@dartcom/ui-kit 10.5.8 → 10.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -100
- package/dist/_virtual/_commonjsHelpers.esm.js +1 -0
- package/dist/_virtual/index.esm.js +1 -0
- package/dist/_virtual/index.esm2.js +1 -0
- package/dist/_virtual/index.esm3.js +1 -0
- package/dist/_virtual/index.esm4.js +1 -0
- package/dist/_virtual/index.esm5.js +1 -0
- package/dist/_virtual/index.esm6.js +1 -0
- package/dist/_virtual/leaflet-arrows.esm.js +1 -0
- package/dist/_virtual/leaflet-arrows.esm2.js +1 -0
- package/dist/_virtual/leaflet-src.esm.js +1 -0
- package/dist/_virtual/leaflet-src.esm2.js +1 -0
- package/dist/_virtual/leaflet.polylineoffset.esm.js +1 -0
- package/dist/_virtual/leaflet.polylineoffset.esm2.js +1 -0
- package/dist/_virtual/papaparse.min.esm.js +1 -0
- package/dist/_virtual/papaparse.min.esm2.js +1 -0
- package/dist/_virtual/screenfull.esm.js +1 -0
- package/dist/_virtual/screenfull.esm2.js +1 -0
- package/dist/_virtual/use-sync-external-store-shim.development.esm.js +1 -0
- package/dist/_virtual/use-sync-external-store-shim.production.esm.js +1 -0
- package/dist/_virtual/uuid.esm.js +1 -0
- package/dist/components/accordion/accordion.esm.js +1 -0
- package/dist/components/alert-dialog/alert-dialog.esm.js +1 -0
- package/dist/components/buttons/button/button.esm.js +1 -0
- package/dist/components/buttons/delete/delete.esm.js +1 -0
- package/dist/components/buttons/delete/types.d.ts +1 -2
- package/dist/components/buttons/delete/types.d.ts.map +1 -1
- package/dist/components/buttons/icon/constants.esm.js +1 -0
- package/dist/components/buttons/icon/icon.esm.js +1 -0
- package/dist/components/buttons/upload/styles.esm.js +1 -0
- package/dist/components/buttons/upload/upload.esm.js +1 -0
- package/dist/components/card/card.esm.js +1 -0
- package/dist/components/checkbox/checkbox.esm.js +1 -0
- package/dist/components/copy-text/copy-text.esm.js +1 -0
- package/dist/components/copy-text/styles.esm.js +1 -0
- package/dist/components/date-field/date-field.esm.js +1 -0
- package/dist/components/drag-list/drag-list.esm.js +1 -0
- package/dist/components/drag-list/draggable/draggable.esm.js +1 -0
- package/dist/components/draggable-container/constants.esm.js +1 -0
- package/dist/components/draggable-container/draggable-container.d.ts.map +1 -1
- package/dist/components/draggable-container/draggable-container.esm.js +1 -0
- package/dist/components/error-boundary/error-boundary.esm.js +1 -0
- package/dist/components/form/error-message/error-message.esm.js +1 -0
- package/dist/components/form/form.esm.js +1 -0
- package/dist/components/form/hooks/useFormContext.esm.js +1 -0
- package/dist/components/input/input.esm.js +1 -0
- package/dist/components/layers/leaflet/config/constants.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/POI/constants.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/POI/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/admin-area/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/building/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/builtup-area/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/camera/config/constants.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/camera/lib/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/city-POI/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/condition/types.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/condition/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/facility-area/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/landuse-area/constants.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/landuse-area/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/lane-marking-arrow/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/lane-marking-line/constants.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/lane-marking-line/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/lane-marking-poly/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/link/constants.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/link/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/nature-field/constants.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/nature-field/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/nature-forest/constants.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/nature-forest/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/ocean-area/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/one-way/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/parking-line/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/pillar/config/constants.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/pillar/lib/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/point-address/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/railroad/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/road-poly/constants.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/road-poly/types.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/road-poly/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/traffic-sign/config/constants.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/traffic-sign/lib/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/traffic-signal/config/constants.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/traffic-signal/lib/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/water-area/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/layers/water-link/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/leaflet.esm.js +1 -0
- package/dist/components/layers/leaflet/lib/types.d.ts +3 -4
- package/dist/components/layers/leaflet/lib/types.d.ts.map +1 -1
- package/dist/components/layers/leaflet/lib/types.esm.js +1 -0
- package/dist/components/layers/leaflet/lib/utils.esm.js +1 -0
- package/dist/components/layers/leaflet/scene.yaml.esm.js +1 -0
- package/dist/components/layers/leaflet/services/tangram-layer.esm.js +1 -0
- package/dist/components/list/list.esm.js +1 -0
- package/dist/components/loader/loader.esm.js +1 -0
- package/dist/components/modal/modal.esm.js +1 -0
- package/dist/components/modal/styles.esm.js +1 -0
- package/dist/components/no-data/no-data.esm.js +1 -0
- package/dist/components/paragraph/paragraph.esm.js +1 -0
- package/dist/components/paragraph/styles.esm.js +1 -0
- package/dist/components/select/select.esm.js +1 -0
- package/dist/components/tabs/tabs.esm.js +1 -0
- package/dist/components/text-field/text-field.esm.js +1 -0
- package/dist/components/uploader/csv/csv.esm.js +1 -0
- package/dist/components/uploader/excel/excel.esm.js +1 -0
- package/dist/configs/global/constants.esm.js +1 -0
- package/dist/configs/global/global.esm.js +1 -0
- package/dist/constants/api.esm.js +1 -0
- package/dist/constants/map.esm.js +1 -0
- package/dist/constants/schema.esm.js +1 -0
- package/dist/index.cjs +110 -18
- package/dist/index.esm.js +1 -33
- package/dist/layouts/auth/auth.esm.js +1 -0
- package/dist/lib/hooks/useDeviceType.esm.js +1 -0
- package/dist/lib/hooks/useGetUser.esm.js +1 -0
- package/dist/lib/hooks/useShowErrorSnackbar.esm.js +1 -0
- package/dist/lib/hooks/useShowSnackbar.esm.js +1 -0
- package/dist/lib/hooks/useSignIn.esm.js +1 -0
- package/dist/lib/hooks/useSignOut.esm.js +1 -0
- package/dist/lib/types.esm.js +1 -0
- package/dist/lib/utils.esm.js +1 -0
- package/dist/library/leaflet-arrows.esm.js +1 -0
- package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.esm.js +1 -0
- package/dist/node_modules/@dnd-kit/core/dist/core.esm.esm.js +1 -0
- package/dist/node_modules/@dnd-kit/modifiers/dist/modifiers.esm.esm.js +1 -0
- package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.esm.js +1 -0
- package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.esm.js +1 -0
- package/dist/node_modules/@hookform/error-message/dist/index.esm.esm.js +1 -0
- package/dist/node_modules/@hookform/resolvers/dist/resolvers.esm.js +1 -0
- package/dist/node_modules/@hookform/resolvers/yup/dist/yup.esm.js +1 -0
- package/dist/node_modules/@react-leaflet/core/lib/component.esm.js +1 -0
- package/dist/node_modules/@react-leaflet/core/lib/context.esm.js +1 -0
- package/dist/node_modules/@react-leaflet/core/lib/control.esm.js +1 -0
- package/dist/node_modules/@react-leaflet/core/lib/element.esm.js +1 -0
- package/dist/node_modules/@reactuses/core/dist/index.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/focusManager.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/mutation.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/mutationCache.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/mutationObserver.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/notifyManager.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/onlineManager.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/query.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/queryCache.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/queryClient.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/queryObserver.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/removable.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/retryer.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/subscribable.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/thenable.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/timeoutManager.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/utils.esm.js +1 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.esm.js +1 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.esm.js +1 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.esm.js +1 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.esm.js +1 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/suspense.esm.js +1 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/useBaseQuery.esm.js +1 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/useMutation.esm.js +1 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/useQuery.esm.js +1 -0
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.esm.js +1 -0
- package/dist/node_modules/date-fns/_lib/defaultOptions.esm.js +1 -0
- package/dist/node_modules/date-fns/_lib/format/formatters.esm.js +1 -0
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.esm.js +1 -0
- package/dist/node_modules/date-fns/_lib/format/longFormatters.esm.js +1 -0
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.esm.js +1 -0
- package/dist/node_modules/date-fns/_lib/normalizeDates.esm.js +1 -0
- package/dist/node_modules/date-fns/_lib/protectedTokens.esm.js +1 -0
- package/dist/node_modules/date-fns/constants.esm.js +1 -0
- package/dist/node_modules/date-fns/constructFrom.esm.js +1 -0
- package/dist/node_modules/date-fns/differenceInCalendarDays.esm.js +1 -0
- package/dist/node_modules/date-fns/format.esm.js +1 -0
- package/dist/node_modules/date-fns/getDayOfYear.esm.js +1 -0
- package/dist/node_modules/date-fns/getISOWeek.esm.js +1 -0
- package/dist/node_modules/date-fns/getISOWeekYear.esm.js +1 -0
- package/dist/node_modules/date-fns/getWeek.esm.js +1 -0
- package/dist/node_modules/date-fns/getWeekYear.esm.js +1 -0
- package/dist/node_modules/date-fns/isDate.esm.js +1 -0
- package/dist/node_modules/date-fns/isSameWeek.esm.js +1 -0
- package/dist/node_modules/date-fns/isValid.esm.js +1 -0
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.esm.js +1 -0
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.esm.js +1 -0
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.esm.js +1 -0
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.esm.js +1 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.esm.js +1 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.esm.js +1 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.esm.js +1 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.esm.js +1 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.esm.js +1 -0
- package/dist/node_modules/date-fns/locale/en-US.esm.js +1 -0
- package/dist/node_modules/date-fns/locale/ru/_lib/formatDistance.esm.js +1 -0
- package/dist/node_modules/date-fns/locale/ru/_lib/formatLong.esm.js +1 -0
- package/dist/node_modules/date-fns/locale/ru/_lib/formatRelative.esm.js +1 -0
- package/dist/node_modules/date-fns/locale/ru/_lib/localize.esm.js +1 -0
- package/dist/node_modules/date-fns/locale/ru/_lib/match.esm.js +1 -0
- package/dist/node_modules/date-fns/locale/ru.esm.js +1 -0
- package/dist/node_modules/date-fns/startOfDay.esm.js +1 -0
- package/dist/node_modules/date-fns/startOfISOWeek.esm.js +1 -0
- package/dist/node_modules/date-fns/startOfISOWeekYear.esm.js +1 -0
- package/dist/node_modules/date-fns/startOfWeek.esm.js +1 -0
- package/dist/node_modules/date-fns/startOfWeekYear.esm.js +1 -0
- package/dist/node_modules/date-fns/startOfYear.esm.js +1 -0
- package/dist/node_modules/date-fns/toDate.esm.js +1 -0
- package/dist/node_modules/fflate/esm/browser.esm.js +1 -0
- package/dist/node_modules/goober/dist/goober.modern.esm.js +1 -0
- package/dist/node_modules/js-cookie/dist/js.cookie.esm.js +2 -0
- package/dist/node_modules/leaflet/dist/leaflet-src.esm.js +5 -0
- package/dist/node_modules/leaflet-area-select/dist/index.esm.js +9 -0
- package/dist/node_modules/leaflet-path-drag/dist/index.esm.js +7 -0
- package/dist/node_modules/leaflet-polylineoffset/leaflet.polylineoffset.esm.js +1 -0
- package/dist/node_modules/leaflet-rotatedmarker/leaflet.rotatedMarker.esm.js +1 -0
- package/dist/node_modules/mobx/dist/mobx.esm.esm.js +1 -0
- package/dist/node_modules/mobx-react-lite/es/ObserverComponent.esm.js +1 -0
- package/dist/node_modules/mobx-react-lite/es/index.esm.js +1 -0
- package/dist/node_modules/mobx-react-lite/es/observer.esm.js +1 -0
- package/dist/node_modules/mobx-react-lite/es/useObserver.esm.js +1 -0
- package/dist/node_modules/mobx-react-lite/es/utils/UniversalFinalizationRegistry.esm.js +1 -0
- package/dist/node_modules/mobx-react-lite/es/utils/assertEnvironment.esm.js +1 -0
- package/dist/node_modules/mobx-react-lite/es/utils/observerBatching.esm.js +1 -0
- package/dist/node_modules/mobx-react-lite/es/utils/observerFinalizationRegistry.esm.js +1 -0
- package/dist/node_modules/mobx-react-lite/es/utils/printDebugValue.esm.js +1 -0
- package/dist/node_modules/notistack/node_modules/clsx/dist/clsx.m.esm.js +1 -0
- package/dist/node_modules/notistack/notistack.esm.esm.js +1 -0
- package/dist/node_modules/papaparse/papaparse.min.esm.js +7 -0
- package/dist/node_modules/property-expr/index.esm.js +1 -0
- package/dist/node_modules/react-copy-to-clipboard-ts/dist/index.esm.js +1 -0
- package/dist/node_modules/react-error-boundary/dist/react-error-boundary.esm.js +1 -0
- package/dist/node_modules/react-hook-form/dist/index.esm.esm.js +1 -0
- package/dist/node_modules/react-leaflet/lib/LayersControl.esm.js +1 -0
- package/dist/node_modules/react-leaflet/lib/hooks.esm.js +1 -0
- package/dist/node_modules/react-papaparse/dist/react-papaparse.es.esm.js +1 -0
- package/dist/node_modules/react-uuid/uuid.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/coordinates.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/dropEmptyColumns.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/dropEmptyRows.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/getData.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/isDateTimestamp.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/parseCell.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/parseCellValue.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/parseCells.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/parseDate.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/parseDimensions.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/parseFilePaths.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/parseProperties.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/parseSharedStrings.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/parseSheet.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/parseStyles.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/readXlsx.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/readXlsxFileBrowser.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/readXlsxFileContents.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/schema/mapToObjects.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/read/unpackXlsxFileBrowser.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/types/Boolean.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/types/Date.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/types/InvalidError.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/types/Number.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/types/String.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/xml/dom.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/xml/xlsx.esm.js +1 -0
- package/dist/node_modules/read-excel-file/modules/xml/xmlBrowser.esm.js +1 -0
- package/dist/node_modules/screenfull/dist/screenfull.esm.js +6 -0
- package/dist/node_modules/tangram/dist/tangram.min.esm.js +1 -0
- package/dist/node_modules/tiny-case/index.esm.js +1 -0
- package/dist/node_modules/toposort/index.esm.js +1 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.esm.js +10 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.esm.js +10 -0
- package/dist/node_modules/use-sync-external-store/shim/index.esm.js +1 -0
- package/dist/node_modules/yup/index.esm.esm.js +1 -0
- package/dist/pages/auth/auth.esm.js +1 -0
- package/dist/pages/auth/constants.esm.js +1 -0
- package/dist/pages/auth/schema.esm.js +1 -0
- package/dist/providers/auth/auth.esm.js +1 -0
- package/dist/providers/initialize/initialize.esm.js +1 -0
- package/dist/providers/localization/localization.esm.js +1 -0
- package/dist/providers/map/map.esm.js +1 -0
- package/dist/providers/mobx/mobx.esm.js +1 -0
- package/dist/providers/mobx/store.esm.js +1 -0
- package/dist/providers/mobx/stores/alert.esm.js +1 -0
- package/dist/providers/mobx/stores/auth.esm.js +1 -0
- package/dist/providers/mobx/stores/modal.esm.js +1 -0
- package/dist/providers/providers.esm.js +1 -0
- package/dist/providers/query/query.esm.js +1 -0
- package/dist/providers/theme/theme.esm.js +1 -0
- package/dist/services/api/api.esm.js +1 -0
- package/dist/services/local-state/local-state.esm.js +1 -0
- package/dist/services/localization/localization.esm.js +1 -0
- package/dist/services/logger/logger.esm.js +1 -0
- package/dist/services/map/map.d.ts +18 -0
- package/dist/services/map/map.d.ts.map +1 -1
- package/dist/services/map/map.esm.js +1 -0
- package/dist/services/query/query.esm.js +1 -0
- package/package.json +4 -3
- package/dist/__test__/types.d.ts +0 -4
- package/dist/__test__/types.d.ts.map +0 -1
- package/dist/components/accordion/accordion.stories.d.ts +0 -8
- package/dist/components/accordion/accordion.stories.d.ts.map +0 -1
- package/dist/components/alert-dialog/alert-dialog.stories.d.ts +0 -13
- package/dist/components/alert-dialog/alert-dialog.stories.d.ts.map +0 -1
- package/dist/components/buttons/button/button.stories.d.ts +0 -10
- package/dist/components/buttons/button/button.stories.d.ts.map +0 -1
- package/dist/components/buttons/delete/button.spec.d.ts +0 -2
- package/dist/components/buttons/delete/button.spec.d.ts.map +0 -1
- package/dist/components/buttons/delete/delete.stories.d.ts +0 -10
- package/dist/components/buttons/delete/delete.stories.d.ts.map +0 -1
- package/dist/components/buttons/icon/icon.stories.d.ts +0 -16
- package/dist/components/buttons/icon/icon.stories.d.ts.map +0 -1
- package/dist/components/card/card.stories.d.ts +0 -9
- package/dist/components/card/card.stories.d.ts.map +0 -1
- package/dist/components/checkbox/checkbox.stories.d.ts +0 -8
- package/dist/components/checkbox/checkbox.stories.d.ts.map +0 -1
- package/dist/components/copy-text/copy-text.stories.d.ts +0 -8
- package/dist/components/copy-text/copy-text.stories.d.ts.map +0 -1
- package/dist/components/date-field/date-field.stories.d.ts +0 -7
- package/dist/components/date-field/date-field.stories.d.ts.map +0 -1
- package/dist/components/drag-list/drag-list.stories.d.ts +0 -8
- package/dist/components/drag-list/drag-list.stories.d.ts.map +0 -1
- package/dist/components/draggable-container/draggable-container.stories.d.ts +0 -10
- package/dist/components/draggable-container/draggable-container.stories.d.ts.map +0 -1
- package/dist/components/form/form.stories.d.ts +0 -8
- package/dist/components/form/form.stories.d.ts.map +0 -1
- package/dist/components/layers/leaflet/leaflet.stories.d.ts +0 -8
- package/dist/components/layers/leaflet/leaflet.stories.d.ts.map +0 -1
- package/dist/components/list/list.stories.d.ts +0 -13
- package/dist/components/list/list.stories.d.ts.map +0 -1
- package/dist/components/loader/card.stories.d.ts +0 -7
- package/dist/components/loader/card.stories.d.ts.map +0 -1
- package/dist/components/loader/loader.stories.d.ts +0 -7
- package/dist/components/loader/loader.stories.d.ts.map +0 -1
- package/dist/components/modal/modal.stories.d.ts +0 -8
- package/dist/components/modal/modal.stories.d.ts.map +0 -1
- package/dist/components/no-data/no-data.stories.d.ts +0 -7
- package/dist/components/no-data/no-data.stories.d.ts.map +0 -1
- package/dist/components/select/select.stories.d.ts +0 -8
- package/dist/components/select/select.stories.d.ts.map +0 -1
- package/dist/components/tabs/tabs.stories.d.ts +0 -7
- package/dist/components/tabs/tabs.stories.d.ts.map +0 -1
- package/dist/components/uploader/csv/csv.stories.d.ts +0 -8
- package/dist/components/uploader/csv/csv.stories.d.ts.map +0 -1
- package/dist/components/uploader/excel/excel.stories.d.ts +0 -7
- package/dist/components/uploader/excel/excel.stories.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.esm.js.map +0 -1
- package/dist/lib/hooks/useSignIn.spec.d.ts +0 -2
- package/dist/lib/hooks/useSignIn.spec.d.ts.map +0 -1
- package/dist/lib/utils.spec.d.ts +0 -2
- package/dist/lib/utils.spec.d.ts.map +0 -1
- package/dist/pages/auth/auth.stories.d.ts +0 -7
- package/dist/pages/auth/auth.stories.d.ts.map +0 -1
- package/dist/services/localization/localization.spec.d.ts +0 -2
- package/dist/services/localization/localization.spec.d.ts.map +0 -1
- package/dist/setupTests.d.ts +0 -1
- package/dist/setupTests.d.ts.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,33 +1 @@
|
|
|
1
|
-
import{useTheme as e,useMediaQuery as t,Box as n,Accordion as i,AccordionSummary as r,AccordionDetails as s,Button as o,styled as a,IconButton as l,Tooltip as u,Slide as c,Dialog as h,DialogTitle as d,DialogContent as f,DialogContentText as p,DialogActions as m,Divider as _,Typography as g,TextField as y,List as v,ListItem as b,CircularProgress as x,Autocomplete as w,Tab as E}from"@mui/material";import*as A from"react";import T,{forwardRef as k,useRef as S,useCallback as O,useEffect as P,createElement as C,cloneElement as R,useMemo as M,useLayoutEffect as N,Component as z,useContext as D,isValidElement as I,memo as F,useState as j,createContext as B,useReducer as U,use as V,useImperativeHandle as G}from"react";import{createPortal as $,unstable_batchedUpdates as Z}from"react-dom";import{jsx as q,jsxs as W}from"react/jsx-runtime";import H from"axios";import K from"@mui/icons-material/ArrowDownward";import Y from"@mui/material/IconButton";import X from"@mui/icons-material/Clear";import Q from"@mui/icons-material/Delete";import J from"@mui/icons-material/Edit";import ee from"@mui/icons-material/Moving";import te from"@mui/icons-material/RestartAlt";import ne from"@mui/icons-material/Save";import ie from"@mui/icons-material/CloudUpload";import re from"@mui/material/Checkbox";import se from"@mui/material/FormControlLabel";import{styled as oe,createTheme as ae,responsiveFontSizes as le,ThemeProvider as ue}from"@mui/material/styles";import{DateField as ce}from"@mui/x-date-pickers/DateField";import he from"@mui/material/Box";import de from"@mui/material/Modal";import{TabContext as fe,TabList as pe,TabPanel as me}from"@mui/lab";import{LocalizationProvider as _e}from"@mui/x-date-pickers";import{AdapterDateFns as ge}from"@mui/x-date-pickers/AdapterDateFns";function ye(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if("default"!==n&&!(n in e)){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}var ve;!function(e){e.CREATE="create",e.UPDATE="update",e.DELETE="delete"}(ve||(ve={}));const be=()=>{const n=e();return{isMobile:t(n.breakpoints.down("sm")),isTablet:t(n.breakpoints.between("sm","md")),isDesktop:t(n.breakpoints.up("md"))}},xe={valid:"18c38ab326d12f428e90be50a5141fc8949de497df7f7e0c1796d58e99d006f3",dateExpired:"8cbc5e15e61e649daf57c3a08422ae372c101afb4759036a3864a9fa588ef717",off:"b1520018920b33a4c1f8100c4f3bb3eb93661db829faa99c9cd75537f6300ba9",invalid:"abcdefghijklmnopqrstuvwxyz0123456789"};function we(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ee,Ae;var Te=(Ae||(Ae=1,Ee=function(){const e=["a","b","c","d","e","f","0","1","2","3","4","5","6","7","8","9"];let t=[];for(let n=0;n<36;n++)t[n]=8===n||13===n||18===n||23===n?"-":e[Math.ceil(Math.random()*e.length-1)];return t.join("")}),Ee),ke=we(Te);function Se(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Se(e[t]))&&(i&&(i+=" "),i+=n);else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function Oe(){for(var e,t,n=0,i="";n<arguments.length;)(e=arguments[n++])&&(t=Se(e))&&(i&&(i+=" "),i+=t);return i}let Pe={data:""},Ce=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Re=/\/\*[^]*?\*\/| +/g,Me=/\n+/g,Le=(e,t)=>{let n="",i="",r="";for(let s in e){let o=e[s];"@"==s[0]?"i"==s[1]?n=s+" "+o+";":i+="f"==s[1]?Le(o,s):s+"{"+Le(o,"k"==s[1]?"":t)+"}":"object"==typeof o?i+=Le(o,t?t.replace(/([^,])+/g,e=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):s):null!=o&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),r+=Le.p?Le.p(s,o):s+":"+o+";")}return n+(t&&r?t+"{"+r+"}":r)+i},Ne={},ze=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+ze(e[n]);return t}return e};function De(e){let t=this||{},n=e.call?e(t.p):e;return((e,t,n,i,r)=>{let s=ze(e),o=Ne[s]||(Ne[s]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(s));if(!Ne[o]){let t=s!==e?e:(e=>{let t,n,i=[{}];for(;t=Ce.exec(e.replace(Re,""));)t[4]?i.shift():t[3]?(n=t[3].replace(Me," ").trim(),i.unshift(i[0][n]=i[0][n]||{})):i[0][t[1]]=t[2].replace(Me," ").trim();return i[0]})(e);Ne[o]=Le(r?{["@keyframes "+o]:t}:t,n?"":"."+o)}let a=n&&Ne.g?Ne.g:null;return n&&(Ne.g=Ne[o]),((e,t,n,i)=>{i?t.data=t.data.replace(i,e):-1===t.data.indexOf(e)&&(t.data=n?e+t.data:t.data+e)})(Ne[o],t,i,a),o})(n.unshift?n.raw?((e,t,n)=>e.reduce((e,i,r)=>{let s=t[r];if(s&&s.call){let e=s(n),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;s=t?"."+t:e&&"object"==typeof e?e.props?"":Le(e,""):!1===e?"":e}return e+i+(null==s?"":s)},""))(n,[].slice.call(arguments,1),t.p):n.reduce((e,n)=>Object.assign(e,n&&n.call?n(t.p):n),{}):n,(e=>{if("object"==typeof window){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||Pe})(t.target),t.g,t.o,t.k)}function Ie(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),e}function Fe(){return Fe=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Fe.apply(this,arguments)}function je(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function Be(e,t){if(null==e)return{};var n,i,r={},s=Object.keys(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}function Ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}De.bind({g:1}),De.bind({k:1});var Ve=function(){return""},Ge=T.createContext({enqueueSnackbar:Ve,closeSnackbar:Ve}),$e="@media (max-width:599.95px)",Ze="@media (min-width:600px)",qe=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},We=function(e){return""+qe(e.vertical)+qe(e.horizontal)},He=function(e){return!!e||0===e},Ke="unmounted",Ye="exited",Xe="entering",Qe="entered",Je="exiting",et=function(e){function t(t){var n;n=e.call(this,t)||this;var i,r=t.appear;return n.appearStatus=null,t.in?r?(i=Ye,n.appearStatus=Xe):i=Qe:i=t.unmountOnExit||t.mountOnEnter?Ke:Ye,n.state={status:i},n.nextCallback=null,n}je(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===Ke?{status:Ye}: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!==Xe&&n!==Qe&&(t=Xe):n!==Xe&&n!==Qe||(t=Je)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e=this.props.timeout,t=e,n=e;return null!=e&&"number"!=typeof e&&"string"!=typeof e&&(n=e.exit,t=e.enter),{exit:n,enter:t}},n.updateStatus=function(e,t){void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),t===Xe?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&this.state.status===Ye&&this.setState({status:Ke})},n.performEnter=function(e){var t=this,n=this.props.enter,i=e,r=this.getTimeouts();e||n?(this.props.onEnter&&this.props.onEnter(this.node,i),this.safeSetState({status:Xe},function(){t.props.onEntering&&t.props.onEntering(t.node,i),t.onTransitionEnd(r.enter,function(){t.safeSetState({status:Qe},function(){t.props.onEntered&&t.props.onEntered(t.node,i)})})})):this.safeSetState({status:Qe},function(){t.props.onEntered&&t.props.onEntered(t.node,i)})},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts();t?(this.props.onExit&&this.props.onExit(this.node),this.safeSetState({status:Je},function(){e.props.onExiting&&e.props.onExiting(e.node),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:Ye},function(){e.props.onExited&&e.props.onExited(e.node)})})})):this.safeSetState({status:Ye},function(){e.props.onExited&&e.props.onExited(e.node)})},n.cancelNextCallback=function(){null!==this.nextCallback&&this.nextCallback.cancel&&(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(){n&&(n=!1,t.nextCallback=null,e())},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=null==e&&!this.props.addEndListener;this.node&&!n?(this.props.addEndListener&&this.props.addEndListener(this.node,this.nextCallback),null!=e&&setTimeout(this.nextCallback,e)):setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if(e===Ke)return null;var t=this.props;return(0,t.children)(e,Be(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]))},Ie(t,[{key:"node",get:function(){var e,t=null===(e=this.props.nodeRef)||void 0===e?void 0:e.current;if(!t)throw new Error("notistack - Custom snackbar is not refForwarding");return t}}]),t}(T.Component);function tt(){}function nt(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function it(e,t){return M(function(){return null==e&&null==t?null:function(n){nt(e,n),nt(t,n)}},[e,t])}function rt(e){var t=e.timeout,n=e.style,i=void 0===n?{}:n,r=e.mode;return{duration:"object"==typeof t?t[r]||0:t,easing:i.transitionTimingFunction,delay:i.transitionDelay}}et.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:tt,onEntering:tt,onEntered:tt,onExit:tt,onExiting:tt,onExited:tt};var st="cubic-bezier(0.4, 0, 0.2, 1)",ot="cubic-bezier(0.0, 0, 0.2, 1)",at="cubic-bezier(0.4, 0, 0.6, 1)",lt=function(e){e.scrollTop=e.scrollTop},ut=function(e){return Math.round(e)+"ms"};function ct(e,t){void 0===e&&(e=["all"]);var n=t||{},i=n.duration,r=void 0===i?300:i,s=n.easing,o=void 0===s?st:s,a=n.delay,l=void 0===a?0:a;return(Array.isArray(e)?e:[e]).map(function(e){var t="string"==typeof r?r:ut(r),n="string"==typeof l?l:ut(l);return e+" "+t+" "+o+" "+n}).join(",")}function ht(e){var t=function(e){return e&&e.ownerDocument||document}(e);return t.defaultView||window}function dt(e,t){if(t){var n=function(e,t){var n,i=t.getBoundingClientRect(),r=ht(t);if(t.fakeTransform)n=t.fakeTransform;else{var s=r.getComputedStyle(t);n=s.getPropertyValue("-webkit-transform")||s.getPropertyValue("transform")}var o=0,a=0;if(n&&"none"!==n&&"string"==typeof n){var l=n.split("(")[1].split(")")[0].split(",");o=parseInt(l[4],10),a=parseInt(l[5],10)}switch(e){case"left":return"translateX("+(r.innerWidth+o-i.left)+"px)";case"right":return"translateX(-"+(i.left+i.width-o)+"px)";case"up":return"translateY("+(r.innerHeight+a-i.top)+"px)";default:return"translateY(-"+(i.top+i.height-a)+"px)"}}(e,t);n&&(t.style.webkitTransform=n,t.style.transform=n)}}var ft=k(function(e,t){var n=e.children,i=e.direction,r=void 0===i?"down":i,s=e.in,o=e.style,a=e.timeout,l=void 0===a?0:a,u=e.onEnter,c=e.onEntered,h=e.onExit,d=e.onExited,f=Be(e,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),p=S(null),m=it(n.ref,p),_=it(m,t),g=O(function(){p.current&&dt(r,p.current)},[r]);return P(function(){if(!s&&"down"!==r&&"right"!==r){var e=function(e,t){var n;function i(){for(var i=this,r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];clearTimeout(n),n=setTimeout(function(){e.apply(i,s)},t)}return void 0===t&&(t=166),i.clear=function(){clearTimeout(n)},i}(function(){p.current&&dt(r,p.current)}),t=ht(p.current);return t.addEventListener("resize",e),function(){e.clear(),t.removeEventListener("resize",e)}}},[r,s]),P(function(){s||g()},[s,g]),C(et,Object.assign({appear:!0,nodeRef:p,onEnter:function(e,t){dt(r,e),lt(e),u&&u(e,t)},onEntered:c,onEntering:function(e){var t=(null==o?void 0:o.transitionTimingFunction)||ot,n=rt({timeout:l,mode:"enter",style:Fe({},o,{transitionTimingFunction:t})});e.style.webkitTransition=ct("-webkit-transform",n),e.style.transition=ct("transform",n),e.style.webkitTransform="none",e.style.transform="none"},onExit:function(e){var t=(null==o?void 0:o.transitionTimingFunction)||at,n=rt({timeout:l,mode:"exit",style:Fe({},o,{transitionTimingFunction:t})});e.style.webkitTransition=ct("-webkit-transform",n),e.style.transition=ct("transform",n),dt(r,e),h&&h(e)},onExited:function(e){e.style.webkitTransition="",e.style.transition="",d&&d(e)},in:s,timeout:l},f),function(e,t){return R(n,Fe({ref:_,style:Fe({visibility:"exited"!==e||s?void 0:"hidden"},o,{},n.props.style)},t))})});ft.displayName="Slide";var pt=function(e){return T.createElement("svg",Object.assign({viewBox:"0 0 24 24",focusable:"false",style:{fontSize:20,marginInlineEnd:8,userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:"currentColor",flexShrink:0}},e))},mt=function(){return T.createElement(pt,null,T.createElement("path",{d:"M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41\n 10.59L10 14.17L17.59 6.58L19 8L10 17Z"}))},_t=function(){return T.createElement(pt,null,T.createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},gt=function(){return T.createElement(pt,null,T.createElement("path",{d:"M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,\n 6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,\n 13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z"}))},yt=function(){return T.createElement(pt,null,T.createElement("path",{d:"M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,\n 0 22,12A10,10 0 0,0 12,2Z"}))},vt={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:{default:void 0,success:T.createElement(mt,null),warning:T.createElement(_t,null),error:T.createElement(gt,null),info:T.createElement(yt,null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:ft,transitionDuration:{enter:225,exit:195}},bt=function(e,t){return function(n,i){return void 0===i&&(i=!1),i?Fe({},vt[n],{},t[n],{},e[n]):"autoHideDuration"===n?(r=e.autoHideDuration,s=t.autoHideDuration,(o=function(e){return"number"==typeof e||null===e})(r)?r:o(s)?s:vt.autoHideDuration):"transitionDuration"===n?function(e,t){var n=function(e,t){return t.some(function(t){return typeof e===t})};return n(e,["string","number"])?e:n(e,["object"])?Fe({},vt.transitionDuration,{},n(t,["object"])&&t,{},e):n(t,["string","number"])?t:n(t,["object"])?Fe({},vt.transitionDuration,{},t):vt.transitionDuration}(e.transitionDuration,t.transitionDuration):e[n]||t[n]||vt[n];var r,s,o}};function xt(e){return Object.entries(e).reduce(function(e,t){var n,i=t[0],r=t[1];return Fe({},e,((n={})[i]=De(r),n))},{})}var wt="notistack-SnackbarContainer",Et="notistack-Snackbar",At="notistack-CollapseWrapper",Tt="notistack-MuiContent",kt=function(e){return"notistack-MuiContent-"+e},St=xt({root:{height:0},entered:{height:"auto"}}),Ot="0px",Pt=k(function(e,t){var n=e.children,i=e.in,r=e.onExited,s=S(null),o=S(null),a=it(t,o),l=function(){return s.current?s.current.clientHeight:0};return C(et,{in:i,unmountOnExit:!0,onEnter:function(e){e.style.height=Ot},onEntered:function(e){e.style.height="auto"},onEntering:function(e){var t=l(),n=rt({timeout:175,mode:"enter"}),i=n.duration,r=n.easing;e.style.transitionDuration="string"==typeof i?i:i+"ms",e.style.height=t+"px",e.style.transitionTimingFunction=r||""},onExit:function(e){e.style.height=l()+"px"},onExited:r,onExiting:function(e){lt(e);var t=rt({timeout:175,mode:"exit"}),n=t.duration,i=t.easing;e.style.transitionDuration="string"==typeof n?n:n+"ms",e.style.height=Ot,e.style.transitionTimingFunction=i||""},nodeRef:o,timeout:175},function(e,t){return C("div",Object.assign({ref:a,className:Oe(St.root,"entered"===e&&St.entered),style:Fe({pointerEvents:"all",overflow:"hidden",minHeight:Ot,transition:ct("height")},"entered"===e&&{overflow:"visible"},{},"exited"===e&&!i&&{visibility:"hidden"})},t),C("div",{ref:s,className:At,style:{display:"flex",width:"100%"}},n))})});Pt.displayName="Collapse";var Ct={right:"left",left:"right",bottom:"up",top:"down"},Rt=function(e){return"anchorOrigin"+We(e)},Mt=function(){};function Lt(e,t){return e.reduce(function(e,n){return null==n?e:function(){for(var i=arguments.length,r=new Array(i),s=0;s<i;s++)r[s]=arguments[s];var o=[].concat(r);t&&-1===o.indexOf(t)&&o.push(t),e.apply(this,o),n.apply(this,o)}},Mt)}var Nt="undefined"!=typeof window?N:P;function zt(e){var t=S(e);return Nt(function(){t.current=e}),O(function(){return t.current.apply(void 0,arguments)},[])}var Dt,It=k(function(e,t){var n=e.children,i=e.className,r=e.autoHideDuration,s=e.disableWindowBlurListener,o=void 0!==s&&s,a=e.onClose,l=e.id,u=e.open,c=e.SnackbarProps,h=void 0===c?{}:c,d=S(),f=zt(function(){a&&a.apply(void 0,arguments)}),p=zt(function(e){a&&null!=e&&(d.current&&clearTimeout(d.current),d.current=setTimeout(function(){f(null,"timeout",l)},e))});P(function(){return u&&p(r),function(){d.current&&clearTimeout(d.current)}},[u,r,p]);var m=function(){d.current&&clearTimeout(d.current)},_=O(function(){null!=r&&p(.5*r)},[r,p]);return P(function(){if(!o&&u)return window.addEventListener("focus",_),window.addEventListener("blur",m),function(){window.removeEventListener("focus",_),window.removeEventListener("blur",m)}},[o,_,u]),C("div",Object.assign({ref:t},h,{className:Oe(Et,i),onMouseEnter:function(e){h.onMouseEnter&&h.onMouseEnter(e),m()},onMouseLeave:function(e){h.onMouseLeave&&h.onMouseLeave(e),_()}}),n)});It.displayName="Snackbar";var Ft=xt({root:(Dt={display:"flex",flexWrap:"wrap",flexGrow:1},Dt[Ze]={flexGrow:"initial",minWidth:"288px"},Dt)}),jt=k(function(e,t){var n=e.className,i=Be(e,["className"]);return T.createElement("div",Object.assign({ref:t,className:Oe(Ft.root,n)},i))});jt.displayName="SnackbarContent";var Bt=xt({root:{backgroundColor:"#313131",fontSize:"0.875rem",lineHeight:1.43,letterSpacing:"0.01071em",color:"#fff",alignItems:"center",padding:"6px 16px",borderRadius:"4px",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"},lessPadding:{paddingLeft:"20px"},default:{backgroundColor:"#313131"},success:{backgroundColor:"#43a047"},error:{backgroundColor:"#d32f2f"},warning:{backgroundColor:"#ff9800"},info:{backgroundColor:"#2196f3"},message:{display:"flex",alignItems:"center",padding:"8px 0"},action:{display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:"16px",marginRight:"-8px"}}),Ut="notistack-snackbar",Vt=k(function(e,t){var n=e.id,i=e.message,r=e.action,s=e.iconVariant,o=e.variant,a=e.hideIconVariant,l=e.style,u=e.className,c=s[o],h=r;return"function"==typeof h&&(h=h(n)),T.createElement(jt,{ref:t,role:"alert","aria-describedby":Ut,style:l,className:Oe(Tt,kt(o),Bt.root,Bt[o],u,!a&&c&&Bt.lessPadding)},T.createElement("div",{id:Ut,className:Bt.message},a?null:c,i),h&&T.createElement("div",{className:Bt.action},h))});Vt.displayName="MaterialDesignContent";var Gt,$t,Zt,qt,Wt,Ht,Kt=F(Vt),Yt=xt({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),Xt=function(e){var t=S(),n=j(!0),i=n[0],r=n[1],s=Lt([e.snack.onClose,e.onClose]),o=O(function(){t.current=setTimeout(function(){r(function(e){return!e})},125)},[]);P(function(){return function(){t.current&&clearTimeout(t.current)}},[]);var a,l=e.snack,u=e.classes,c=e.Component,h=void 0===c?Kt:c,d=M(function(){return function(e){void 0===e&&(e={});var t={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(e).filter(function(e){return!t[e]}).reduce(function(t,n){var i;return Fe({},t,((i={})[n]=e[n],i))},{})}(u)},[u]),f=l.open,p=l.SnackbarProps,m=l.TransitionComponent,_=l.TransitionProps,g=l.transitionDuration,y=l.disableWindowBlurListener,v=l.content,b=Be(l,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),x=Fe({direction:(a=b.anchorOrigin,"center"!==a.horizontal?Ct[a.horizontal]:Ct[a.vertical]),timeout:g},_),w=v;"function"==typeof w&&(w=w(b.id,b.message));var E=["onEnter","onEntered","onExit","onExited"].reduce(function(t,n){var i;return Fe({},t,((i={})[n]=Lt([e.snack[n],e[n]],b.id),i))},{});return T.createElement(Pt,{in:i,onExited:E.onExited},T.createElement(It,{open:f,id:b.id,disableWindowBlurListener:y,autoHideDuration:b.autoHideDuration,className:Oe(Yt.wrappedRoot,d.root,d[Rt(b.anchorOrigin)]),SnackbarProps:p,onClose:s},T.createElement(m,Object.assign({},x,{appear:!0,in:f,onExit:E.onExit,onExited:o,onEnter:E.onEnter,onEntered:Lt([E.onEntered,function(){e.snack.requestClose&&s(null,"instructed",e.snack.id)}],b.id)}),w||T.createElement(h,Object.assign({},b)))))},Qt={default:20},Jt={default:6,dense:2},en="."+At,tn=xt({root:(Gt={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:ct(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},Gt[en]={padding:Jt.default+"px 0px",transition:"padding 300ms ease 0ms"},Gt.maxWidth="calc(100% - "+2*Qt.default+"px)",Gt[$e]={width:"100%",maxWidth:"calc(100% - 32px)"},Gt),rootDense:($t={},$t[en]={padding:Jt.dense+"px 0px"},$t),top:{top:Qt.default-Jt.default+"px",flexDirection:"column"},bottom:{bottom:Qt.default-Jt.default+"px",flexDirection:"column-reverse"},left:(Zt={left:Qt.default+"px"},Zt[Ze]={alignItems:"flex-start"},Zt[$e]={left:"16px"},Zt),right:(qt={right:Qt.default+"px"},qt[Ze]={alignItems:"flex-end"},qt[$e]={right:"16px"},qt),center:(Wt={left:"50%",transform:"translateX(-50%)"},Wt[Ze]={alignItems:"center"},Wt)}),nn=function(e){var t=e.classes,n=void 0===t?{}:t,i=e.anchorOrigin,r=e.dense,s=e.children,o=Oe(wt,tn[i.vertical],tn[i.horizontal],tn.root,n.containerRoot,n["containerAnchorOrigin"+We(i)],r&&tn.rootDense);return T.createElement("div",{className:o},s)},rn=F(nn),sn="production"!==process.env.NODE_ENV,on={NO_PERSIST_ALL:"Reached maxSnack while all enqueued snackbars have 'persist' flag. Notistack will dismiss the oldest snackbar anyway to allow other ones in the queue to be presented."},an=function(e){return!("string"==typeof e||I(e))},ln=function(e){function t(t){var n;return(n=e.call(this,t)||this).enqueueSnackbar=function(e,t){if(void 0===t&&(t={}),null==e)throw new Error("enqueueSnackbar called with invalid argument");var i=an(e)?e:t,r=an(e)?e.message:e,s=i.key,o=i.preventDuplicate,a=Be(i,["key","preventDuplicate"]),l=He(s),u=l?s:(new Date).getTime()+Math.random(),c=bt(a,n.props),h=Fe({id:u},a,{message:r,open:!0,entered:!1,requestClose:!1,persist:c("persist"),action:c("action"),content:c("content"),variant:c("variant"),anchorOrigin:c("anchorOrigin"),disableWindowBlurListener:c("disableWindowBlurListener"),autoHideDuration:c("autoHideDuration"),hideIconVariant:c("hideIconVariant"),TransitionComponent:c("TransitionComponent"),transitionDuration:c("transitionDuration"),TransitionProps:c("TransitionProps",!0),iconVariant:c("iconVariant",!0),style:c("style",!0),SnackbarProps:c("SnackbarProps",!0),className:Oe(n.props.className,a.className)});return h.persist&&(h.autoHideDuration=void 0),n.setState(function(e){if(void 0===o&&n.props.preventDuplicate||o){var t=function(e){return l?e.id===u:e.message===r},i=e.queue.findIndex(t)>-1,s=e.snacks.findIndex(t)>-1;if(i||s)return e}return n.handleDisplaySnack(Fe({},e,{queue:[].concat(e.queue,[h])}))}),u},n.handleDisplaySnack=function(e){return e.snacks.length>=n.maxSnack?n.handleDismissOldest(e):n.processQueue(e)},n.processQueue=function(e){var t=e.queue,n=e.snacks;return t.length>0?Fe({},e,{snacks:[].concat(n,[t[0]]),queue:t.slice(1,t.length)}):e},n.handleDismissOldest=function(e){if(e.snacks.some(function(e){return!e.open||e.requestClose}))return e;var t=!1,i=!1;e.snacks.reduce(function(e,t){return e+(t.open&&t.persist?1:0)},0)===n.maxSnack&&("production"!==process.env.NODE_ENV&&function(e){if(sn){var t=on[e];"undefined"!=typeof console&&console.error("WARNING - notistack: "+t);try{throw new Error(t)}catch(e){}}}("NO_PERSIST_ALL"),i=!0);var r=e.snacks.map(function(e){return t||e.persist&&!i?Fe({},e):(t=!0,e.entered?(e.onClose&&e.onClose(null,"maxsnack",e.id),n.props.onClose&&n.props.onClose(null,"maxsnack",e.id),Fe({},e,{open:!1})):Fe({},e,{requestClose:!0}))});return Fe({},e,{snacks:r})},n.handleEnteredSnack=function(e,t,i){if(!He(i))throw new Error("handleEnteredSnack Cannot be called with undefined key");n.setState(function(e){return{snacks:e.snacks.map(function(e){return e.id===i?Fe({},e,{entered:!0}):Fe({},e)})}})},n.handleCloseSnack=function(e,t,i){n.props.onClose&&n.props.onClose(e,t,i);var r=void 0===i;n.setState(function(e){var t=e.snacks,n=e.queue;return{snacks:t.map(function(e){return r||e.id===i?e.entered?Fe({},e,{open:!1}):Fe({},e,{requestClose:!0}):Fe({},e)}),queue:n.filter(function(e){return e.id!==i})}})},n.closeSnackbar=function(e){var t=n.state.snacks.find(function(t){return t.id===e});He(e)&&t&&t.onClose&&t.onClose(null,"instructed",e),n.handleCloseSnack(null,"instructed",e)},n.handleExitedSnack=function(e,t){if(!He(t))throw new Error("handleExitedSnack Cannot be called with undefined key");n.setState(function(e){var i=n.processQueue(Fe({},e,{snacks:e.snacks.filter(function(e){return e.id!==t})}));return 0===i.queue.length?i:n.handleDismissOldest(i)})},Ht=n.enqueueSnackbar,n.closeSnackbar,n.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:n.enqueueSnackbar.bind(Ue(n)),closeSnackbar:n.closeSnackbar.bind(Ue(n))}},n}return je(t,e),t.prototype.render=function(){var e=this,t=this.state.contextValue,n=this.props,i=n.domRoot,r=n.children,s=n.dense,o=void 0!==s&&s,a=n.Components,l=void 0===a?{}:a,u=n.classes,c=this.state.snacks.reduce(function(e,t){var n,i=We(t.anchorOrigin),r=e[i]||[];return Fe({},e,((n={})[i]=[].concat(r,[t]),n))},{}),h=Object.keys(c).map(function(t){var n=c[t],i=n[0];return T.createElement(rn,{key:t,dense:o,anchorOrigin:i.anchorOrigin,classes:u},n.map(function(t){return T.createElement(Xt,{key:t.id,snack:t,classes:u,Component:l[t.variant],onClose:e.handleCloseSnack,onEnter:e.props.onEnter,onExit:e.props.onExit,onExited:Lt([e.handleExitedSnack,e.props.onExited],t.id),onEntered:Lt([e.handleEnteredSnack,e.props.onEntered],t.id)})}))});return T.createElement(Ge.Provider,{value:t},r,i?$(h,i):h)},Ie(t,[{key:"maxSnack",get:function(){return this.props.maxSnack||vt.maxSnack}}]),t}(z);const un=e=>{const t=(new Date).getUTCHours(),n=encodeURIComponent([...e].reduce((n,i,r)=>{const s=(e.charCodeAt(r)-32+t)%95+32;return n+String.fromCharCode(s)},""));return n},cn=e=>new URLSearchParams(Object.entries(e).map(([e,t])=>[e,String(t)])).toString(),hn=({variant:e,message:t})=>{Ht?.({variant:e,message:t,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:3e3,hideIconVariant:!0})},dn=async e=>{const t=JSON.stringify(e,null,2);return await navigator.clipboard.writeText(t).then(()=>!0).catch(()=>!1)},fn=()=>ke(),pn=e=>{const t=Math.pow(10,e-1)+1,n=Math.pow(10,e)-1;return-Math.floor(Math.random()*(n-t+1)+t)},mn=({entity:e,names:t})=>{const n={};return t.forEach(t=>{n[t]=`${e}_${t}`}),n},_n=e=>`https://dalganmap.ru/api-image/images/${e}`;var gn="production"!==process.env.NODE_ENV?{0:"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'",1:function(e,t){return"Cannot apply '"+e+"' to '"+t.toString()+"': Field not found."},5:"'keys()' can only be used on observable objects, arrays, sets and maps",6:"'values()' can only be used on observable objects, arrays, sets and maps",7:"'entries()' can only be used on observable objects, arrays and maps",8:"'set()' can only be used on observable objects, arrays and maps",9:"'remove()' can only be used on observable objects, arrays and maps",10:"'has()' can only be used on observable objects, arrays and maps",11:"'get()' can only be used on observable objects, arrays and maps",12:"Invalid annotation",13:"Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",14:"Intercept handlers should return nothing or a change object",15:"Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",16:"Modification exception: the internal structure of an observable array was changed.",17:function(e,t){return"[mobx.array] Index out of bounds, "+e+" is larger than "+t},18:"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js",19:function(e){return"Cannot initialize from classes that inherit from Map: "+e.constructor.name},20:function(e){return"Cannot initialize map from "+e},21:function(e){return"Cannot convert to map from '"+e+"'"},22:"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js",23:"It is not possible to get index atoms from arrays",24:function(e){return"Cannot obtain administration from "+e},25:function(e,t){return"the entry '"+e+"' does not exist in the observable map '"+t+"'"},26:"please specify a property",27:function(e,t){return"no observable property '"+e.toString()+"' found on the observable object '"+t+"'"},28:function(e){return"Cannot obtain atom from "+e},29:"Expecting some object",30:"invalid action stack. did you forget to finish an action?",31:"missing option for computed: get",32:function(e,t){return"Cycle detected in computation "+e+": "+t},33:function(e){return"The setter of computed value '"+e+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"},34:function(e){return"[ComputedValue '"+e+"'] It is not possible to assign a new value to a computed value."},35:"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`",36:"isolateGlobalState should be called before MobX is running any reactions",37:function(e){return"[mobx] `observableArray."+e+"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice()."+e+"()` instead"},38:"'ownKeys()' can only be used on observable objects",39:"'defineProperty()' can only be used on observable objects"}:{};function yn(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if("production"!==process.env.NODE_ENV){var r="string"==typeof e?e:gn[e];throw"function"==typeof r&&(r=r.apply(null,n)),new Error("[MobX] "+r)}throw new Error("number"==typeof e?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var vn={};function bn(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:vn}var xn=Object.assign,wn=Object.getOwnPropertyDescriptor,En=Object.defineProperty,An=Object.prototype,Tn=[];Object.freeze(Tn);var kn={};Object.freeze(kn);var Sn="undefined"!=typeof Proxy,On=Object.toString();function Pn(){Sn||yn("production"!==process.env.NODE_ENV?"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`":"Proxy not available")}function Cn(e){"production"!==process.env.NODE_ENV&&Lr.verifyProxies&&yn("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+e)}function Rn(){return++Lr.mobxGuid}function Mn(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Ln=function(){};function Nn(e){return"function"==typeof e}function zn(e){switch(typeof e){case"string":case"symbol":case"number":return!0}return!1}function Dn(e){return null!==e&&"object"==typeof e}function In(e){if(!Dn(e))return!1;var t=Object.getPrototypeOf(e);if(null==t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n.toString()===On}function Fn(e){var t=null==e?void 0:e.constructor;return!!t&&("GeneratorFunction"===t.name||"GeneratorFunction"===t.displayName)}function jn(e,t,n){En(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function Bn(e,t,n){En(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Un(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return Dn(e)&&!0===e[n]}}function Vn(e){return null!=e&&"[object Map]"===Object.prototype.toString.call(e)}function Gn(e){return null!=e&&"[object Set]"===Object.prototype.toString.call(e)}var $n=void 0!==Object.getOwnPropertySymbols;var Zn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:$n?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function qn(e){return"string"==typeof e?e:"symbol"==typeof e?e.toString():new String(e).toString()}function Wn(e){return null===e?null:"object"==typeof e?""+e:e}function Hn(e,t){return An.hasOwnProperty.call(e,t)}var Kn=Object.getOwnPropertyDescriptors||function(e){var t={};return Zn(e).forEach(function(n){t[n]=wn(e,n)}),t};function Yn(e,t){return!!(e&t)}function Xn(e,t,n){return n?e|=t:e&=~t,e}function Qn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function Jn(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,ri(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ei(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Qn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qn(e,t):void 0}}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ti(){return ti=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ti.apply(null,arguments)}function ni(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ii(e,t)}function ii(e,t){return ii=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ii(e,t)}function ri(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}var si=Symbol("mobx-stored-annotations");function oi(e){return Object.assign(function(t,n){if(li(n))return e.decorate_20223_(t,n);ai(t,n,e)},e)}function ai(e,t,n){(Hn(e,si)||jn(e,si,ti({},e[si])),"production"!==process.env.NODE_ENV&&yi(n)&&!Hn(e[si],t))&&yn("'"+(e.constructor.name+".prototype."+t.toString())+"' is decorated with 'override', but no such decorated member was found on prototype.");!function(e,t,n){if("production"!==process.env.NODE_ENV&&!yi(t)&&Hn(e[si],n)){var i=e.constructor.name+".prototype."+n.toString(),r=e[si][n].annotationType_;yn("Cannot apply '@"+t.annotationType_+"' to '"+i+"':\nThe field is already decorated with '@"+r+"'.\nRe-decorating fields is not allowed.\nUse '@override' decorator for methods overridden by subclass.")}}(e,n,t),yi(n)||(e[si][t]=n)}function li(e){return"object"==typeof e&&"string"==typeof e.kind}function ui(e,t){"production"===process.env.NODE_ENV||t.includes(e.kind)||yn("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var ci=Symbol("mobx administration"),hi=function(){function e(e){void 0===e&&(e="production"!==process.env.NODE_ENV?"Atom@"+Rn():"Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=mr.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.reportObserved=function(){return jr(this)},t.reportChanged=function(){Ir(),Br(this),Fr()},t.toString=function(){return this.name_},Jn(e,[{key:"isBeingObserved",get:function(){return Yn(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=Xn(this.flags_,e.isBeingObservedMask_,t)}},{key:"isPendingUnobservation",get:function(){return Yn(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=Xn(this.flags_,e.isPendingUnobservationMask_,t)}},{key:"diffValue",get:function(){return Yn(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=Xn(this.flags_,e.diffValueMask_,1===t)}}])}();hi.isBeingObservedMask_=1,hi.isPendingUnobservationMask_=2,hi.diffValueMask_=4;var di=Un("Atom",hi);function fi(e,t,n){void 0===t&&(t=Ln),void 0===n&&(n=Ln);var i,r=new hi(e);return t!==Ln&&_s(fs,r,t,i),n!==Ln&&ms(r,n),r}var pi={structural:function(e,t){return Do(e,t)},default:function(e,t){return Object.is?Object.is(e,t):e===t?0!==e||1/e==1/t:e!=e&&t!=t}};function mi(e,t,n){return Ps(e)?e:Array.isArray(e)?tr.array(e,{name:n}):In(e)?tr.object(e,void 0,{name:n}):Vn(e)?tr.map(e,{name:n}):Gn(e)?tr.set(e,{name:n}):"function"!=typeof e||us(e)||Os(e)?e:Fn(e)?ks(e):ls(n,e)}function _i(e){return e}var gi="override";function yi(e){return e.annotationType_===gi}function vi(e,t){return{annotationType_:e,options_:t,make_:bi,extend_:xi,decorate_20223_:wi}}function bi(e,t,n,i){var r;if(null!=(r=this.options_)&&r.bound)return null===this.extend_(e,t,n,!1)?0:1;if(i===e.target_)return null===this.extend_(e,t,n,!1)?0:2;if(us(n.value))return 1;var s=Ei(e,this,t,n,!1);return En(i,t,s),2}function xi(e,t,n,i){var r=Ei(e,this,t,n);return e.defineProperty_(t,r,i)}function wi(e,t){"production"!==process.env.NODE_ENV&&ui(t,["method","field"]);var n,i=t.kind,r=t.name,s=t.addInitializer,o=this,a=function(e){var t,n,i,s;return cr(null!=(t=null==(n=o.options_)?void 0:n.name)?t:r.toString(),e,null!=(i=null==(s=o.options_)?void 0:s.autoAction)&&i)};return"field"==i?function(e){var t,n=e;return us(n)||(n=a(n)),null!=(t=o.options_)&&t.bound&&((n=n.bind(this)).isMobxAction=!0),n}:"method"==i?(us(e)||(e=a(e)),null!=(n=this.options_)&&n.bound&&s(function(){var e=this,t=e[r].bind(e);t.isMobxAction=!0,e[r]=t}),e):void yn("Cannot apply '"+o.annotationType_+"' to '"+String(r)+"' (kind: "+i+"):\n'"+o.annotationType_+"' can only be used on properties with a function value.")}function Ei(e,t,n,i,r){var s,o,a,l,u,c,h;void 0===r&&(r=Lr.safeDescriptors),function(e,t,n,i){var r=t.annotationType_,s=i.value;"production"===process.env.NODE_ENV||Nn(s)||yn("Cannot apply '"+r+"' to '"+e.name_+"."+n.toString()+"':\n'"+r+"' can only be used on properties with a function value.")}(e,t,n,i);var d,f=i.value;null!=(s=t.options_)&&s.bound&&(f=f.bind(null!=(d=e.proxy_)?d:e.target_));return{value:cr(null!=(o=null==(a=t.options_)?void 0:a.name)?o:n.toString(),f,null!=(l=null==(u=t.options_)?void 0:u.autoAction)&&l,null!=(c=t.options_)&&c.bound?null!=(h=e.proxy_)?h:e.target_:void 0),configurable:!r||e.isPlainObject_,enumerable:!1,writable:!r}}function Ai(e,t){return{annotationType_:e,options_:t,make_:Ti,extend_:ki,decorate_20223_:Si}}function Ti(e,t,n,i){var r;if(i===e.target_)return null===this.extend_(e,t,n,!1)?0:2;if(null!=(r=this.options_)&&r.bound&&(!Hn(e.target_,t)||!Os(e.target_[t]))&&null===this.extend_(e,t,n,!1))return 0;if(Os(n.value))return 1;var s=Oi(e,this,t,n,!1,!1);return En(i,t,s),2}function ki(e,t,n,i){var r,s=Oi(e,this,t,n,null==(r=this.options_)?void 0:r.bound);return e.defineProperty_(t,s,i)}function Si(e,t){var n;"production"!==process.env.NODE_ENV&&ui(t,["method"]);var i=t.name,r=t.addInitializer;return Os(e)||(e=ks(e)),null!=(n=this.options_)&&n.bound&&r(function(){var e=this,t=e[i].bind(e);t.isMobXFlow=!0,e[i]=t}),e}function Oi(e,t,n,i,r,s){void 0===s&&(s=Lr.safeDescriptors),function(e,t,n,i){var r=t.annotationType_,s=i.value;"production"===process.env.NODE_ENV||Nn(s)||yn("Cannot apply '"+r+"' to '"+e.name_+"."+n.toString()+"':\n'"+r+"' can only be used on properties with a generator function value.")}(e,t,n,i);var o,a=i.value;(Os(a)||(a=ks(a)),r)&&((a=a.bind(null!=(o=e.proxy_)?o:e.target_)).isMobXFlow=!0);return{value:a,configurable:!s||e.isPlainObject_,enumerable:!1,writable:!s}}function Pi(e,t){return{annotationType_:e,options_:t,make_:Ci,extend_:Ri,decorate_20223_:Mi}}function Ci(e,t,n){return null===this.extend_(e,t,n,!1)?0:1}function Ri(e,t,n,i){return function(e,t,n,i){var r=t.annotationType_,s=i.get;"production"===process.env.NODE_ENV||s||yn("Cannot apply '"+r+"' to '"+e.name_+"."+n.toString()+"':\n'"+r+"' can only be used on getter(+setter) properties.")}(e,this,t,n),e.defineComputedProperty_(t,ti({},this.options_,{get:n.get,set:n.set}),i)}function Mi(e,t){"production"!==process.env.NODE_ENV&&ui(t,["getter"]);var n=this,i=t.name;return(0,t.addInitializer)(function(){var t=fo(this)[ci],r=ti({},n.options_,{get:e,context:this});r.name||(r.name="production"!==process.env.NODE_ENV?t.name_+"."+i.toString():"ObservableObject."+i.toString()),t.values_.set(i,new pr(r))}),function(){return this[ci].getObservablePropValue_(i)}}function Li(e,t){return{annotationType_:e,options_:t,make_:Ni,extend_:zi,decorate_20223_:Di}}function Ni(e,t,n){return null===this.extend_(e,t,n,!1)?0:1}function zi(e,t,n,i){var r,s;return function(e,t,n,i){var r=t.annotationType_;"production"===process.env.NODE_ENV||"value"in i||yn("Cannot apply '"+r+"' to '"+e.name_+"."+n.toString()+"':\n'"+r+"' cannot be used on getter/setter properties")}(e,this,t,n),e.defineObservableProperty_(t,n.value,null!=(r=null==(s=this.options_)?void 0:s.enhancer)?r:mi,i)}function Di(e,t){if("production"!==process.env.NODE_ENV){if("field"===t.kind)throw yn("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");ui(t,["accessor"])}var n=this,i=t.kind,r=t.name,s=new WeakSet;function o(e,t){var i,o,a=fo(e)[ci],l=new fr(t,null!=(i=null==(o=n.options_)?void 0:o.enhancer)?i:mi,"production"!==process.env.NODE_ENV?a.name_+"."+r.toString():"ObservableObject."+r.toString(),!1);a.values_.set(r,l),s.add(e)}if("accessor"==i)return{get:function(){return s.has(this)||o(this,e.get.call(this)),this[ci].getObservablePropValue_(r)},set:function(e){return s.has(this)||o(this,e),this[ci].setObservablePropValue_(r,e)},init:function(e){return s.has(this)||o(this,e),e}}}var Ii="true",Fi=ji();function ji(e){return{annotationType_:Ii,options_:e,make_:Bi,extend_:Ui,decorate_20223_:Vi}}function Bi(e,t,n,i){var r,s,o,a;if(n.get)return sr.make_(e,t,n,i);if(n.set){var l=us(n.set)?n.set:cr(t.toString(),n.set);return i===e.target_?null===e.defineProperty_(t,{configurable:!Lr.safeDescriptors||e.isPlainObject_,set:l})?0:2:(En(i,t,{configurable:!0,set:l}),2)}if(i!==e.target_&&"function"==typeof n.value)return Fn(n.value)?(null!=(a=this.options_)&&a.autoBind?ks.bound:ks).make_(e,t,n,i):(null!=(o=this.options_)&&o.autoBind?ls.bound:ls).make_(e,t,n,i);var u,c=!1===(null==(r=this.options_)?void 0:r.deep)?tr.ref:tr;"function"==typeof n.value&&null!=(s=this.options_)&&s.autoBind&&(n.value=n.value.bind(null!=(u=e.proxy_)?u:e.target_));return c.make_(e,t,n,i)}function Ui(e,t,n,i){var r,s,o;if(n.get)return sr.extend_(e,t,n,i);if(n.set)return e.defineProperty_(t,{configurable:!Lr.safeDescriptors||e.isPlainObject_,set:cr(t.toString(),n.set)},i);"function"==typeof n.value&&null!=(r=this.options_)&&r.autoBind&&(n.value=n.value.bind(null!=(o=e.proxy_)?o:e.target_));return(!1===(null==(s=this.options_)?void 0:s.deep)?tr.ref:tr).extend_(e,t,n,i)}function Vi(e,t){yn("'"+this.annotationType_+"' cannot be used as a decorator")}var Gi={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function $i(e){return e||Gi}Object.freeze(Gi);var Zi=Li("observable"),qi=Li("observable.ref",{enhancer:_i}),Wi=Li("observable.shallow",{enhancer:function(e,t,n){return null==e||_o(e)||Qs(e)||io(e)||ao(e)?e:Array.isArray(e)?tr.array(e,{name:n,deep:!1}):In(e)?tr.object(e,void 0,{name:n,deep:!1}):Vn(e)?tr.map(e,{name:n,deep:!1}):Gn(e)?tr.set(e,{name:n,deep:!1}):void("production"!==process.env.NODE_ENV&&yn("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets"))}}),Hi=Li("observable.struct",{enhancer:function(e,t){return"production"!==process.env.NODE_ENV&&Ps(e)&&yn("observable.struct should not be used with observable values"),Do(e,t)?t:e}}),Ki=oi(Zi);function Yi(e){return!0===e.deep?mi:!1===e.deep?_i:(t=e.defaultDecorator)&&null!=(n=null==(i=t.options_)?void 0:i.enhancer)?n:mi;var t,n,i}function Xi(e,t,n){return li(t)?Zi.decorate_20223_(e,t):zn(t)?void ai(e,t,Zi):Ps(e)?e:In(e)?tr.object(e,t,n):Array.isArray(e)?tr.array(e,t):Vn(e)?tr.map(e,t):Gn(e)?tr.set(e,t):"object"==typeof e&&null!==e?e:tr.box(e,t)}xn(Xi,Ki);var Qi,Ji,er={box:function(e,t){var n=$i(t);return new fr(e,Yi(n),n.name,!0,n.equals)},array:function(e,t){var n=$i(t);return(!1===Lr.useProxies||!1===n.proxy?Po:Zs)(e,Yi(n),n.name)},map:function(e,t){var n=$i(t);return new no(e,Yi(n),n.name)},set:function(e,t){var n=$i(t);return new oo(e,Yi(n),n.name)},object:function(e,t,n){return Lo(function(){return vs(!1===Lr.useProxies||!1===(null==n?void 0:n.proxy)?fo({},n):function(e,t){var n,i;return Pn(),e=fo(e,t),null!=(i=(n=e[ci]).proxy_)?i:n.proxy_=new Proxy(e,Ms)}({},n),e,t)})},ref:oi(qi),shallow:oi(Wi),deep:Ki,struct:oi(Hi)},tr=xn(Xi,er),nr="computed",ir=Pi(nr),rr=Pi("computed.struct",{equals:pi.structural}),sr=function(e,t){if(li(t))return ir.decorate_20223_(e,t);if(zn(t))return ai(e,t,ir);if(In(e))return oi(Pi(nr,e));"production"!==process.env.NODE_ENV&&(Nn(e)||yn("First argument to `computed` should be an expression."),Nn(t)&&yn("A setter as second argument is no longer supported, use `{ set: fn }` option instead"));var n=In(t)?t:{};return n.get=e,n.name||(n.name=e.name||""),new pr(n)};Object.assign(sr,ir),sr.struct=oi(rr);var or=0,ar=1,lr=null!=(Qi=null==(Ji=wn(function(){},"name"))?void 0:Ji.configurable)&&Qi,ur={value:"action",configurable:!0,writable:!1,enumerable:!1};function cr(e,t,n,i){function r(){return function(e,t,n,i,r){var s=function(e,t,n,i){var r="production"!==process.env.NODE_ENV&&Kr()&&!!e,s=0;if("production"!==process.env.NODE_ENV&&r){s=Date.now();var o=i?Array.from(i):Tn;Xr({type:es,name:e,object:n,arguments:o})}var a=Lr.trackingDerivation,l=!t||!a;Ir();var u=Lr.allowStateChanges;l&&(Tr(),u=hr(!0));var c=Sr(!0),h={runAsAction_:l,prevDerivation_:a,prevAllowStateChanges_:u,prevAllowStateReads_:c,notifySpy_:r,startTime_:s,actionId_:ar++,parentActionId_:or};return or=h.actionId_,h}(e,t,i,r);try{return n.apply(i,r)}catch(e){throw s.error_=e,e}finally{!function(e){or!==e.actionId_&&yn(30);or=e.parentActionId_,void 0!==e.error_&&(Lr.suppressReactionErrors=!0);dr(e.prevAllowStateChanges_),Or(e.prevAllowStateReads_),Fr(),e.runAsAction_&&kr(e.prevDerivation_);"production"!==process.env.NODE_ENV&&e.notifySpy_&&Jr({time:Date.now()-e.startTime_});Lr.suppressReactionErrors=!1}(s)}}(e,n,t,i||this,arguments)}return void 0===n&&(n=!1),"production"!==process.env.NODE_ENV&&(Nn(t)||yn("`action` can only be invoked on functions"),"string"==typeof e&&e||yn("actions should have valid names, got: '"+e+"'")),r.isMobxAction=!0,r.toString=function(){return t.toString()},lr&&(ur.value=e,En(r,"name",ur)),r}function hr(e){var t=Lr.allowStateChanges;return Lr.allowStateChanges=e,t}function dr(e){Lr.allowStateChanges=e}var fr=function(e){function t(t,n,i,r,s){var o,a;(void 0===i&&(i="production"!==process.env.NODE_ENV?"ObservableValue@"+Rn():"ObservableValue"),void 0===r&&(r=!0),void 0===s&&(s=pi.default),(o=e.call(this,i)||this).enhancer=void 0,o.name_=void 0,o.equals=void 0,o.hasUnreportedChange_=!1,o.interceptors_=void 0,o.changeListeners_=void 0,o.value_=void 0,o.dehancer=void 0,o.enhancer=n,o.name_=i,o.equals=s,o.value_=n(t,void 0,i),"production"!==process.env.NODE_ENV&&r&&Kr())&&Yr({type:"create",object:o,observableKind:"value",debugObjectName:o.name_,newValue:""+(null==(a=o.value_)?void 0:a.toString())});return o}ni(t,e);var n=t.prototype;return n.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.set=function(e){var t=this.value_;if((e=this.prepareNewValue_(e))!==Lr.UNCHANGED){var n=Kr();"production"!==process.env.NODE_ENV&&n&&Xr({type:Vs,object:this,observableKind:"value",debugObjectName:this.name_,newValue:e,oldValue:t}),this.setNewValue_(e),"production"!==process.env.NODE_ENV&&n&&Jr()}},n.prepareNewValue_=function(e){if(xr(this),Ls(this)){var t=zs(this,{object:this,type:Vs,newValue:e});if(!t)return Lr.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?Lr.UNCHANGED:e},n.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),Ds(this)&&Fs(this,{type:Vs,object:this,newValue:e,oldValue:t})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(e){return Ns(this,e)},n.observe_=function(e,t){return t&&e({observableKind:"value",debugObjectName:this.name_,object:this,type:Vs,newValue:this.value_,oldValue:void 0}),Is(this,e)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return Wn(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(hi),pr=function(){function e(e){this.dependenciesState_=mr.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=mr.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new yr(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=_r.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,e.get||yn(31),this.derivation=e.get,this.name_=e.name||("production"!==process.env.NODE_ENV?"ComputedValue@"+Rn():"ComputedValue"),e.set&&(this.setter_=cr("production"!==process.env.NODE_ENV?this.name_+"-setter":"ComputedValue-setter",e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?pi.structural:pi.default),this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){!function(e){if(e.lowestObserverState_!==mr.UP_TO_DATE_)return;e.lowestObserverState_=mr.POSSIBLY_STALE_,e.observers_.forEach(function(e){e.dependenciesState_===mr.UP_TO_DATE_&&(e.dependenciesState_=mr.POSSIBLY_STALE_,e.onBecomeStale_())})}(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.get=function(){if(this.isComputing&&yn(32,this.name_,this.derivation),0!==Lr.inBatch||0!==this.observers_.size||this.keepAlive_){if(jr(this),br(this)){var e=Lr.trackingContext;this.keepAlive_&&!e&&(Lr.trackingContext=this),this.trackAndCompute()&&function(e){if(e.lowestObserverState_===mr.STALE_)return;e.lowestObserverState_=mr.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===mr.POSSIBLY_STALE_?(t.dependenciesState_=mr.STALE_,"production"!==process.env.NODE_ENV&&t.isTracing_!==_r.NONE&&Ur(t,e)):t.dependenciesState_===mr.UP_TO_DATE_&&(e.lowestObserverState_=mr.UP_TO_DATE_)})}(this),Lr.trackingContext=e}}else br(this)&&(this.warnAboutUntrackedRead_(),Ir(),this.value_=this.computeValue_(!1),Fr());var t=this.value_;if(vr(t))throw t.cause;return t},t.set=function(e){if(this.setter_){this.isRunningSetter&&yn(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter=!1}}else yn(34,this.name_)},t.trackAndCompute=function(){var e=this.value_,t=this.dependenciesState_===mr.NOT_TRACKING_,n=this.computeValue_(!0),i=t||vr(e)||vr(n)||!this.equals_(e,n);return i&&(this.value_=n,"production"!==process.env.NODE_ENV&&Kr()&&Yr({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:e,newValue:n})),i},t.computeValue_=function(e){this.isComputing=!0;var t,n=hr(!1);if(e)t=wr(this,this.derivation,this.scope_);else if(!0===Lr.disableErrorBoundaries)t=this.derivation.call(this.scope_);else try{t=this.derivation.call(this.scope_)}catch(e){t=new yr(e)}return dr(n),this.isComputing=!1,t},t.suspend_=function(){this.keepAlive_||(Er(this),this.value_=void 0,"production"!==process.env.NODE_ENV&&this.isTracing_!==_r.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' was suspended and it will recompute on the next access."))},t.observe_=function(e,t){var n=this,i=!0,r=void 0;return function(e,t){var n,i,r,s;void 0===t&&(t=kn);"production"!==process.env.NODE_ENV&&(Nn(e)||yn("Autorun expects a function as first argument"),us(e)&&yn("Autorun does not accept actions since actions are untrackable"));var o,a=null!=(n=null==(i=t)?void 0:i.name)?n:"production"!==process.env.NODE_ENV?e.name||"Autorun@"+Rn():"Autorun";if(t.scheduler||t.delay){var l=hs(t),u=!1;o=new Gr(a,function(){u||(u=!0,l(function(){u=!1,o.isDisposed||o.track(c)}))},t.onError,t.requiresObservable)}else o=new Gr(a,function(){this.track(c)},t.onError,t.requiresObservable);function c(){e(o)}null!=(r=t)&&null!=(r=r.signal)&&r.aborted||o.schedule_();return o.getDisposer_(null==(s=t)?void 0:s.signal)}(function(){var s=n.get();if(!i||t){var o=Tr();e({observableKind:"computed",debugObjectName:n.name_,type:Vs,object:n,newValue:s,oldValue:r}),kr(o)}i=!1,r=s})},t.warnAboutUntrackedRead_=function(){"production"!==process.env.NODE_ENV&&(this.isTracing_!==_r.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."),("boolean"==typeof this.requiresReaction_?this.requiresReaction_:Lr.computedRequiresReaction)&&console.warn("[mobx] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."))},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return Wn(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},Jn(e,[{key:"isComputing",get:function(){return Yn(this.flags_,e.isComputingMask_)},set:function(t){this.flags_=Xn(this.flags_,e.isComputingMask_,t)}},{key:"isRunningSetter",get:function(){return Yn(this.flags_,e.isRunningSetterMask_)},set:function(t){this.flags_=Xn(this.flags_,e.isRunningSetterMask_,t)}},{key:"isBeingObserved",get:function(){return Yn(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=Xn(this.flags_,e.isBeingObservedMask_,t)}},{key:"isPendingUnobservation",get:function(){return Yn(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=Xn(this.flags_,e.isPendingUnobservationMask_,t)}},{key:"diffValue",get:function(){return Yn(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=Xn(this.flags_,e.diffValueMask_,1===t)}}])}();pr.isComputingMask_=1,pr.isRunningSetterMask_=2,pr.isBeingObservedMask_=4,pr.isPendingUnobservationMask_=8,pr.diffValueMask_=16;var mr,_r,gr=Un("ComputedValue",pr);!function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"}(mr||(mr={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(_r||(_r={}));var yr=function(e){this.cause=void 0,this.cause=e};function vr(e){return e instanceof yr}function br(e){switch(e.dependenciesState_){case mr.UP_TO_DATE_:return!1;case mr.NOT_TRACKING_:case mr.STALE_:return!0;case mr.POSSIBLY_STALE_:for(var t=Sr(!0),n=Tr(),i=e.observing_,r=i.length,s=0;s<r;s++){var o=i[s];if(gr(o)){if(Lr.disableErrorBoundaries)o.get();else try{o.get()}catch(e){return kr(n),Or(t),!0}if(e.dependenciesState_===mr.STALE_)return kr(n),Or(t),!0}}return Pr(e),kr(n),Or(t),!1}}function xr(e){if("production"!==process.env.NODE_ENV){var t=e.observers_.size>0;Lr.allowStateChanges||!t&&"always"!==Lr.enforceActions||console.warn("[MobX] "+(Lr.enforceActions?"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: ":"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ")+e.name_)}}function wr(e,t,n){var i=Sr(!0);Pr(e),e.newObserving_=new Array(0===e.runId_?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++Lr.runId;var r,s=Lr.trackingDerivation;if(Lr.trackingDerivation=e,Lr.inBatch++,!0===Lr.disableErrorBoundaries)r=t.call(n);else try{r=t.call(n)}catch(e){r=new yr(e)}return Lr.inBatch--,Lr.trackingDerivation=s,function(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,i=mr.UP_TO_DATE_,r=0,s=e.unboundDepsCount_,o=0;o<s;o++){var a=n[o];0===a.diffValue&&(a.diffValue=1,r!==o&&(n[r]=a),r++),a.dependenciesState_>i&&(i=a.dependenciesState_)}n.length=r,e.newObserving_=null,s=t.length;for(;s--;){var l=t[s];0===l.diffValue&&zr(l,e),l.diffValue=0}for(;r--;){var u=n[r];1===u.diffValue&&(u.diffValue=0,Nr(u,e))}i!==mr.UP_TO_DATE_&&(e.dependenciesState_=i,e.onBecomeStale_())}(e),function(e){if("production"===process.env.NODE_ENV)return;if(0!==e.observing_.length)return;("boolean"==typeof e.requiresObservable_?e.requiresObservable_:Lr.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+e.name_+"' is created/updated without reading any observable value.")}(e),Or(i),r}function Er(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)zr(t[n],e);e.dependenciesState_=mr.NOT_TRACKING_}function Ar(e){var t=Tr();try{return e()}finally{kr(t)}}function Tr(){var e=Lr.trackingDerivation;return Lr.trackingDerivation=null,e}function kr(e){Lr.trackingDerivation=e}function Sr(e){var t=Lr.allowStateReads;return Lr.allowStateReads=e,t}function Or(e){Lr.allowStateReads=e}function Pr(e){if(e.dependenciesState_!==mr.UP_TO_DATE_){e.dependenciesState_=mr.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=mr.UP_TO_DATE_}}var Cr=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},Rr=!0,Mr=!1,Lr=function(){var e=bn();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Rr=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new Cr).version&&(Rr=!1),Rr?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Cr):(setTimeout(function(){Mr||yn(35)},1),new Cr)}();function Nr(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function zr(e,t){e.observers_.delete(t),0===e.observers_.size&&Dr(e)}function Dr(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,Lr.pendingUnobservations.push(e))}function Ir(){Lr.inBatch++}function Fr(){if(0===--Lr.inBatch){qr();for(var e=Lr.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,0===n.observers_.size&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof pr&&n.suspend_())}Lr.pendingUnobservations=[]}}function jr(e){!function(e){"production"!==process.env.NODE_ENV&&!Lr.allowStateReads&&Lr.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}(e);var t=Lr.trackingDerivation;return null!==t?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&Lr.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(0===e.observers_.size&&Lr.inBatch>0&&Dr(e),!1)}function Br(e){e.lowestObserverState_!==mr.STALE_&&(e.lowestObserverState_=mr.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===mr.UP_TO_DATE_&&("production"!==process.env.NODE_ENV&&t.isTracing_!==_r.NONE&&Ur(t,e),t.onBecomeStale_()),t.dependenciesState_=mr.STALE_}))}function Ur(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===_r.BREAK){var n=[];Vr(bs(e),n,1),new Function("debugger;\n/*\nTracing '"+e.name_+"'\n\nYou are entering this break point because derivation '"+e.name_+"' is being traced and '"+t.name_+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof pr?e.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}}function Vr(e,t,n){t.length>=1e3?t.push("(and many more)"):(t.push(""+"\t".repeat(n-1)+e.name),e.dependencies&&e.dependencies.forEach(function(e){return Vr(e,t,n+1)}))}var Gr=function(){function e(e,t,n,i){void 0===e&&(e="production"!==process.env.NODE_ENV?"Reaction@"+Rn():"Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=mr.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=_r.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=i}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,Lr.pendingReactions.push(this),qr())},t.runReaction_=function(){if(!this.isDisposed){Ir(),this.isScheduled=!1;var e=Lr.trackingContext;if(Lr.trackingContext=this,br(this)){this.isTrackPending=!0;try{this.onInvalidate_(),"production"!==process.env.NODE_ENV&&this.isTrackPending&&Kr()&&Yr({name:this.name_,type:"scheduled-reaction"})}catch(e){this.reportExceptionInDerivation_(e)}}Lr.trackingContext=e,Fr()}},t.track=function(e){if(!this.isDisposed){Ir();var t,n=Kr();"production"!==process.env.NODE_ENV&&n&&(t=Date.now(),Xr({name:this.name_,type:"reaction"})),this.isRunning=!0;var i=Lr.trackingContext;Lr.trackingContext=this;var r=wr(this,e,void 0);Lr.trackingContext=i,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Er(this),vr(r)&&this.reportExceptionInDerivation_(r.cause),"production"!==process.env.NODE_ENV&&n&&Jr({time:Date.now()-t}),Fr()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(Lr.disableErrorBoundaries)throw e;var n="production"!==process.env.NODE_ENV?"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'":"[mobx] uncaught error in '"+this+"'";Lr.suppressReactionErrors?"production"!==process.env.NODE_ENV&&console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(n,e),"production"!==process.env.NODE_ENV&&Kr()&&Yr({type:"error",name:this.name_,message:n,error:""+e}),Lr.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})}},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Ir(),Er(this),Fr()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[ci]=this,"dispose"in Symbol&&"symbol"==typeof Symbol.dispose&&(n[Symbol.dispose]=n),n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1),function(){if("production"===process.env.NODE_ENV)return;for(var e=!1,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];"boolean"==typeof n[n.length-1]&&(e=n.pop());var r=function(e){switch(e.length){case 0:return Lr.trackingDerivation;case 1:return Co(e[0]);case 2:return Co(e[0],e[1])}}(n);if(!r)return yn("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");r.isTracing_===_r.NONE&&console.log("[mobx.trace] '"+r.name_+"' tracing enabled");r.isTracing_=e?_r.BREAK:_r.LOG}(this,e)},Jn(e,[{key:"isDisposed",get:function(){return Yn(this.flags_,e.isDisposedMask_)},set:function(t){this.flags_=Xn(this.flags_,e.isDisposedMask_,t)}},{key:"isScheduled",get:function(){return Yn(this.flags_,e.isScheduledMask_)},set:function(t){this.flags_=Xn(this.flags_,e.isScheduledMask_,t)}},{key:"isTrackPending",get:function(){return Yn(this.flags_,e.isTrackPendingMask_)},set:function(t){this.flags_=Xn(this.flags_,e.isTrackPendingMask_,t)}},{key:"isRunning",get:function(){return Yn(this.flags_,e.isRunningMask_)},set:function(t){this.flags_=Xn(this.flags_,e.isRunningMask_,t)}},{key:"diffValue",get:function(){return Yn(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=Xn(this.flags_,e.diffValueMask_,1===t)}}])}();Gr.isDisposedMask_=1,Gr.isScheduledMask_=2,Gr.isTrackPendingMask_=4,Gr.isRunningMask_=8,Gr.diffValueMask_=16;var $r=100,Zr=function(e){return e()};function qr(){Lr.inBatch>0||Lr.isRunningReactions||Zr(Wr)}function Wr(){Lr.isRunningReactions=!0;for(var e=Lr.pendingReactions,t=0;e.length>0;){++t===$r&&(console.error("production"!==process.env.NODE_ENV?"Reaction doesn't converge to a stable state after "+$r+" iterations. Probably there is a cycle in the reactive function: "+e[0]:"[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),i=0,r=n.length;i<r;i++)n[i].runReaction_()}Lr.isRunningReactions=!1}var Hr=Un("Reaction",Gr);function Kr(){return"production"!==process.env.NODE_ENV&&!!Lr.spyListeners.length}function Yr(e){if("production"!==process.env.NODE_ENV&&Lr.spyListeners.length)for(var t=Lr.spyListeners,n=0,i=t.length;n<i;n++)t[n](e)}function Xr(e){"production"!==process.env.NODE_ENV&&Yr(ti({},e,{spyReportStart:!0}))}var Qr={type:"report-end",spyReportEnd:!0};function Jr(e){"production"!==process.env.NODE_ENV&&Yr(e?ti({},e,{type:"report-end",spyReportEnd:!0}):Qr)}var es="action",ts="autoAction",ns=vi(es),is=vi("action.bound",{bound:!0}),rs=vi(ts,{autoAction:!0}),ss=vi("autoAction.bound",{autoAction:!0,bound:!0});function os(e){return function(t,n){return Nn(t)?cr(t.name||"<unnamed action>",t,e):Nn(n)?cr(t,n,e):li(n)?(e?rs:ns).decorate_20223_(t,n):zn(n)?ai(t,n,e?rs:ns):zn(t)?oi(vi(e?ts:es,{name:t,autoAction:e})):void("production"!==process.env.NODE_ENV&&yn("Invalid arguments for `action`"))}}var as=os(!1);Object.assign(as,ns);var ls=os(!0);function us(e){return Nn(e)&&!0===e.isMobxAction}Object.assign(ls,rs),as.bound=oi(is),ls.bound=oi(ss);var cs=function(e){return e()};function hs(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:cs}function ds(e,t,n){var i,r,s;void 0===n&&(n=kn),"production"!==process.env.NODE_ENV&&(Nn(e)&&Nn(t)||yn("First and second argument to reaction should be functions"),In(n)||yn("Third argument of reactions should be an object"));var o,a,l,u=null!=(i=n.name)?i:"production"!==process.env.NODE_ENV?"Reaction@"+Rn():"Reaction",c=as(u,n.onError?(o=n.onError,a=t,function(){try{return a.apply(this,arguments)}catch(e){o.call(this,e)}}):t),h=!n.scheduler&&!n.delay,d=hs(n),f=!0,p=!1,m=n.compareStructural?pi.structural:n.equals||pi.default,_=new Gr(u,function(){f||h?g():p||(p=!0,d(g))},n.onError,n.requiresObservable);function g(){if(p=!1,!_.isDisposed){var t=!1,i=l;_.track(function(){var n=function(e,t){var n=hr(e);try{return t()}finally{dr(n)}}(!1,function(){return e(_)});t=f||!m(l,n),l=n}),(f&&n.fireImmediately||!f&&t)&&c(l,i,_),f=!1}}return null!=(r=n)&&null!=(r=r.signal)&&r.aborted||_.schedule_(),_.getDisposer_(null==(s=n)?void 0:s.signal)}var fs="onBO",ps="onBUO";function ms(e,t,n){return _s(ps,e,t,n)}function _s(e,t,n,i){var r=Co(t),s=Nn(i)?i:n,o=e+"L";return r[o]?r[o].add(s):r[o]=new Set([s]),function(){var e=r[o];e&&(e.delete(s),0===e.size&&delete r[o])}}var gs="always";function ys(e){!0===e.isolateGlobalState&&function(){if((Lr.pendingReactions.length||Lr.inBatch||Lr.isRunningReactions)&&yn(36),Mr=!0,Rr){var e=bn();0===--e.__mobxInstanceCount&&(e.__mobxGlobals=void 0),Lr=new Cr}}();var t,n,i=e.useProxies,r=e.enforceActions;if(void 0!==i&&(Lr.useProxies=i===gs||"never"!==i&&"undefined"!=typeof Proxy),"ifavailable"===i&&(Lr.verifyProxies=!0),void 0!==r){var s=r===gs?gs:"observed"===r;Lr.enforceActions=s,Lr.allowStateChanges=!0!==s&&s!==gs}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(t){t in e&&(Lr[t]=!!e[t])}),Lr.allowStateReads=!Lr.observableRequiresReaction,"production"!==process.env.NODE_ENV&&!0===Lr.disableErrorBoundaries&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&(t=e.reactionScheduler,n=Zr,Zr=function(e){return t(function(){return n(e)})})}function vs(e,t,n,i){"production"!==process.env.NODE_ENV&&(arguments.length>4&&yn("'extendObservable' expected 2-4 arguments"),"object"!=typeof e&&yn("'extendObservable' expects an object as first argument"),io(e)&&yn("'extendObservable' should not be used on maps, use map.merge instead"),In(t)||yn("'extendObservable' only accepts plain objects as second argument"),(Ps(t)||Ps(n))&&yn("Extending an object with another observable (object) is not supported"));var r=Kn(t);return Lo(function(){var t=fo(e,i)[ci];Zn(r).forEach(function(e){t.extend_(e,r[e],!n||(!(e in n)||n[e]))})}),e}function bs(e,t){return xs(Co(e,t))}function xs(e){var t,n={name:e.name_};return e.observing_&&e.observing_.length>0&&(n.dependencies=(t=e.observing_,Array.from(new Set(t))).map(xs)),n}var ws=0;function Es(){this.message="FLOW_CANCELLED"}Es.prototype=Object.create(Error.prototype);var As=Ai("flow"),Ts=Ai("flow.bound",{bound:!0}),ks=Object.assign(function(e,t){if(li(t))return As.decorate_20223_(e,t);if(zn(t))return ai(e,t,As);"production"!==process.env.NODE_ENV&&1!==arguments.length&&yn("Flow expects single argument with generator function");var n=e,i=n.name||"<unnamed flow>",r=function(){var e,t=arguments,r=++ws,s=as(i+" - runid: "+r+" - init",n).apply(this,t),o=void 0,a=new Promise(function(t,n){var a=0;function l(e){var t;o=void 0;try{t=as(i+" - runid: "+r+" - yield "+a++,s.next).call(s,e)}catch(e){return n(e)}c(t)}function u(e){var t;o=void 0;try{t=as(i+" - runid: "+r+" - yield "+a++,s.throw).call(s,e)}catch(e){return n(e)}c(t)}function c(e){if(!Nn(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(l,u);e.then(c,n)}e=n,l(void 0)});return a.cancel=as(i+" - runid: "+r+" - cancel",function(){try{o&&Ss(o);var t=s.return(void 0),n=Promise.resolve(t.value);n.then(Ln,Ln),Ss(n),e(new Es)}catch(t){e(t)}}),a};return r.isMobXFlow=!0,r},As);function Ss(e){Nn(e.cancel)&&e.cancel()}function Os(e){return!0===(null==e?void 0:e.isMobXFlow)}function Ps(e){return"production"!==process.env.NODE_ENV&&1!==arguments.length&&yn("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),function(e){return!!e&&(_o(e)||!!e[ci]||di(e)||Hr(e)||gr(e))}(e)}function Cs(e,t){void 0===t&&(t=void 0),Ir();try{return e.apply(t)}finally{Fr()}}function Rs(e){return e[ci]}ks.bound=oi(Ts);var Ms={has:function(e,t){return"production"!==process.env.NODE_ENV&&Lr.trackingDerivation&&Cn("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),Rs(e).has_(t)},get:function(e,t){return Rs(e).get_(t)},set:function(e,t,n){var i;return!!zn(t)&&("production"===process.env.NODE_ENV||Rs(e).values_.has(t)||Cn("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),null==(i=Rs(e).set_(t,n,!0))||i)},deleteProperty:function(e,t){var n;return"production"!==process.env.NODE_ENV&&Cn("delete properties from an observable object. Use 'remove' from 'mobx' instead."),!!zn(t)&&(null==(n=Rs(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var i;return"production"!==process.env.NODE_ENV&&Cn("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),null==(i=Rs(e).defineProperty_(t,n))||i},ownKeys:function(e){return"production"!==process.env.NODE_ENV&&Lr.trackingDerivation&&Cn("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),Rs(e).ownKeys_()},preventExtensions:function(e){yn(13)}};function Ls(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function Ns(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),Mn(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function zs(e,t){var n=Tr();try{for(var i=[].concat(e.interceptors_||[]),r=0,s=i.length;r<s&&((t=i[r](t))&&!t.type&&yn(14),t);r++);return t}finally{kr(n)}}function Ds(e){return void 0!==e.changeListeners_&&e.changeListeners_.length>0}function Is(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),Mn(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function Fs(e,t){var n=Tr(),i=e.changeListeners_;if(i){for(var r=0,s=(i=i.slice()).length;r<s;r++)i[r](t);kr(n)}}var js=Symbol("mobx-keys");function Bs(e,t,n){return"production"!==process.env.NODE_ENV&&(In(e)||In(Object.getPrototypeOf(e))||yn("'makeAutoObservable' can only be used for classes that don't have a superclass"),_o(e)&&yn("makeAutoObservable can only be used on objects not already made observable")),In(e)?vs(e,e,t,n):(Lo(function(){var i=fo(e,n)[ci];if(!e[js]){var r=Object.getPrototypeOf(e),s=new Set([].concat(Zn(e),Zn(r)));s.delete("constructor"),s.delete(ci),jn(r,js,s)}e[js].forEach(function(e){return i.make_(e,!t||(!(e in t)||t[e]))})}),e)}var Us="splice",Vs="update",Gs={get:function(e,t){var n=e[ci];return t===ci?n:"length"===t?n.getArrayLength_():"string"!=typeof t||isNaN(t)?Hn(qs,t)?qs[t]:e[t]:n.get_(parseInt(t))},set:function(e,t,n){var i=e[ci];return"length"===t&&i.setArrayLength_(n),"symbol"==typeof t||isNaN(t)?e[t]=n:i.set_(parseInt(t),n),!0},preventExtensions:function(){yn(15)}},$s=function(){function e(e,t,n,i){void 0===e&&(e="production"!==process.env.NODE_ENV?"ObservableArray@"+Rn():"ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=n,this.legacyMode_=i,this.atom_=new hi(e),this.enhancer_=function(n,i){return t(n,i,"production"!==process.env.NODE_ENV?e+"[..]":"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.dehanceValues_=function(e){return void 0!==this.dehancer&&e.length>0?e.map(this.dehancer):e},t.intercept_=function(e){return Ns(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Is(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&yn("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i<e-t;i++)n[i]=void 0;this.spliceWithArray_(t,0,n)}else this.spliceWithArray_(e,t-e)},t.updateArrayLength_=function(e,t){e!==this.lastKnownLength_&&yn(16),this.lastKnownLength_+=t,this.legacyMode_&&t>0&&Oo(e+t+1)},t.spliceWithArray_=function(e,t,n){var i=this;xr(this.atom_);var r=this.values_.length;if(void 0===e?e=0:e>r?e=r:e<0&&(e=Math.max(0,r+e)),t=1===arguments.length?r-e:null==t?0:Math.max(0,Math.min(t,r-e)),void 0===n&&(n=Tn),Ls(this)){var s=zs(this,{object:this.proxy_,type:Us,index:e,removedCount:t,added:n});if(!s)return Tn;t=s.removedCount,n=s.added}if(n=0===n.length?n:n.map(function(e){return i.enhancer_(e,void 0)}),this.legacyMode_||"production"!==process.env.NODE_ENV){var o=n.length-t;this.updateArrayLength_(r,o)}var a=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,a),this.dehanceValues_(a)},t.spliceItemsIntoValues_=function(e,t,n){var i;if(n.length<1e4)return(i=this.values_).splice.apply(i,[e,t].concat(n));var r=this.values_.slice(e,e+t),s=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var o=0;o<n.length;o++)this.values_[e+o]=n[o];for(var a=0;a<s.length;a++)this.values_[e+n.length+a]=s[a];return r},t.notifyArrayChildUpdate_=function(e,t,n){var i=!this.owned_&&Kr(),r=Ds(this),s=r||i?{observableKind:"array",object:this.proxy_,type:Vs,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;"production"!==process.env.NODE_ENV&&i&&Xr(s),this.atom_.reportChanged(),r&&Fs(this,s),"production"!==process.env.NODE_ENV&&i&&Jr()},t.notifyArraySplice_=function(e,t,n){var i=!this.owned_&&Kr(),r=Ds(this),s=r||i?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Us,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;"production"!==process.env.NODE_ENV&&i&&Xr(s),this.atom_.reportChanged(),r&&Fs(this,s),"production"!==process.env.NODE_ENV&&i&&Jr()},t.get_=function(e){if(!(this.legacyMode_&&e>=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("production"!==process.env.NODE_ENV?"[mobx.array] Attempt to read an array index ("+e+") that is out of bounds ("+this.values_.length+"). Please check length first. Out of bound indices will not be tracked by MobX":"[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&yn(17,e,n.length),e<n.length){xr(this.atom_);var i=n[e];if(Ls(this)){var r=zs(this,{type:Vs,object:this.proxy_,index:e,newValue:t});if(!r)return;t=r.newValue}(t=this.enhancer_(t,i))!==i&&(n[e]=t,this.notifyArrayChildUpdate_(e,t,i))}else{for(var s=new Array(e+1-n.length),o=0;o<s.length-1;o++)s[o]=void 0;s[s.length-1]=t,this.spliceWithArray_(n.length,0,s)}},e}();function Zs(e,t,n,i){return void 0===n&&(n="production"!==process.env.NODE_ENV?"ObservableArray@"+Rn():"ObservableArray"),void 0===i&&(i=!1),Pn(),Lo(function(){var r=new $s(n,t,i,!1);Bn(r.values_,ci,r);var s=new Proxy(r.values_,Gs);return r.proxy_=s,e&&e.length&&r.spliceWithArray_(0,0,e),s})}var qs={clear:function(){return this.splice(0)},replace:function(e){var t=this[ci];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];var s=this[ci];switch(arguments.length){case 0:return[];case 1:return s.spliceWithArray_(e);case 2:return s.spliceWithArray_(e,t)}return s.spliceWithArray_(e,t,i)},spliceWithArray:function(e,t,n){return this[ci].spliceWithArray_(e,t,n)},push:function(){for(var e=this[ci],t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e.spliceWithArray_(e.values_.length,0,n),e.values_.length},pop:function(){return this.splice(Math.max(this[ci].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[ci],t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e.spliceWithArray_(0,0,n),e.values_.length},reverse:function(){return Lr.trackingDerivation&&yn(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Lr.trackingDerivation&&yn(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[ci],n=t.dehanceValues_(t.values_).indexOf(e);return n>-1&&(this.splice(n,1),!0)}};function Ws(e,t){"function"==typeof Array.prototype[e]&&(qs[e]=t(e))}function Hs(e){return function(){var t=this[ci];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Ks(e){return function(t,n){var i=this,r=this[ci];return r.atom_.reportObserved(),r.dehanceValues_(r.values_)[e](function(e,r){return t.call(n,e,r,i)})}}function Ys(e){return function(){var t=this,n=this[ci];n.atom_.reportObserved();var i=n.dehanceValues_(n.values_),r=arguments[0];return arguments[0]=function(e,n,i){return r(e,n,i,t)},i[e].apply(i,arguments)}}Ws("at",Hs),Ws("concat",Hs),Ws("flat",Hs),Ws("includes",Hs),Ws("indexOf",Hs),Ws("join",Hs),Ws("lastIndexOf",Hs),Ws("slice",Hs),Ws("toString",Hs),Ws("toLocaleString",Hs),Ws("toSorted",Hs),Ws("toSpliced",Hs),Ws("with",Hs),Ws("every",Ks),Ws("filter",Ks),Ws("find",Ks),Ws("findIndex",Ks),Ws("findLast",Ks),Ws("findLastIndex",Ks),Ws("flatMap",Ks),Ws("forEach",Ks),Ws("map",Ks),Ws("some",Ks),Ws("toReversed",Ks),Ws("reduce",Ys),Ws("reduceRight",Ys);var Xs=Un("ObservableArrayAdministration",$s);function Qs(e){return Dn(e)&&Xs(e[ci])}var Js={},eo="add",to="delete",no=function(){function e(e,t,n){var i=this;void 0===t&&(t=mi),void 0===n&&(n="production"!==process.env.NODE_ENV?"ObservableMap@"+Rn():"ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[ci]=Js,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,Nn(Map)||yn(18),Lo(function(){i.keysAtom_=fi("production"!==process.env.NODE_ENV?i.name_+".keys()":"ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)})}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!Lr.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var i=n=new fr(this.has_(e),_i,"production"!==process.env.NODE_ENV?this.name_+"."+qn(e)+"?":"ObservableMap.key?",!1);this.hasMap_.set(e,i),ms(i,function(){return t.hasMap_.delete(e)})}return n.get()},t.set=function(e,t){var n=this.has_(e);if(Ls(this)){var i=zs(this,{type:n?Vs:eo,object:this,newValue:t,name:e});if(!i)return this;t=i.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if((xr(this.keysAtom_),Ls(this))&&!zs(this,{type:to,object:this,name:e}))return!1;if(this.has_(e)){var n=Kr(),i=Ds(this),r=i||n?{observableKind:"map",debugObjectName:this.name_,type:to,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return"production"!==process.env.NODE_ENV&&n&&Xr(r),Cs(function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)}),i&&Fs(this,r),"production"!==process.env.NODE_ENV&&n&&Jr(),!0}return!1},t.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==Lr.UNCHANGED){var i=Kr(),r=Ds(this),s=r||i?{observableKind:"map",debugObjectName:this.name_,type:Vs,object:this,oldValue:n.value_,name:e,newValue:t}:null;"production"!==process.env.NODE_ENV&&i&&Xr(s),n.setNewValue_(t),r&&Fs(this,s),"production"!==process.env.NODE_ENV&&i&&Jr()}},t.addValue_=function(e,t){var n=this;xr(this.keysAtom_),Cs(function(){var i,r=new fr(t,n.enhancer_,"production"!==process.env.NODE_ENV?n.name_+"."+qn(e):"ObservableMap.key",!1);n.data_.set(e,r),t=r.value_,null==(i=n.hasMap_.get(e))||i.setNewValue_(!0),n.keysAtom_.reportChanged()});var i=Kr(),r=Ds(this),s=r||i?{observableKind:"map",debugObjectName:this.name_,type:eo,object:this,name:e,newValue:t}:null;"production"!==process.env.NODE_ENV&&i&&Xr(s),r&&Fs(this,s),"production"!==process.env.NODE_ENV&&i&&Jr()},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ro({next:function(){var n=t.next(),i=n.done,r=n.value;return{done:i,value:i?void 0:e.get(r)}}})},t.entries=function(){var e=this,t=this.keys();return ro({next:function(){var n=t.next(),i=n.done,r=n.value;return{done:i,value:i?void 0:[r,e.get(r)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(e,t){for(var n,i=ei(this);!(n=i()).done;){var r=n.value,s=r[0],o=r[1];e.call(t,o,s,this)}},t.merge=function(e){var t=this;return io(e)&&(e=new Map(e)),Cs(function(){var n,i,r;In(e)?function(e){var t=Object.keys(e);if(!$n)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(t){return An.propertyIsEnumerable.call(e,t)})):t}(e).forEach(function(n){return t.set(n,e[n])}):Array.isArray(e)?e.forEach(function(e){var n=e[0],i=e[1];return t.set(n,i)}):Vn(e)?(n=e,i=Object.getPrototypeOf(n),r=Object.getPrototypeOf(i),null!==Object.getPrototypeOf(r)&&yn(19,e),e.forEach(function(e,n){return t.set(n,e)})):null!=e&&yn(20,e)}),this},t.clear=function(){var e=this;Cs(function(){Ar(function(){for(var t,n=ei(e.keys());!(t=n()).done;){var i=t.value;e.delete(i)}})})},t.replace=function(e){var t=this;return Cs(function(){for(var n,i=function(e){if(Vn(e)||io(e))return e;if(Array.isArray(e))return new Map(e);if(In(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return yn(21,e)}(e),r=new Map,s=!1,o=ei(t.data_.keys());!(n=o()).done;){var a=n.value;if(!i.has(a))if(t.delete(a))s=!0;else{var l=t.data_.get(a);r.set(a,l)}}for(var u,c=ei(i.entries());!(u=c()).done;){var h=u.value,d=h[0],f=h[1],p=t.data_.has(d);if(t.set(d,f),t.data_.has(d)){var m=t.data_.get(d);r.set(d,m),p||(s=!0)}}if(!s)if(t.data_.size!==r.size)t.keysAtom_.reportChanged();else for(var _=t.data_.keys(),g=r.keys(),y=_.next(),v=g.next();!y.done;){if(y.value!==v.value){t.keysAtom_.reportChanged();break}y=_.next(),v=g.next()}t.data_=r}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return"production"!==process.env.NODE_ENV&&!0===t&&yn("`observe` doesn't support fireImmediately=true in combination with maps."),Is(this,e)},t.intercept_=function(e){return Ns(this,e)},Jn(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),io=Un("ObservableMap",no);function ro(e){return e[Symbol.toStringTag]="MapIterator",Bo(e)}var so={},oo=function(){function e(e,t,n){var i=this;void 0===t&&(t=mi),void 0===n&&(n="production"!==process.env.NODE_ENV?"ObservableSet@"+Rn():"ObservableSet"),this.name_=void 0,this[ci]=so,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,Nn(Set)||yn(22),this.enhancer_=function(e,i){return t(e,i,n)},Lo(function(){i.atom_=fi(i.name_),e&&i.replace(e)})}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;Cs(function(){Ar(function(){for(var t,n=ei(e.data_.values());!(t=n()).done;){var i=t.value;e.delete(i)}})})},t.forEach=function(e,t){for(var n,i=ei(this);!(n=i()).done;){var r=n.value;e.call(t,r,r,this)}},t.add=function(e){var t=this;if(xr(this.atom_),Ls(this)){var n=zs(this,{type:eo,object:this,newValue:e});if(!n)return this;e=n.newValue}if(!this.has(e)){Cs(function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()});var i="production"!==process.env.NODE_ENV&&Kr(),r=Ds(this),s=r||i?{observableKind:"set",debugObjectName:this.name_,type:eo,object:this,newValue:e}:null;i&&"production"!==process.env.NODE_ENV&&Xr(s),r&&Fs(this,s),i&&"production"!==process.env.NODE_ENV&&Jr()}return this},t.delete=function(e){var t=this;if(Ls(this)&&!zs(this,{type:to,object:this,oldValue:e}))return!1;if(this.has(e)){var n="production"!==process.env.NODE_ENV&&Kr(),i=Ds(this),r=i||n?{observableKind:"set",debugObjectName:this.name_,type:to,object:this,oldValue:e}:null;return n&&"production"!==process.env.NODE_ENV&&Xr(r),Cs(function(){t.atom_.reportChanged(),t.data_.delete(e)}),i&&Fs(this,r),n&&"production"!==process.env.NODE_ENV&&Jr(),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=this.values();return lo({next:function(){var t=e.next(),n=t.value,i=t.done;return i?{value:void 0,done:i}:{value:[n,n],done:i}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var e=this,t=this.data_.values();return lo({next:function(){var n=t.next(),i=n.value,r=n.done;return r?{value:void 0,done:r}:{value:e.dehanceValue_(i),done:r}}})},t.intersection=function(e){return Gn(e)&&!ao(e)?e.intersection(this):new Set(this).intersection(e)},t.union=function(e){return Gn(e)&&!ao(e)?e.union(this):new Set(this).union(e)},t.difference=function(e){return new Set(this).difference(e)},t.symmetricDifference=function(e){return Gn(e)&&!ao(e)?e.symmetricDifference(this):new Set(this).symmetricDifference(e)},t.isSubsetOf=function(e){return new Set(this).isSubsetOf(e)},t.isSupersetOf=function(e){return new Set(this).isSupersetOf(e)},t.isDisjointFrom=function(e){return Gn(e)&&!ao(e)?e.isDisjointFrom(this):new Set(this).isDisjointFrom(e)},t.replace=function(e){var t=this;return ao(e)&&(e=new Set(e)),Cs(function(){Array.isArray(e)||Gn(e)?(t.clear(),e.forEach(function(e){return t.add(e)})):null!=e&&yn("Cannot initialize set from "+e)}),this},t.observe_=function(e,t){return"production"!==process.env.NODE_ENV&&!0===t&&yn("`observe` doesn't support fireImmediately=true in combination with sets."),Is(this,e)},t.intercept_=function(e){return Ns(this,e)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},Jn(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),ao=Un("ObservableSet",oo);function lo(e){return e[Symbol.toStringTag]="SetIterator",Bo(e)}var uo=Object.create(null),co="remove",ho=function(){function e(e,t,n,i){void 0===t&&(t=new Map),void 0===i&&(i=Fi),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=e,this.values_=t,this.name_=n,this.defaultAnnotation_=i,this.keysAtom_=new hi("production"!==process.env.NODE_ENV?this.name_+".keys":"ObservableObject.keys"),this.isPlainObject_=In(this.target_),"production"===process.env.NODE_ENV||Vo(this.defaultAnnotation_)||yn("defaultAnnotation must be valid annotation"),"production"!==process.env.NODE_ENV&&(this.appliedAnnotations_={})}var t=e.prototype;return t.getObservablePropValue_=function(e){return this.values_.get(e).get()},t.setObservablePropValue_=function(e,t){var n=this.values_.get(e);if(n instanceof pr)return n.set(t),!0;if(Ls(this)){var i=zs(this,{type:Vs,object:this.proxy_||this.target_,name:e,newValue:t});if(!i)return null;t=i.newValue}if((t=n.prepareNewValue_(t))!==Lr.UNCHANGED){var r=Ds(this),s="production"!==process.env.NODE_ENV&&Kr(),o=r||s?{type:Vs,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:n.value_,name:e,newValue:t}:null;"production"!==process.env.NODE_ENV&&s&&Xr(o),n.setNewValue_(t),r&&Fs(this,o),"production"!==process.env.NODE_ENV&&s&&Jr()}return!0},t.get_=function(e){return Lr.trackingDerivation&&!Hn(this.target_,e)&&this.has_(e),this.target_[e]},t.set_=function(e,t,n){return void 0===n&&(n=!1),Hn(this.target_,e)?this.values_.has(e)?this.setObservablePropValue_(e,t):n?Reflect.set(this.target_,e,t):(this.target_[e]=t,!0):this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,n)},t.has_=function(e){if(!Lr.trackingDerivation)return e in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var t=this.pendingKeys_.get(e);return t||(t=new fr(e in this.target_,_i,"production"!==process.env.NODE_ENV?this.name_+"."+qn(e)+"?":"ObservableObject.key?",!1),this.pendingKeys_.set(e,t)),t.get()},t.make_=function(e,t){if(!0===t&&(t=this.defaultAnnotation_),!1!==t){if(yo(this,t,e),!(e in this.target_)){var n;if(null!=(n=this.target_[si])&&n[e])return;yn(1,t.annotationType_,this.name_+"."+e.toString())}for(var i=this.target_;i&&i!==An;){var r=wn(i,e);if(r){var s=t.make_(this,e,r,i);if(0===s)return;if(1===s)break}i=Object.getPrototypeOf(i)}go(this,t,e)}},t.extend_=function(e,t,n,i){if(void 0===i&&(i=!1),!0===n&&(n=this.defaultAnnotation_),!1===n)return this.defineProperty_(e,t,i);yo(this,n,e);var r=n.extend_(this,e,t,i);return r&&go(this,n,e),r},t.defineProperty_=function(e,t,n){void 0===n&&(n=!1),xr(this.keysAtom_);try{Ir();var i=this.delete_(e);if(!i)return i;if(Ls(this)){var r=zs(this,{object:this.proxy_||this.target_,name:e,type:eo,newValue:t.value});if(!r)return null;var s=r.newValue;t.value!==s&&(t=ti({},t,{value:s}))}if(n){if(!Reflect.defineProperty(this.target_,e,t))return!1}else En(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{Fr()}return!0},t.defineObservableProperty_=function(e,t,n,i){void 0===i&&(i=!1),xr(this.keysAtom_);try{Ir();var r=this.delete_(e);if(!r)return r;if(Ls(this)){var s=zs(this,{object:this.proxy_||this.target_,name:e,type:eo,newValue:t});if(!s)return null;t=s.newValue}var o=mo(e),a={configurable:!Lr.safeDescriptors||this.isPlainObject_,enumerable:!0,get:o.get,set:o.set};if(i){if(!Reflect.defineProperty(this.target_,e,a))return!1}else En(this.target_,e,a);var l=new fr(t,n,"production"!==process.env.NODE_ENV?this.name_+"."+e.toString():"ObservableObject.key",!1);this.values_.set(e,l),this.notifyPropertyAddition_(e,l.value_)}finally{Fr()}return!0},t.defineComputedProperty_=function(e,t,n){void 0===n&&(n=!1),xr(this.keysAtom_);try{Ir();var i=this.delete_(e);if(!i)return i;if(Ls(this))if(!zs(this,{object:this.proxy_||this.target_,name:e,type:eo,newValue:void 0}))return null;t.name||(t.name="production"!==process.env.NODE_ENV?this.name_+"."+e.toString():"ObservableObject.key"),t.context=this.proxy_||this.target_;var r=mo(e),s={configurable:!Lr.safeDescriptors||this.isPlainObject_,enumerable:!1,get:r.get,set:r.set};if(n){if(!Reflect.defineProperty(this.target_,e,s))return!1}else En(this.target_,e,s);this.values_.set(e,new pr(t)),this.notifyPropertyAddition_(e,void 0)}finally{Fr()}return!0},t.delete_=function(e,t){if(void 0===t&&(t=!1),xr(this.keysAtom_),!Hn(this.target_,e))return!0;if(Ls(this)&&!zs(this,{object:this.proxy_||this.target_,name:e,type:co}))return null;try{var n;Ir();var i,r=Ds(this),s="production"!==process.env.NODE_ENV&&Kr(),o=this.values_.get(e),a=void 0;if(!o&&(r||s))a=null==(i=wn(this.target_,e))?void 0:i.value;if(t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if("production"!==process.env.NODE_ENV&&delete this.appliedAnnotations_[e],o&&(this.values_.delete(e),o instanceof fr&&(a=o.value_),Br(o)),this.keysAtom_.reportChanged(),null==(n=this.pendingKeys_)||null==(n=n.get(e))||n.set(e in this.target_),r||s){var l={type:co,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:a,name:e};"production"!==process.env.NODE_ENV&&s&&Xr(l),r&&Fs(this,l),"production"!==process.env.NODE_ENV&&s&&Jr()}}finally{Fr()}return!0},t.observe_=function(e,t){return"production"!==process.env.NODE_ENV&&!0===t&&yn("`observe` doesn't support the fire immediately property for observable objects."),Is(this,e)},t.intercept_=function(e){return Ns(this,e)},t.notifyPropertyAddition_=function(e,t){var n,i=Ds(this),r="production"!==process.env.NODE_ENV&&Kr();if(i||r){var s=i||r?{type:eo,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;"production"!==process.env.NODE_ENV&&r&&Xr(s),i&&Fs(this,s),"production"!==process.env.NODE_ENV&&r&&Jr()}null==(n=this.pendingKeys_)||null==(n=n.get(e))||n.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Zn(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function fo(e,t){var n;if("production"!==process.env.NODE_ENV&&t&&_o(e)&&yn("Options can't be provided for already observable objects."),Hn(e,ci))return"production"===process.env.NODE_ENV||Ro(e)instanceof ho||yn("Cannot convert '"+Mo(e)+"' into observable object:\nThe target is already observable of different type.\nExtending builtins is not supported."),e;"production"===process.env.NODE_ENV||Object.isExtensible(e)||yn("Cannot make the designated object observable; it is not extensible");var i=null!=(n=null==t?void 0:t.name)?n:"production"!==process.env.NODE_ENV?(In(e)?"ObservableObject":e.constructor.name)+"@"+Rn():"ObservableObject",r=new ho(e,new Map,String(i),function(e){var t;return e?null!=(t=e.defaultDecorator)?t:ji(e):void 0}(t));return jn(e,ci,r),e}var po=Un("ObservableObjectAdministration",ho);function mo(e){return uo[e]||(uo[e]={get:function(){return this[ci].getObservablePropValue_(e)},set:function(t){return this[ci].setObservablePropValue_(e,t)}})}function _o(e){return!!Dn(e)&&po(e[ci])}function go(e,t,n){var i;"production"!==process.env.NODE_ENV&&(e.appliedAnnotations_[n]=t),null==(i=e.target_[si])||delete i[n]}function yo(e,t,n){if("production"===process.env.NODE_ENV||Vo(t)||yn("Cannot annotate '"+e.name_+"."+n.toString()+"': Invalid annotation."),"production"!==process.env.NODE_ENV&&!yi(t)&&Hn(e.appliedAnnotations_,n)){var i=e.name_+"."+n.toString(),r=e.appliedAnnotations_[n].annotationType_;yn("Cannot apply '"+t.annotationType_+"' to '"+i+"':\nThe field is already annotated with '"+r+"'.\nRe-annotating fields is not allowed.\nUse 'override' annotation for methods overridden by subclass.")}}var vo,bo,xo=ko(0),wo=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,!1===e}(),Eo=0,Ao=function(){};vo=Ao,bo=Array.prototype,Object.setPrototypeOf?Object.setPrototypeOf(vo.prototype,bo):void 0!==vo.prototype.__proto__?vo.prototype.__proto__=bo:vo.prototype=bo;var To=function(e){function t(t,n,i,r){var s;return void 0===i&&(i="production"!==process.env.NODE_ENV?"ObservableArray@"+Rn():"ObservableArray"),void 0===r&&(r=!1),s=e.call(this)||this,Lo(function(){var e=new $s(i,n,r,!0);e.proxy_=s,Bn(s,ci,e),t&&t.length&&s.spliceWithArray(0,0,t),wo&&Object.defineProperty(s,"0",xo)}),s}ni(t,e);var n=t.prototype;return n.concat=function(){this[ci].atom_.reportObserved();for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Array.prototype.concat.apply(this.slice(),t.map(function(e){return Qs(e)?e.slice():e}))},n[Symbol.iterator]=function(){var e=this,t=0;return Bo({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},Jn(t,[{key:"length",get:function(){return this[ci].getArrayLength_()},set:function(e){this[ci].setArrayLength_(e)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(Ao);function ko(e){return{enumerable:!1,configurable:!0,get:function(){return this[ci].get_(e)},set:function(t){this[ci].set_(e,t)}}}function So(e){En(To.prototype,""+e,ko(e))}function Oo(e){if(e>Eo){for(var t=Eo;t<e+100;t++)So(t);Eo=e}}function Po(e,t,n){return new To(e,t,n)}function Co(e,t){if("object"==typeof e&&null!==e){if(Qs(e))return void 0!==t&&yn(23),e[ci].atom_;if(ao(e))return e.atom_;if(io(e)){if(void 0===t)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||yn(25,t,Mo(e)),n}if(_o(e)){if(!t)return yn(26);var i=e[ci].values_.get(t);return i||yn(27,t,Mo(e)),i}if(di(e)||gr(e)||Hr(e))return e}else if(Nn(e)&&Hr(e[ci]))return e[ci];yn(28)}function Ro(e,t){return e||yn(29),di(e)||gr(e)||Hr(e)||io(e)||ao(e)?e:e[ci]?e[ci]:void yn(24,e)}function Mo(e,t){var n;if(void 0!==t)n=Co(e,t);else{if(us(e))return e.name;n=_o(e)||io(e)||ao(e)?Ro(e):Co(e)}return n.name_}function Lo(e){var t=Tr(),n=hr(!0);Ir();try{return e()}finally{Fr(),dr(n),kr(t)}}Object.entries(qs).forEach(function(e){var t=e[0],n=e[1];"concat"!==t&&jn(To.prototype,t,n)}),Oo(1e3);var No,zo=An.toString;function Do(e,t,n){return void 0===n&&(n=-1),Io(e,t,n)}function Io(e,t,n,i,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var s=typeof e;if("function"!==s&&"object"!==s&&"object"!=typeof t)return!1;var o=zo.call(e);if(o!==zo.call(t))return!1;switch(o){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0===+e?1/+e==1/t:+e===+t;case"[object Date]":case"[object Boolean]":return+e===+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++}e=Fo(e),t=Fo(t);var a="[object Array]"===o;if(!a){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,u=t.constructor;if(l!==u&&!(Nn(l)&&l instanceof l&&Nn(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),r=r||[];for(var c=(i=i||[]).length;c--;)if(i[c]===e)return r[c]===t;if(i.push(e),r.push(t),a){if((c=e.length)!==t.length)return!1;for(;c--;)if(!Io(e[c],t[c],n-1,i,r))return!1}else{var h=Object.keys(e),d=h.length;if(Object.keys(t).length!==d)return!1;for(var f=0;f<d;f++){var p=h[f];if(!Hn(t,p)||!Io(e[p],t[p],n-1,i,r))return!1}}return i.pop(),r.pop(),!0}function Fo(e){return Qs(e)?e.slice():Vn(e)||io(e)||Gn(e)||ao(e)?Array.from(e.entries()):e}var jo=(null==(No=bn().Iterator)?void 0:No.prototype)||{};function Bo(e){return e[Symbol.iterator]=Uo,Object.assign(Object.create(jo),e)}function Uo(){return this}function Vo(e){return e instanceof Object&&"string"==typeof e.annotationType_&&Nn(e.make_)&&Nn(e.extend_)}["Symbol","Map","Set"].forEach(function(e){void 0===bn()[e]&&yn("MobX requires global '"+e+"' to be available or polyfilled")}),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return"production"===process.env.NODE_ENV?(console.warn("[mobx.spy] Is a no-op in production builds"),function(){}):(Lr.spyListeners.push(e),Mn(function(){Lr.spyListeners=Lr.spyListeners.filter(function(t){return t!==e})}))},extras:{getDebugName:Mo},$mobx:ci});class Go{constructor(){Bs(this)}_visible=tr.map();getIsOpen(e){return this._visible.get(e)??!1}_setVisible({name:e,value:t}){this._visible.set(e,t)}open(e){this._setVisible({name:e,value:!0})}close(e){this._setVisible({name:e,value:!1})}closeAll(){this._visible.clear()}}const $o=new Go;const Zo=new class{constructor(){}load(e){try{const t=localStorage.getItem(e);if(t){return JSON.parse(t)}return null}catch{return null}}save(e,t){try{const n=JSON.stringify(t);return localStorage.setItem(e,n),!0}catch{return!1}}remove(e){localStorage.removeItem(e)}clear(){localStorage.clear()}},qo=6048e5,Wo=Symbol.for("constructDateFrom");function Ho(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&Wo in e?e[Wo](t):e instanceof Date?new e.constructor(t):new Date(t)}function Ko(e,t){return Ho(t||e,e)}let Yo={};function Xo(){return Yo}function Qo(e,t){const n=Xo(),i=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,r=Ko(e,t?.in),s=r.getDay(),o=(s<i?7:0)+s-i;return r.setDate(r.getDate()-o),r.setHours(0,0,0,0),r}function Jo(e,t){return Qo(e,{...t,weekStartsOn:1})}function ea(e,t){const n=Ko(e,t?.in),i=n.getFullYear(),r=Ho(n,0);r.setFullYear(i+1,0,4),r.setHours(0,0,0,0);const s=Jo(r),o=Ho(n,0);o.setFullYear(i,0,4),o.setHours(0,0,0,0);const a=Jo(o);return n.getTime()>=s.getTime()?i+1:n.getTime()>=a.getTime()?i:i-1}function ta(e){const t=Ko(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function na(e,...t){const n=Ho.bind(null,e||t.find(e=>"object"==typeof e));return t.map(n)}function ia(e,t){const n=Ko(e,t?.in);return n.setHours(0,0,0,0),n}function ra(e){return!(!((t=e)instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t))&&"number"!=typeof e||isNaN(+Ko(e)));var t}const sa={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function oa(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const aa={date:oa({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:oa({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:oa({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},la={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function ua(e){return(t,n)=>{let i;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{const t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}return i[e.argumentCallback?e.argumentCallback(t):t]}}const ca={ordinalNumber:(e,t)=>{const n=Number(e),i=n%100;if(i>20||i<10)switch(i%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:ua({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:ua({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:ua({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:ua({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:ua({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"})};function ha(e){return(t,n={})=>{const i=n.width,r=i&&e.matchPatterns[i]||e.matchPatterns[e.defaultMatchWidth],s=t.match(r);if(!s)return null;const o=s[0],a=i&&e.parsePatterns[i]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?function(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n;return}(a,e=>e.test(o)):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(a,e=>e.test(o));let u;u=e.valueCallback?e.valueCallback(l):l,u=n.valueCallback?n.valueCallback(u):u;return{value:u,rest:t.slice(o.length)}}}function da(e){return(t,n={})=>{const i=t.match(e.matchPattern);if(!i)return null;const r=i[0],s=t.match(e.parsePattern);if(!s)return null;let o=e.valueCallback?e.valueCallback(s[0]):s[0];o=n.valueCallback?n.valueCallback(o):o;return{value:o,rest:t.slice(r.length)}}}const fa={ordinalNumber:da({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:ha({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:ha({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:e=>e+1}),month:ha({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:ha({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:ha({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"})},pa={code:"en-US",formatDistance:(e,t,n)=>{let i;const r=sa[e];return i="string"==typeof r?r:1===t?r.one:r.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+i:i+" ago":i},formatLong:aa,formatRelative:(e,t,n,i)=>la[e],localize:ca,match:fa,options:{weekStartsOn:0,firstWeekContainsDate:1}};function ma(e,t){const n=Ko(e,t?.in),i=function(e,t,n){const[i,r]=na(n?.in,e,t),s=ia(i),o=ia(r),a=+s-ta(s),l=+o-ta(o);return Math.round((a-l)/864e5)}(n,function(e,t){const n=Ko(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}(n));return i+1}function _a(e,t){const n=Ko(e,t?.in),i=+Jo(n)-+function(e,t){const n=ea(e,t),i=Ho(e,0);return i.setFullYear(n,0,4),i.setHours(0,0,0,0),Jo(i)}(n);return Math.round(i/qo)+1}function ga(e,t){const n=Ko(e,t?.in),i=n.getFullYear(),r=Xo(),s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=Ho(t?.in||e,0);o.setFullYear(i+1,0,s),o.setHours(0,0,0,0);const a=Qo(o,t),l=Ho(t?.in||e,0);l.setFullYear(i,0,s),l.setHours(0,0,0,0);const u=Qo(l,t);return+n>=+a?i+1:+n>=+u?i:i-1}function ya(e,t){const n=Ko(e,t?.in),i=+Qo(n,t)-+function(e,t){const n=Xo(),i=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,r=ga(e,t),s=Ho(t?.in||e,0);return s.setFullYear(r,0,i),s.setHours(0,0,0,0),Qo(s,t)}(n,t);return Math.round(i/qo)+1}function va(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const ba={y(e,t){const n=e.getFullYear(),i=n>0?n:1-n;return va("yy"===t?i%100:i,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):va(n+1,2)},d:(e,t)=>va(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>va(e.getHours()%12||12,t.length),H:(e,t)=>va(e.getHours(),t.length),m:(e,t)=>va(e.getMinutes(),t.length),s:(e,t)=>va(e.getSeconds(),t.length),S(e,t){const n=t.length,i=e.getMilliseconds();return va(Math.trunc(i*Math.pow(10,n-3)),t.length)}},xa="midnight",wa="noon",Ea="morning",Aa="afternoon",Ta="evening",ka="night",Sa={G:function(e,t,n){const i=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(i,{width:"abbreviated"});case"GGGGG":return n.era(i,{width:"narrow"});default:return n.era(i,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),i=t>0?t:1-t;return n.ordinalNumber(i,{unit:"year"})}return ba.y(e,t)},Y:function(e,t,n,i){const r=ga(e,i),s=r>0?r:1-r;if("YY"===t){return va(s%100,2)}return"Yo"===t?n.ordinalNumber(s,{unit:"year"}):va(s,t.length)},R:function(e,t){return va(ea(e),t.length)},u:function(e,t){return va(e.getFullYear(),t.length)},Q:function(e,t,n){const i=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return va(i,2);case"Qo":return n.ordinalNumber(i,{unit:"quarter"});case"QQQ":return n.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(i,{width:"narrow",context:"formatting"});default:return n.quarter(i,{width:"wide",context:"formatting"})}},q:function(e,t,n){const i=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return va(i,2);case"qo":return n.ordinalNumber(i,{unit:"quarter"});case"qqq":return n.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(i,{width:"narrow",context:"standalone"});default:return n.quarter(i,{width:"wide",context:"standalone"})}},M:function(e,t,n){const i=e.getMonth();switch(t){case"M":case"MM":return ba.M(e,t);case"Mo":return n.ordinalNumber(i+1,{unit:"month"});case"MMM":return n.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(i,{width:"narrow",context:"formatting"});default:return n.month(i,{width:"wide",context:"formatting"})}},L:function(e,t,n){const i=e.getMonth();switch(t){case"L":return String(i+1);case"LL":return va(i+1,2);case"Lo":return n.ordinalNumber(i+1,{unit:"month"});case"LLL":return n.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(i,{width:"narrow",context:"standalone"});default:return n.month(i,{width:"wide",context:"standalone"})}},w:function(e,t,n,i){const r=ya(e,i);return"wo"===t?n.ordinalNumber(r,{unit:"week"}):va(r,t.length)},I:function(e,t,n){const i=_a(e);return"Io"===t?n.ordinalNumber(i,{unit:"week"}):va(i,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):ba.d(e,t)},D:function(e,t,n){const i=ma(e);return"Do"===t?n.ordinalNumber(i,{unit:"dayOfYear"}):va(i,t.length)},E:function(e,t,n){const i=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},e:function(e,t,n,i){const r=e.getDay(),s=(r-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return va(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},c:function(e,t,n,i){const r=e.getDay(),s=(r-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return va(s,t.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(e,t,n){const i=e.getDay(),r=0===i?7:i;switch(t){case"i":return String(r);case"ii":return va(r,t.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},a:function(e,t,n){const i=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(e,t,n){const i=e.getHours();let r;switch(r=12===i?wa:0===i?xa:i/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){const i=e.getHours();let r;switch(r=i>=17?Ta:i>=12?Aa:i>=4?Ea:ka,t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return ba.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):ba.H(e,t)},K:function(e,t,n){const i=e.getHours()%12;return"Ko"===t?n.ordinalNumber(i,{unit:"hour"}):va(i,t.length)},k:function(e,t,n){let i=e.getHours();return 0===i&&(i=24),"ko"===t?n.ordinalNumber(i,{unit:"hour"}):va(i,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):ba.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):ba.s(e,t)},S:function(e,t){return ba.S(e,t)},X:function(e,t,n){const i=e.getTimezoneOffset();if(0===i)return"Z";switch(t){case"X":return Pa(i);case"XXXX":case"XX":return Ca(i);default:return Ca(i,":")}},x:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"x":return Pa(i);case"xxxx":case"xx":return Ca(i);default:return Ca(i,":")}},O:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Oa(i,":");default:return"GMT"+Ca(i,":")}},z:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Oa(i,":");default:return"GMT"+Ca(i,":")}},t:function(e,t,n){return va(Math.trunc(+e/1e3),t.length)},T:function(e,t,n){return va(+e,t.length)}};function Oa(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),r=Math.trunc(i/60),s=i%60;return 0===s?n+String(r):n+String(r)+t+va(s,2)}function Pa(e,t){if(e%60==0){return(e>0?"-":"+")+va(Math.abs(e)/60,2)}return Ca(e,t)}function Ca(e,t=""){const n=e>0?"-":"+",i=Math.abs(e);return n+va(Math.trunc(i/60),2)+t+va(i%60,2)}const Ra=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},Ma=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},La={p:Ma,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],i=n[1],r=n[2];if(!r)return Ra(e,t);let s;switch(i){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;default:s=t.dateTime({width:"full"})}return s.replace("{{date}}",Ra(i,t)).replace("{{time}}",Ma(r,t))}},Na=/^D+$/,za=/^Y+$/,Da=["D","DD","YY","YYYY"];const Ia=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Fa=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ja=/^'([^]*?)'?$/,Ba=/''/g,Ua=/[a-zA-Z]/;function Va(e,t,n){const i=Xo(),r=i.locale??pa,s=i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=i.weekStartsOn??i.locale?.options?.weekStartsOn??0,a=Ko(e,n?.in);if(!ra(a))throw new RangeError("Invalid time value");let l=t.match(Fa).map(e=>{const t=e[0];if("p"===t||"P"===t){return(0,La[t])(e,r.formatLong)}return e}).join("").match(Ia).map(e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Ga(e)};if(Sa[t])return{isToken:!0,value:e};if(t.match(Ua))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});r.localize.preprocessor&&(l=r.localize.preprocessor(a,l));const u={firstWeekContainsDate:s,weekStartsOn:o,locale:r};return l.map(n=>{if(!n.isToken)return n.value;const i=n.value;(function(e){return za.test(e)}(i)||function(e){return Na.test(e)}(i))&&function(e,t,n){const i=function(e,t,n){const i="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${i} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(i),Da.includes(e))throw new RangeError(i)}(i,t,String(e));return(0,Sa[i[0]])(a,i,r.localize,u)}).join("")}function Ga(e){const t=e.match(ja);return t?t[1].replace(Ba,"'"):e}function $a(e,t,n){const[i,r]=na(n?.in,e,t);return+Qo(i,n)===+Qo(r,n)}const Za=new class{defaultFormatStr="dd.MM.yyyy";format({date:e,formatStr:t=this.defaultFormatStr}){return Va(e,t)}};const qa=new class{constructor(){}log({message:e,context:t,meta:n}){console.log(t,e,n)}warn({message:e,context:t,meta:n}){console.warn(t,e,n)}error({message:e,context:t,meta:n}){console.error(t,e,n)}};var Wa,Ha={exports:{}};
|
|
2
|
-
/* @preserve
|
|
3
|
-
* Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
|
|
4
|
-
* (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
|
|
5
|
-
*/function Ka(){return Wa||(Wa=1,function(e){var t="1.9.4";function n(e){var t,n,i,r;for(n=1,i=arguments.length;n<i;n++)for(t in r=arguments[n])e[t]=r[t];return e}var i=Object.create||function(){function e(){}return function(t){return e.prototype=t,new e}}();function r(e,t){var n=Array.prototype.slice;if(e.bind)return e.bind.apply(e,n.call(arguments,1));var i=n.call(arguments,2);return function(){return e.apply(t,i.length?i.concat(n.call(arguments)):arguments)}}var s=0;function o(e){return"_leaflet_id"in e||(e._leaflet_id=++s),e._leaflet_id}function a(e,t,n){var i,r,s,o;return o=function(){i=!1,r&&(s.apply(n,r),r=!1)},s=function(){i?r=arguments:(e.apply(n,arguments),setTimeout(o,t),i=!0)},s}function l(e,t,n){var i=t[1],r=t[0],s=i-r;return e===i&&n?e:((e-r)%s+s)%s+r}function u(){return!1}function c(e,t){if(!1===t)return e;var n=Math.pow(10,void 0===t?6:t);return Math.round(e*n)/n}function h(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function d(e){return h(e).split(/\s+/)}function f(e,t){for(var n in Object.prototype.hasOwnProperty.call(e,"options")||(e.options=e.options?i(e.options):{}),t)e.options[n]=t[n];return e.options}function p(e,t,n){var i=[];for(var r in e)i.push(encodeURIComponent(n?r.toUpperCase():r)+"="+encodeURIComponent(e[r]));return(t&&-1!==t.indexOf("?")?"&":"?")+i.join("&")}var m=/\{ *([\w_ -]+) *\}/g;function _(e,t){return e.replace(m,function(e,n){var i=t[n];if(void 0===i)throw new Error("No value provided for variable "+e);return"function"==typeof i&&(i=i(t)),i})}var g=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function y(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}var v="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function b(e){return window["webkit"+e]||window["moz"+e]||window["ms"+e]}var x=0;function w(e){var t=+new Date,n=Math.max(0,16-(t-x));return x=t+n,window.setTimeout(e,n)}var E=window.requestAnimationFrame||b("RequestAnimationFrame")||w,A=window.cancelAnimationFrame||b("CancelAnimationFrame")||b("CancelRequestAnimationFrame")||function(e){window.clearTimeout(e)};function T(e,t,n){if(!n||E!==w)return E.call(window,r(e,t));e.call(t)}function k(e){e&&A.call(window,e)}var S={__proto__:null,extend:n,create:i,bind:r,get lastId(){return s},stamp:o,throttle:a,wrapNum:l,falseFn:u,formatNum:c,trim:h,splitWords:d,setOptions:f,getParamString:p,template:_,isArray:g,indexOf:y,emptyImageUrl:v,requestFn:E,cancelFn:A,requestAnimFrame:T,cancelAnimFrame:k};function O(){}function P(e){if("undefined"!=typeof L&&L&&L.Mixin){e=g(e)?e:[e];for(var t=0;t<e.length;t++)e[t]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",(new Error).stack)}}O.extend=function(e){var t=function(){f(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},r=t.__super__=this.prototype,s=i(r);for(var o in s.constructor=t,t.prototype=s,this)Object.prototype.hasOwnProperty.call(this,o)&&"prototype"!==o&&"__super__"!==o&&(t[o]=this[o]);return e.statics&&n(t,e.statics),e.includes&&(P(e.includes),n.apply(null,[s].concat(e.includes))),n(s,e),delete s.statics,delete s.includes,s.options&&(s.options=r.options?i(r.options):{},n(s.options,e.options)),s._initHooks=[],s.callInitHooks=function(){if(!this._initHooksCalled){r.callInitHooks&&r.callInitHooks.call(this),this._initHooksCalled=!0;for(var e=0,t=s._initHooks.length;e<t;e++)s._initHooks[e].call(this)}},t},O.include=function(e){var t=this.prototype.options;return n(this.prototype,e),e.options&&(this.prototype.options=t,this.mergeOptions(e.options)),this},O.mergeOptions=function(e){return n(this.prototype.options,e),this},O.addInitHook=function(e){var t=Array.prototype.slice.call(arguments,1),n="function"==typeof e?e:function(){this[e].apply(this,t)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(n),this};var C={on:function(e,t,n){if("object"==typeof e)for(var i in e)this._on(i,e[i],t);else for(var r=0,s=(e=d(e)).length;r<s;r++)this._on(e[r],t,n);return this},off:function(e,t,n){if(arguments.length)if("object"==typeof e)for(var i in e)this._off(i,e[i],t);else{e=d(e);for(var r=1===arguments.length,s=0,o=e.length;s<o;s++)r?this._off(e[s]):this._off(e[s],t,n)}else delete this._events;return this},_on:function(e,t,n,i){if("function"==typeof t){if(!1===this._listens(e,t,n)){n===this&&(n=void 0);var r={fn:t,ctx:n};i&&(r.once=!0),this._events=this._events||{},this._events[e]=this._events[e]||[],this._events[e].push(r)}}else console.warn("wrong listener type: "+typeof t)},_off:function(e,t,n){var i,r,s;if(this._events&&(i=this._events[e]))if(1!==arguments.length)if("function"==typeof t){var o=this._listens(e,t,n);if(!1!==o){var a=i[o];this._firingCount&&(a.fn=u,this._events[e]=i=i.slice()),i.splice(o,1)}}else console.warn("wrong listener type: "+typeof t);else{if(this._firingCount)for(r=0,s=i.length;r<s;r++)i[r].fn=u;delete this._events[e]}},fire:function(e,t,i){if(!this.listens(e,i))return this;var r=n({},t,{type:e,target:this,sourceTarget:t&&t.sourceTarget||this});if(this._events){var s=this._events[e];if(s){this._firingCount=this._firingCount+1||1;for(var o=0,a=s.length;o<a;o++){var l=s[o],u=l.fn;l.once&&this.off(e,u,l.ctx),u.call(l.ctx||this,r)}this._firingCount--}}return i&&this._propagateEvent(r),this},listens:function(e,t,n,i){"string"!=typeof e&&console.warn('"string" type argument expected');var r=t;"function"!=typeof t&&(i=!!t,r=void 0,n=void 0);var s=this._events&&this._events[e];if(s&&s.length&&!1!==this._listens(e,r,n))return!0;if(i)for(var o in this._eventParents)if(this._eventParents[o].listens(e,t,n,i))return!0;return!1},_listens:function(e,t,n){if(!this._events)return!1;var i=this._events[e]||[];if(!t)return!!i.length;n===this&&(n=void 0);for(var r=0,s=i.length;r<s;r++)if(i[r].fn===t&&i[r].ctx===n)return r;return!1},once:function(e,t,n){if("object"==typeof e)for(var i in e)this._on(i,e[i],t,!0);else for(var r=0,s=(e=d(e)).length;r<s;r++)this._on(e[r],t,n,!0);return this},addEventParent:function(e){return this._eventParents=this._eventParents||{},this._eventParents[o(e)]=e,this},removeEventParent:function(e){return this._eventParents&&delete this._eventParents[o(e)],this},_propagateEvent:function(e){for(var t in this._eventParents)this._eventParents[t].fire(e.type,n({layer:e.target,propagatedFrom:e.target},e),!0)}};C.addEventListener=C.on,C.removeEventListener=C.clearAllEventListeners=C.off,C.addOneTimeEventListener=C.once,C.fireEvent=C.fire,C.hasEventListeners=C.listens;var R=O.extend(C);function M(e,t,n){this.x=n?Math.round(e):e,this.y=n?Math.round(t):t}var N=Math.trunc||function(e){return e>0?Math.floor(e):Math.ceil(e)};function z(e,t,n){return e instanceof M?e:g(e)?new M(e[0],e[1]):null==e?e:"object"==typeof e&&"x"in e&&"y"in e?new M(e.x,e.y):new M(e,t,n)}function D(e,t){if(e)for(var n=t?[e,t]:e,i=0,r=n.length;i<r;i++)this.extend(n[i])}function I(e,t){return!e||e instanceof D?e:new D(e,t)}function F(e,t){if(e)for(var n=t?[e,t]:e,i=0,r=n.length;i<r;i++)this.extend(n[i])}function j(e,t){return e instanceof F?e:new F(e,t)}function B(e,t,n){if(isNaN(e)||isNaN(t))throw new Error("Invalid LatLng object: ("+e+", "+t+")");this.lat=+e,this.lng=+t,void 0!==n&&(this.alt=+n)}function U(e,t,n){return e instanceof B?e:g(e)&&"object"!=typeof e[0]?3===e.length?new B(e[0],e[1],e[2]):2===e.length?new B(e[0],e[1]):null:null==e?e:"object"==typeof e&&"lat"in e?new B(e.lat,"lng"in e?e.lng:e.lon,e.alt):void 0===t?null:new B(e,t,n)}M.prototype={clone:function(){return new M(this.x,this.y)},add:function(e){return this.clone()._add(z(e))},_add:function(e){return this.x+=e.x,this.y+=e.y,this},subtract:function(e){return this.clone()._subtract(z(e))},_subtract:function(e){return this.x-=e.x,this.y-=e.y,this},divideBy:function(e){return this.clone()._divideBy(e)},_divideBy:function(e){return this.x/=e,this.y/=e,this},multiplyBy:function(e){return this.clone()._multiplyBy(e)},_multiplyBy:function(e){return this.x*=e,this.y*=e,this},scaleBy:function(e){return new M(this.x*e.x,this.y*e.y)},unscaleBy:function(e){return new M(this.x/e.x,this.y/e.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=N(this.x),this.y=N(this.y),this},distanceTo:function(e){var t=(e=z(e)).x-this.x,n=e.y-this.y;return Math.sqrt(t*t+n*n)},equals:function(e){return(e=z(e)).x===this.x&&e.y===this.y},contains:function(e){return e=z(e),Math.abs(e.x)<=Math.abs(this.x)&&Math.abs(e.y)<=Math.abs(this.y)},toString:function(){return"Point("+c(this.x)+", "+c(this.y)+")"}},D.prototype={extend:function(e){var t,n;if(!e)return this;if(e instanceof M||"number"==typeof e[0]||"x"in e)t=n=z(e);else if(t=(e=I(e)).min,n=e.max,!t||!n)return this;return this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(n.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(n.y,this.max.y)):(this.min=t.clone(),this.max=n.clone()),this},getCenter:function(e){return z((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,e)},getBottomLeft:function(){return z(this.min.x,this.max.y)},getTopRight:function(){return z(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(e){var t,n;return(e="number"==typeof e[0]||e instanceof M?z(e):I(e))instanceof D?(t=e.min,n=e.max):t=n=e,t.x>=this.min.x&&n.x<=this.max.x&&t.y>=this.min.y&&n.y<=this.max.y},intersects:function(e){e=I(e);var t=this.min,n=this.max,i=e.min,r=e.max,s=r.x>=t.x&&i.x<=n.x,o=r.y>=t.y&&i.y<=n.y;return s&&o},overlaps:function(e){e=I(e);var t=this.min,n=this.max,i=e.min,r=e.max,s=r.x>t.x&&i.x<n.x,o=r.y>t.y&&i.y<n.y;return s&&o},isValid:function(){return!(!this.min||!this.max)},pad:function(e){var t=this.min,n=this.max,i=Math.abs(t.x-n.x)*e,r=Math.abs(t.y-n.y)*e;return I(z(t.x-i,t.y-r),z(n.x+i,n.y+r))},equals:function(e){return!!e&&(e=I(e),this.min.equals(e.getTopLeft())&&this.max.equals(e.getBottomRight()))}},F.prototype={extend:function(e){var t,n,i=this._southWest,r=this._northEast;if(e instanceof B)t=e,n=e;else{if(!(e instanceof F))return e?this.extend(U(e)||j(e)):this;if(t=e._southWest,n=e._northEast,!t||!n)return this}return i||r?(i.lat=Math.min(t.lat,i.lat),i.lng=Math.min(t.lng,i.lng),r.lat=Math.max(n.lat,r.lat),r.lng=Math.max(n.lng,r.lng)):(this._southWest=new B(t.lat,t.lng),this._northEast=new B(n.lat,n.lng)),this},pad:function(e){var t=this._southWest,n=this._northEast,i=Math.abs(t.lat-n.lat)*e,r=Math.abs(t.lng-n.lng)*e;return new F(new B(t.lat-i,t.lng-r),new B(n.lat+i,n.lng+r))},getCenter:function(){return new B((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new B(this.getNorth(),this.getWest())},getSouthEast:function(){return new B(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(e){e="number"==typeof e[0]||e instanceof B||"lat"in e?U(e):j(e);var t,n,i=this._southWest,r=this._northEast;return e instanceof F?(t=e.getSouthWest(),n=e.getNorthEast()):t=n=e,t.lat>=i.lat&&n.lat<=r.lat&&t.lng>=i.lng&&n.lng<=r.lng},intersects:function(e){e=j(e);var t=this._southWest,n=this._northEast,i=e.getSouthWest(),r=e.getNorthEast(),s=r.lat>=t.lat&&i.lat<=n.lat,o=r.lng>=t.lng&&i.lng<=n.lng;return s&&o},overlaps:function(e){e=j(e);var t=this._southWest,n=this._northEast,i=e.getSouthWest(),r=e.getNorthEast(),s=r.lat>t.lat&&i.lat<n.lat,o=r.lng>t.lng&&i.lng<n.lng;return s&&o},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(e,t){return!!e&&(e=j(e),this._southWest.equals(e.getSouthWest(),t)&&this._northEast.equals(e.getNorthEast(),t))},isValid:function(){return!(!this._southWest||!this._northEast)}},B.prototype={equals:function(e,t){return!!e&&(e=U(e),Math.max(Math.abs(this.lat-e.lat),Math.abs(this.lng-e.lng))<=(void 0===t?1e-9:t))},toString:function(e){return"LatLng("+c(this.lat,e)+", "+c(this.lng,e)+")"},distanceTo:function(e){return $.distance(this,U(e))},wrap:function(){return $.wrapLatLng(this)},toBounds:function(e){var t=180*e/40075017,n=t/Math.cos(Math.PI/180*this.lat);return j([this.lat-t,this.lng-n],[this.lat+t,this.lng+n])},clone:function(){return new B(this.lat,this.lng,this.alt)}};var V,G={latLngToPoint:function(e,t){var n=this.projection.project(e),i=this.scale(t);return this.transformation._transform(n,i)},pointToLatLng:function(e,t){var n=this.scale(t),i=this.transformation.untransform(e,n);return this.projection.unproject(i)},project:function(e){return this.projection.project(e)},unproject:function(e){return this.projection.unproject(e)},scale:function(e){return 256*Math.pow(2,e)},zoom:function(e){return Math.log(e/256)/Math.LN2},getProjectedBounds:function(e){if(this.infinite)return null;var t=this.projection.bounds,n=this.scale(e);return new D(this.transformation.transform(t.min,n),this.transformation.transform(t.max,n))},infinite:!1,wrapLatLng:function(e){var t=this.wrapLng?l(e.lng,this.wrapLng,!0):e.lng;return new B(this.wrapLat?l(e.lat,this.wrapLat,!0):e.lat,t,e.alt)},wrapLatLngBounds:function(e){var t=e.getCenter(),n=this.wrapLatLng(t),i=t.lat-n.lat,r=t.lng-n.lng;if(0===i&&0===r)return e;var s=e.getSouthWest(),o=e.getNorthEast();return new F(new B(s.lat-i,s.lng-r),new B(o.lat-i,o.lng-r))}},$=n({},G,{wrapLng:[-180,180],R:6371e3,distance:function(e,t){var n=Math.PI/180,i=e.lat*n,r=t.lat*n,s=Math.sin((t.lat-e.lat)*n/2),o=Math.sin((t.lng-e.lng)*n/2),a=s*s+Math.cos(i)*Math.cos(r)*o*o,l=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return this.R*l}}),Z=6378137,q={R:Z,MAX_LATITUDE:85.0511287798,project:function(e){var t=Math.PI/180,n=this.MAX_LATITUDE,i=Math.max(Math.min(n,e.lat),-n),r=Math.sin(i*t);return new M(this.R*e.lng*t,this.R*Math.log((1+r)/(1-r))/2)},unproject:function(e){var t=180/Math.PI;return new B((2*Math.atan(Math.exp(e.y/this.R))-Math.PI/2)*t,e.x*t/this.R)},bounds:(V=Z*Math.PI,new D([-V,-V],[V,V]))};function W(e,t,n,i){if(g(e))return this._a=e[0],this._b=e[1],this._c=e[2],void(this._d=e[3]);this._a=e,this._b=t,this._c=n,this._d=i}function H(e,t,n,i){return new W(e,t,n,i)}W.prototype={transform:function(e,t){return this._transform(e.clone(),t)},_transform:function(e,t){return t=t||1,e.x=t*(this._a*e.x+this._b),e.y=t*(this._c*e.y+this._d),e},untransform:function(e,t){return t=t||1,new M((e.x/t-this._b)/this._a,(e.y/t-this._d)/this._c)}};var K=n({},$,{code:"EPSG:3857",projection:q,transformation:function(){var e=.5/(Math.PI*q.R);return H(e,.5,-e,.5)}()}),Y=n({},K,{code:"EPSG:900913"});function X(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function Q(e,t){var n,i,r,s,o,a,l="";for(n=0,r=e.length;n<r;n++){for(i=0,s=(o=e[n]).length;i<s;i++)l+=(i?"L":"M")+(a=o[i]).x+" "+a.y;l+=t?Fe.svg?"z":"x":""}return l||"M0 0"}var J,ee=document.documentElement.style,te="ActiveXObject"in window,ne=te&&!document.addEventListener,ie="msLaunchUri"in navigator&&!("documentMode"in document),re=Ie("webkit"),se=Ie("android"),oe=Ie("android 2")||Ie("android 3"),ae=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),le=se&&Ie("Google")&&ae<537&&!("AudioNode"in window),ue=!!window.opera,ce=!ie&&Ie("chrome"),he=Ie("gecko")&&!re&&!ue&&!te,de=!ce&&Ie("safari"),fe=Ie("phantom"),pe="OTransition"in ee,me=0===navigator.platform.indexOf("Win"),_e=te&&"transition"in ee,ge="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!oe,ye="MozPerspective"in ee,ve=!window.L_DISABLE_3D&&(_e||ge||ye)&&!pe&&!fe,be="undefined"!=typeof orientation||Ie("mobile"),xe=be&&re,we=be&&ge,Ee=!window.PointerEvent&&window.MSPointerEvent,Ae=!(!window.PointerEvent&&!Ee),Te="ontouchstart"in window||!!window.TouchEvent,ke=!window.L_NO_TOUCH&&(Te||Ae),Se=be&&ue,Oe=be&&he,Pe=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Ce=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassiveEventSupport",u,t),window.removeEventListener("testPassiveEventSupport",u,t)}catch(e){}return e}(),Re=!!document.createElement("canvas").getContext,Me=!(!document.createElementNS||!X("svg").createSVGRect),Le=!!Me&&((J=document.createElement("div")).innerHTML="<svg/>","http://www.w3.org/2000/svg"===(J.firstChild&&J.firstChild.namespaceURI)),Ne=!Me&&function(){try{var e=document.createElement("div");e.innerHTML='<v:shape adj="1"/>';var t=e.firstChild;return t.style.behavior="url(#default#VML)",t&&"object"==typeof t.adj}catch(e){return!1}}(),ze=0===navigator.platform.indexOf("Mac"),De=0===navigator.platform.indexOf("Linux");function Ie(e){return navigator.userAgent.toLowerCase().indexOf(e)>=0}var Fe={ie:te,ielt9:ne,edge:ie,webkit:re,android:se,android23:oe,androidStock:le,opera:ue,chrome:ce,gecko:he,safari:de,phantom:fe,opera12:pe,win:me,ie3d:_e,webkit3d:ge,gecko3d:ye,any3d:ve,mobile:be,mobileWebkit:xe,mobileWebkit3d:we,msPointer:Ee,pointer:Ae,touch:ke,touchNative:Te,mobileOpera:Se,mobileGecko:Oe,retina:Pe,passiveEvents:Ce,canvas:Re,svg:Me,vml:Ne,inlineSvg:Le,mac:ze,linux:De},je=Fe.msPointer?"MSPointerDown":"pointerdown",Be=Fe.msPointer?"MSPointerMove":"pointermove",Ue=Fe.msPointer?"MSPointerUp":"pointerup",Ve=Fe.msPointer?"MSPointerCancel":"pointercancel",Ge={touchstart:je,touchmove:Be,touchend:Ue,touchcancel:Ve},$e={touchstart:et,touchmove:Je,touchend:Je,touchcancel:Je},Ze={},qe=!1;function We(e,t,n){return"touchstart"===t&&Qe(),$e[t]?(n=$e[t].bind(this,n),e.addEventListener(Ge[t],n,!1),n):(console.warn("wrong event specified:",t),u)}function He(e,t,n){Ge[t]?e.removeEventListener(Ge[t],n,!1):console.warn("wrong event specified:",t)}function Ke(e){Ze[e.pointerId]=e}function Ye(e){Ze[e.pointerId]&&(Ze[e.pointerId]=e)}function Xe(e){delete Ze[e.pointerId]}function Qe(){qe||(document.addEventListener(je,Ke,!0),document.addEventListener(Be,Ye,!0),document.addEventListener(Ue,Xe,!0),document.addEventListener(Ve,Xe,!0),qe=!0)}function Je(e,t){if(t.pointerType!==(t.MSPOINTER_TYPE_MOUSE||"mouse")){for(var n in t.touches=[],Ze)t.touches.push(Ze[n]);t.changedTouches=[t],e(t)}}function et(e,t){t.MSPOINTER_TYPE_TOUCH&&t.pointerType===t.MSPOINTER_TYPE_TOUCH&&Kt(t),Je(e,t)}function tt(e){var t,n,i={};for(n in e)t=e[n],i[n]=t&&t.bind?t.bind(e):t;return e=i,i.type="dblclick",i.detail=2,i.isTrusted=!1,i._simulated=!0,i}var nt=200;function it(e,t){e.addEventListener("dblclick",t);var n,i=0;function r(e){if(1===e.detail){if("mouse"!==e.pointerType&&(!e.sourceCapabilities||e.sourceCapabilities.firesTouchEvents)){var r=Xt(e);if(!r.some(function(e){return e instanceof HTMLLabelElement&&e.attributes.for})||r.some(function(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement})){var s=Date.now();s-i<=nt?2===++n&&t(tt(e)):n=1,i=s}}}else n=e.detail}return e.addEventListener("click",r),{dblclick:t,simDblclick:r}}function rt(e,t){e.removeEventListener("dblclick",t.dblclick),e.removeEventListener("click",t.simDblclick)}var st,ot,at,lt,ut,ct=St(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ht=St(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),dt="webkitTransition"===ht||"OTransition"===ht?ht+"End":"transitionend";function ft(e){return"string"==typeof e?document.getElementById(e):e}function pt(e,t){var n=e.style[t]||e.currentStyle&&e.currentStyle[t];if((!n||"auto"===n)&&document.defaultView){var i=document.defaultView.getComputedStyle(e,null);n=i?i[t]:null}return"auto"===n?null:n}function mt(e,t,n){var i=document.createElement(e);return i.className=t||"",n&&n.appendChild(i),i}function _t(e){var t=e.parentNode;t&&t.removeChild(e)}function gt(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function yt(e){var t=e.parentNode;t&&t.lastChild!==e&&t.appendChild(e)}function vt(e){var t=e.parentNode;t&&t.firstChild!==e&&t.insertBefore(e,t.firstChild)}function bt(e,t){if(void 0!==e.classList)return e.classList.contains(t);var n=At(e);return n.length>0&&new RegExp("(^|\\s)"+t+"(\\s|$)").test(n)}function xt(e,t){if(void 0!==e.classList)for(var n=d(t),i=0,r=n.length;i<r;i++)e.classList.add(n[i]);else if(!bt(e,t)){var s=At(e);Et(e,(s?s+" ":"")+t)}}function wt(e,t){void 0!==e.classList?e.classList.remove(t):Et(e,h((" "+At(e)+" ").replace(" "+t+" "," ")))}function Et(e,t){void 0===e.className.baseVal?e.className=t:e.className.baseVal=t}function At(e){return e.correspondingElement&&(e=e.correspondingElement),void 0===e.className.baseVal?e.className:e.className.baseVal}function Tt(e,t){"opacity"in e.style?e.style.opacity=t:"filter"in e.style&&kt(e,t)}function kt(e,t){var n=!1,i="DXImageTransform.Microsoft.Alpha";try{n=e.filters.item(i)}catch(e){if(1===t)return}t=Math.round(100*t),n?(n.Enabled=100!==t,n.Opacity=t):e.style.filter+=" progid:"+i+"(opacity="+t+")"}function St(e){for(var t=document.documentElement.style,n=0;n<e.length;n++)if(e[n]in t)return e[n];return!1}function Ot(e,t,n){var i=t||new M(0,0);e.style[ct]=(Fe.ie3d?"translate("+i.x+"px,"+i.y+"px)":"translate3d("+i.x+"px,"+i.y+"px,0)")+(n?" scale("+n+")":"")}function Pt(e,t){e._leaflet_pos=t,Fe.any3d?Ot(e,t):(e.style.left=t.x+"px",e.style.top=t.y+"px")}function Ct(e){return e._leaflet_pos||new M(0,0)}if("onselectstart"in document)st=function(){jt(window,"selectstart",Kt)},ot=function(){Ut(window,"selectstart",Kt)};else{var Rt=St(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);st=function(){if(Rt){var e=document.documentElement.style;at=e[Rt],e[Rt]="none"}},ot=function(){Rt&&(document.documentElement.style[Rt]=at,at=void 0)}}function Mt(){jt(window,"dragstart",Kt)}function Lt(){Ut(window,"dragstart",Kt)}function Nt(e){for(;-1===e.tabIndex;)e=e.parentNode;e.style&&(zt(),lt=e,ut=e.style.outlineStyle,e.style.outlineStyle="none",jt(window,"keydown",zt))}function zt(){lt&&(lt.style.outlineStyle=ut,lt=void 0,ut=void 0,Ut(window,"keydown",zt))}function Dt(e){do{e=e.parentNode}while(!(e.offsetWidth&&e.offsetHeight||e===document.body));return e}function It(e){var t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}var Ft={__proto__:null,TRANSFORM:ct,TRANSITION:ht,TRANSITION_END:dt,get:ft,getStyle:pt,create:mt,remove:_t,empty:gt,toFront:yt,toBack:vt,hasClass:bt,addClass:xt,removeClass:wt,setClass:Et,getClass:At,setOpacity:Tt,testProp:St,setTransform:Ot,setPosition:Pt,getPosition:Ct,get disableTextSelection(){return st},get enableTextSelection(){return ot},disableImageDrag:Mt,enableImageDrag:Lt,preventOutline:Nt,restoreOutline:zt,getSizedParentNode:Dt,getScale:It};function jt(e,t,n,i){if(t&&"object"==typeof t)for(var r in t)$t(e,r,t[r],n);else for(var s=0,o=(t=d(t)).length;s<o;s++)$t(e,t[s],n,i);return this}var Bt="_leaflet_events";function Ut(e,t,n,i){if(1===arguments.length)Vt(e),delete e[Bt];else if(t&&"object"==typeof t)for(var r in t)Zt(e,r,t[r],n);else if(t=d(t),2===arguments.length)Vt(e,function(e){return-1!==y(t,e)});else for(var s=0,o=t.length;s<o;s++)Zt(e,t[s],n,i);return this}function Vt(e,t){for(var n in e[Bt]){var i=n.split(/\d/)[0];t&&!t(i)||Zt(e,i,null,null,n)}}var Gt={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function $t(e,t,n,i){var r=t+o(n)+(i?"_"+o(i):"");if(e[Bt]&&e[Bt][r])return this;var s=function(t){return n.call(i||e,t||window.event)},a=s;!Fe.touchNative&&Fe.pointer&&0===t.indexOf("touch")?s=We(e,t,s):Fe.touch&&"dblclick"===t?s=it(e,s):"addEventListener"in e?"touchstart"===t||"touchmove"===t||"wheel"===t||"mousewheel"===t?e.addEventListener(Gt[t]||t,s,!!Fe.passiveEvents&&{passive:!1}):"mouseenter"===t||"mouseleave"===t?(s=function(t){t=t||window.event,tn(e,t)&&a(t)},e.addEventListener(Gt[t],s,!1)):e.addEventListener(t,a,!1):e.attachEvent("on"+t,s),e[Bt]=e[Bt]||{},e[Bt][r]=s}function Zt(e,t,n,i,r){r=r||t+o(n)+(i?"_"+o(i):"");var s=e[Bt]&&e[Bt][r];if(!s)return this;!Fe.touchNative&&Fe.pointer&&0===t.indexOf("touch")?He(e,t,s):Fe.touch&&"dblclick"===t?rt(e,s):"removeEventListener"in e?e.removeEventListener(Gt[t]||t,s,!1):e.detachEvent("on"+t,s),e[Bt][r]=null}function qt(e){return e.stopPropagation?e.stopPropagation():e.originalEvent?e.originalEvent._stopped=!0:e.cancelBubble=!0,this}function Wt(e){return $t(e,"wheel",qt),this}function Ht(e){return jt(e,"mousedown touchstart dblclick contextmenu",qt),e._leaflet_disable_click=!0,this}function Kt(e){return e.preventDefault?e.preventDefault():e.returnValue=!1,this}function Yt(e){return Kt(e),qt(e),this}function Xt(e){if(e.composedPath)return e.composedPath();for(var t=[],n=e.target;n;)t.push(n),n=n.parentNode;return t}function Qt(e,t){if(!t)return new M(e.clientX,e.clientY);var n=It(t),i=n.boundingClientRect;return new M((e.clientX-i.left)/n.x-t.clientLeft,(e.clientY-i.top)/n.y-t.clientTop)}var Jt=Fe.linux&&Fe.chrome?window.devicePixelRatio:Fe.mac?3*window.devicePixelRatio:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function en(e){return Fe.edge?e.wheelDeltaY/2:e.deltaY&&0===e.deltaMode?-e.deltaY/Jt:e.deltaY&&1===e.deltaMode?20*-e.deltaY:e.deltaY&&2===e.deltaMode?60*-e.deltaY:e.deltaX||e.deltaZ?0:e.wheelDelta?(e.wheelDeltaY||e.wheelDelta)/2:e.detail&&Math.abs(e.detail)<32765?20*-e.detail:e.detail?e.detail/-32765*60:0}function tn(e,t){var n=t.relatedTarget;if(!n)return!0;try{for(;n&&n!==e;)n=n.parentNode}catch(e){return!1}return n!==e}var nn={__proto__:null,on:jt,off:Ut,stopPropagation:qt,disableScrollPropagation:Wt,disableClickPropagation:Ht,preventDefault:Kt,stop:Yt,getPropagationPath:Xt,getMousePosition:Qt,getWheelDelta:en,isExternalTarget:tn,addListener:jt,removeListener:Ut},rn=R.extend({run:function(e,t,n,i){this.stop(),this._el=e,this._inProgress=!0,this._duration=n||.25,this._easeOutPower=1/Math.max(i||.5,.2),this._startPos=Ct(e),this._offset=t.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=T(this._animate,this),this._step()},_step:function(e){var t=+new Date-this._startTime,n=1e3*this._duration;t<n?this._runFrame(this._easeOut(t/n),e):(this._runFrame(1),this._complete())},_runFrame:function(e,t){var n=this._startPos.add(this._offset.multiplyBy(e));t&&n._round(),Pt(this._el,n),this.fire("step")},_complete:function(){k(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(e){return 1-Math.pow(1-e,this._easeOutPower)}}),sn=R.extend({options:{crs:K,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(e,t){t=f(this,t),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(e),this._initLayout(),this._onResize=r(this._onResize,this),this._initEvents(),t.maxBounds&&this.setMaxBounds(t.maxBounds),void 0!==t.zoom&&(this._zoom=this._limitZoom(t.zoom)),t.center&&void 0!==t.zoom&&this.setView(U(t.center),t.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=ht&&Fe.any3d&&!Fe.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),jt(this._proxy,dt,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(e,t,i){return t=void 0===t?this._zoom:this._limitZoom(t),e=this._limitCenter(U(e),t,this.options.maxBounds),i=i||{},this._stop(),this._loaded&&!i.reset&&!0!==i&&(void 0!==i.animate&&(i.zoom=n({animate:i.animate},i.zoom),i.pan=n({animate:i.animate,duration:i.duration},i.pan)),this._zoom!==t?this._tryAnimatedZoom&&this._tryAnimatedZoom(e,t,i.zoom):this._tryAnimatedPan(e,i.pan))?(clearTimeout(this._sizeTimer),this):(this._resetView(e,t,i.pan&&i.pan.noMoveStart),this)},setZoom:function(e,t){return this._loaded?this.setView(this.getCenter(),e,{zoom:t}):(this._zoom=e,this)},zoomIn:function(e,t){return e=e||(Fe.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+e,t)},zoomOut:function(e,t){return e=e||(Fe.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-e,t)},setZoomAround:function(e,t,n){var i=this.getZoomScale(t),r=this.getSize().divideBy(2),s=(e instanceof M?e:this.latLngToContainerPoint(e)).subtract(r).multiplyBy(1-1/i),o=this.containerPointToLatLng(r.add(s));return this.setView(o,t,{zoom:n})},_getBoundsCenterZoom:function(e,t){t=t||{},e=e.getBounds?e.getBounds():j(e);var n=z(t.paddingTopLeft||t.padding||[0,0]),i=z(t.paddingBottomRight||t.padding||[0,0]),r=this.getBoundsZoom(e,!1,n.add(i));if((r="number"==typeof t.maxZoom?Math.min(t.maxZoom,r):r)===1/0)return{center:e.getCenter(),zoom:r};var s=i.subtract(n).divideBy(2),o=this.project(e.getSouthWest(),r),a=this.project(e.getNorthEast(),r);return{center:this.unproject(o.add(a).divideBy(2).add(s),r),zoom:r}},fitBounds:function(e,t){if(!(e=j(e)).isValid())throw new Error("Bounds are not valid.");var n=this._getBoundsCenterZoom(e,t);return this.setView(n.center,n.zoom,t)},fitWorld:function(e){return this.fitBounds([[-90,-180],[90,180]],e)},panTo:function(e,t){return this.setView(e,this._zoom,{pan:t})},panBy:function(e,t){if(t=t||{},!(e=z(e).round()).x&&!e.y)return this.fire("moveend");if(!0!==t.animate&&!this.getSize().contains(e))return this._resetView(this.unproject(this.project(this.getCenter()).add(e)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new rn,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),t.noMoveStart||this.fire("movestart"),!1!==t.animate){xt(this._mapPane,"leaflet-pan-anim");var n=this._getMapPanePos().subtract(e).round();this._panAnim.run(this._mapPane,n,t.duration||.25,t.easeLinearity)}else this._rawPanBy(e),this.fire("move").fire("moveend");return this},flyTo:function(e,t,n){if(!1===(n=n||{}).animate||!Fe.any3d)return this.setView(e,t,n);this._stop();var i=this.project(this.getCenter()),r=this.project(e),s=this.getSize(),o=this._zoom;e=U(e),t=void 0===t?o:t;var a=Math.max(s.x,s.y),l=a*this.getZoomScale(o,t),u=r.distanceTo(i)||1,c=1.42,h=c*c;function d(e){var t=(l*l-a*a+(e?-1:1)*h*h*u*u)/(2*(e?l:a)*h*u),n=Math.sqrt(t*t+1)-t;return n<1e-9?-18:Math.log(n)}function f(e){return(Math.exp(e)-Math.exp(-e))/2}function p(e){return(Math.exp(e)+Math.exp(-e))/2}function m(e){return f(e)/p(e)}var _=d(0);function g(e){return a*(p(_)/p(_+c*e))}function y(e){return a*(p(_)*m(_+c*e)-f(_))/h}function v(e){return 1-Math.pow(1-e,1.5)}var b=Date.now(),x=(d(1)-_)/c,w=n.duration?1e3*n.duration:1e3*x*.8;function E(){var n=(Date.now()-b)/w,s=v(n)*x;n<=1?(this._flyToFrame=T(E,this),this._move(this.unproject(i.add(r.subtract(i).multiplyBy(y(s)/u)),o),this.getScaleZoom(a/g(s),o),{flyTo:!0})):this._move(e,t)._moveEnd(!0)}return this._moveStart(!0,n.noMoveStart),E.call(this),this},flyToBounds:function(e,t){var n=this._getBoundsCenterZoom(e,t);return this.flyTo(n.center,n.zoom,t)},setMaxBounds:function(e){return e=j(e),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),e.isValid()?(this.options.maxBounds=e,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(e){var t=this.options.minZoom;return this.options.minZoom=e,this._loaded&&t!==e&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(e):this},setMaxZoom:function(e){var t=this.options.maxZoom;return this.options.maxZoom=e,this._loaded&&t!==e&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(e):this},panInsideBounds:function(e,t){this._enforcingBounds=!0;var n=this.getCenter(),i=this._limitCenter(n,this._zoom,j(e));return n.equals(i)||this.panTo(i,t),this._enforcingBounds=!1,this},panInside:function(e,t){var n=z((t=t||{}).paddingTopLeft||t.padding||[0,0]),i=z(t.paddingBottomRight||t.padding||[0,0]),r=this.project(this.getCenter()),s=this.project(e),o=this.getPixelBounds(),a=I([o.min.add(n),o.max.subtract(i)]),l=a.getSize();if(!a.contains(s)){this._enforcingBounds=!0;var u=s.subtract(a.getCenter()),c=a.extend(s).getSize().subtract(l);r.x+=u.x<0?-c.x:c.x,r.y+=u.y<0?-c.y:c.y,this.panTo(this.unproject(r),t),this._enforcingBounds=!1}return this},invalidateSize:function(e){if(!this._loaded)return this;e=n({animate:!1,pan:!0},!0===e?{animate:!0}:e);var t=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var i=this.getSize(),s=t.divideBy(2).round(),o=i.divideBy(2).round(),a=s.subtract(o);return a.x||a.y?(e.animate&&e.pan?this.panBy(a):(e.pan&&this._rawPanBy(a),this.fire("move"),e.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:t,newSize:i})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(e){if(e=this._locateOptions=n({timeout:1e4,watch:!1},e),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var t=r(this._handleGeolocationResponse,this),i=r(this._handleGeolocationError,this);return e.watch?this._locationWatchId=navigator.geolocation.watchPosition(t,i,e):navigator.geolocation.getCurrentPosition(t,i,e),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(e){if(this._container._leaflet_id){var t=e.code,n=e.message||(1===t?"permission denied":2===t?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:t,message:"Geolocation error: "+n+"."})}},_handleGeolocationResponse:function(e){if(this._container._leaflet_id){var t=new B(e.coords.latitude,e.coords.longitude),n=t.toBounds(2*e.coords.accuracy),i=this._locateOptions;if(i.setView){var r=this.getBoundsZoom(n);this.setView(t,i.maxZoom?Math.min(r,i.maxZoom):r)}var s={latlng:t,bounds:n,timestamp:e.timestamp};for(var o in e.coords)"number"==typeof e.coords[o]&&(s[o]=e.coords[o]);this.fire("locationfound",s)}},addHandler:function(e,t){if(!t)return this;var n=this[e]=new t(this);return this._handlers.push(n),this.options[e]&&n.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(e){this._container._leaflet_id=void 0,this._containerId=void 0}var e;for(e in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),_t(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(k(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[e].remove();for(e in this._panes)_t(this._panes[e]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(e,t){var n=mt("div","leaflet-pane"+(e?" leaflet-"+e.replace("Pane","")+"-pane":""),t||this._mapPane);return e&&(this._panes[e]=n),n},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var e=this.getPixelBounds();return new F(this.unproject(e.getBottomLeft()),this.unproject(e.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(e,t,n){e=j(e),n=z(n||[0,0]);var i=this.getZoom()||0,r=this.getMinZoom(),s=this.getMaxZoom(),o=e.getNorthWest(),a=e.getSouthEast(),l=this.getSize().subtract(n),u=I(this.project(a,i),this.project(o,i)).getSize(),c=Fe.any3d?this.options.zoomSnap:1,h=l.x/u.x,d=l.y/u.y,f=t?Math.max(h,d):Math.min(h,d);return i=this.getScaleZoom(f,i),c&&(i=Math.round(i/(c/100))*(c/100),i=t?Math.ceil(i/c)*c:Math.floor(i/c)*c),Math.max(r,Math.min(s,i))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new M(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(e,t){var n=this._getTopLeftPoint(e,t);return new D(n,n.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(e){return this.options.crs.getProjectedBounds(void 0===e?this.getZoom():e)},getPane:function(e){return"string"==typeof e?this._panes[e]:e},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(e,t){var n=this.options.crs;return t=void 0===t?this._zoom:t,n.scale(e)/n.scale(t)},getScaleZoom:function(e,t){var n=this.options.crs;t=void 0===t?this._zoom:t;var i=n.zoom(e*n.scale(t));return isNaN(i)?1/0:i},project:function(e,t){return t=void 0===t?this._zoom:t,this.options.crs.latLngToPoint(U(e),t)},unproject:function(e,t){return t=void 0===t?this._zoom:t,this.options.crs.pointToLatLng(z(e),t)},layerPointToLatLng:function(e){var t=z(e).add(this.getPixelOrigin());return this.unproject(t)},latLngToLayerPoint:function(e){return this.project(U(e))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(e){return this.options.crs.wrapLatLng(U(e))},wrapLatLngBounds:function(e){return this.options.crs.wrapLatLngBounds(j(e))},distance:function(e,t){return this.options.crs.distance(U(e),U(t))},containerPointToLayerPoint:function(e){return z(e).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(e){return z(e).add(this._getMapPanePos())},containerPointToLatLng:function(e){var t=this.containerPointToLayerPoint(z(e));return this.layerPointToLatLng(t)},latLngToContainerPoint:function(e){return this.layerPointToContainerPoint(this.latLngToLayerPoint(U(e)))},mouseEventToContainerPoint:function(e){return Qt(e,this._container)},mouseEventToLayerPoint:function(e){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e))},mouseEventToLatLng:function(e){return this.layerPointToLatLng(this.mouseEventToLayerPoint(e))},_initContainer:function(e){var t=this._container=ft(e);if(!t)throw new Error("Map container not found.");if(t._leaflet_id)throw new Error("Map container is already initialized.");jt(t,"scroll",this._onScroll,this),this._containerId=o(t)},_initLayout:function(){var e=this._container;this._fadeAnimated=this.options.fadeAnimation&&Fe.any3d,xt(e,"leaflet-container"+(Fe.touch?" leaflet-touch":"")+(Fe.retina?" leaflet-retina":"")+(Fe.ielt9?" leaflet-oldie":"")+(Fe.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var t=pt(e,"position");"absolute"!==t&&"relative"!==t&&"fixed"!==t&&"sticky"!==t&&(e.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var e=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Pt(this._mapPane,new M(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(xt(e.markerPane,"leaflet-zoom-hide"),xt(e.shadowPane,"leaflet-zoom-hide"))},_resetView:function(e,t,n){Pt(this._mapPane,new M(0,0));var i=!this._loaded;this._loaded=!0,t=this._limitZoom(t),this.fire("viewprereset");var r=this._zoom!==t;this._moveStart(r,n)._move(e,t)._moveEnd(r),this.fire("viewreset"),i&&this.fire("load")},_moveStart:function(e,t){return e&&this.fire("zoomstart"),t||this.fire("movestart"),this},_move:function(e,t,n,i){void 0===t&&(t=this._zoom);var r=this._zoom!==t;return this._zoom=t,this._lastCenter=e,this._pixelOrigin=this._getNewPixelOrigin(e),i?n&&n.pinch&&this.fire("zoom",n):((r||n&&n.pinch)&&this.fire("zoom",n),this.fire("move",n)),this},_moveEnd:function(e){return e&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return k(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(e){Pt(this._mapPane,this._getMapPanePos().subtract(e))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(e){this._targets={},this._targets[o(this._container)]=this;var t=e?Ut:jt;t(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&t(window,"resize",this._onResize,this),Fe.any3d&&this.options.transform3DLimit&&(e?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){k(this._resizeRequest),this._resizeRequest=T(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var e=this._getMapPanePos();Math.max(Math.abs(e.x),Math.abs(e.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(e,t){for(var n,i=[],r="mouseout"===t||"mouseover"===t,s=e.target||e.srcElement,a=!1;s;){if((n=this._targets[o(s)])&&("click"===t||"preclick"===t)&&this._draggableMoved(n)){a=!0;break}if(n&&n.listens(t,!0)){if(r&&!tn(s,e))break;if(i.push(n),r)break}if(s===this._container)break;s=s.parentNode}return i.length||a||r||!this.listens(t,!0)||(i=[this]),i},_isClickDisabled:function(e){for(;e&&e!==this._container;){if(e._leaflet_disable_click)return!0;e=e.parentNode}},_handleDOMEvent:function(e){var t=e.target||e.srcElement;if(!(!this._loaded||t._leaflet_disable_events||"click"===e.type&&this._isClickDisabled(t))){var n=e.type;"mousedown"===n&&Nt(t),this._fireDOMEvent(e,n)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(e,t,i){if("click"===e.type){var r=n({},e);r.type="preclick",this._fireDOMEvent(r,r.type,i)}var s=this._findEventTargets(e,t);if(i){for(var o=[],a=0;a<i.length;a++)i[a].listens(t,!0)&&o.push(i[a]);s=o.concat(s)}if(s.length){"contextmenu"===t&&Kt(e);var l=s[0],u={originalEvent:e};if("keypress"!==e.type&&"keydown"!==e.type&&"keyup"!==e.type){var c=l.getLatLng&&(!l._radius||l._radius<=10);u.containerPoint=c?this.latLngToContainerPoint(l.getLatLng()):this.mouseEventToContainerPoint(e),u.layerPoint=this.containerPointToLayerPoint(u.containerPoint),u.latlng=c?l.getLatLng():this.layerPointToLatLng(u.layerPoint)}for(a=0;a<s.length;a++)if(s[a].fire(t,u,!0),u.originalEvent._stopped||!1===s[a].options.bubblingMouseEvents&&-1!==y(this._mouseEvents,t))return}},_draggableMoved:function(e){return(e=e.dragging&&e.dragging.enabled()?e:this).dragging&&e.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var e=0,t=this._handlers.length;e<t;e++)this._handlers[e].disable()},whenReady:function(e,t){return this._loaded?e.call(t||this,{target:this}):this.on("load",e,t),this},_getMapPanePos:function(){return Ct(this._mapPane)||new M(0,0)},_moved:function(){var e=this._getMapPanePos();return e&&!e.equals([0,0])},_getTopLeftPoint:function(e,t){return(e&&void 0!==t?this._getNewPixelOrigin(e,t):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(e,t){var n=this.getSize()._divideBy(2);return this.project(e,t)._subtract(n)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(e,t,n){var i=this._getNewPixelOrigin(n,t);return this.project(e,t)._subtract(i)},_latLngBoundsToNewLayerBounds:function(e,t,n){var i=this._getNewPixelOrigin(n,t);return I([this.project(e.getSouthWest(),t)._subtract(i),this.project(e.getNorthWest(),t)._subtract(i),this.project(e.getSouthEast(),t)._subtract(i),this.project(e.getNorthEast(),t)._subtract(i)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(e){return this.latLngToLayerPoint(e).subtract(this._getCenterLayerPoint())},_limitCenter:function(e,t,n){if(!n)return e;var i=this.project(e,t),r=this.getSize().divideBy(2),s=new D(i.subtract(r),i.add(r)),o=this._getBoundsOffset(s,n,t);return Math.abs(o.x)<=1&&Math.abs(o.y)<=1?e:this.unproject(i.add(o),t)},_limitOffset:function(e,t){if(!t)return e;var n=this.getPixelBounds(),i=new D(n.min.add(e),n.max.add(e));return e.add(this._getBoundsOffset(i,t))},_getBoundsOffset:function(e,t,n){var i=I(this.project(t.getNorthEast(),n),this.project(t.getSouthWest(),n)),r=i.min.subtract(e.min),s=i.max.subtract(e.max);return new M(this._rebound(r.x,-s.x),this._rebound(r.y,-s.y))},_rebound:function(e,t){return e+t>0?Math.round(e-t)/2:Math.max(0,Math.ceil(e))-Math.max(0,Math.floor(t))},_limitZoom:function(e){var t=this.getMinZoom(),n=this.getMaxZoom(),i=Fe.any3d?this.options.zoomSnap:1;return i&&(e=Math.round(e/i)*i),Math.max(t,Math.min(n,e))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){wt(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(e,t){var n=this._getCenterOffset(e)._trunc();return!(!0!==(t&&t.animate)&&!this.getSize().contains(n)||(this.panBy(n,t),0))},_createAnimProxy:function(){var e=this._proxy=mt("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(e),this.on("zoomanim",function(e){var t=ct,n=this._proxy.style[t];Ot(this._proxy,this.project(e.center,e.zoom),this.getZoomScale(e.zoom,1)),n===this._proxy.style[t]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){_t(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var e=this.getCenter(),t=this.getZoom();Ot(this._proxy,this.project(e,t),this.getZoomScale(t,1))},_catchTransitionEnd:function(e){this._animatingZoom&&e.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(e,t,n){if(this._animatingZoom)return!0;if(n=n||{},!this._zoomAnimated||!1===n.animate||this._nothingToAnimate()||Math.abs(t-this._zoom)>this.options.zoomAnimationThreshold)return!1;var i=this.getZoomScale(t),r=this._getCenterOffset(e)._divideBy(1-1/i);return!(!0!==n.animate&&!this.getSize().contains(r)||(T(function(){this._moveStart(!0,n.noMoveStart||!1)._animateZoom(e,t,!0)},this),0))},_animateZoom:function(e,t,n,i){this._mapPane&&(n&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=t,xt(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:e,zoom:t,noUpdate:i}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(r(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&wt(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function on(e,t){return new sn(e,t)}var an=O.extend({options:{position:"topright"},initialize:function(e){f(this,e)},getPosition:function(){return this.options.position},setPosition:function(e){var t=this._map;return t&&t.removeControl(this),this.options.position=e,t&&t.addControl(this),this},getContainer:function(){return this._container},addTo:function(e){this.remove(),this._map=e;var t=this._container=this.onAdd(e),n=this.getPosition(),i=e._controlCorners[n];return xt(t,"leaflet-control"),-1!==n.indexOf("bottom")?i.insertBefore(t,i.firstChild):i.appendChild(t),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(_t(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(e){this._map&&e&&e.screenX>0&&e.screenY>0&&this._map.getContainer().focus()}}),ln=function(e){return new an(e)};sn.include({addControl:function(e){return e.addTo(this),this},removeControl:function(e){return e.remove(),this},_initControlPos:function(){var e=this._controlCorners={},t="leaflet-",n=this._controlContainer=mt("div",t+"control-container",this._container);function i(i,r){var s=t+i+" "+t+r;e[i+r]=mt("div",s,n)}i("top","left"),i("top","right"),i("bottom","left"),i("bottom","right")},_clearControlPos:function(){for(var e in this._controlCorners)_t(this._controlCorners[e]);_t(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var un=an.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(e,t,n,i){return n<i?-1:i<n?1:0}},initialize:function(e,t,n){for(var i in f(this,n),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1,e)this._addLayer(e[i],i);for(i in t)this._addLayer(t[i],i,!0)},onAdd:function(e){this._initLayout(),this._update(),this._map=e,e.on("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(e){return an.prototype.addTo.call(this,e),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(e,t){return this._addLayer(e,t),this._map?this._update():this},addOverlay:function(e,t){return this._addLayer(e,t,!0),this._map?this._update():this},removeLayer:function(e){e.off("add remove",this._onLayerChange,this);var t=this._getLayer(o(e));return t&&this._layers.splice(this._layers.indexOf(t),1),this._map?this._update():this},expand:function(){xt(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var e=this._map.getSize().y-(this._container.offsetTop+50);return e<this._section.clientHeight?(xt(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=e+"px"):wt(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return wt(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var e="leaflet-control-layers",t=this._container=mt("div",e),n=this.options.collapsed;t.setAttribute("aria-haspopup",!0),Ht(t),Wt(t);var i=this._section=mt("section",e+"-list");n&&(this._map.on("click",this.collapse,this),jt(t,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var r=this._layersLink=mt("a",e+"-toggle",t);r.href="#",r.title="Layers",r.setAttribute("role","button"),jt(r,{keydown:function(e){13===e.keyCode&&this._expandSafely()},click:function(e){Kt(e),this._expandSafely()}},this),n||this.expand(),this._baseLayersList=mt("div",e+"-base",i),this._separator=mt("div",e+"-separator",i),this._overlaysList=mt("div",e+"-overlays",i),t.appendChild(i)},_getLayer:function(e){for(var t=0;t<this._layers.length;t++)if(this._layers[t]&&o(this._layers[t].layer)===e)return this._layers[t]},_addLayer:function(e,t,n){this._map&&e.on("add remove",this._onLayerChange,this),this._layers.push({layer:e,name:t,overlay:n}),this.options.sortLayers&&this._layers.sort(r(function(e,t){return this.options.sortFunction(e.layer,t.layer,e.name,t.name)},this)),this.options.autoZIndex&&e.setZIndex&&(this._lastZIndex++,e.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;gt(this._baseLayersList),gt(this._overlaysList),this._layerControlInputs=[];var e,t,n,i,r=0;for(n=0;n<this._layers.length;n++)i=this._layers[n],this._addItem(i),t=t||i.overlay,e=e||!i.overlay,r+=i.overlay?0:1;return this.options.hideSingleBase&&(e=e&&r>1,this._baseLayersList.style.display=e?"":"none"),this._separator.style.display=t&&e?"":"none",this},_onLayerChange:function(e){this._handlingClick||this._update();var t=this._getLayer(o(e.target)),n=t.overlay?"add"===e.type?"overlayadd":"overlayremove":"add"===e.type?"baselayerchange":null;n&&this._map.fire(n,t)},_createRadioElement:function(e,t){var n='<input type="radio" class="leaflet-control-layers-selector" name="'+e+'"'+(t?' checked="checked"':"")+"/>",i=document.createElement("div");return i.innerHTML=n,i.firstChild},_addItem:function(e){var t,n=document.createElement("label"),i=this._map.hasLayer(e.layer);e.overlay?((t=document.createElement("input")).type="checkbox",t.className="leaflet-control-layers-selector",t.defaultChecked=i):t=this._createRadioElement("leaflet-base-layers_"+o(this),i),this._layerControlInputs.push(t),t.layerId=o(e.layer),jt(t,"click",this._onInputClick,this);var r=document.createElement("span");r.innerHTML=" "+e.name;var s=document.createElement("span");return n.appendChild(s),s.appendChild(t),s.appendChild(r),(e.overlay?this._overlaysList:this._baseLayersList).appendChild(n),this._checkDisabledLayers(),n},_onInputClick:function(){if(!this._preventClick){var e,t,n=this._layerControlInputs,i=[],r=[];this._handlingClick=!0;for(var s=n.length-1;s>=0;s--)e=n[s],t=this._getLayer(e.layerId).layer,e.checked?i.push(t):e.checked||r.push(t);for(s=0;s<r.length;s++)this._map.hasLayer(r[s])&&this._map.removeLayer(r[s]);for(s=0;s<i.length;s++)this._map.hasLayer(i[s])||this._map.addLayer(i[s]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var e,t,n=this._layerControlInputs,i=this._map.getZoom(),r=n.length-1;r>=0;r--)e=n[r],t=this._getLayer(e.layerId).layer,e.disabled=void 0!==t.options.minZoom&&i<t.options.minZoom||void 0!==t.options.maxZoom&&i>t.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var e=this._section;this._preventClick=!0,jt(e,"click",Kt),this.expand();var t=this;setTimeout(function(){Ut(e,"click",Kt),t._preventClick=!1})}}),cn=function(e,t,n){return new un(e,t,n)},hn=an.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">−</span>',zoomOutTitle:"Zoom out"},onAdd:function(e){var t="leaflet-control-zoom",n=mt("div",t+" leaflet-bar"),i=this.options;return this._zoomInButton=this._createButton(i.zoomInText,i.zoomInTitle,t+"-in",n,this._zoomIn),this._zoomOutButton=this._createButton(i.zoomOutText,i.zoomOutTitle,t+"-out",n,this._zoomOut),this._updateDisabled(),e.on("zoomend zoomlevelschange",this._updateDisabled,this),n},onRemove:function(e){e.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(e){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(e.shiftKey?3:1))},_zoomOut:function(e){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(e.shiftKey?3:1))},_createButton:function(e,t,n,i,r){var s=mt("a",n,i);return s.innerHTML=e,s.href="#",s.title=t,s.setAttribute("role","button"),s.setAttribute("aria-label",t),Ht(s),jt(s,"click",Yt),jt(s,"click",r,this),jt(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var e=this._map,t="leaflet-disabled";wt(this._zoomInButton,t),wt(this._zoomOutButton,t),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||e._zoom===e.getMinZoom())&&(xt(this._zoomOutButton,t),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||e._zoom===e.getMaxZoom())&&(xt(this._zoomInButton,t),this._zoomInButton.setAttribute("aria-disabled","true"))}});sn.mergeOptions({zoomControl:!0}),sn.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new hn,this.addControl(this.zoomControl))});var dn=function(e){return new hn(e)},fn=an.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(e){var t="leaflet-control-scale",n=mt("div",t),i=this.options;return this._addScales(i,t+"-line",n),e.on(i.updateWhenIdle?"moveend":"move",this._update,this),e.whenReady(this._update,this),n},onRemove:function(e){e.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(e,t,n){e.metric&&(this._mScale=mt("div",t,n)),e.imperial&&(this._iScale=mt("div",t,n))},_update:function(){var e=this._map,t=e.getSize().y/2,n=e.distance(e.containerPointToLatLng([0,t]),e.containerPointToLatLng([this.options.maxWidth,t]));this._updateScales(n)},_updateScales:function(e){this.options.metric&&e&&this._updateMetric(e),this.options.imperial&&e&&this._updateImperial(e)},_updateMetric:function(e){var t=this._getRoundNum(e),n=t<1e3?t+" m":t/1e3+" km";this._updateScale(this._mScale,n,t/e)},_updateImperial:function(e){var t,n,i,r=3.2808399*e;r>5280?(t=r/5280,n=this._getRoundNum(t),this._updateScale(this._iScale,n+" mi",n/t)):(i=this._getRoundNum(r),this._updateScale(this._iScale,i+" ft",i/r))},_updateScale:function(e,t,n){e.style.width=Math.round(this.options.maxWidth*n)+"px",e.innerHTML=t},_getRoundNum:function(e){var t=Math.pow(10,(Math.floor(e)+"").length-1),n=e/t;return t*(n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:1)}}),pn=function(e){return new fn(e)},mn='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg>',_n=an.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(Fe.inlineSvg?mn+" ":"")+"Leaflet</a>"},initialize:function(e){f(this,e),this._attributions={}},onAdd:function(e){for(var t in e.attributionControl=this,this._container=mt("div","leaflet-control-attribution"),Ht(this._container),e._layers)e._layers[t].getAttribution&&this.addAttribution(e._layers[t].getAttribution());return this._update(),e.on("layeradd",this._addAttribution,this),this._container},onRemove:function(e){e.off("layeradd",this._addAttribution,this)},_addAttribution:function(e){e.layer.getAttribution&&(this.addAttribution(e.layer.getAttribution()),e.layer.once("remove",function(){this.removeAttribution(e.layer.getAttribution())},this))},setPrefix:function(e){return this.options.prefix=e,this._update(),this},addAttribution:function(e){return e?(this._attributions[e]||(this._attributions[e]=0),this._attributions[e]++,this._update(),this):this},removeAttribution:function(e){return e?(this._attributions[e]&&(this._attributions[e]--,this._update()),this):this},_update:function(){if(this._map){var e=[];for(var t in this._attributions)this._attributions[t]&&e.push(t);var n=[];this.options.prefix&&n.push(this.options.prefix),e.length&&n.push(e.join(", ")),this._container.innerHTML=n.join(' <span aria-hidden="true">|</span> ')}}});sn.mergeOptions({attributionControl:!0}),sn.addInitHook(function(){this.options.attributionControl&&(new _n).addTo(this)});var gn=function(e){return new _n(e)};an.Layers=un,an.Zoom=hn,an.Scale=fn,an.Attribution=_n,ln.layers=cn,ln.zoom=dn,ln.scale=pn,ln.attribution=gn;var yn=O.extend({initialize:function(e){this._map=e},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});yn.addTo=function(e,t){return e.addHandler(t,this),this};var vn={Events:C},bn=Fe.touch?"touchstart mousedown":"mousedown",xn=R.extend({options:{clickTolerance:3},initialize:function(e,t,n,i){f(this,i),this._element=e,this._dragStartTarget=t||e,this._preventOutline=n},enable:function(){this._enabled||(jt(this._dragStartTarget,bn,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(xn._dragging===this&&this.finishDrag(!0),Ut(this._dragStartTarget,bn,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(e){if(this._enabled&&(this._moved=!1,!bt(this._element,"leaflet-zoom-anim")))if(e.touches&&1!==e.touches.length)xn._dragging===this&&this.finishDrag();else if(!(xn._dragging||e.shiftKey||1!==e.which&&1!==e.button&&!e.touches||(xn._dragging=this,this._preventOutline&&Nt(this._element),Mt(),st(),this._moving))){this.fire("down");var t=e.touches?e.touches[0]:e,n=Dt(this._element);this._startPoint=new M(t.clientX,t.clientY),this._startPos=Ct(this._element),this._parentScale=It(n);var i="mousedown"===e.type;jt(document,i?"mousemove":"touchmove",this._onMove,this),jt(document,i?"mouseup":"touchend touchcancel",this._onUp,this)}},_onMove:function(e){if(this._enabled)if(e.touches&&e.touches.length>1)this._moved=!0;else{var t=e.touches&&1===e.touches.length?e.touches[0]:e,n=new M(t.clientX,t.clientY)._subtract(this._startPoint);(n.x||n.y)&&(Math.abs(n.x)+Math.abs(n.y)<this.options.clickTolerance||(n.x/=this._parentScale.x,n.y/=this._parentScale.y,Kt(e),this._moved||(this.fire("dragstart"),this._moved=!0,xt(document.body,"leaflet-dragging"),this._lastTarget=e.target||e.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),xt(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(n),this._moving=!0,this._lastEvent=e,this._updatePosition()))}},_updatePosition:function(){var e={originalEvent:this._lastEvent};this.fire("predrag",e),Pt(this._element,this._newPos),this.fire("drag",e)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(e){wt(document.body,"leaflet-dragging"),this._lastTarget&&(wt(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),Ut(document,"mousemove touchmove",this._onMove,this),Ut(document,"mouseup touchend touchcancel",this._onUp,this),Lt(),ot();var t=this._moved&&this._moving;this._moving=!1,xn._dragging=!1,t&&this.fire("dragend",{noInertia:e,distance:this._newPos.distanceTo(this._startPos)})}});function wn(e,t,n){var i,r,s,o,a,l,u,c,h,d=[1,4,2,8];for(r=0,u=e.length;r<u;r++)e[r]._code=zn(e[r],t);for(o=0;o<4;o++){for(c=d[o],i=[],r=0,s=(u=e.length)-1;r<u;s=r++)a=e[r],l=e[s],a._code&c?l._code&c||((h=Nn(l,a,c,t,n))._code=zn(h,t),i.push(h)):(l._code&c&&((h=Nn(l,a,c,t,n))._code=zn(h,t),i.push(h)),i.push(a));e=i}return e}function En(e,t){var n,i,r,s,o,a,l,u,c;if(!e||0===e.length)throw new Error("latlngs not passed");Fn(e)||(console.warn("latlngs are not flat! Only the first ring will be used"),e=e[0]);var h=U([0,0]),d=j(e);d.getNorthWest().distanceTo(d.getSouthWest())*d.getNorthEast().distanceTo(d.getNorthWest())<1700&&(h=An(e));var f=e.length,p=[];for(n=0;n<f;n++){var m=U(e[n]);p.push(t.project(U([m.lat-h.lat,m.lng-h.lng])))}for(a=l=u=0,n=0,i=f-1;n<f;i=n++)r=p[n],s=p[i],o=r.y*s.x-s.y*r.x,l+=(r.x+s.x)*o,u+=(r.y+s.y)*o,a+=3*o;c=0===a?p[0]:[l/a,u/a];var _=t.unproject(z(c));return U([_.lat+h.lat,_.lng+h.lng])}function An(e){for(var t=0,n=0,i=0,r=0;r<e.length;r++){var s=U(e[r]);t+=s.lat,n+=s.lng,i++}return U([t/i,n/i])}var Tn,kn={__proto__:null,clipPolygon:wn,polygonCenter:En,centroid:An};function Sn(e,t){if(!t||!e.length)return e.slice();var n=t*t;return e=Cn(e=Mn(e,n),n)}function On(e,t,n){return Math.sqrt(In(e,t,n,!0))}function Pn(e,t,n){return In(e,t,n)}function Cn(e,t){var n=e.length,i=new(typeof Uint8Array!=void 0+""?Uint8Array:Array)(n);i[0]=i[n-1]=1,Rn(e,i,t,0,n-1);var r,s=[];for(r=0;r<n;r++)i[r]&&s.push(e[r]);return s}function Rn(e,t,n,i,r){var s,o,a,l=0;for(o=i+1;o<=r-1;o++)(a=In(e[o],e[i],e[r],!0))>l&&(s=o,l=a);l>n&&(t[s]=1,Rn(e,t,n,i,s),Rn(e,t,n,s,r))}function Mn(e,t){for(var n=[e[0]],i=1,r=0,s=e.length;i<s;i++)Dn(e[i],e[r])>t&&(n.push(e[i]),r=i);return r<s-1&&n.push(e[s-1]),n}function Ln(e,t,n,i,r){var s,o,a,l=i?Tn:zn(e,n),u=zn(t,n);for(Tn=u;;){if(!(l|u))return[e,t];if(l&u)return!1;a=zn(o=Nn(e,t,s=l||u,n,r),n),s===l?(e=o,l=a):(t=o,u=a)}}function Nn(e,t,n,i,r){var s,o,a=t.x-e.x,l=t.y-e.y,u=i.min,c=i.max;return 8&n?(s=e.x+a*(c.y-e.y)/l,o=c.y):4&n?(s=e.x+a*(u.y-e.y)/l,o=u.y):2&n?(s=c.x,o=e.y+l*(c.x-e.x)/a):1&n&&(s=u.x,o=e.y+l*(u.x-e.x)/a),new M(s,o,r)}function zn(e,t){var n=0;return e.x<t.min.x?n|=1:e.x>t.max.x&&(n|=2),e.y<t.min.y?n|=4:e.y>t.max.y&&(n|=8),n}function Dn(e,t){var n=t.x-e.x,i=t.y-e.y;return n*n+i*i}function In(e,t,n,i){var r,s=t.x,o=t.y,a=n.x-s,l=n.y-o,u=a*a+l*l;return u>0&&((r=((e.x-s)*a+(e.y-o)*l)/u)>1?(s=n.x,o=n.y):r>0&&(s+=a*r,o+=l*r)),a=e.x-s,l=e.y-o,i?a*a+l*l:new M(s,o)}function Fn(e){return!g(e[0])||"object"!=typeof e[0][0]&&void 0!==e[0][0]}function jn(e){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Fn(e)}function Bn(e,t){var n,i,r,s,o,a,l,u;if(!e||0===e.length)throw new Error("latlngs not passed");Fn(e)||(console.warn("latlngs are not flat! Only the first ring will be used"),e=e[0]);var c=U([0,0]),h=j(e);h.getNorthWest().distanceTo(h.getSouthWest())*h.getNorthEast().distanceTo(h.getNorthWest())<1700&&(c=An(e));var d=e.length,f=[];for(n=0;n<d;n++){var p=U(e[n]);f.push(t.project(U([p.lat-c.lat,p.lng-c.lng])))}for(n=0,i=0;n<d-1;n++)i+=f[n].distanceTo(f[n+1])/2;if(0===i)u=f[0];else for(n=0,s=0;n<d-1;n++)if(o=f[n],a=f[n+1],(s+=r=o.distanceTo(a))>i){l=(s-i)/r,u=[a.x-l*(a.x-o.x),a.y-l*(a.y-o.y)];break}var m=t.unproject(z(u));return U([m.lat+c.lat,m.lng+c.lng])}var Un={__proto__:null,simplify:Sn,pointToSegmentDistance:On,closestPointOnSegment:Pn,clipSegment:Ln,_getEdgeIntersection:Nn,_getBitCode:zn,_sqClosestPointOnSegment:In,isFlat:Fn,_flat:jn,polylineCenter:Bn},Vn={project:function(e){return new M(e.lng,e.lat)},unproject:function(e){return new B(e.y,e.x)},bounds:new D([-180,-90],[180,90])},Gn={R:6378137,R_MINOR:6356752.314245179,bounds:new D([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(e){var t=Math.PI/180,n=this.R,i=e.lat*t,r=this.R_MINOR/n,s=Math.sqrt(1-r*r),o=s*Math.sin(i),a=Math.tan(Math.PI/4-i/2)/Math.pow((1-o)/(1+o),s/2);return i=-n*Math.log(Math.max(a,1e-10)),new M(e.lng*t*n,i)},unproject:function(e){for(var t,n=180/Math.PI,i=this.R,r=this.R_MINOR/i,s=Math.sqrt(1-r*r),o=Math.exp(-e.y/i),a=Math.PI/2-2*Math.atan(o),l=0,u=.1;l<15&&Math.abs(u)>1e-7;l++)t=s*Math.sin(a),t=Math.pow((1-t)/(1+t),s/2),a+=u=Math.PI/2-2*Math.atan(o*t)-a;return new B(a*n,e.x*n/i)}},$n={__proto__:null,LonLat:Vn,Mercator:Gn,SphericalMercator:q},Zn=n({},$,{code:"EPSG:3395",projection:Gn,transformation:function(){var e=.5/(Math.PI*Gn.R);return H(e,.5,-e,.5)}()}),qn=n({},$,{code:"EPSG:4326",projection:Vn,transformation:H(1/180,1,-1/180,.5)}),Wn=n({},G,{projection:Vn,transformation:H(1,0,-1,0),scale:function(e){return Math.pow(2,e)},zoom:function(e){return Math.log(e)/Math.LN2},distance:function(e,t){var n=t.lng-e.lng,i=t.lat-e.lat;return Math.sqrt(n*n+i*i)},infinite:!0});G.Earth=$,G.EPSG3395=Zn,G.EPSG3857=K,G.EPSG900913=Y,G.EPSG4326=qn,G.Simple=Wn;var Hn=R.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(e){return e.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(e){return e&&e.removeLayer(this),this},getPane:function(e){return this._map.getPane(e?this.options[e]||e:this.options.pane)},addInteractiveTarget:function(e){return this._map._targets[o(e)]=this,this},removeInteractiveTarget:function(e){return delete this._map._targets[o(e)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(e){var t=e.target;if(t.hasLayer(this)){if(this._map=t,this._zoomAnimated=t._zoomAnimated,this.getEvents){var n=this.getEvents();t.on(n,this),this.once("remove",function(){t.off(n,this)},this)}this.onAdd(t),this.fire("add"),t.fire("layeradd",{layer:this})}}});sn.include({addLayer:function(e){if(!e._layerAdd)throw new Error("The provided object is not a Layer.");var t=o(e);return this._layers[t]||(this._layers[t]=e,e._mapToAdd=this,e.beforeAdd&&e.beforeAdd(this),this.whenReady(e._layerAdd,e)),this},removeLayer:function(e){var t=o(e);return this._layers[t]?(this._loaded&&e.onRemove(this),delete this._layers[t],this._loaded&&(this.fire("layerremove",{layer:e}),e.fire("remove")),e._map=e._mapToAdd=null,this):this},hasLayer:function(e){return o(e)in this._layers},eachLayer:function(e,t){for(var n in this._layers)e.call(t,this._layers[n]);return this},_addLayers:function(e){for(var t=0,n=(e=e?g(e)?e:[e]:[]).length;t<n;t++)this.addLayer(e[t])},_addZoomLimit:function(e){isNaN(e.options.maxZoom)&&isNaN(e.options.minZoom)||(this._zoomBoundLayers[o(e)]=e,this._updateZoomLevels())},_removeZoomLimit:function(e){var t=o(e);this._zoomBoundLayers[t]&&(delete this._zoomBoundLayers[t],this._updateZoomLevels())},_updateZoomLevels:function(){var e=1/0,t=-1/0,n=this._getZoomSpan();for(var i in this._zoomBoundLayers){var r=this._zoomBoundLayers[i].options;e=void 0===r.minZoom?e:Math.min(e,r.minZoom),t=void 0===r.maxZoom?t:Math.max(t,r.maxZoom)}this._layersMaxZoom=t===-1/0?void 0:t,this._layersMinZoom=e===1/0?void 0:e,n!==this._getZoomSpan()&&this.fire("zoomlevelschange"),void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Kn=Hn.extend({initialize:function(e,t){var n,i;if(f(this,t),this._layers={},e)for(n=0,i=e.length;n<i;n++)this.addLayer(e[n])},addLayer:function(e){var t=this.getLayerId(e);return this._layers[t]=e,this._map&&this._map.addLayer(e),this},removeLayer:function(e){var t=e in this._layers?e:this.getLayerId(e);return this._map&&this._layers[t]&&this._map.removeLayer(this._layers[t]),delete this._layers[t],this},hasLayer:function(e){return("number"==typeof e?e:this.getLayerId(e))in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(e){var t,n,i=Array.prototype.slice.call(arguments,1);for(t in this._layers)(n=this._layers[t])[e]&&n[e].apply(n,i);return this},onAdd:function(e){this.eachLayer(e.addLayer,e)},onRemove:function(e){this.eachLayer(e.removeLayer,e)},eachLayer:function(e,t){for(var n in this._layers)e.call(t,this._layers[n]);return this},getLayer:function(e){return this._layers[e]},getLayers:function(){var e=[];return this.eachLayer(e.push,e),e},setZIndex:function(e){return this.invoke("setZIndex",e)},getLayerId:function(e){return o(e)}}),Yn=function(e,t){return new Kn(e,t)},Xn=Kn.extend({addLayer:function(e){return this.hasLayer(e)?this:(e.addEventParent(this),Kn.prototype.addLayer.call(this,e),this.fire("layeradd",{layer:e}))},removeLayer:function(e){return this.hasLayer(e)?(e in this._layers&&(e=this._layers[e]),e.removeEventParent(this),Kn.prototype.removeLayer.call(this,e),this.fire("layerremove",{layer:e})):this},setStyle:function(e){return this.invoke("setStyle",e)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var e=new F;for(var t in this._layers){var n=this._layers[t];e.extend(n.getBounds?n.getBounds():n.getLatLng())}return e}}),Qn=function(e,t){return new Xn(e,t)},Jn=O.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(e){f(this,e)},createIcon:function(e){return this._createIcon("icon",e)},createShadow:function(e){return this._createIcon("shadow",e)},_createIcon:function(e,t){var n=this._getIconUrl(e);if(!n){if("icon"===e)throw new Error("iconUrl not set in Icon options (see the docs).");return null}var i=this._createImg(n,t&&"IMG"===t.tagName?t:null);return this._setIconStyles(i,e),(this.options.crossOrigin||""===this.options.crossOrigin)&&(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),i},_setIconStyles:function(e,t){var n=this.options,i=n[t+"Size"];"number"==typeof i&&(i=[i,i]);var r=z(i),s=z("shadow"===t&&n.shadowAnchor||n.iconAnchor||r&&r.divideBy(2,!0));e.className="leaflet-marker-"+t+" "+(n.className||""),s&&(e.style.marginLeft=-s.x+"px",e.style.marginTop=-s.y+"px"),r&&(e.style.width=r.x+"px",e.style.height=r.y+"px")},_createImg:function(e,t){return(t=t||document.createElement("img")).src=e,t},_getIconUrl:function(e){return Fe.retina&&this.options[e+"RetinaUrl"]||this.options[e+"Url"]}});function ei(e){return new Jn(e)}var ti=Jn.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(e){return"string"!=typeof ti.imagePath&&(ti.imagePath=this._detectIconPath()),(this.options.imagePath||ti.imagePath)+Jn.prototype._getIconUrl.call(this,e)},_stripUrl:function(e){var t=function(e,t,n){var i=t.exec(e);return i&&i[n]};return(e=t(e,/^url\((['"])?(.+)\1\)$/,2))&&t(e,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var e=mt("div","leaflet-default-icon-path",document.body),t=pt(e,"background-image")||pt(e,"backgroundImage");if(document.body.removeChild(e),t=this._stripUrl(t))return t;var n=document.querySelector('link[href$="leaflet.css"]');return n?n.href.substring(0,n.href.length-11-1):""}}),ni=yn.extend({initialize:function(e){this._marker=e},addHooks:function(){var e=this._marker._icon;this._draggable||(this._draggable=new xn(e,e,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),xt(e,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&wt(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(e){var t=this._marker,n=t._map,i=this._marker.options.autoPanSpeed,r=this._marker.options.autoPanPadding,s=Ct(t._icon),o=n.getPixelBounds(),a=n.getPixelOrigin(),l=I(o.min._subtract(a).add(r),o.max._subtract(a).subtract(r));if(!l.contains(s)){var u=z((Math.max(l.max.x,s.x)-l.max.x)/(o.max.x-l.max.x)-(Math.min(l.min.x,s.x)-l.min.x)/(o.min.x-l.min.x),(Math.max(l.max.y,s.y)-l.max.y)/(o.max.y-l.max.y)-(Math.min(l.min.y,s.y)-l.min.y)/(o.min.y-l.min.y)).multiplyBy(i);n.panBy(u,{animate:!1}),this._draggable._newPos._add(u),this._draggable._startPos._add(u),Pt(t._icon,this._draggable._newPos),this._onDrag(e),this._panRequest=T(this._adjustPan.bind(this,e))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(e){this._marker.options.autoPan&&(k(this._panRequest),this._panRequest=T(this._adjustPan.bind(this,e)))},_onDrag:function(e){var t=this._marker,n=t._shadow,i=Ct(t._icon),r=t._map.layerPointToLatLng(i);n&&Pt(n,i),t._latlng=r,e.latlng=r,e.oldLatLng=this._oldLatLng,t.fire("move",e).fire("drag",e)},_onDragEnd:function(e){k(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",e)}}),ii=Hn.extend({options:{icon:new ti,interactive:!0,keyboard:!0,title:"",alt:"Marker",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(e,t){f(this,t),this._latlng=U(e)},onAdd:function(e){this._zoomAnimated=this._zoomAnimated&&e.options.markerZoomAnimation,this._zoomAnimated&&e.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(e){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&e.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(e){var t=this._latlng;return this._latlng=U(e),this.update(),this.fire("move",{oldLatLng:t,latlng:this._latlng})},setZIndexOffset:function(e){return this.options.zIndexOffset=e,this.update()},getIcon:function(){return this.options.icon},setIcon:function(e){return this.options.icon=e,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var e=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(e)}return this},_initIcon:function(){var e=this.options,t="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),n=e.icon.createIcon(this._icon),i=!1;n!==this._icon&&(this._icon&&this._removeIcon(),i=!0,e.title&&(n.title=e.title),"IMG"===n.tagName&&(n.alt=e.alt||"")),xt(n,t),e.keyboard&&(n.tabIndex="0",n.setAttribute("role","button")),this._icon=n,e.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&jt(n,"focus",this._panOnFocus,this);var r=e.icon.createShadow(this._shadow),s=!1;r!==this._shadow&&(this._removeShadow(),s=!0),r&&(xt(r,t),r.alt=""),this._shadow=r,e.opacity<1&&this._updateOpacity(),i&&this.getPane().appendChild(this._icon),this._initInteraction(),r&&s&&this.getPane(e.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Ut(this._icon,"focus",this._panOnFocus,this),_t(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&_t(this._shadow),this._shadow=null},_setPos:function(e){this._icon&&Pt(this._icon,e),this._shadow&&Pt(this._shadow,e),this._zIndex=e.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(e){this._icon&&(this._icon.style.zIndex=this._zIndex+e)},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center).round();this._setPos(t)},_initInteraction:function(){if(this.options.interactive&&(xt(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),ni)){var e=this.options.draggable;this.dragging&&(e=this.dragging.enabled(),this.dragging.disable()),this.dragging=new ni(this),e&&this.dragging.enable()}},setOpacity:function(e){return this.options.opacity=e,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var e=this.options.opacity;this._icon&&Tt(this._icon,e),this._shadow&&Tt(this._shadow,e)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var e=this._map;if(e){var t=this.options.icon.options,n=t.iconSize?z(t.iconSize):z(0,0),i=t.iconAnchor?z(t.iconAnchor):z(0,0);e.panInside(this._latlng,{paddingTopLeft:i,paddingBottomRight:n.subtract(i)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function ri(e,t){return new ii(e,t)}var si=Hn.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(e){this._renderer=e.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(e){return f(this,e),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&e&&Object.prototype.hasOwnProperty.call(e,"weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),oi=si.extend({options:{fill:!0,radius:10},initialize:function(e,t){f(this,t),this._latlng=U(e),this._radius=this.options.radius},setLatLng:function(e){var t=this._latlng;return this._latlng=U(e),this.redraw(),this.fire("move",{oldLatLng:t,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(e){return this.options.radius=this._radius=e,this.redraw()},getRadius:function(){return this._radius},setStyle:function(e){var t=e&&e.radius||this._radius;return si.prototype.setStyle.call(this,e),this.setRadius(t),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var e=this._radius,t=this._radiusY||e,n=this._clickTolerance(),i=[e+n,t+n];this._pxBounds=new D(this._point.subtract(i),this._point.add(i))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(e){return e.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function ai(e,t){return new oi(e,t)}var li=oi.extend({initialize:function(e,t,i){if("number"==typeof t&&(t=n({},i,{radius:t})),f(this,t),this._latlng=U(e),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(e){return this._mRadius=e,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var e=[this._radius,this._radiusY||this._radius];return new F(this._map.layerPointToLatLng(this._point.subtract(e)),this._map.layerPointToLatLng(this._point.add(e)))},setStyle:si.prototype.setStyle,_project:function(){var e=this._latlng.lng,t=this._latlng.lat,n=this._map,i=n.options.crs;if(i.distance===$.distance){var r=Math.PI/180,s=this._mRadius/$.R/r,o=n.project([t+s,e]),a=n.project([t-s,e]),l=o.add(a).divideBy(2),u=n.unproject(l).lat,c=Math.acos((Math.cos(s*r)-Math.sin(t*r)*Math.sin(u*r))/(Math.cos(t*r)*Math.cos(u*r)))/r;(isNaN(c)||0===c)&&(c=s/Math.cos(Math.PI/180*t)),this._point=l.subtract(n.getPixelOrigin()),this._radius=isNaN(c)?0:l.x-n.project([u,e-c]).x,this._radiusY=l.y-o.y}else{var h=i.unproject(i.project(this._latlng).subtract([this._mRadius,0]));this._point=n.latLngToLayerPoint(this._latlng),this._radius=this._point.x-n.latLngToLayerPoint(h).x}this._updateBounds()}});function ui(e,t,n){return new li(e,t,n)}var ci=si.extend({options:{smoothFactor:1,noClip:!1},initialize:function(e,t){f(this,t),this._setLatLngs(e)},getLatLngs:function(){return this._latlngs},setLatLngs:function(e){return this._setLatLngs(e),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(e){for(var t,n,i=1/0,r=null,s=In,o=0,a=this._parts.length;o<a;o++)for(var l=this._parts[o],u=1,c=l.length;u<c;u++){var h=s(e,t=l[u-1],n=l[u],!0);h<i&&(i=h,r=s(e,t,n))}return r&&(r.distance=Math.sqrt(i)),r},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Bn(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(e,t){return t=t||this._defaultShape(),e=U(e),t.push(e),this._bounds.extend(e),this.redraw()},_setLatLngs:function(e){this._bounds=new F,this._latlngs=this._convertLatLngs(e)},_defaultShape:function(){return Fn(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(e){for(var t=[],n=Fn(e),i=0,r=e.length;i<r;i++)n?(t[i]=U(e[i]),this._bounds.extend(t[i])):t[i]=this._convertLatLngs(e[i]);return t},_project:function(){var e=new D;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,e),this._bounds.isValid()&&e.isValid()&&(this._rawPxBounds=e,this._updateBounds())},_updateBounds:function(){var e=this._clickTolerance(),t=new M(e,e);this._rawPxBounds&&(this._pxBounds=new D([this._rawPxBounds.min.subtract(t),this._rawPxBounds.max.add(t)]))},_projectLatlngs:function(e,t,n){var i,r,s=e[0]instanceof B,o=e.length;if(s){for(r=[],i=0;i<o;i++)r[i]=this._map.latLngToLayerPoint(e[i]),n.extend(r[i]);t.push(r)}else for(i=0;i<o;i++)this._projectLatlngs(e[i],t,n)},_clipPoints:function(){var e=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(e))if(this.options.noClip)this._parts=this._rings;else{var t,n,i,r,s,o,a,l=this._parts;for(t=0,i=0,r=this._rings.length;t<r;t++)for(n=0,s=(a=this._rings[t]).length;n<s-1;n++)(o=Ln(a[n],a[n+1],e,n,!0))&&(l[i]=l[i]||[],l[i].push(o[0]),o[1]===a[n+1]&&n!==s-2||(l[i].push(o[1]),i++))}},_simplifyPoints:function(){for(var e=this._parts,t=this.options.smoothFactor,n=0,i=e.length;n<i;n++)e[n]=Sn(e[n],t)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(e,t){var n,i,r,s,o,a,l=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(e))return!1;for(n=0,s=this._parts.length;n<s;n++)for(i=0,r=(o=(a=this._parts[n]).length)-1;i<o;r=i++)if((t||0!==i)&&On(e,a[r],a[i])<=l)return!0;return!1}});function hi(e,t){return new ci(e,t)}ci._flat=jn;var di=ci.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return En(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(e){var t=ci.prototype._convertLatLngs.call(this,e),n=t.length;return n>=2&&t[0]instanceof B&&t[0].equals(t[n-1])&&t.pop(),t},_setLatLngs:function(e){ci.prototype._setLatLngs.call(this,e),Fn(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Fn(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var e=this._renderer._bounds,t=this.options.weight,n=new M(t,t);if(e=new D(e.min.subtract(n),e.max.add(n)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(e))if(this.options.noClip)this._parts=this._rings;else for(var i,r=0,s=this._rings.length;r<s;r++)(i=wn(this._rings[r],e,!0)).length&&this._parts.push(i)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(e){var t,n,i,r,s,o,a,l,u=!1;if(!this._pxBounds||!this._pxBounds.contains(e))return!1;for(r=0,a=this._parts.length;r<a;r++)for(s=0,o=(l=(t=this._parts[r]).length)-1;s<l;o=s++)n=t[s],i=t[o],n.y>e.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(u=!u);return u||ci.prototype._containsPoint.call(this,e,!0)}});function fi(e,t){return new di(e,t)}var pi=Xn.extend({initialize:function(e,t){f(this,t),this._layers={},e&&this.addData(e)},addData:function(e){var t,n,i,r=g(e)?e:e.features;if(r){for(t=0,n=r.length;t<n;t++)((i=r[t]).geometries||i.geometry||i.features||i.coordinates)&&this.addData(i);return this}var s=this.options;if(s.filter&&!s.filter(e))return this;var o=mi(e,s);return o?(o.feature=wi(e),o.defaultOptions=o.options,this.resetStyle(o),s.onEachFeature&&s.onEachFeature(e,o),this.addLayer(o)):this},resetStyle:function(e){return void 0===e?this.eachLayer(this.resetStyle,this):(e.options=n({},e.defaultOptions),this._setLayerStyle(e,this.options.style),this)},setStyle:function(e){return this.eachLayer(function(t){this._setLayerStyle(t,e)},this)},_setLayerStyle:function(e,t){e.setStyle&&("function"==typeof t&&(t=t(e.feature)),e.setStyle(t))}});function mi(e,t){var n,i,r,s,o="Feature"===e.type?e.geometry:e,a=o?o.coordinates:null,l=[],u=t&&t.pointToLayer,c=t&&t.coordsToLatLng||gi;if(!a&&!o)return null;switch(o.type){case"Point":return _i(u,e,n=c(a),t);case"MultiPoint":for(r=0,s=a.length;r<s;r++)n=c(a[r]),l.push(_i(u,e,n,t));return new Xn(l);case"LineString":case"MultiLineString":return i=yi(a,"LineString"===o.type?0:1,c),new ci(i,t);case"Polygon":case"MultiPolygon":return i=yi(a,"Polygon"===o.type?1:2,c),new di(i,t);case"GeometryCollection":for(r=0,s=o.geometries.length;r<s;r++){var h=mi({geometry:o.geometries[r],type:"Feature",properties:e.properties},t);h&&l.push(h)}return new Xn(l);case"FeatureCollection":for(r=0,s=o.features.length;r<s;r++){var d=mi(o.features[r],t);d&&l.push(d)}return new Xn(l);default:throw new Error("Invalid GeoJSON object.")}}function _i(e,t,n,i){return e?e(t,n):new ii(n,i&&i.markersInheritOptions&&i)}function gi(e){return new B(e[1],e[0],e[2])}function yi(e,t,n){for(var i,r=[],s=0,o=e.length;s<o;s++)i=t?yi(e[s],t-1,n):(n||gi)(e[s]),r.push(i);return r}function vi(e,t){return void 0!==(e=U(e)).alt?[c(e.lng,t),c(e.lat,t),c(e.alt,t)]:[c(e.lng,t),c(e.lat,t)]}function bi(e,t,n,i){for(var r=[],s=0,o=e.length;s<o;s++)r.push(t?bi(e[s],Fn(e[s])?0:t-1,n,i):vi(e[s],i));return!t&&n&&r.length>0&&r.push(r[0].slice()),r}function xi(e,t){return e.feature?n({},e.feature,{geometry:t}):wi(t)}function wi(e){return"Feature"===e.type||"FeatureCollection"===e.type?e:{type:"Feature",properties:{},geometry:e}}var Ei={toGeoJSON:function(e){return xi(this,{type:"Point",coordinates:vi(this.getLatLng(),e)})}};function Ai(e,t){return new pi(e,t)}ii.include(Ei),li.include(Ei),oi.include(Ei),ci.include({toGeoJSON:function(e){var t=!Fn(this._latlngs);return xi(this,{type:(t?"Multi":"")+"LineString",coordinates:bi(this._latlngs,t?1:0,!1,e)})}}),di.include({toGeoJSON:function(e){var t=!Fn(this._latlngs),n=t&&!Fn(this._latlngs[0]),i=bi(this._latlngs,n?2:t?1:0,!0,e);return t||(i=[i]),xi(this,{type:(n?"Multi":"")+"Polygon",coordinates:i})}}),Kn.include({toMultiPoint:function(e){var t=[];return this.eachLayer(function(n){t.push(n.toGeoJSON(e).geometry.coordinates)}),xi(this,{type:"MultiPoint",coordinates:t})},toGeoJSON:function(e){var t=this.feature&&this.feature.geometry&&this.feature.geometry.type;if("MultiPoint"===t)return this.toMultiPoint(e);var n="GeometryCollection"===t,i=[];return this.eachLayer(function(t){if(t.toGeoJSON){var r=t.toGeoJSON(e);if(n)i.push(r.geometry);else{var s=wi(r);"FeatureCollection"===s.type?i.push.apply(i,s.features):i.push(s)}}}),n?xi(this,{geometries:i,type:"GeometryCollection"}):{type:"FeatureCollection",features:i}}});var Ti=Ai,ki=Hn.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(e,t,n){this._url=e,this._bounds=j(t),f(this,n)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(xt(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){_t(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(e){return this.options.opacity=e,this._image&&this._updateOpacity(),this},setStyle:function(e){return e.opacity&&this.setOpacity(e.opacity),this},bringToFront:function(){return this._map&&yt(this._image),this},bringToBack:function(){return this._map&&vt(this._image),this},setUrl:function(e){return this._url=e,this._image&&(this._image.src=e),this},setBounds:function(e){return this._bounds=j(e),this._map&&this._reset(),this},getEvents:function(){var e={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},setZIndex:function(e){return this.options.zIndex=e,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var e="IMG"===this._url.tagName,t=this._image=e?this._url:mt("img");xt(t,"leaflet-image-layer"),this._zoomAnimated&&xt(t,"leaflet-zoom-animated"),this.options.className&&xt(t,this.options.className),t.onselectstart=u,t.onmousemove=u,t.onload=r(this.fire,this,"load"),t.onerror=r(this._overlayOnError,this,"error"),(this.options.crossOrigin||""===this.options.crossOrigin)&&(t.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),e?this._url=t.src:(t.src=this._url,t.alt=this.options.alt)},_animateZoom:function(e){var t=this._map.getZoomScale(e.zoom),n=this._map._latLngBoundsToNewLayerBounds(this._bounds,e.zoom,e.center).min;Ot(this._image,n,t)},_reset:function(){var e=this._image,t=new D(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),n=t.getSize();Pt(e,t.min),e.style.width=n.x+"px",e.style.height=n.y+"px"},_updateOpacity:function(){Tt(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var e=this.options.errorOverlayUrl;e&&this._url!==e&&(this._url=e,this._image.src=e)},getCenter:function(){return this._bounds.getCenter()}}),Si=function(e,t,n){return new ki(e,t,n)},Oi=ki.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var e="VIDEO"===this._url.tagName,t=this._image=e?this._url:mt("video");if(xt(t,"leaflet-image-layer"),this._zoomAnimated&&xt(t,"leaflet-zoom-animated"),this.options.className&&xt(t,this.options.className),t.onselectstart=u,t.onmousemove=u,t.onloadeddata=r(this.fire,this,"load"),e){for(var n=t.getElementsByTagName("source"),i=[],s=0;s<n.length;s++)i.push(n[s].src);this._url=n.length>0?i:[t.src]}else{g(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(t.style,"objectFit")&&(t.style.objectFit="fill"),t.autoplay=!!this.options.autoplay,t.loop=!!this.options.loop,t.muted=!!this.options.muted,t.playsInline=!!this.options.playsInline;for(var o=0;o<this._url.length;o++){var a=mt("source");a.src=this._url[o],t.appendChild(a)}}}});function Pi(e,t,n){return new Oi(e,t,n)}var Ci=ki.extend({_initImage:function(){var e=this._image=this._url;xt(e,"leaflet-image-layer"),this._zoomAnimated&&xt(e,"leaflet-zoom-animated"),this.options.className&&xt(e,this.options.className),e.onselectstart=u,e.onmousemove=u}});function Ri(e,t,n){return new Ci(e,t,n)}var Mi=Hn.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(e,t){e&&(e instanceof B||g(e))?(this._latlng=U(e),f(this,t)):(f(this,e),this._source=t),this.options.content&&(this._content=this.options.content)},openOn:function(e){return(e=arguments.length?e:this._source._map).hasLayer(this)||e.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(e){return this._map?this.close():(arguments.length?this._source=e:e=this._source,this._prepareOpen(),this.openOn(e._map)),this},onAdd:function(e){this._zoomAnimated=e._zoomAnimated,this._container||this._initLayout(),e._fadeAnimated&&Tt(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),e._fadeAnimated&&Tt(this._container,1),this.bringToFront(),this.options.interactive&&(xt(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(e){e._fadeAnimated?(Tt(this._container,0),this._removeTimeout=setTimeout(r(_t,void 0,this._container),200)):_t(this._container),this.options.interactive&&(wt(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(e){return this._latlng=U(e),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(e){return this._content=e,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var e={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&yt(this._container),this},bringToBack:function(){return this._map&&vt(this._container),this},_prepareOpen:function(e){var t=this._source;if(!t._map)return!1;if(t instanceof Xn){t=null;var n=this._source._layers;for(var i in n)if(n[i]._map){t=n[i];break}if(!t)return!1;this._source=t}if(!e)if(t.getCenter)e=t.getCenter();else if(t.getLatLng)e=t.getLatLng();else{if(!t.getBounds)throw new Error("Unable to get source layer LatLng.");e=t.getBounds().getCenter()}return this.setLatLng(e),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var e=this._contentNode,t="function"==typeof this._content?this._content(this._source||this):this._content;if("string"==typeof t)e.innerHTML=t;else{for(;e.hasChildNodes();)e.removeChild(e.firstChild);e.appendChild(t)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var e=this._map.latLngToLayerPoint(this._latlng),t=z(this.options.offset),n=this._getAnchor();this._zoomAnimated?Pt(this._container,e.add(n)):t=t.add(e).add(n);var i=this._containerBottom=-t.y,r=this._containerLeft=-Math.round(this._containerWidth/2)+t.x;this._container.style.bottom=i+"px",this._container.style.left=r+"px"}},_getAnchor:function(){return[0,0]}});sn.include({_initOverlay:function(e,t,n,i){var r=t;return r instanceof e||(r=new e(i).setContent(t)),n&&r.setLatLng(n),r}}),Hn.include({_initOverlay:function(e,t,n,i){var r=n;return r instanceof e?(f(r,i),r._source=this):(r=t&&!i?t:new e(i,this)).setContent(n),r}});var Li=Mi.extend({options:{pane:"popupPane",offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(e){return!(e=arguments.length?e:this._source._map).hasLayer(this)&&e._popup&&e._popup.options.autoClose&&e.removeLayer(e._popup),e._popup=this,Mi.prototype.openOn.call(this,e)},onAdd:function(e){Mi.prototype.onAdd.call(this,e),e.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof si||this._source.on("preclick",qt))},onRemove:function(e){Mi.prototype.onRemove.call(this,e),e.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof si||this._source.off("preclick",qt))},getEvents:function(){var e=Mi.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(e.preclick=this.close),this.options.keepInView&&(e.moveend=this._adjustPan),e},_initLayout:function(){var e="leaflet-popup",t=this._container=mt("div",e+" "+(this.options.className||"")+" leaflet-zoom-animated"),n=this._wrapper=mt("div",e+"-content-wrapper",t);if(this._contentNode=mt("div",e+"-content",n),Ht(t),Wt(this._contentNode),jt(t,"contextmenu",qt),this._tipContainer=mt("div",e+"-tip-container",t),this._tip=mt("div",e+"-tip",this._tipContainer),this.options.closeButton){var i=this._closeButton=mt("a",e+"-close-button",t);i.setAttribute("role","button"),i.setAttribute("aria-label","Close popup"),i.href="#close",i.innerHTML='<span aria-hidden="true">×</span>',jt(i,"click",function(e){Kt(e),this.close()},this)}},_updateLayout:function(){var e=this._contentNode,t=e.style;t.width="",t.whiteSpace="nowrap";var n=e.offsetWidth;n=Math.min(n,this.options.maxWidth),n=Math.max(n,this.options.minWidth),t.width=n+1+"px",t.whiteSpace="",t.height="";var i=e.offsetHeight,r=this.options.maxHeight,s="leaflet-popup-scrolled";r&&i>r?(t.height=r+"px",xt(e,s)):wt(e,s),this._containerWidth=this._container.offsetWidth},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center),n=this._getAnchor();Pt(this._container,t.add(n))},_adjustPan:function(){if(this.options.autoPan)if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning)this._autopanning=!1;else{var e=this._map,t=parseInt(pt(this._container,"marginBottom"),10)||0,n=this._container.offsetHeight+t,i=this._containerWidth,r=new M(this._containerLeft,-n-this._containerBottom);r._add(Ct(this._container));var s=e.layerPointToContainerPoint(r),o=z(this.options.autoPanPadding),a=z(this.options.autoPanPaddingTopLeft||o),l=z(this.options.autoPanPaddingBottomRight||o),u=e.getSize(),c=0,h=0;s.x+i+l.x>u.x&&(c=s.x+i-u.x+l.x),s.x-c-a.x<0&&(c=s.x-a.x),s.y+n+l.y>u.y&&(h=s.y+n-u.y+l.y),s.y-h-a.y<0&&(h=s.y-a.y),(c||h)&&(this.options.keepInView&&(this._autopanning=!0),e.fire("autopanstart").panBy([c,h]))}},_getAnchor:function(){return z(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Ni=function(e,t){return new Li(e,t)};sn.mergeOptions({closePopupOnClick:!0}),sn.include({openPopup:function(e,t,n){return this._initOverlay(Li,e,t,n).openOn(this),this},closePopup:function(e){return(e=arguments.length?e:this._popup)&&e.close(),this}}),Hn.include({bindPopup:function(e,t){return this._popup=this._initOverlay(Li,this._popup,e,t),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(e){return this._popup&&(this instanceof Xn||(this._popup._source=this),this._popup._prepareOpen(e||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(e){return this._popup&&this._popup.setContent(e),this},getPopup:function(){return this._popup},_openPopup:function(e){if(this._popup&&this._map){Yt(e);var t=e.layer||e.target;this._popup._source!==t||t instanceof si?(this._popup._source=t,this.openPopup(e.latlng)):this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(e.latlng)}},_movePopup:function(e){this._popup.setLatLng(e.latlng)},_onKeyPress:function(e){13===e.originalEvent.keyCode&&this._openPopup(e)}});var zi=Mi.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(e){Mi.prototype.onAdd.call(this,e),this.setOpacity(this.options.opacity),e.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(e){Mi.prototype.onRemove.call(this,e),e.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var e=Mi.prototype.getEvents.call(this);return this.options.permanent||(e.preclick=this.close),e},_initLayout:function(){var e="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=mt("div",e),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+o(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(e){var t,n,i=this._map,r=this._container,s=i.latLngToContainerPoint(i.getCenter()),o=i.layerPointToContainerPoint(e),a=this.options.direction,l=r.offsetWidth,u=r.offsetHeight,c=z(this.options.offset),h=this._getAnchor();"top"===a?(t=l/2,n=u):"bottom"===a?(t=l/2,n=0):"center"===a?(t=l/2,n=u/2):"right"===a?(t=0,n=u/2):"left"===a?(t=l,n=u/2):o.x<s.x?(a="right",t=0,n=u/2):(a="left",t=l+2*(c.x+h.x),n=u/2),e=e.subtract(z(t,n,!0)).add(c).add(h),wt(r,"leaflet-tooltip-right"),wt(r,"leaflet-tooltip-left"),wt(r,"leaflet-tooltip-top"),wt(r,"leaflet-tooltip-bottom"),xt(r,"leaflet-tooltip-"+a),Pt(r,e)},_updatePosition:function(){var e=this._map.latLngToLayerPoint(this._latlng);this._setPosition(e)},setOpacity:function(e){this.options.opacity=e,this._container&&Tt(this._container,e)},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center);this._setPosition(t)},_getAnchor:function(){return z(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Di=function(e,t){return new zi(e,t)};sn.include({openTooltip:function(e,t,n){return this._initOverlay(zi,e,t,n).openOn(this),this},closeTooltip:function(e){return e.close(),this}}),Hn.include({bindTooltip:function(e,t){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(zi,this._tooltip,e,t),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(e){if(e||!this._tooltipHandlersAdded){var t=e?"off":"on",n={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?n.add=this._openTooltip:(n.mouseover=this._openTooltip,n.mouseout=this.closeTooltip,n.click=this._openTooltip,this._map?this._addFocusListeners():n.add=this._addFocusListeners),this._tooltip.options.sticky&&(n.mousemove=this._moveTooltip),this[t](n),this._tooltipHandlersAdded=!e}},openTooltip:function(e){return this._tooltip&&(this instanceof Xn||(this._tooltip._source=this),this._tooltip._prepareOpen(e)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(e){return this._tooltip&&this._tooltip.setContent(e),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(e){var t="function"==typeof e.getElement&&e.getElement();t&&(jt(t,"focus",function(){this._tooltip._source=e,this.openTooltip()},this),jt(t,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(e){var t="function"==typeof e.getElement&&e.getElement();t&&t.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(e){if(this._tooltip&&this._map)if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var t=this;this._map.once("moveend",function(){t._openOnceFlag=!1,t._openTooltip(e)})}else this._tooltip._source=e.layer||e.target,this.openTooltip(this._tooltip.options.sticky?e.latlng:void 0)},_moveTooltip:function(e){var t,n,i=e.latlng;this._tooltip.options.sticky&&e.originalEvent&&(t=this._map.mouseEventToContainerPoint(e.originalEvent),n=this._map.containerPointToLayerPoint(t),i=this._map.layerPointToLatLng(n)),this._tooltip.setLatLng(i)}});var Ii=Jn.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(e){var t=e&&"DIV"===e.tagName?e:document.createElement("div"),n=this.options;if(n.html instanceof Element?(gt(t),t.appendChild(n.html)):t.innerHTML=!1!==n.html?n.html:"",n.bgPos){var i=z(n.bgPos);t.style.backgroundPosition=-i.x+"px "+-i.y+"px"}return this._setIconStyles(t,"icon"),t},createShadow:function(){return null}});function Fi(e){return new Ii(e)}Jn.Default=ti;var ji=Hn.extend({options:{tileSize:256,opacity:1,updateWhenIdle:Fe.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(e){f(this,e)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(e){e._addZoomLimit(this)},onRemove:function(e){this._removeAllTiles(),_t(this._container),e._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(yt(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(vt(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(e){return this.options.opacity=e,this._updateOpacity(),this},setZIndex:function(e){return this.options.zIndex=e,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var e=this._clampZoom(this._map.getZoom());e!==this._tileZoom&&(this._tileZoom=e,this._updateLevels()),this._update()}return this},getEvents:function(){var e={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=a(this._onMoveEnd,this.options.updateInterval,this)),e.move=this._onMove),this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},createTile:function(){return document.createElement("div")},getTileSize:function(){var e=this.options.tileSize;return e instanceof M?e:new M(e,e)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(e){for(var t,n=this.getPane().children,i=-e(-1/0,1/0),r=0,s=n.length;r<s;r++)t=n[r].style.zIndex,n[r]!==this._container&&t&&(i=e(i,+t));isFinite(i)&&(this.options.zIndex=i+e(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!Fe.ielt9){Tt(this._container,this.options.opacity);var e=+new Date,t=!1,n=!1;for(var i in this._tiles){var r=this._tiles[i];if(r.current&&r.loaded){var s=Math.min(1,(e-r.loaded)/200);Tt(r.el,s),s<1?t=!0:(r.active?n=!0:this._onOpaqueTile(r),r.active=!0)}}n&&!this._noPrune&&this._pruneTiles(),t&&(k(this._fadeFrame),this._fadeFrame=T(this._updateOpacity,this))}},_onOpaqueTile:u,_initContainer:function(){this._container||(this._container=mt("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var e=this._tileZoom,t=this.options.maxZoom;if(void 0!==e){for(var n in this._levels)n=Number(n),this._levels[n].el.children.length||n===e?(this._levels[n].el.style.zIndex=t-Math.abs(e-n),this._onUpdateLevel(n)):(_t(this._levels[n].el),this._removeTilesAtZoom(n),this._onRemoveLevel(n),delete this._levels[n]);var i=this._levels[e],r=this._map;return i||((i=this._levels[e]={}).el=mt("div","leaflet-tile-container leaflet-zoom-animated",this._container),i.el.style.zIndex=t,i.origin=r.project(r.unproject(r.getPixelOrigin()),e).round(),i.zoom=e,this._setZoomTransform(i,r.getCenter(),r.getZoom()),u(i.el.offsetWidth),this._onCreateLevel(i)),this._level=i,i}},_onUpdateLevel:u,_onRemoveLevel:u,_onCreateLevel:u,_pruneTiles:function(){if(this._map){var e,t,n=this._map.getZoom();if(n>this.options.maxZoom||n<this.options.minZoom)this._removeAllTiles();else{for(e in this._tiles)(t=this._tiles[e]).retain=t.current;for(e in this._tiles)if((t=this._tiles[e]).current&&!t.active){var i=t.coords;this._retainParent(i.x,i.y,i.z,i.z-5)||this._retainChildren(i.x,i.y,i.z,i.z+2)}for(e in this._tiles)this._tiles[e].retain||this._removeTile(e)}}},_removeTilesAtZoom:function(e){for(var t in this._tiles)this._tiles[t].coords.z===e&&this._removeTile(t)},_removeAllTiles:function(){for(var e in this._tiles)this._removeTile(e)},_invalidateAll:function(){for(var e in this._levels)_t(this._levels[e].el),this._onRemoveLevel(Number(e)),delete this._levels[e];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(e,t,n,i){var r=Math.floor(e/2),s=Math.floor(t/2),o=n-1,a=new M(+r,+s);a.z=+o;var l=this._tileCoordsToKey(a),u=this._tiles[l];return u&&u.active?(u.retain=!0,!0):(u&&u.loaded&&(u.retain=!0),o>i&&this._retainParent(r,s,o,i))},_retainChildren:function(e,t,n,i){for(var r=2*e;r<2*e+2;r++)for(var s=2*t;s<2*t+2;s++){var o=new M(r,s);o.z=n+1;var a=this._tileCoordsToKey(o),l=this._tiles[a];l&&l.active?l.retain=!0:(l&&l.loaded&&(l.retain=!0),n+1<i&&this._retainChildren(r,s,n+1,i))}},_resetView:function(e){var t=e&&(e.pinch||e.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),t,t)},_animateZoom:function(e){this._setView(e.center,e.zoom,!0,e.noUpdate)},_clampZoom:function(e){var t=this.options;return void 0!==t.minNativeZoom&&e<t.minNativeZoom?t.minNativeZoom:void 0!==t.maxNativeZoom&&t.maxNativeZoom<e?t.maxNativeZoom:e},_setView:function(e,t,n,i){var r=Math.round(t);r=void 0!==this.options.maxZoom&&r>this.options.maxZoom||void 0!==this.options.minZoom&&r<this.options.minZoom?void 0:this._clampZoom(r);var s=this.options.updateWhenZooming&&r!==this._tileZoom;i&&!s||(this._tileZoom=r,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==r&&this._update(e),n||this._pruneTiles(),this._noPrune=!!n),this._setZoomTransforms(e,t)},_setZoomTransforms:function(e,t){for(var n in this._levels)this._setZoomTransform(this._levels[n],e,t)},_setZoomTransform:function(e,t,n){var i=this._map.getZoomScale(n,e.zoom),r=e.origin.multiplyBy(i).subtract(this._map._getNewPixelOrigin(t,n)).round();Fe.any3d?Ot(e.el,r,i):Pt(e.el,r)},_resetGrid:function(){var e=this._map,t=e.options.crs,n=this._tileSize=this.getTileSize(),i=this._tileZoom,r=this._map.getPixelWorldBounds(this._tileZoom);r&&(this._globalTileRange=this._pxBoundsToTileRange(r)),this._wrapX=t.wrapLng&&!this.options.noWrap&&[Math.floor(e.project([0,t.wrapLng[0]],i).x/n.x),Math.ceil(e.project([0,t.wrapLng[1]],i).x/n.y)],this._wrapY=t.wrapLat&&!this.options.noWrap&&[Math.floor(e.project([t.wrapLat[0],0],i).y/n.x),Math.ceil(e.project([t.wrapLat[1],0],i).y/n.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(e){var t=this._map,n=t._animatingZoom?Math.max(t._animateToZoom,t.getZoom()):t.getZoom(),i=t.getZoomScale(n,this._tileZoom),r=t.project(e,this._tileZoom).floor(),s=t.getSize().divideBy(2*i);return new D(r.subtract(s),r.add(s))},_update:function(e){var t=this._map;if(t){var n=this._clampZoom(t.getZoom());if(void 0===e&&(e=t.getCenter()),void 0!==this._tileZoom){var i=this._getTiledPixelBounds(e),r=this._pxBoundsToTileRange(i),s=r.getCenter(),o=[],a=this.options.keepBuffer,l=new D(r.getBottomLeft().subtract([a,-a]),r.getTopRight().add([a,-a]));if(!(isFinite(r.min.x)&&isFinite(r.min.y)&&isFinite(r.max.x)&&isFinite(r.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var u in this._tiles){var c=this._tiles[u].coords;c.z===this._tileZoom&&l.contains(new M(c.x,c.y))||(this._tiles[u].current=!1)}if(Math.abs(n-this._tileZoom)>1)this._setView(e,n);else{for(var h=r.min.y;h<=r.max.y;h++)for(var d=r.min.x;d<=r.max.x;d++){var f=new M(d,h);if(f.z=this._tileZoom,this._isValidTile(f)){var p=this._tiles[this._tileCoordsToKey(f)];p?p.current=!0:o.push(f)}}if(o.sort(function(e,t){return e.distanceTo(s)-t.distanceTo(s)}),0!==o.length){this._loading||(this._loading=!0,this.fire("loading"));var m=document.createDocumentFragment();for(d=0;d<o.length;d++)this._addTile(o[d],m);this._level.el.appendChild(m)}}}}},_isValidTile:function(e){var t=this._map.options.crs;if(!t.infinite){var n=this._globalTileRange;if(!t.wrapLng&&(e.x<n.min.x||e.x>n.max.x)||!t.wrapLat&&(e.y<n.min.y||e.y>n.max.y))return!1}if(!this.options.bounds)return!0;var i=this._tileCoordsToBounds(e);return j(this.options.bounds).overlaps(i)},_keyToBounds:function(e){return this._tileCoordsToBounds(this._keyToTileCoords(e))},_tileCoordsToNwSe:function(e){var t=this._map,n=this.getTileSize(),i=e.scaleBy(n),r=i.add(n);return[t.unproject(i,e.z),t.unproject(r,e.z)]},_tileCoordsToBounds:function(e){var t=this._tileCoordsToNwSe(e),n=new F(t[0],t[1]);return this.options.noWrap||(n=this._map.wrapLatLngBounds(n)),n},_tileCoordsToKey:function(e){return e.x+":"+e.y+":"+e.z},_keyToTileCoords:function(e){var t=e.split(":"),n=new M(+t[0],+t[1]);return n.z=+t[2],n},_removeTile:function(e){var t=this._tiles[e];t&&(_t(t.el),delete this._tiles[e],this.fire("tileunload",{tile:t.el,coords:this._keyToTileCoords(e)}))},_initTile:function(e){xt(e,"leaflet-tile");var t=this.getTileSize();e.style.width=t.x+"px",e.style.height=t.y+"px",e.onselectstart=u,e.onmousemove=u,Fe.ielt9&&this.options.opacity<1&&Tt(e,this.options.opacity)},_addTile:function(e,t){var n=this._getTilePos(e),i=this._tileCoordsToKey(e),s=this.createTile(this._wrapCoords(e),r(this._tileReady,this,e));this._initTile(s),this.createTile.length<2&&T(r(this._tileReady,this,e,null,s)),Pt(s,n),this._tiles[i]={el:s,coords:e,current:!0},t.appendChild(s),this.fire("tileloadstart",{tile:s,coords:e})},_tileReady:function(e,t,n){t&&this.fire("tileerror",{error:t,tile:n,coords:e});var i=this._tileCoordsToKey(e);(n=this._tiles[i])&&(n.loaded=+new Date,this._map._fadeAnimated?(Tt(n.el,0),k(this._fadeFrame),this._fadeFrame=T(this._updateOpacity,this)):(n.active=!0,this._pruneTiles()),t||(xt(n.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:n.el,coords:e})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Fe.ielt9||!this._map._fadeAnimated?T(this._pruneTiles,this):setTimeout(r(this._pruneTiles,this),250)))},_getTilePos:function(e){return e.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(e){var t=new M(this._wrapX?l(e.x,this._wrapX):e.x,this._wrapY?l(e.y,this._wrapY):e.y);return t.z=e.z,t},_pxBoundsToTileRange:function(e){var t=this.getTileSize();return new D(e.min.unscaleBy(t).floor(),e.max.unscaleBy(t).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var e in this._tiles)if(!this._tiles[e].loaded)return!1;return!0}});function Bi(e){return new ji(e)}var Ui=ji.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(e,t){this._url=e,(t=f(this,t)).detectRetina&&Fe.retina&&t.maxZoom>0?(t.tileSize=Math.floor(t.tileSize/2),t.zoomReverse?(t.zoomOffset--,t.minZoom=Math.min(t.maxZoom,t.minZoom+1)):(t.zoomOffset++,t.maxZoom=Math.max(t.minZoom,t.maxZoom-1)),t.minZoom=Math.max(0,t.minZoom)):t.zoomReverse?t.minZoom=Math.min(t.maxZoom,t.minZoom):t.maxZoom=Math.max(t.minZoom,t.maxZoom),"string"==typeof t.subdomains&&(t.subdomains=t.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(e,t){return this._url===e&&void 0===t&&(t=!0),this._url=e,t||this.redraw(),this},createTile:function(e,t){var n=document.createElement("img");return jt(n,"load",r(this._tileOnLoad,this,t,n)),jt(n,"error",r(this._tileOnError,this,t,n)),(this.options.crossOrigin||""===this.options.crossOrigin)&&(n.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),"string"==typeof this.options.referrerPolicy&&(n.referrerPolicy=this.options.referrerPolicy),n.alt="",n.src=this.getTileUrl(e),n},getTileUrl:function(e){var t={r:Fe.retina?"@2x":"",s:this._getSubdomain(e),x:e.x,y:e.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var i=this._globalTileRange.max.y-e.y;this.options.tms&&(t.y=i),t["-y"]=i}return _(this._url,n(t,this.options))},_tileOnLoad:function(e,t){Fe.ielt9?setTimeout(r(e,this,null,t),0):e(null,t)},_tileOnError:function(e,t,n){var i=this.options.errorTileUrl;i&&t.getAttribute("src")!==i&&(t.src=i),e(n,t)},_onTileRemove:function(e){e.tile.onload=null},_getZoomForUrl:function(){var e=this._tileZoom,t=this.options.maxZoom;return this.options.zoomReverse&&(e=t-e),e+this.options.zoomOffset},_getSubdomain:function(e){var t=Math.abs(e.x+e.y)%this.options.subdomains.length;return this.options.subdomains[t]},_abortLoading:function(){var e,t;for(e in this._tiles)if(this._tiles[e].coords.z!==this._tileZoom&&((t=this._tiles[e].el).onload=u,t.onerror=u,!t.complete)){t.src=v;var n=this._tiles[e].coords;_t(t),delete this._tiles[e],this.fire("tileabort",{tile:t,coords:n})}},_removeTile:function(e){var t=this._tiles[e];if(t)return t.el.setAttribute("src",v),ji.prototype._removeTile.call(this,e)},_tileReady:function(e,t,n){if(this._map&&(!n||n.getAttribute("src")!==v))return ji.prototype._tileReady.call(this,e,t,n)}});function Vi(e,t){return new Ui(e,t)}var Gi=Ui.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(e,t){this._url=e;var i=n({},this.defaultWmsParams);for(var r in t)r in this.options||(i[r]=t[r]);var s=(t=f(this,t)).detectRetina&&Fe.retina?2:1,o=this.getTileSize();i.width=o.x*s,i.height=o.y*s,this.wmsParams=i},onAdd:function(e){this._crs=this.options.crs||e.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var t=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[t]=this._crs.code,Ui.prototype.onAdd.call(this,e)},getTileUrl:function(e){var t=this._tileCoordsToNwSe(e),n=this._crs,i=I(n.project(t[0]),n.project(t[1])),r=i.min,s=i.max,o=(this._wmsVersion>=1.3&&this._crs===qn?[r.y,r.x,s.y,s.x]:[r.x,r.y,s.x,s.y]).join(","),a=Ui.prototype.getTileUrl.call(this,e);return a+p(this.wmsParams,a,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+o},setParams:function(e,t){return n(this.wmsParams,e),t||this.redraw(),this}});function $i(e,t){return new Gi(e,t)}Ui.WMS=Gi,Vi.wms=$i;var Zi=Hn.extend({options:{padding:.1},initialize:function(e){f(this,e),o(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),xt(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var e={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(e.zoomanim=this._onAnimZoom),e},_onAnimZoom:function(e){this._updateTransform(e.center,e.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(e,t){var n=this._map.getZoomScale(t,this._zoom),i=this._map.getSize().multiplyBy(.5+this.options.padding),r=this._map.project(this._center,t),s=i.multiplyBy(-n).add(r).subtract(this._map._getNewPixelOrigin(e,t));Fe.any3d?Ot(this._container,s,n):Pt(this._container,s)},_reset:function(){for(var e in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[e]._reset()},_onZoomEnd:function(){for(var e in this._layers)this._layers[e]._project()},_updatePaths:function(){for(var e in this._layers)this._layers[e]._update()},_update:function(){var e=this.options.padding,t=this._map.getSize(),n=this._map.containerPointToLayerPoint(t.multiplyBy(-e)).round();this._bounds=new D(n,n.add(t.multiplyBy(1+2*e)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),qi=Zi.extend({options:{tolerance:0},getEvents:function(){var e=Zi.prototype.getEvents.call(this);return e.viewprereset=this._onViewPreReset,e},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Zi.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var e=this._container=document.createElement("canvas");jt(e,"mousemove",this._onMouseMove,this),jt(e,"click dblclick mousedown mouseup contextmenu",this._onClick,this),jt(e,"mouseout",this._handleMouseOut,this),e._leaflet_disable_events=!0,this._ctx=e.getContext("2d")},_destroyContainer:function(){k(this._redrawRequest),delete this._ctx,_t(this._container),Ut(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var e in this._redrawBounds=null,this._layers)this._layers[e]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){Zi.prototype._update.call(this);var e=this._bounds,t=this._container,n=e.getSize(),i=Fe.retina?2:1;Pt(t,e.min),t.width=i*n.x,t.height=i*n.y,t.style.width=n.x+"px",t.style.height=n.y+"px",Fe.retina&&this._ctx.scale(2,2),this._ctx.translate(-e.min.x,-e.min.y),this.fire("update")}},_reset:function(){Zi.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(e){this._updateDashArray(e),this._layers[o(e)]=e;var t=e._order={layer:e,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=t),this._drawLast=t,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(e){this._requestRedraw(e)},_removePath:function(e){var t=e._order,n=t.next,i=t.prev;n?n.prev=i:this._drawLast=i,i?i.next=n:this._drawFirst=n,delete e._order,delete this._layers[o(e)],this._requestRedraw(e)},_updatePath:function(e){this._extendRedrawBounds(e),e._project(),e._update(),this._requestRedraw(e)},_updateStyle:function(e){this._updateDashArray(e),this._requestRedraw(e)},_updateDashArray:function(e){if("string"==typeof e.options.dashArray){var t,n,i=e.options.dashArray.split(/[, ]+/),r=[];for(n=0;n<i.length;n++){if(t=Number(i[n]),isNaN(t))return;r.push(t)}e.options._dashArray=r}else e.options._dashArray=e.options.dashArray},_requestRedraw:function(e){this._map&&(this._extendRedrawBounds(e),this._redrawRequest=this._redrawRequest||T(this._redraw,this))},_extendRedrawBounds:function(e){if(e._pxBounds){var t=(e.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new D,this._redrawBounds.extend(e._pxBounds.min.subtract([t,t])),this._redrawBounds.extend(e._pxBounds.max.add([t,t]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var e=this._redrawBounds;if(e){var t=e.getSize();this._ctx.clearRect(e.min.x,e.min.y,t.x,t.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var e,t=this._redrawBounds;if(this._ctx.save(),t){var n=t.getSize();this._ctx.beginPath(),this._ctx.rect(t.min.x,t.min.y,n.x,n.y),this._ctx.clip()}this._drawing=!0;for(var i=this._drawFirst;i;i=i.next)e=i.layer,(!t||e._pxBounds&&e._pxBounds.intersects(t))&&e._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(e,t){if(this._drawing){var n,i,r,s,o=e._parts,a=o.length,l=this._ctx;if(a){for(l.beginPath(),n=0;n<a;n++){for(i=0,r=o[n].length;i<r;i++)s=o[n][i],l[i?"lineTo":"moveTo"](s.x,s.y);t&&l.closePath()}this._fillStroke(l,e)}}},_updateCircle:function(e){if(this._drawing&&!e._empty()){var t=e._point,n=this._ctx,i=Math.max(Math.round(e._radius),1),r=(Math.max(Math.round(e._radiusY),1)||i)/i;1!==r&&(n.save(),n.scale(1,r)),n.beginPath(),n.arc(t.x,t.y/r,i,0,2*Math.PI,!1),1!==r&&n.restore(),this._fillStroke(n,e)}},_fillStroke:function(e,t){var n=t.options;n.fill&&(e.globalAlpha=n.fillOpacity,e.fillStyle=n.fillColor||n.color,e.fill(n.fillRule||"evenodd")),n.stroke&&0!==n.weight&&(e.setLineDash&&e.setLineDash(t.options&&t.options._dashArray||[]),e.globalAlpha=n.opacity,e.lineWidth=n.weight,e.strokeStyle=n.color,e.lineCap=n.lineCap,e.lineJoin=n.lineJoin,e.stroke())},_onClick:function(e){for(var t,n,i=this._map.mouseEventToLayerPoint(e),r=this._drawFirst;r;r=r.next)(t=r.layer).options.interactive&&t._containsPoint(i)&&("click"!==e.type&&"preclick"!==e.type||!this._map._draggableMoved(t))&&(n=t);this._fireEvent(!!n&&[n],e)},_onMouseMove:function(e){if(this._map&&!this._map.dragging.moving()&&!this._map._animatingZoom){var t=this._map.mouseEventToLayerPoint(e);this._handleMouseHover(e,t)}},_handleMouseOut:function(e){var t=this._hoveredLayer;t&&(wt(this._container,"leaflet-interactive"),this._fireEvent([t],e,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(e,t){if(!this._mouseHoverThrottled){for(var n,i,s=this._drawFirst;s;s=s.next)(n=s.layer).options.interactive&&n._containsPoint(t)&&(i=n);i!==this._hoveredLayer&&(this._handleMouseOut(e),i&&(xt(this._container,"leaflet-interactive"),this._fireEvent([i],e,"mouseover"),this._hoveredLayer=i)),this._fireEvent(!!this._hoveredLayer&&[this._hoveredLayer],e),this._mouseHoverThrottled=!0,setTimeout(r(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(e,t,n){this._map._fireDOMEvent(t,n||t.type,e)},_bringToFront:function(e){var t=e._order;if(t){var n=t.next,i=t.prev;n&&(n.prev=i,i?i.next=n:n&&(this._drawFirst=n),t.prev=this._drawLast,this._drawLast.next=t,t.next=null,this._drawLast=t,this._requestRedraw(e))}},_bringToBack:function(e){var t=e._order;if(t){var n=t.next,i=t.prev;i&&(i.next=n,n?n.prev=i:i&&(this._drawLast=i),t.prev=null,t.next=this._drawFirst,this._drawFirst.prev=t,this._drawFirst=t,this._requestRedraw(e))}}});function Wi(e){return Fe.canvas?new qi(e):null}var Hi=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(e){return document.createElement("<lvml:"+e+' class="lvml">')}}catch(e){}return function(e){return document.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),Ki={_initContainer:function(){this._container=mt("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Zi.prototype._update.call(this),this.fire("update"))},_initPath:function(e){var t=e._container=Hi("shape");xt(t,"leaflet-vml-shape "+(this.options.className||"")),t.coordsize="1 1",e._path=Hi("path"),t.appendChild(e._path),this._updateStyle(e),this._layers[o(e)]=e},_addPath:function(e){var t=e._container;this._container.appendChild(t),e.options.interactive&&e.addInteractiveTarget(t)},_removePath:function(e){var t=e._container;_t(t),e.removeInteractiveTarget(t),delete this._layers[o(e)]},_updateStyle:function(e){var t=e._stroke,n=e._fill,i=e.options,r=e._container;r.stroked=!!i.stroke,r.filled=!!i.fill,i.stroke?(t||(t=e._stroke=Hi("stroke")),r.appendChild(t),t.weight=i.weight+"px",t.color=i.color,t.opacity=i.opacity,i.dashArray?t.dashStyle=g(i.dashArray)?i.dashArray.join(" "):i.dashArray.replace(/( *, *)/g," "):t.dashStyle="",t.endcap=i.lineCap.replace("butt","flat"),t.joinstyle=i.lineJoin):t&&(r.removeChild(t),e._stroke=null),i.fill?(n||(n=e._fill=Hi("fill")),r.appendChild(n),n.color=i.fillColor||i.color,n.opacity=i.fillOpacity):n&&(r.removeChild(n),e._fill=null)},_updateCircle:function(e){var t=e._point.round(),n=Math.round(e._radius),i=Math.round(e._radiusY||n);this._setPath(e,e._empty()?"M0 0":"AL "+t.x+","+t.y+" "+n+","+i+" 0,23592600")},_setPath:function(e,t){e._path.v=t},_bringToFront:function(e){yt(e._container)},_bringToBack:function(e){vt(e._container)}},Yi=Fe.vml?Hi:X,Xi=Zi.extend({_initContainer:function(){this._container=Yi("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Yi("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){_t(this._container),Ut(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!this._map._animatingZoom||!this._bounds){Zi.prototype._update.call(this);var e=this._bounds,t=e.getSize(),n=this._container;this._svgSize&&this._svgSize.equals(t)||(this._svgSize=t,n.setAttribute("width",t.x),n.setAttribute("height",t.y)),Pt(n,e.min),n.setAttribute("viewBox",[e.min.x,e.min.y,t.x,t.y].join(" ")),this.fire("update")}},_initPath:function(e){var t=e._path=Yi("path");e.options.className&&xt(t,e.options.className),e.options.interactive&&xt(t,"leaflet-interactive"),this._updateStyle(e),this._layers[o(e)]=e},_addPath:function(e){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(e._path),e.addInteractiveTarget(e._path)},_removePath:function(e){_t(e._path),e.removeInteractiveTarget(e._path),delete this._layers[o(e)]},_updatePath:function(e){e._project(),e._update()},_updateStyle:function(e){var t=e._path,n=e.options;t&&(n.stroke?(t.setAttribute("stroke",n.color),t.setAttribute("stroke-opacity",n.opacity),t.setAttribute("stroke-width",n.weight),t.setAttribute("stroke-linecap",n.lineCap),t.setAttribute("stroke-linejoin",n.lineJoin),n.dashArray?t.setAttribute("stroke-dasharray",n.dashArray):t.removeAttribute("stroke-dasharray"),n.dashOffset?t.setAttribute("stroke-dashoffset",n.dashOffset):t.removeAttribute("stroke-dashoffset")):t.setAttribute("stroke","none"),n.fill?(t.setAttribute("fill",n.fillColor||n.color),t.setAttribute("fill-opacity",n.fillOpacity),t.setAttribute("fill-rule",n.fillRule||"evenodd")):t.setAttribute("fill","none"))},_updatePoly:function(e,t){this._setPath(e,Q(e._parts,t))},_updateCircle:function(e){var t=e._point,n=Math.max(Math.round(e._radius),1),i="a"+n+","+(Math.max(Math.round(e._radiusY),1)||n)+" 0 1,0 ",r=e._empty()?"M0 0":"M"+(t.x-n)+","+t.y+i+2*n+",0 "+i+2*-n+",0 ";this._setPath(e,r)},_setPath:function(e,t){e._path.setAttribute("d",t)},_bringToFront:function(e){yt(e._path)},_bringToBack:function(e){vt(e._path)}});function Qi(e){return Fe.svg||Fe.vml?new Xi(e):null}Fe.vml&&Xi.include(Ki),sn.include({getRenderer:function(e){var t=e.options.renderer||this._getPaneRenderer(e.options.pane)||this.options.renderer||this._renderer;return t||(t=this._renderer=this._createRenderer()),this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(e){if("overlayPane"===e||void 0===e)return!1;var t=this._paneRenderers[e];return void 0===t&&(t=this._createRenderer({pane:e}),this._paneRenderers[e]=t),t},_createRenderer:function(e){return this.options.preferCanvas&&Wi(e)||Qi(e)}});var Ji=di.extend({initialize:function(e,t){di.prototype.initialize.call(this,this._boundsToLatLngs(e),t)},setBounds:function(e){return this.setLatLngs(this._boundsToLatLngs(e))},_boundsToLatLngs:function(e){return[(e=j(e)).getSouthWest(),e.getNorthWest(),e.getNorthEast(),e.getSouthEast()]}});function er(e,t){return new Ji(e,t)}Xi.create=Yi,Xi.pointsToPath=Q,pi.geometryToLayer=mi,pi.coordsToLatLng=gi,pi.coordsToLatLngs=yi,pi.latLngToCoords=vi,pi.latLngsToCoords=bi,pi.getFeature=xi,pi.asFeature=wi,sn.mergeOptions({boxZoom:!0});var tr=yn.extend({initialize:function(e){this._map=e,this._container=e._container,this._pane=e._panes.overlayPane,this._resetStateTimeout=0,e.on("unload",this._destroy,this)},addHooks:function(){jt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Ut(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){_t(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(e){if(!e.shiftKey||1!==e.which&&1!==e.button)return!1;this._clearDeferredResetState(),this._resetState(),st(),Mt(),this._startPoint=this._map.mouseEventToContainerPoint(e),jt(document,{contextmenu:Yt,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(e){this._moved||(this._moved=!0,this._box=mt("div","leaflet-zoom-box",this._container),xt(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(e);var t=new D(this._point,this._startPoint),n=t.getSize();Pt(this._box,t.min),this._box.style.width=n.x+"px",this._box.style.height=n.y+"px"},_finish:function(){this._moved&&(_t(this._box),wt(this._container,"leaflet-crosshair")),ot(),Lt(),Ut(document,{contextmenu:Yt,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(e){if((1===e.which||1===e.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(r(this._resetState,this),0);var t=new F(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(t).fire("boxzoomend",{boxZoomBounds:t})}},_onKeyDown:function(e){27===e.keyCode&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});sn.addInitHook("addHandler","boxZoom",tr),sn.mergeOptions({doubleClickZoom:!0});var nr=yn.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(e){var t=this._map,n=t.getZoom(),i=t.options.zoomDelta,r=e.originalEvent.shiftKey?n-i:n+i;"center"===t.options.doubleClickZoom?t.setZoom(r):t.setZoomAround(e.containerPoint,r)}});sn.addInitHook("addHandler","doubleClickZoom",nr),sn.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var ir=yn.extend({addHooks:function(){if(!this._draggable){var e=this._map;this._draggable=new xn(e._mapPane,e._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),e.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),e.on("zoomend",this._onZoomEnd,this),e.whenReady(this._onZoomEnd,this))}xt(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){wt(this._map._container,"leaflet-grab"),wt(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var e=this._map;if(e._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var t=j(this._map.options.maxBounds);this._offsetLimit=I(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;e.fire("movestart").fire("dragstart"),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(e){if(this._map.options.inertia){var t=this._lastTime=+new Date,n=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(n),this._times.push(t),this._prunePositions(t)}this._map.fire("move",e).fire("drag",e)},_prunePositions:function(e){for(;this._positions.length>1&&e-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var e=this._map.getSize().divideBy(2),t=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=t.subtract(e).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(e,t){return e-(e-t)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var e=this._draggable._newPos.subtract(this._draggable._startPos),t=this._offsetLimit;e.x<t.min.x&&(e.x=this._viscousLimit(e.x,t.min.x)),e.y<t.min.y&&(e.y=this._viscousLimit(e.y,t.min.y)),e.x>t.max.x&&(e.x=this._viscousLimit(e.x,t.max.x)),e.y>t.max.y&&(e.y=this._viscousLimit(e.y,t.max.y)),this._draggable._newPos=this._draggable._startPos.add(e)}},_onPreDragWrap:function(){var e=this._worldWidth,t=Math.round(e/2),n=this._initialWorldOffset,i=this._draggable._newPos.x,r=(i-t+n)%e+t-n,s=(i+t+n)%e-t-n,o=Math.abs(r+n)<Math.abs(s+n)?r:s;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=o},_onDragEnd:function(e){var t=this._map,n=t.options,i=!n.inertia||e.noInertia||this._times.length<2;if(t.fire("dragend",e),i)t.fire("moveend");else{this._prunePositions(+new Date);var r=this._lastPos.subtract(this._positions[0]),s=(this._lastTime-this._times[0])/1e3,o=n.easeLinearity,a=r.multiplyBy(o/s),l=a.distanceTo([0,0]),u=Math.min(n.inertiaMaxSpeed,l),c=a.multiplyBy(u/l),h=u/(n.inertiaDeceleration*o),d=c.multiplyBy(-h/2).round();d.x||d.y?(d=t._limitOffset(d,t.options.maxBounds),T(function(){t.panBy(d,{duration:h,easeLinearity:o,noMoveStart:!0,animate:!0})})):t.fire("moveend")}}});sn.addInitHook("addHandler","dragging",ir),sn.mergeOptions({keyboard:!0,keyboardPanDelta:80});var rr=yn.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(e){this._map=e,this._setPanDelta(e.options.keyboardPanDelta),this._setZoomDelta(e.options.zoomDelta)},addHooks:function(){var e=this._map._container;e.tabIndex<=0&&(e.tabIndex="0"),jt(e,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Ut(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var e=document.body,t=document.documentElement,n=e.scrollTop||t.scrollTop,i=e.scrollLeft||t.scrollLeft;this._map._container.focus(),window.scrollTo(i,n)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(e){var t,n,i=this._panKeys={},r=this.keyCodes;for(t=0,n=r.left.length;t<n;t++)i[r.left[t]]=[-1*e,0];for(t=0,n=r.right.length;t<n;t++)i[r.right[t]]=[e,0];for(t=0,n=r.down.length;t<n;t++)i[r.down[t]]=[0,e];for(t=0,n=r.up.length;t<n;t++)i[r.up[t]]=[0,-1*e]},_setZoomDelta:function(e){var t,n,i=this._zoomKeys={},r=this.keyCodes;for(t=0,n=r.zoomIn.length;t<n;t++)i[r.zoomIn[t]]=e;for(t=0,n=r.zoomOut.length;t<n;t++)i[r.zoomOut[t]]=-e},_addHooks:function(){jt(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Ut(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(e){if(!(e.altKey||e.ctrlKey||e.metaKey)){var t,n=e.keyCode,i=this._map;if(n in this._panKeys){if(!i._panAnim||!i._panAnim._inProgress)if(t=this._panKeys[n],e.shiftKey&&(t=z(t).multiplyBy(3)),i.options.maxBounds&&(t=i._limitOffset(z(t),i.options.maxBounds)),i.options.worldCopyJump){var r=i.wrapLatLng(i.unproject(i.project(i.getCenter()).add(t)));i.panTo(r)}else i.panBy(t)}else if(n in this._zoomKeys)i.setZoom(i.getZoom()+(e.shiftKey?3:1)*this._zoomKeys[n]);else{if(27!==n||!i._popup||!i._popup.options.closeOnEscapeKey)return;i.closePopup()}Yt(e)}}});sn.addInitHook("addHandler","keyboard",rr),sn.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var sr=yn.extend({addHooks:function(){jt(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Ut(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(e){var t=en(e),n=this._map.options.wheelDebounceTime;this._delta+=t,this._lastMousePos=this._map.mouseEventToContainerPoint(e),this._startTime||(this._startTime=+new Date);var i=Math.max(n-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(r(this._performZoom,this),i),Yt(e)},_performZoom:function(){var e=this._map,t=e.getZoom(),n=this._map.options.zoomSnap||0;e._stop();var i=this._delta/(4*this._map.options.wheelPxPerZoomLevel),r=4*Math.log(2/(1+Math.exp(-Math.abs(i))))/Math.LN2,s=n?Math.ceil(r/n)*n:r,o=e._limitZoom(t+(this._delta>0?s:-s))-t;this._delta=0,this._startTime=null,o&&("center"===e.options.scrollWheelZoom?e.setZoom(t+o):e.setZoomAround(this._lastMousePos,t+o))}});sn.addInitHook("addHandler","scrollWheelZoom",sr);var or=600;sn.mergeOptions({tapHold:Fe.touchNative&&Fe.safari&&Fe.mobile,tapTolerance:15});var ar=yn.extend({addHooks:function(){jt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Ut(this._map._container,"touchstart",this._onDown,this)},_onDown:function(e){if(clearTimeout(this._holdTimeout),1===e.touches.length){var t=e.touches[0];this._startPos=this._newPos=new M(t.clientX,t.clientY),this._holdTimeout=setTimeout(r(function(){this._cancel(),this._isTapValid()&&(jt(document,"touchend",Kt),jt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",t))},this),or),jt(document,"touchend touchcancel contextmenu",this._cancel,this),jt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function e(){Ut(document,"touchend",Kt),Ut(document,"touchend touchcancel",e)},_cancel:function(){clearTimeout(this._holdTimeout),Ut(document,"touchend touchcancel contextmenu",this._cancel,this),Ut(document,"touchmove",this._onMove,this)},_onMove:function(e){var t=e.touches[0];this._newPos=new M(t.clientX,t.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(e,t){var n=new MouseEvent(e,{bubbles:!0,cancelable:!0,view:window,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY});n._simulated=!0,t.target.dispatchEvent(n)}});sn.addInitHook("addHandler","tapHold",ar),sn.mergeOptions({touchZoom:Fe.touch,bounceAtZoomLimits:!0});var lr=yn.extend({addHooks:function(){xt(this._map._container,"leaflet-touch-zoom"),jt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){wt(this._map._container,"leaflet-touch-zoom"),Ut(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(e){var t=this._map;if(e.touches&&2===e.touches.length&&!t._animatingZoom&&!this._zooming){var n=t.mouseEventToContainerPoint(e.touches[0]),i=t.mouseEventToContainerPoint(e.touches[1]);this._centerPoint=t.getSize()._divideBy(2),this._startLatLng=t.containerPointToLatLng(this._centerPoint),"center"!==t.options.touchZoom&&(this._pinchStartLatLng=t.containerPointToLatLng(n.add(i)._divideBy(2))),this._startDist=n.distanceTo(i),this._startZoom=t.getZoom(),this._moved=!1,this._zooming=!0,t._stop(),jt(document,"touchmove",this._onTouchMove,this),jt(document,"touchend touchcancel",this._onTouchEnd,this),Kt(e)}},_onTouchMove:function(e){if(e.touches&&2===e.touches.length&&this._zooming){var t=this._map,n=t.mouseEventToContainerPoint(e.touches[0]),i=t.mouseEventToContainerPoint(e.touches[1]),s=n.distanceTo(i)/this._startDist;if(this._zoom=t.getScaleZoom(s,this._startZoom),!t.options.bounceAtZoomLimits&&(this._zoom<t.getMinZoom()&&s<1||this._zoom>t.getMaxZoom()&&s>1)&&(this._zoom=t._limitZoom(this._zoom)),"center"===t.options.touchZoom){if(this._center=this._startLatLng,1===s)return}else{var o=n._add(i)._divideBy(2)._subtract(this._centerPoint);if(1===s&&0===o.x&&0===o.y)return;this._center=t.unproject(t.project(this._pinchStartLatLng,this._zoom).subtract(o),this._zoom)}this._moved||(t._moveStart(!0,!1),this._moved=!0),k(this._animRequest);var a=r(t._move,t,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=T(a,this,!0),Kt(e)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,k(this._animRequest),Ut(document,"touchmove",this._onTouchMove,this),Ut(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});sn.addInitHook("addHandler","touchZoom",lr),sn.BoxZoom=tr,sn.DoubleClickZoom=nr,sn.Drag=ir,sn.Keyboard=rr,sn.ScrollWheelZoom=sr,sn.TapHold=ar,sn.TouchZoom=lr,e.Bounds=D,e.Browser=Fe,e.CRS=G,e.Canvas=qi,e.Circle=li,e.CircleMarker=oi,e.Class=O,e.Control=an,e.DivIcon=Ii,e.DivOverlay=Mi,e.DomEvent=nn,e.DomUtil=Ft,e.Draggable=xn,e.Evented=R,e.FeatureGroup=Xn,e.GeoJSON=pi,e.GridLayer=ji,e.Handler=yn,e.Icon=Jn,e.ImageOverlay=ki,e.LatLng=B,e.LatLngBounds=F,e.Layer=Hn,e.LayerGroup=Kn,e.LineUtil=Un,e.Map=sn,e.Marker=ii,e.Mixin=vn,e.Path=si,e.Point=M,e.PolyUtil=kn,e.Polygon=di,e.Polyline=ci,e.Popup=Li,e.PosAnimation=rn,e.Projection=$n,e.Rectangle=Ji,e.Renderer=Zi,e.SVG=Xi,e.SVGOverlay=Ci,e.TileLayer=Ui,e.Tooltip=zi,e.Transformation=W,e.Util=S,e.VideoOverlay=Oi,e.bind=r,e.bounds=I,e.canvas=Wi,e.circle=ui,e.circleMarker=ai,e.control=ln,e.divIcon=Fi,e.extend=n,e.featureGroup=Qn,e.geoJSON=Ai,e.geoJson=Ti,e.gridLayer=Bi,e.icon=ei,e.imageOverlay=Si,e.latLng=U,e.latLngBounds=j,e.layerGroup=Yn,e.map=on,e.marker=ri,e.point=z,e.polygon=fi,e.polyline=hi,e.popup=Ni,e.rectangle=er,e.setOptions=f,e.stamp=o,e.svg=Qi,e.svgOverlay=Ri,e.tileLayer=Vi,e.tooltip=Di,e.transformation=H,e.version=t,e.videoOverlay=Pi;var ur=window.L;e.noConflict=function(){return window.L=ur,this},window.L=e}(Ha.exports)),Ha.exports}var Ya=Ka(),Xa=we(Ya);class Qa{getCoordinateByLatLng(e){const{lat:t,lng:n}=e;return{lat:t,lon:n}}getLatLngByCoordinate(e){const{lat:t,lon:n}=e;return new Ya.LatLng(t,n)}}const Ja=new Qa;var el=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},tl={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},nl=new class{#e=tl;#t=!1;setTimeoutProvider(e){"production"!==process.env.NODE_ENV&&this.#t&&e!==this.#e&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#e,provider:e}),this.#e=e,"production"!==process.env.NODE_ENV&&(this.#t=!1)}setTimeout(e,t){return"production"!==process.env.NODE_ENV&&(this.#t=!0),this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return"production"!==process.env.NODE_ENV&&(this.#t=!0),this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};var il="undefined"==typeof window||"Deno"in globalThis;function rl(){}function sl(e){return"number"==typeof e&&e>=0&&e!==1/0}function ol(e,t){return Math.max(e+(t||0)-Date.now(),0)}function al(e,t){return"function"==typeof e?e(t):e}function ll(e,t){return"function"==typeof e?e(t):e}function ul(e,t){const{type:n="all",exact:i,fetchStatus:r,predicate:s,queryKey:o,stale:a}=e;if(o)if(i){if(t.queryHash!==hl(o,t.options))return!1}else if(!fl(t.queryKey,o))return!1;if("all"!==n){const e=t.isActive();if("active"===n&&!e)return!1;if("inactive"===n&&e)return!1}return("boolean"!=typeof a||t.isStale()===a)&&((!r||r===t.state.fetchStatus)&&!(s&&!s(t)))}function cl(e,t){const{exact:n,status:i,predicate:r,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(dl(t.options.mutationKey)!==dl(s))return!1}else if(!fl(t.options.mutationKey,s))return!1}return(!i||t.state.status===i)&&!(r&&!r(t))}function hl(e,t){return(t?.queryKeyHashFn||dl)(e)}function dl(e){return JSON.stringify(e,(e,t)=>yl(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function fl(e,t){return e===t||typeof e==typeof t&&(!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&Object.keys(t).every(n=>fl(e[n],t[n])))}var pl=Object.prototype.hasOwnProperty;function ml(e,t,n=0){if(e===t)return e;if(n>500)return t;const i=gl(e)&&gl(t);if(!(i||yl(e)&&yl(t)))return t;const r=(i?e:Object.keys(e)).length,s=i?t:Object.keys(t),o=s.length,a=i?new Array(o):{};let l=0;for(let u=0;u<o;u++){const o=i?u:s[u],c=e[o],h=t[o];if(c===h){a[o]=c,(i?u<r:pl.call(e,o))&&l++;continue}if(null===c||null===h||"object"!=typeof c||"object"!=typeof h){a[o]=h;continue}const d=ml(c,h,n+1);a[o]=d,d===c&&l++}return r===o&&l===r?e:a}function _l(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function gl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function yl(e){if(!vl(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!!vl(n)&&(!!n.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype)}function vl(e){return"[object Object]"===Object.prototype.toString.call(e)}function bl(e,t,n){if("function"==typeof n.structuralSharing)return n.structuralSharing(e,t);if(!1!==n.structuralSharing){if("production"!==process.env.NODE_ENV)try{return ml(e,t)}catch(e){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${e}`),e}return ml(e,t)}return t}function xl(e,t,n=0){const i=[...e,t];return n&&i.length>n?i.slice(1):i}function wl(e,t,n=0){const i=[t,...e];return n&&i.length>n?i.slice(0,-1):i}var El=Symbol();function Al(e,t){return"production"!==process.env.NODE_ENV&&e.queryFn===El&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==El?e.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`))}function Tl(e,t){return"function"==typeof e?e(...t):!!e}var kl=new class extends el{#n;#i;#r;constructor(){super(),this.#r=e=>{if(!il&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#i||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#i?.(),this.#i=void 0)}setEventListener(e){this.#r=e,this.#i?.(),this.#i=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#n!==e&&(this.#n=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#n?this.#n:"hidden"!==globalThis.document?.visibilityState}};function Sl(){let e,t;const n=new Promise((n,i)=>{e=n,t=i});function i(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.status="pending",n.catch(()=>{}),n.resolve=t=>{i({status:"fulfilled",value:t}),e(t)},n.reject=e=>{i({status:"rejected",reason:e}),t(e)},n}var Ol=function(e){setTimeout(e,0)};var Pl=function(){let e=[],t=0,n=e=>{e()},i=e=>{e()},r=Ol;const s=i=>{t?e.push(i):r(()=>{n(i)})};return{batch:s=>{let o;t++;try{o=s()}finally{t--,t||(()=>{const t=e;e=[],t.length&&r(()=>{i(()=>{t.forEach(e=>{n(e)})})})})()}return o},batchCalls:e=>(...t)=>{s(()=>{e(...t)})},schedule:s,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{i=e},setScheduler:e=>{r=e}}}(),Cl=new class extends el{#s=!0;#i;#r;constructor(){super(),this.#r=e=>{if(!il&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#i||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#i?.(),this.#i=void 0)}setEventListener(e){this.#r=e,this.#i?.(),this.#i=e(this.setOnline.bind(this))}setOnline(e){this.#s!==e&&(this.#s=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#s}};function Rl(e){return Math.min(1e3*2**e,3e4)}function Ml(e){return"online"!==(e??"online")||Cl.isOnline()}var Ll=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Nl(e){let t,n=!1,i=0;const r=Sl(),s=()=>"pending"!==r.status,o=()=>kl.isFocused()&&("always"===e.networkMode||Cl.isOnline())&&e.canRun(),a=()=>Ml(e.networkMode)&&e.canRun(),l=e=>{s()||(t?.(),r.resolve(e))},u=e=>{s()||(t?.(),r.reject(e))},c=()=>new Promise(n=>{t=e=>{(s()||o())&&n(e)},e.onPause?.()}).then(()=>{t=void 0,s()||e.onContinue?.()}),h=()=>{if(s())return;let t;const r=0===i?e.initialPromise:void 0;try{t=r??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(l).catch(t=>{if(s())return;const r=e.retry??(il?0:3),a=e.retryDelay??Rl,l="function"==typeof a?a(i,t):a,d=!0===r||"number"==typeof r&&i<r||"function"==typeof r&&r(i,t);!n&&d?(i++,e.onFail?.(i,t),function(e){return new Promise(t=>{nl.setTimeout(t,e)})}(l).then(()=>o()?void 0:c()).then(()=>{n?u(t):h()})):u(t)})};return{promise:r,status:()=>r.status,cancel:t=>{if(!s()){const n=new Ll(t);u(n),e.onCancel?.(n)}},continue:()=>(t?.(),r),cancelRetry:()=>{n=!0},continueRetry:()=>{n=!1},canStart:a,start:()=>(a()?h():c().then(h),r)}}var zl=class{#o;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),sl(this.gcTime)&&(this.#o=nl.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(il?1/0:3e5))}clearGcTimeout(){this.#o&&(nl.clearTimeout(this.#o),this.#o=void 0)}},Dl=class extends zl{#a;#l;#u;#c;#h;#d;#f;constructor(e){super(),this.#f=!1,this.#d=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#c=e.client,this.#u=this.#c.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#a=jl(this.options),this.state=e.state??this.#a,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#h?.promise}setOptions(e){if(this.options={...this.#d,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){const e=jl(this.options);void 0!==e.data&&(this.setState(Fl(e.data,e.dataUpdatedAt)),this.#a=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,t){const n=bl(this.state.data,e,this.options);return this.#p({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#p({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#h?.promise;return this.#h?.cancel(e),t?t.then(rl).catch(rl):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#a)}isActive(){return this.observers.some(e=>!1!==ll(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===El||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===al(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!ol(this.state.dataUpdatedAt,e))}onFocus(){const e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#h?.continue()}onOnline(){const e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#h?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#h&&(this.#f?this.#h.cancel({revert:!0}):this.#h.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#p({type:"invalidate"})}async fetch(e,t){if("idle"!==this.state.fetchStatus&&"rejected"!==this.#h?.status())if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#h)return this.#h.continueRetry(),this.#h.promise;if(e&&this.setOptions(e),!this.options.queryFn){const e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}"production"!==process.env.NODE_ENV&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,i=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#f=!0,n.signal)})},r=()=>{const e=Al(this.options,t),n=(()=>{const e={client:this.#c,queryKey:this.queryKey,meta:this.meta};return i(e),e})();return this.#f=!1,this.options.persister?this.options.persister(e,n,this):e(n)},s=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:r};return i(e),e})();this.options.behavior?.onFetch(s,this),this.#l=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===s.fetchOptions?.meta||this.#p({type:"fetch",meta:s.fetchOptions?.meta}),this.#h=Nl({initialPromise:t?.initialPromise,fn:s.fetchFn,onCancel:e=>{e instanceof Ll&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),n.abort()},onFail:(e,t)=>{this.#p({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#p({type:"pause"})},onContinue:()=>{this.#p({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0});try{const e=await this.#h.start();if(void 0===e)throw"production"!==process.env.NODE_ENV&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Ll){if(e.silent)return this.#h.promise;if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#p({type:"error",error:e}),this.#u.config.onError?.(e,this),this.#u.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#p(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...Il(t.data,this.options),fetchMeta:e.meta??null};case"success":const n={...t,...Fl(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?n:void 0,n;case"error":const i=e.error;return{...t,error:i,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),Pl.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function Il(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ml(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function Fl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function jl(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,n=void 0!==t,i=n?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Bl=class extends el{constructor(e,t){super(),this.options=t,this.#c=e,this.#m=null,this.#_=Sl(),this.bindMethods(),this.setOptions(t)}#c;#g=void 0;#y=void 0;#v=void 0;#b;#x;#_;#m;#w;#E;#A;#T;#k;#S;#O=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#g.addObserver(this),Ul(this.#g,this.options)?this.#P():this.updateResult(),this.#C())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Vl(this.#g,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Vl(this.#g,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#R(),this.#M(),this.#g.removeObserver(this)}setOptions(e){const t=this.options,n=this.#g;if(this.options=this.#c.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof ll(this.options.enabled,this.#g))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#L(),this.#g.setOptions(this.options),t._defaulted&&!_l(this.options,t)&&this.#c.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#g,observer:this});const i=this.hasListeners();i&&Gl(this.#g,n,this.options,t)&&this.#P(),this.updateResult(),!i||this.#g===n&&ll(this.options.enabled,this.#g)===ll(t.enabled,this.#g)&&al(this.options.staleTime,this.#g)===al(t.staleTime,this.#g)||this.#N();const r=this.#z();!i||this.#g===n&&ll(this.options.enabled,this.#g)===ll(t.enabled,this.#g)&&r===this.#S||this.#D(r)}getOptimisticResult(e){const t=this.#c.getQueryCache().build(this.#c,e),n=this.createResult(t,e);return function(e,t){if(!_l(e.getCurrentResult(),t))return!0;return!1}(this,n)&&(this.#v=n,this.#x=this.options,this.#b=this.#g.state),n}getCurrentResult(){return this.#v}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),"promise"===n&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#_.status||this.#_.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,n))})}trackProp(e){this.#O.add(e)}getCurrentQuery(){return this.#g}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#c.defaultQueryOptions(e),n=this.#c.getQueryCache().build(this.#c,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#P({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#v))}#P(e){this.#L();let t=this.#g.fetch(this.options,e);return e?.throwOnError||(t=t.catch(rl)),t}#N(){this.#R();const e=al(this.options.staleTime,this.#g);if(il||this.#v.isStale||!sl(e))return;const t=ol(this.#v.dataUpdatedAt,e)+1;this.#T=nl.setTimeout(()=>{this.#v.isStale||this.updateResult()},t)}#z(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#g):this.options.refetchInterval)??!1}#D(e){this.#M(),this.#S=e,!il&&!1!==ll(this.options.enabled,this.#g)&&sl(this.#S)&&0!==this.#S&&(this.#k=nl.setInterval(()=>{(this.options.refetchIntervalInBackground||kl.isFocused())&&this.#P()},this.#S))}#C(){this.#N(),this.#D(this.#z())}#R(){this.#T&&(nl.clearTimeout(this.#T),this.#T=void 0)}#M(){this.#k&&(nl.clearInterval(this.#k),this.#k=void 0)}createResult(e,t){const n=this.#g,i=this.options,r=this.#v,s=this.#b,o=this.#x,a=e!==n?e.state:this.#y,{state:l}=e;let u,c={...l},h=!1;if(t._optimisticResults){const r=this.hasListeners(),s=!r&&Ul(e,t),o=r&&Gl(e,n,t,i);(s||o)&&(c={...c,...Il(l.data,e.options)}),"isRestoring"===t._optimisticResults&&(c.fetchStatus="idle")}let{error:d,errorUpdatedAt:f,status:p}=c;u=c.data;let m=!1;if(void 0!==t.placeholderData&&void 0===u&&"pending"===p){let e;r?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=r.data,m=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#A?.state.data,this.#A):t.placeholderData,void 0!==e&&(p="success",u=bl(r?.data,e,t),h=!0)}if(t.select&&void 0!==u&&!m)if(r&&u===s?.data&&t.select===this.#w)u=this.#E;else try{this.#w=t.select,u=t.select(u),u=bl(r?.data,u,t),this.#E=u,this.#m=null}catch(e){this.#m=e}this.#m&&(d=this.#m,u=this.#E,f=Date.now(),p="error");const _="fetching"===c.fetchStatus,g="pending"===p,y="error"===p,v=g&&_,b=void 0!==u,x={status:p,fetchStatus:c.fetchStatus,isPending:g,isSuccess:"success"===p,isError:y,isInitialLoading:v,isLoading:v,data:u,dataUpdatedAt:c.dataUpdatedAt,error:d,errorUpdatedAt:f,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>a.dataUpdateCount||c.errorUpdateCount>a.errorUpdateCount,isFetching:_,isRefetching:_&&!g,isLoadingError:y&&!b,isPaused:"paused"===c.fetchStatus,isPlaceholderData:h,isRefetchError:y&&b,isStale:$l(e,t),refetch:this.refetch,promise:this.#_,isEnabled:!1!==ll(t.enabled,e)};if(this.options.experimental_prefetchInRender){const t=void 0!==x.data,i="error"===x.status&&!t,r=e=>{i?e.reject(x.error):t&&e.resolve(x.data)},s=()=>{const e=this.#_=x.promise=Sl();r(e)},o=this.#_;switch(o.status){case"pending":e.queryHash===n.queryHash&&r(o);break;case"fulfilled":(i||x.data!==o.value)&&s();break;case"rejected":i&&x.error===o.reason||s()}}return x}updateResult(){const e=this.#v,t=this.createResult(this.#g,this.options);if(this.#b=this.#g.state,this.#x=this.options,void 0!==this.#b.data&&(this.#A=this.#g),_l(t,e))return;this.#v=t;this.#I({listeners:(()=>{if(!e)return!0;const{notifyOnChangeProps:t}=this.options,n="function"==typeof t?t():t;if("all"===n||!n&&!this.#O.size)return!0;const i=new Set(n??this.#O);return this.options.throwOnError&&i.add("error"),Object.keys(this.#v).some(t=>{const n=t;return this.#v[n]!==e[n]&&i.has(n)})})()})}#L(){const e=this.#c.getQueryCache().build(this.#c,this.options);if(e===this.#g)return;const t=this.#g;this.#g=e,this.#y=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#C()}#I(e){Pl.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#v)}),this.#c.getQueryCache().notify({query:this.#g,type:"observerResultsUpdated"})})}};function Ul(e,t){return function(e,t){return!1!==ll(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===t.retryOnMount)}(e,t)||void 0!==e.state.data&&Vl(e,t,t.refetchOnMount)}function Vl(e,t,n){if(!1!==ll(t.enabled,e)&&"static"!==al(t.staleTime,e)){const i="function"==typeof n?n(e):n;return"always"===i||!1!==i&&$l(e,t)}return!1}function Gl(e,t,n,i){return(e!==t||!1===ll(i.enabled,e))&&(!n.suspense||"error"!==e.state.status)&&$l(e,n)}function $l(e,t){return!1!==ll(t.enabled,e)&&e.isStaleByTime(al(t.staleTime,e))}function Zl(e){return{onFetch:(t,n)=>{const i=t.options,r=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],o=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let n=!1;const u=e=>{!function(e,t,n){let i,r=!1;Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)})}(e,()=>t.signal,()=>n=!0)},c=Al(t.options,t.fetchOptions),h=async(e,i,r)=>{if(n)return Promise.reject();if(null==i&&e.pages.length)return Promise.resolve(e);const s=(()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:i,direction:r?"backward":"forward",meta:t.options.meta};return u(e),e})(),o=await c(s),{maxPages:a}=t.options,l=r?wl:xl;return{pages:l(e.pages,o,a),pageParams:l(e.pageParams,i,a)}};if(r&&s.length){const e="backward"===r,t={pages:s,pageParams:o},n=(e?Wl:ql)(i,t);a=await h(t,n,e)}else{const t=e??s.length;do{const e=0===l?o[0]??i.initialPageParam:ql(i,a);if(l>0&&null==e)break;a=await h(a,e),l++}while(l<t)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=u}}}function ql(e,{pages:t,pageParams:n}){const i=t.length-1;return t.length>0?e.getNextPageParam(t[i],t,n[i],n):void 0}function Wl(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Hl=class extends zl{#c;#F;#j;#h;constructor(e){super(),this.#c=e.client,this.mutationId=e.mutationId,this.#j=e.mutationCache,this.#F=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#F.includes(e)||(this.#F.push(e),this.clearGcTimeout(),this.#j.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#F=this.#F.filter(t=>t!==e),this.scheduleGc(),this.#j.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#F.length||("pending"===this.state.status?this.scheduleGc():this.#j.remove(this))}continue(){return this.#h?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#p({type:"continue"})},n={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#h=Nl({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{this.#p({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#p({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#j.canRun(this)});const i="pending"===this.state.status,r=!this.#h.canStart();try{if(i)t();else{this.#p({type:"pending",variables:e,isPaused:r}),this.#j.config.onMutate&&await this.#j.config.onMutate(e,this,n);const t=await(this.options.onMutate?.(e,n));t!==this.state.context&&this.#p({type:"pending",context:t,variables:e,isPaused:r})}const s=await this.#h.start();return await(this.#j.config.onSuccess?.(s,e,this.state.context,this,n)),await(this.options.onSuccess?.(s,e,this.state.context,n)),await(this.#j.config.onSettled?.(s,null,this.state.variables,this.state.context,this,n)),await(this.options.onSettled?.(s,null,e,this.state.context,n)),this.#p({type:"success",data:s}),s}catch(t){try{await(this.#j.config.onError?.(t,e,this.state.context,this,n))}catch(e){Promise.reject(e)}try{await(this.options.onError?.(t,e,this.state.context,n))}catch(e){Promise.reject(e)}try{await(this.#j.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n))}catch(e){Promise.reject(e)}try{await(this.options.onSettled?.(void 0,t,e,this.state.context,n))}catch(e){Promise.reject(e)}throw this.#p({type:"error",error:t}),t}finally{this.#j.runNext(this)}}#p(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),Pl.batch(()=>{this.#F.forEach(t=>{t.onMutationUpdate(e)}),this.#j.notify({mutation:this,type:"updated",action:e})})}};var Kl=class extends el{constructor(e={}){super(),this.config=e,this.#B=new Set,this.#U=new Map,this.#V=0}#B;#U;#V;build(e,t,n){const i=new Hl({client:e,mutationCache:this,mutationId:++this.#V,options:e.defaultMutationOptions(t),state:n});return this.add(i),i}add(e){this.#B.add(e);const t=Yl(e);if("string"==typeof t){const n=this.#U.get(t);n?n.push(e):this.#U.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#B.delete(e)){const t=Yl(e);if("string"==typeof t){const n=this.#U.get(t);if(n)if(n.length>1){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}else n[0]===e&&this.#U.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Yl(e);if("string"==typeof t){const n=this.#U.get(t),i=n?.find(e=>"pending"===e.state.status);return!i||i===e}return!0}runNext(e){const t=Yl(e);if("string"==typeof t){const n=this.#U.get(t)?.find(t=>t!==e&&t.state.isPaused);return n?.continue()??Promise.resolve()}return Promise.resolve()}clear(){Pl.batch(()=>{this.#B.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#B.clear(),this.#U.clear()})}getAll(){return Array.from(this.#B)}find(e){const t={exact:!0,...e};return this.getAll().find(e=>cl(t,e))}findAll(e={}){return this.getAll().filter(t=>cl(e,t))}notify(e){Pl.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(e=>e.state.isPaused);return Pl.batch(()=>Promise.all(e.map(e=>e.continue().catch(rl))))}};function Yl(e){return e.options.scope?.id}var Xl=class extends el{#c;#v=void 0;#G;#$;constructor(e,t){super(),this.#c=e,this.setOptions(t),this.bindMethods(),this.#Z()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#c.defaultMutationOptions(e),_l(this.options,t)||this.#c.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#G,observer:this}),t?.mutationKey&&this.options.mutationKey&&dl(t.mutationKey)!==dl(this.options.mutationKey)?this.reset():"pending"===this.#G?.state.status&&this.#G.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#G?.removeObserver(this)}onMutationUpdate(e){this.#Z(),this.#I(e)}getCurrentResult(){return this.#v}reset(){this.#G?.removeObserver(this),this.#G=void 0,this.#Z(),this.#I()}mutate(e,t){return this.#$=t,this.#G?.removeObserver(this),this.#G=this.#c.getMutationCache().build(this.#c,this.options),this.#G.addObserver(this),this.#G.execute(e)}#Z(){const e=this.#G?.state??{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0};this.#v={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#I(e){Pl.batch(()=>{if(this.#$&&this.hasListeners()){const t=this.#v.variables,n=this.#v.context,i={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};if("success"===e?.type){try{this.#$.onSuccess?.(e.data,t,n,i)}catch(e){Promise.reject(e)}try{this.#$.onSettled?.(e.data,null,t,n,i)}catch(e){Promise.reject(e)}}else if("error"===e?.type){try{this.#$.onError?.(e.error,t,n,i)}catch(e){Promise.reject(e)}try{this.#$.onSettled?.(void 0,e.error,t,n,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#v)})})}},Ql=class extends el{constructor(e={}){super(),this.config=e,this.#q=new Map}#q;build(e,t,n){const i=t.queryKey,r=t.queryHash??hl(i,t);let s=this.get(r);return s||(s=new Dl({client:e,queryKey:i,queryHash:r,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(i)}),this.add(s)),s}add(e){this.#q.has(e.queryHash)||(this.#q.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#q.get(e.queryHash);t&&(e.destroy(),t===e&&this.#q.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Pl.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#q.get(e)}getAll(){return[...this.#q.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(e=>ul(t,e))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ul(e,t)):t}notify(e){Pl.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Pl.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Pl.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Jl=class{#W;#j;#d;#H;#K;#Y;#X;#Q;constructor(e={}){this.#W=e.queryCache||new Ql,this.#j=e.mutationCache||new Kl,this.#d=e.defaultOptions||{},this.#H=new Map,this.#K=new Map,this.#Y=0}mount(){this.#Y++,1===this.#Y&&(this.#X=kl.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#W.onFocus())}),this.#Q=Cl.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#W.onOnline())}))}unmount(){this.#Y--,0===this.#Y&&(this.#X?.(),this.#X=void 0,this.#Q?.(),this.#Q=void 0)}isFetching(e){return this.#W.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#j.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#W.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#W.build(this,t),i=n.state.data;return void 0===i?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(al(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return this.#W.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){const i=this.defaultQueryOptions({queryKey:e}),r=this.#W.get(i.queryHash),s=r?.state.data,o=function(e,t){return"function"==typeof e?e(t):e}(t,s);if(void 0!==o)return this.#W.build(this,i).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Pl.batch(()=>this.#W.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#W.get(t.queryHash)?.state}removeQueries(e){const t=this.#W;Pl.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){const n=this.#W;return Pl.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},i=Pl.batch(()=>this.#W.findAll(e).map(e=>e.cancel(n)));return Promise.all(i).then(rl).catch(rl)}invalidateQueries(e,t={}){return Pl.batch(()=>(this.#W.findAll(e).forEach(e=>{e.invalidate()}),"none"===e?.refetchType?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},i=Pl.batch(()=>this.#W.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(rl)),"paused"===e.state.fetchStatus?Promise.resolve():t}));return Promise.all(i).then(rl)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const n=this.#W.build(this,t);return n.isStaleByTime(al(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(rl).catch(rl)}fetchInfiniteQuery(e){return e.behavior=Zl(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(rl).catch(rl)}ensureInfiniteQueryData(e){return e.behavior=Zl(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Cl.isOnline()?this.#j.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#W}getMutationCache(){return this.#j}getDefaultOptions(){return this.#d}setDefaultOptions(e){this.#d=e}setQueryDefaults(e,t){this.#H.set(dl(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#H.values()],n={};return t.forEach(t=>{fl(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#K.set(dl(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#K.values()],n={};return t.forEach(t=>{fl(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#d.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=hl(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===El&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#d.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#W.clear(),this.#j.clear()}},eu=A.createContext(void 0),tu=e=>{const t=A.useContext(eu);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},nu=({client:e,children:t})=>(A.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),q(eu.Provider,{value:e,children:t})),iu=A.createContext(!1);iu.Provider;var ru=A.createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),su=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ou(e,t,n){if("production"!==process.env.NODE_ENV&&("object"!=typeof e||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const i=A.useContext(iu),r=A.useContext(ru),s=tu(),o=s.defaultQueryOptions(e);s.getDefaultOptions().queries?._experimental_beforeQuery?.(o);const a=s.getQueryCache().get(o.queryHash);"production"!==process.env.NODE_ENV&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),o._optimisticResults=i?"isRestoring":"optimistic",(e=>{if(e.suspense){const t=1e3,n=e=>"static"===e?e:Math.max(e??t,t),i=e.staleTime;e.staleTime="function"==typeof i?(...e)=>n(i(...e)):n(i),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,t))}})(o),((e,t,n)=>{const i=n?.state.error&&"function"==typeof e.throwOnError?Tl(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||i)&&(t.isReset()||(e.retryOnMount=!1))})(o,r,a),(e=>{A.useEffect(()=>{e.clearReset()},[e])})(r);const l=!s.getQueryCache().get(o.queryHash),[u]=A.useState(()=>new t(s,o)),c=u.getOptimisticResult(o),h=!i&&!1!==e.subscribed;if(A.useSyncExternalStore(A.useCallback(e=>{const t=h?u.subscribe(Pl.batchCalls(e)):rl;return u.updateResult(),t},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),A.useEffect(()=>{u.setOptions(o)},[o,u]),((e,t)=>e?.suspense&&t.isPending)(o,c))throw su(o,u,r);if((({result:e,errorResetBoundary:t,throwOnError:n,query:i,suspense:r})=>e.isError&&!t.isReset()&&!e.isFetching&&i&&(r&&void 0===e.data||Tl(n,[e.error,i])))({result:c,errorResetBoundary:r,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw c.error;if(s.getDefaultOptions().queries?._experimental_afterQuery?.(o,c),o.experimental_prefetchInRender&&!il&&((e,t)=>e.isLoading&&e.isFetching&&!t)(c,i)){const e=l?su(o,u,r):a?.promise;e?.catch(rl).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?c:u.trackResult(c)}function au(e,t){const n=tu(),[i]=A.useState(()=>new Xl(n,e));A.useEffect(()=>{i.setOptions(e)},[i,e]);const r=A.useSyncExternalStore(A.useCallback(e=>i.subscribe(Pl.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),s=A.useCallback((e,t)=>{i.mutate(e,t).catch(rl)},[i]);if(r.error&&Tl(i.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:s,mutateAsync:r.mutate}}const lu=new class{client;queryCache;mutationCache;constructor(){const e=new Ql,t=new Kl;this.queryCache=e,this.mutationCache=t,this.client=new Jl({queryCache:e,mutationCache:t})}};class uu{constructor(){Bs(this),ds(()=>this.isUnauthorized,e=>{e&&(Zo.remove("access_token"),Zo.remove("token_type"))})}_isUnauthorized=!1;get isUnauthorized(){return this._isUnauthorized}set isUnauthorized(e){this._isUnauthorized=e}}const cu=new uu;class hu{constructor(){Bs(this)}_visible=tr.map();getIsOpen(e){return this._visible.get(e)??!1}_setVisible({name:e,value:t}){this._visible.set(e,t)}open(e){this._setVisible({name:e,value:!0})}close(e){this._setVisible({name:e,value:!1})}closeAll(){this._visible.clear()}}const du=new hu;class fu{authStore=cu;modalStore=du;alertStore=$o}const pu=new fu,mu=A.createContext(pu),_u=({children:e})=>q(mu.Provider,{value:pu,children:e});class gu{config;client;constructor(e){this.config=e,this.client=H.create({baseURL:e?.baseURL,withCredentials:e?.withCredentials,timeout:1e4,headers:{"Content-Type":"application/json"}}),this.setupInterceptors()}setupInterceptors(){this.client.interceptors.request.use(e=>{pu.authStore.isUnauthorized=!1;const t=this.config?.getHeaders?.(),n=Zo.load("access_token"),i=Zo.load("token_type");return n&&i&&(e.headers.Authorization=`${i} ${n}`),t&&Object.entries(t).forEach(([t,n])=>{e.headers[t]=n}),e},e=>(hn({message:e.message,variant:"error"}),Promise.reject(e))),this.client.interceptors.response.use(e=>e,e=>(hn({message:e.message,variant:"error"}),401===e.status&&(pu.authStore.isUnauthorized=!0),Promise.reject(e)))}async get({url:e,config:t}){return(await this.client.get(e,t)).data}async post({url:e,body:t,config:n}){return(await this.client.post(e,t,n)).data}async put({url:e,body:t,config:n}){return(await this.client.put(e,t,n)).data}async patch({url:e,body:t,config:n}){return(await this.client.patch(e,t,n)).data}async delete({url:e,config:t}){return(await this.client.delete(e,t)).data}}class yu{configOptions;_private_key;_apiService;static _instance=null;static get instance(){if(!yu._instance)throw new Error("Dartcom Config не инициализирован с приватным ключом. Вызовите Config.initialize(...) первым, чтобы иметь возможность пользоваться компонентами нашей библиотеки");return yu._instance}static initialize(e){yu._instance||(yu._instance=new yu(e))}static deactivate(){this._instance=null}constructor(e){this.configOptions=e;const{private_key:t,apiConfig:n}=e;this._private_key=t;const i=new gu(n);this._apiService=i,this._getCheckKeyData().then(t=>{if(t){const{valid:n}=t;e.onCheck?.(t),this._isValidApiKey=n}})}get apiService(){return this._apiService}_isValidApiKey=!1;get isValidApiKey(){return this._isValidApiKey}async _getCheckKeyData(){const e=await this.apiService.get({url:"check_tile_token",config:{params:{tile_token:this._private_key}}}).then(e=>e).catch(e=>{const{response:t,message:n}=e;if(this.configOptions.onError?.(e),t){const{data:{detail:e}}=t;return e}return{reason:n,valid:!1}});return e}}const vu=()=>ou({queryKey:["user"],queryFn:async()=>await yu.instance.apiService.get({url:"user/"})},Bl),bu=()=>au({mutationKey:["user"],mutationFn:async()=>await yu.instance.apiService.get({url:"user/"})}),xu=()=>{const{enqueueSnackbar:e}=D(Ge);return({variant:t,message:n})=>{e({variant:t,message:n,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:3e3,hideIconVariant:!0})}},wu=()=>{const e=xu();return t=>{const{response:n}=t;if(n){const{data:t}=n;if(t){const{detail:n}=t;n&&n.forEach(t=>{e({variant:"error",message:t})})}}}},Eu=()=>au({mutationKey:["sign-in-mutation"],mutationFn:async({body:{username:e,password:t}})=>{const n=cn({username:e,password:un(t)});return await yu.instance.apiService.post({url:"token",body:n,config:{headers:{"Content-Type":"application/x-www-form-urlencoded"}}})},onSuccess:({access_token:e,token_type:t})=>{Zo.save("access_token",e),Zo.save("token_type",t)}}),Au=()=>au({mutationKey:["logout-mutation"],mutationFn:async e=>await yu.instance.apiService.post({url:"logout"}),onError:wu(),onSuccess:()=>{lu.client.invalidateQueries({queryKey:["user"]})}});var Tu,ku,Su,Ou;!function(e){e.GET="GET",e.DELETE="DELETE",e.PUT="PUT",e.POST="POST"}(Tu||(Tu={})),function(e){e.TOP_RIGHT="top-right",e.BOTTOM_RIGHT="bottom-right",e.BOTTOM_LEFT="bottom-left",e.TOP_LEFT="top-left"}(ku||(ku={}));var Pu,Cu,Ru=function(){if(Ou)return Su;function e(e){this._maxSize=e,this.clear()}Ou=1,e.prototype.clear=function(){this._size=0,this._values=Object.create(null)},e.prototype.get=function(e){return this._values[e]},e.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var t=/[^.^\]^[]+|(?=\[\]|\.\.)/g,n=/^\d+$/,i=/^\d/,r=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,s=/^\s*(['"]?)(.*?)(\1)\s*$/,o=new e(512),a=new e(512),l=new e(512);function u(e){return o.get(e)||o.set(e,c(e).map(function(e){return e.replace(s,"$2")}))}function c(e){return e.match(t)||[""]}function h(e){return"string"==typeof e&&e&&-1!==["'",'"'].indexOf(e.charAt(0))}function d(e){return!h(e)&&(function(e){return e.match(i)&&!e.match(n)}(e)||function(e){return r.test(e)}(e))}return Su={Cache:e,split:c,normalizePath:u,setter:function(e){var t=u(e);return a.get(e)||a.set(e,function(e,n){for(var i=0,r=t.length,s=e;i<r-1;){var o=t[i];if("__proto__"===o||"constructor"===o||"prototype"===o)return e;s=s[t[i++]]}s[t[i]]=n})},getter:function(e,t){var n=u(e);return l.get(e)||l.set(e,function(e){for(var i=0,r=n.length;i<r;){if(null==e&&t)return;e=e[n[i++]]}return e})},join:function(e){return e.reduce(function(e,t){return e+(h(t)||n.test(t)?"["+t+"]":(e?".":"")+t)},"")},forEach:function(e,t,n){!function(e,t,n){var i,r,s,o,a=e.length;for(r=0;r<a;r++)(i=e[r])&&(d(i)&&(i='"'+i+'"'),s=!(o=h(i))&&/^\d+$/.test(i),t.call(n,i,o,s,r,e))}(Array.isArray(e)?e:c(e),t,n)}},Su}();var Mu,Lu=function(){if(Cu)return Pu;Cu=1;const e=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\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]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\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\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\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]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\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\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\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\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?: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_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,t=t=>t.match(e)||[],n=e=>e[0].toUpperCase()+e.slice(1),i=(e,n)=>t(e).join(n).toLowerCase(),r=e=>t(e).reduce((e,t)=>`${e}${e?t[0].toUpperCase()+t.slice(1).toLowerCase():t.toLowerCase()}`,"");return Pu={words:t,upperFirst:n,camelCase:r,pascalCase:e=>n(r(e)),snakeCase:e=>i(e,"_"),kebabCase:e=>i(e,"-"),sentenceCase:e=>n(i(e," ")),titleCase:e=>t(e).map(n).join(" ")}}(),Nu={exports:{}};var zu=function(){if(Mu)return Nu.exports;function e(e,t){var n=e.length,i=new Array(n),r={},s=n,o=function(e){for(var t=new Map,n=0,i=e.length;n<i;n++){var r=e[n];t.has(r[0])||t.set(r[0],new Set),t.has(r[1])||t.set(r[1],new Set),t.get(r[0]).add(r[1])}return t}(t),a=function(e){for(var t=new Map,n=0,i=e.length;n<i;n++)t.set(e[n],n);return t}(e);for(t.forEach(function(e){if(!a.has(e[0])||!a.has(e[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});s--;)r[s]||l(e[s],s,new Set);return i;function l(e,t,s){if(s.has(e)){var u;try{u=", node was:"+JSON.stringify(e)}catch(e){u=""}throw new Error("Cyclic dependency"+u)}if(!a.has(e))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(e));if(!r[t]){r[t]=!0;var c=o.get(e)||new Set;if(t=(c=Array.from(c)).length){s.add(e);do{var h=c[--t];l(h,a.get(h),s)}while(t);s.delete(e)}i[--n]=e}}}return Mu=1,Nu.exports=function(t){return e(function(e){for(var t=new Set,n=0,i=e.length;n<i;n++){var r=e[n];t.add(r[0]),t.add(r[1])}return Array.from(t)}(t),t)},Nu.exports.array=e,Nu.exports}(),Du=we(zu);const Iu=Object.prototype.toString,Fu=Error.prototype.toString,ju=RegExp.prototype.toString,Bu="undefined"!=typeof Symbol?Symbol.prototype.toString:()=>"",Uu=/^Symbol\((.*)\)(.*)$/;function Vu(e,t=!1){if(null==e||!0===e||!1===e)return""+e;const n=typeof e;if("number"===n)return function(e){return e!=+e?"NaN":0===e&&1/e<0?"-0":""+e}(e);if("string"===n)return t?`"${e}"`:e;if("function"===n)return"[Function "+(e.name||"anonymous")+"]";if("symbol"===n)return Bu.call(e).replace(Uu,"Symbol($1)");const i=Iu.call(e).slice(8,-1);return"Date"===i?isNaN(e.getTime())?""+e:e.toISOString(e):"Error"===i||e instanceof Error?"["+Fu.call(e)+"]":"RegExp"===i?ju.call(e):null}function Gu(e,t){let n=Vu(e,t);return null!==n?n:JSON.stringify(e,function(e,n){let i=Vu(this[e],t);return null!==i?i:n},2)}function $u(e){return null==e?[]:[].concat(e)}let Zu,qu,Wu,Hu=/\$\{\s*(\w+)\s*\}/g;Zu=Symbol.toStringTag;class Ku{constructor(e,t,n,i){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[Zu]="Error",this.name="ValidationError",this.value=t,this.path=n,this.type=i,this.errors=[],this.inner=[],$u(e).forEach(e=>{if(Yu.isError(e)){this.errors.push(...e.errors);const t=e.inner.length?e.inner:[e];this.inner.push(...t)}else this.errors.push(e)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}qu=Symbol.hasInstance,Wu=Symbol.toStringTag;class Yu extends Error{static formatError(e,t){const n=t.label||t.path||"this";return t=Object.assign({},t,{path:n,originalPath:t.path}),"string"==typeof e?e.replace(Hu,(e,n)=>Gu(t[n])):"function"==typeof e?e(t):e}static isError(e){return e&&"ValidationError"===e.name}constructor(e,t,n,i,r){const s=new Ku(e,t,n,i);if(r)return s;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[Wu]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,Yu)}static[qu](e){return Ku[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Xu={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:n,originalValue:i})=>{const r=null!=i&&i!==n?` (cast from the value \`${Gu(i,!0)}\`).`:".";return"mixed"!==t?`${e} must be a \`${t}\` type, but the final value was: \`${Gu(n,!0)}\``+r:`${e} must match the configured type. The validated value was: \`${Gu(n,!0)}\``+r}},Qu={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Ju={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},ec={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},tc={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},nc={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},ic={notType:e=>{const{path:t,value:n,spec:i}=e,r=i.types.length;if(Array.isArray(n)){if(n.length<r)return`${t} tuple value has too few items, expected a length of ${r} but got ${n.length} for value: \`${Gu(n,!0)}\``;if(n.length>r)return`${t} tuple value has too many items, expected a length of ${r} but got ${n.length} for value: \`${Gu(n,!0)}\``}return Yu.formatError(Xu.notType,e)}};Object.assign(Object.create(null),{mixed:Xu,string:Qu,number:Ju,date:ec,object:tc,array:nc,boolean:{isValue:"${path} field must be ${value}"},tuple:ic});const rc=e=>e&&e.__isYupSchema__;class sc{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:n,then:i,otherwise:r}=t,s="function"==typeof n?n:(...e)=>e.every(e=>e===n);return new sc(e,(e,t)=>{var n;let o=s(...e)?i:r;return null!=(n=null==o?void 0:o(t))?n:t})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let n=this.refs.map(e=>e.getValue(null==t?void 0:t.value,null==t?void 0:t.parent,null==t?void 0:t.context)),i=this.fn(n,e,t);if(void 0===i||i===e)return e;if(!rc(i))throw new TypeError("conditions must return a schema object");return i.resolve(t)}}const oc="$",ac=".";class lc{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,"string"!=typeof e)throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),""===e)throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===oc,this.isValue=this.key[0]===ac,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?oc:this.isValue?ac:"";this.path=this.key.slice(n.length),this.getter=this.path&&Ru.getter(this.path,!0),this.map=t.map}getValue(e,t,n){let i=this.isContext?n:this.isValue?e:t;return this.getter&&(i=this.getter(i||{})),this.map&&(i=this.map(i)),i}cast(e,t){return this.getValue(e,null==t?void 0:t.parent,null==t?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}lc.prototype.__isYupRef=!0;const uc=e=>null==e;function cc(e){function t({value:t,path:n="",options:i,originalValue:r,schema:s},o,a){const{name:l,test:u,params:c,message:h,skipAbsent:d}=e;let{parent:f,context:p,abortEarly:m=s.spec.abortEarly,disableStackTrace:_=s.spec.disableStackTrace}=i;const g={value:t,parent:f,context:p};function y(e={}){const i=hc(Object.assign({value:t,originalValue:r,label:s.spec.label,path:e.path||n,spec:s.spec,disableStackTrace:e.disableStackTrace||_},c,e.params),g),o=new Yu(Yu.formatError(e.message||h,i),t,i.path,e.type||l,i.disableStackTrace);return o.params=i,o}const v=m?o:a;let b={path:n,parent:f,type:l,from:i.from,createError:y,resolve:e=>dc(e,g),options:i,originalValue:r,schema:s};const x=e=>{Yu.isError(e)?v(e):e?a(null):v(y())},w=e=>{Yu.isError(e)?v(e):o(e)};if(d&&uc(t))return x(!0);let E;try{var A;if(E=u.call(b,t,b),"function"==typeof(null==(A=E)?void 0:A.then)){if(i.sync)throw new Error(`Validation test of type: "${b.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(E).then(x,w)}}catch(e){return void w(e)}x(E)}return t.OPTIONS=e,t}function hc(e,t){if(!e)return e;for(const n of Object.keys(e))e[n]=dc(e[n],t);return e}function dc(e,t){return lc.isRef(e)?e.getValue(t.value,t.parent,t.context):e}function fc(e,t,n,i=n){let r,s,o;return t?(Ru.forEach(t,(a,l,u)=>{let c=l?a.slice(1,a.length-1):a,h="tuple"===(e=e.resolve({context:i,parent:r,value:n})).type,d=u?parseInt(c,10):0;if(e.innerType||h){if(h&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${o}" must contain an index to the tuple element, e.g. "${o}[0]"`);if(n&&d>=n.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${t}. because there is no value at that index. `);r=n,n=n&&n[d],e=h?e.spec.types[d]:e.innerType}if(!u){if(!e.fields||!e.fields[c])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${o} which is a type: "${e.type}")`);r=n,n=n&&n[c],e=e.fields[c]}s=c,o=l?"["+a+"]":"."+a}),{schema:e,parent:r,parentPath:s}):{parent:r,parentPath:t,schema:e}}class pc extends Set{describe(){const e=[];for(const t of this.values())e.push(lc.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const n of this.values())t.push(e(n));return t}clone(){return new pc(this.values())}merge(e,t){const n=this.clone();return e.forEach(e=>n.add(e)),t.forEach(e=>n.delete(e)),n}}function mc(e,t=new Map){if(rc(e)||!e||"object"!=typeof e)return e;if(t.has(e))return t.get(e);let n;if(e instanceof Date)n=new Date(e.getTime()),t.set(e,n);else if(e instanceof RegExp)n=new RegExp(e),t.set(e,n);else if(Array.isArray(e)){n=new Array(e.length),t.set(e,n);for(let i=0;i<e.length;i++)n[i]=mc(e[i],t)}else if(e instanceof Map){n=new Map,t.set(e,n);for(const[i,r]of e.entries())n.set(i,mc(r,t))}else if(e instanceof Set){n=new Set,t.set(e,n);for(const i of e)n.add(mc(i,t))}else{if(!(e instanceof Object))throw Error(`Unable to clone ${e}`);n={},t.set(e,n);for(const[i,r]of Object.entries(e))n[i]=mc(r,t)}return n}function _c(e){if(null==e||!e.length)return;const t=[];let n="",i=!1,r=!1;for(let s=0;s<e.length;s++){const o=e[s];"["!==o||r?"]"!==o||r?'"'!==o?"."!==o||i||r?n+=o:n&&(t.push(n),n=""):r=!r:(n&&(/^\d+$/.test(n)?t.push(n):t.push(n.replace(/^"|"$/g,"")),n=""),i=!1):(n&&(t.push(...n.split(".").filter(Boolean)),n=""),i=!0)}return n&&t.push(...n.split(".").filter(Boolean)),t}function gc(e,t){var n;if((null==(n=e.inner)||!n.length)&&e.errors.length)return function(e,t){const n=t?`${t}.${e.path}`:e.path;return e.errors.map(e=>({message:e,path:_c(n)}))}(e,t);const i=t?`${t}.${e.path}`:e.path;return e.inner.flatMap(e=>gc(e,i))}class yc{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new pc,this._blacklist=new pc,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Xu.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},null==e?void 0:e.spec),this.withMutation(e=>{e.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=mc(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(0===e.length)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let n=e(this);return this._mutate=t,n}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&"mixed"!==this.type)throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,n=e.clone();const i=Object.assign({},t.spec,n.spec);return n.spec=i,n.internalTests=Object.assign({},t.internalTests,n.internalTests),n._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),n._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),n.tests=t.tests,n.exclusiveTests=t.exclusiveTests,n.withMutation(t=>{e.tests.forEach(e=>{t.test(e.OPTIONS)})}),n.transforms=[...t.transforms,...n.transforms],n}isType(e){return null==e?!(!this.spec.nullable||null!==e)||!(!this.spec.optional||void 0!==e):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let n=t.conditions;t=t.clone(),t.conditions=[],t=n.reduce((t,n)=>n.resolve(t,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,n,i,r;return Object.assign({},e,{from:e.from||[],strict:null!=(t=e.strict)?t:this.spec.strict,abortEarly:null!=(n=e.abortEarly)?n:this.spec.abortEarly,recursive:null!=(i=e.recursive)?i:this.spec.recursive,disableStackTrace:null!=(r=e.disableStackTrace)?r:this.spec.disableStackTrace})}cast(e,t={}){let n=this.resolve(Object.assign({},t,{value:e})),i="ignore-optionality"===t.assert,r=n._cast(e,t);if(!1!==t.assert&&!n.isType(r)){if(i&&uc(r))return r;let s=Gu(e),o=Gu(r);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${n.type}". \n\nattempted value: ${s} \n`+(o!==s?`result of cast: ${o}`:""))}return r}_cast(e,t){let n=void 0===e?e:this.transforms.reduce((n,i)=>i.call(this,n,e,this,t),e);return void 0===n&&(n=this.getDefault(t)),n}_validate(e,t={},n,i){let{path:r,originalValue:s=e,strict:o=this.spec.strict}=t,a=e;o||(a=this._cast(a,Object.assign({assert:!1},t)));let l=[];for(let e of Object.values(this.internalTests))e&&l.push(e);this.runTests({path:r,value:a,originalValue:s,options:t,tests:l},n,e=>{if(e.length)return i(e,a);this.runTests({path:r,value:a,originalValue:s,options:t,tests:this.tests},n,i)})}runTests(e,t,n){let i=!1,{tests:r,value:s,originalValue:o,path:a,options:l}=e,u=e=>{i||(i=!0,t(e,s))},c=e=>{i||(i=!0,n(e,s))},h=r.length,d=[];if(!h)return c([]);let f={value:s,originalValue:o,path:a,options:l,schema:this};for(let e=0;e<r.length;e++){(0,r[e])(f,u,function(e){e&&(Array.isArray(e)?d.push(...e):d.push(e)),--h<=0&&c(d)})}}asNestedTest({key:e,index:t,parent:n,parentPath:i,originalParent:r,options:s}){const o=null!=e?e:t;if(null==o)throw TypeError("Must include `key` or `index` for nested validations");const a="number"==typeof o;let l=n[o];const u=Object.assign({},s,{strict:!0,parent:n,value:l,originalValue:r[o],key:void 0,[a?"index":"key"]:o,path:a||o.includes(".")?`${i||""}[${a?o:`"${o}"`}]`:(i?`${i}.`:"")+e});return(e,t,n)=>this.resolve(u)._validate(l,u,t,n)}validate(e,t){var n;let i=this.resolve(Object.assign({},t,{value:e})),r=null!=(n=null==t?void 0:t.disableStackTrace)?n:i.spec.disableStackTrace;return new Promise((n,s)=>i._validate(e,t,(e,t)=>{Yu.isError(e)&&(e.value=t),s(e)},(e,t)=>{e.length?s(new Yu(e,t,void 0,void 0,r)):n(t)}))}validateSync(e,t){var n;let i,r=this.resolve(Object.assign({},t,{value:e})),s=null!=(n=null==t?void 0:t.disableStackTrace)?n:r.spec.disableStackTrace;return r._validate(e,Object.assign({},t,{sync:!0}),(e,t)=>{throw Yu.isError(e)&&(e.value=t),e},(t,n)=>{if(t.length)throw new Yu(t,e,void 0,void 0,s);i=n}),i}isValid(e,t){return this.validate(e,t).then(()=>!0,e=>{if(Yu.isError(e))return!1;throw e})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(e){if(Yu.isError(e))return!1;throw e}}_getDefault(e){let t=this.spec.default;return null==t?t:"function"==typeof t?t.call(this,e):mc(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){if(0===arguments.length)return this._getDefault();return this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const n=this.clone({nullable:e});return n.internalTests.nullable=cc({message:t,name:"nullable",test(e){return null!==e||this.schema.spec.nullable}}),n}optionality(e,t){const n=this.clone({optional:e});return n.internalTests.optionality=cc({message:t,name:"optionality",test(e){return void 0!==e||this.schema.spec.optional}}),n}optional(){return this.optionality(!0)}defined(e=Xu.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Xu.notNull){return this.nullability(!1,e)}required(e=Xu.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(t=1===e.length?"function"==typeof e[0]?{test:e[0]}:e[0]:2===e.length?{name:e[0],test:e[1]}:{name:e[0],message:e[1],test:e[2]},void 0===t.message&&(t.message=Xu.default),"function"!=typeof t.test)throw new TypeError("`test` is a required parameters");let n=this.clone(),i=cc(t),r=t.exclusive||t.name&&!0===n.exclusiveTests[t.name];if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(n.exclusiveTests[t.name]=!!t.exclusive),n.tests=n.tests.filter(e=>{if(e.OPTIONS.name===t.name){if(r)return!1;if(e.OPTIONS.test===i.OPTIONS.test)return!1}return!0}),n.tests.push(i),n}when(e,t){Array.isArray(e)||"string"==typeof e||(t=e,e=".");let n=this.clone(),i=$u(e).map(e=>new lc(e));return i.forEach(e=>{e.isSibling&&n.deps.push(e.key)}),n.conditions.push("function"==typeof t?new sc(i,t):sc.fromOptions(i,t)),n}typeError(e){let t=this.clone();return t.internalTests.typeError=cc({message:e,name:"typeError",skipAbsent:!0,test(e){return!!this.schema._typeCheck(e)||this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=Xu.oneOf){let n=this.clone();return e.forEach(e=>{n._whitelist.add(e),n._blacklist.delete(e)}),n.internalTests.whiteList=cc({message:t,name:"oneOf",skipAbsent:!0,test(e){let t=this.schema._whitelist,n=t.resolveAll(this.resolve);return!!n.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:n}})}}),n}notOneOf(e,t=Xu.notOneOf){let n=this.clone();return e.forEach(e=>{n._blacklist.add(e),n._whitelist.delete(e)}),n.internalTests.blacklist=cc({message:t,name:"notOneOf",test(e){let t=this.schema._blacklist,n=t.resolveAll(this.resolve);return!n.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:n}})}}),n}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:n,meta:i,optional:r,nullable:s}=t.spec,o={meta:i,label:n,optional:r,nullable:s,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.filter((e,t,n)=>n.findIndex(t=>t.OPTIONS.name===e.OPTIONS.name)===t).map(t=>{const n=t.OPTIONS.params&&e?hc(Object.assign({},t.OPTIONS.params),e):t.OPTIONS.params;return{name:t.OPTIONS.name,params:n}})};return o}get"~standard"(){const e=this,t={version:1,vendor:"yup",async validate(t){try{return{value:await e.validate(t,{abortEarly:!1})}}catch(e){if(e instanceof Yu)return{issues:gc(e)};throw e}}};return t}}yc.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])yc.prototype[`${e}At`]=function(t,n,i={}){const{parent:r,parentPath:s,schema:o}=fc(this,t,n,i.context);return o[e](r&&r[s],Object.assign({},i,{parent:r,path:t}))};for(const e of["equals","is"])yc.prototype[e]=yc.prototype.oneOf;for(const e of["not","nope"])yc.prototype[e]=yc.prototype.notOneOf;const vc=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function bc(e){var t,n;const i=vc.exec(e);return i?{year:xc(i[1]),month:xc(i[2],1)-1,day:xc(i[3],1),hour:xc(i[4]),minute:xc(i[5]),second:xc(i[6]),millisecond:i[7]?xc(i[7].substring(0,3)):0,precision:null!=(t=null==(n=i[7])?void 0:n.length)?t:void 0,z:i[8]||void 0,plusMinus:i[9]||void 0,hourOffset:xc(i[10]),minuteOffset:xc(i[11])}:null}function xc(e,t=0){return Number(e)||t}let wc=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Ec=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,Ac=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Tc=new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"),kc=e=>uc(e)||e===e.trim(),Sc={}.toString();function Oc(){return new Pc}class Pc extends yc{constructor(){super({type:"string",check:e=>(e instanceof String&&(e=e.valueOf()),"string"==typeof e)}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce||this.isType(e))return e;if(Array.isArray(e))return e;const n=null!=e&&e.toString?e.toString():e;return n===Sc?e:n})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||Xu.required,name:"required",skipAbsent:!0,test:e=>!!e.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(e=>"required"!==e.OPTIONS.name),e))}length(e,t=Qu.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t=Qu.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t=Qu.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}matches(e,t){let n,i,r=!1;return t&&("object"==typeof t?({excludeEmptyString:r=!1,message:n,name:i}=t):n=t),this.test({name:i||"matches",message:n||Qu.matches,params:{regex:e},skipAbsent:!0,test:t=>""===t&&r||-1!==t.search(e)})}email(e=Qu.email){return this.matches(wc,{name:"email",message:e,excludeEmptyString:!0})}url(e=Qu.url){return this.matches(Ec,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=Qu.uuid){return this.matches(Ac,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t,n,i="";return e&&("object"==typeof e?({message:i="",allowOffset:t=!1,precision:n}=e):i=e),this.matches(Tc,{name:"datetime",message:i||Qu.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:i||Qu.datetime_offset,params:{allowOffset:t},skipAbsent:!0,test:e=>{if(!e||t)return!0;const n=bc(e);return!!n&&!!n.z}}).test({name:"datetime_precision",message:i||Qu.datetime_precision,params:{precision:n},skipAbsent:!0,test:e=>{if(!e||null==n)return!0;const t=bc(e);return!!t&&t.precision===n}})}ensure(){return this.default("").transform(e=>null===e?"":e)}trim(e=Qu.trim){return this.transform(e=>null!=e?e.trim():e).test({message:e,name:"trim",test:kc})}lowercase(e=Qu.lowercase){return this.transform(e=>uc(e)?e:e.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>uc(e)||e===e.toLowerCase()})}uppercase(e=Qu.uppercase){return this.transform(e=>uc(e)?e:e.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>uc(e)||e===e.toUpperCase()})}}Oc.prototype=Pc.prototype;function Cc(){return new Rc}class Rc extends yc{constructor(){super({type:"number",check:e=>(e instanceof Number&&(e=e.valueOf()),"number"==typeof e&&!(e=>e!=+e)(e))}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce)return e;let n=e;if("string"==typeof n){if(n=n.replace(/\s/g,""),""===n)return NaN;n=+n}return this.isType(n)||null===n?n:parseFloat(n)})})}min(e,t=Ju.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t>=this.resolve(e)}})}max(e,t=Ju.max){return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(t){return t<=this.resolve(e)}})}lessThan(e,t=Ju.lessThan){return this.test({message:t,name:"max",exclusive:!0,params:{less:e},skipAbsent:!0,test(t){return t<this.resolve(e)}})}moreThan(e,t=Ju.moreThan){return this.test({message:t,name:"min",exclusive:!0,params:{more:e},skipAbsent:!0,test(t){return t>this.resolve(e)}})}positive(e=Ju.positive){return this.moreThan(0,e)}negative(e=Ju.negative){return this.lessThan(0,e)}integer(e=Ju.integer){return this.test({name:"integer",message:e,skipAbsent:!0,test:e=>Number.isInteger(e)})}truncate(){return this.transform(e=>uc(e)?e:0|e)}round(e){var t;let n=["ceil","floor","round","trunc"];if("trunc"===(e=(null==(t=e)?void 0:t.toLowerCase())||"round"))return this.truncate();if(-1===n.indexOf(e.toLowerCase()))throw new TypeError("Only valid options for round() are: "+n.join(", "));return this.transform(t=>uc(t)?t:Math[e](t))}}Cc.prototype=Rc.prototype;let Mc=new Date("");function Lc(){return new Nc}class Nc extends yc{constructor(){super({type:"date",check(e){return t=e,"[object Date]"===Object.prototype.toString.call(t)&&!isNaN(e.getTime());var t}}),this.withMutation(()=>{this.transform((e,t)=>!this.spec.coerce||this.isType(e)||null===e?e:(e=function(e){const t=bc(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(void 0===t.z&&void 0===t.plusMinus)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let n=0;return"Z"!==t.z&&void 0!==t.plusMinus&&(n=60*t.hourOffset+t.minuteOffset,"+"===t.plusMinus&&(n=0-n)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+n,t.second,t.millisecond)}(e),isNaN(e)?Nc.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let n;if(lc.isRef(e))n=e;else{let i=this.cast(e);if(!this._typeCheck(i))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);n=i}return n}min(e,t=ec.min){let n=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(e){return e>=this.resolve(n)}})}max(e,t=ec.max){let n=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(e){return e<=this.resolve(n)}})}}function zc(e,t){let n=1/0;return e.some((e,i)=>{var r;if(null!=(r=t.path)&&r.includes(e))return n=i,!0}),n}function Dc(e){return(t,n)=>zc(e,t)-zc(e,n)}Nc.INVALID_DATE=Mc,Lc.prototype=Nc.prototype,Lc.INVALID_DATE=Mc;const Ic=(e,t,n)=>{if("string"!=typeof e)return e;let i=e;try{i=JSON.parse(e)}catch(e){}return n.isType(i)?i:e};function Fc(e){if("fields"in e){const t={};for(const[n,i]of Object.entries(e.fields))t[n]=Fc(i);return e.setFields(t)}if("array"===e.type){const t=e.optional();return t.innerType&&(t.innerType=Fc(t.innerType)),t}return"tuple"===e.type?e.optional().clone({types:e.spec.types.map(Fc)}):"optional"in e?e.optional():e}let jc=e=>"[object Object]"===Object.prototype.toString.call(e);function Bc(e,t){let n=Object.keys(e.fields);return Object.keys(t).filter(e=>-1===n.indexOf(e))}const Uc=Dc([]);function Vc(e){return new Gc(e)}class Gc extends yc{constructor(e){super({type:"object",check:e=>jc(e)||"function"==typeof e}),this.fields=Object.create(null),this._sortErrors=Uc,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var n;let i=super._cast(e,t);if(void 0===i)return this.getDefault(t);if(!this._typeCheck(i))return i;let r=this.fields,s=null!=(n=t.stripUnknown)?n:this.spec.noUnknown,o=[].concat(this._nodes,Object.keys(i).filter(e=>!this._nodes.includes(e))),a={},l=Object.assign({},t,{parent:a,__validating:t.__validating||!1}),u=!1;for(const e of o){let n=r[e],o=e in i,c=i[e];if(n){let r;l.path=(t.path?`${t.path}.`:"")+e,n=n.resolve({value:c,context:t.context,parent:a});let s=n instanceof yc?n.spec:void 0,o=null==s?void 0:s.strict;if(null!=s&&s.strip){u=u||e in i;continue}r=t.__validating&&o?c:n.cast(c,l),void 0!==r&&(a[e]=r)}else o&&!s&&(a[e]=c);o===e in a&&a[e]===c||(u=!0)}return u?a:i}_validate(e,t={},n,i){let{from:r=[],originalValue:s=e,recursive:o=this.spec.recursive}=t;t.from=[{schema:this,value:s},...r],t.__validating=!0,t.originalValue=s,super._validate(e,t,n,(e,r)=>{if(!o||!jc(r))return void i(e,r);s=s||r;let a=[];for(let e of this._nodes){let n=this.fields[e];n&&!lc.isRef(n)&&a.push(n.asNestedTest({options:t,key:e,parent:r,parentPath:t.path,originalParent:s}))}this.runTests({tests:a,value:r,originalValue:s,options:t},n,t=>{i(t.sort(this._sortErrors).concat(e),r)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),n=t.fields;for(let[e,t]of Object.entries(this.fields)){const i=n[e];n[e]=void 0===i?t:i}return t.withMutation(t=>t.setFields(n,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(n=>{var i;const r=this.fields[n];let s=e;null!=(i=s)&&i.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[n]})),t[n]=r&&"getDefault"in r?r.getDefault(s):void 0}),t}setFields(e,t){let n=this.clone();return n.fields=e,n._nodes=function(e,t=[]){let n=[],i=new Set,r=new Set(t.map(([e,t])=>`${e}-${t}`));function s(e,t){let s=Ru.split(e)[0];i.add(s),r.has(`${t}-${s}`)||n.push([t,s])}for(const t of Object.keys(e)){let n=e[t];i.add(t),lc.isRef(n)&&n.isSibling?s(n.path,t):rc(n)&&"deps"in n&&n.deps.forEach(e=>s(e,t))}return Du.array(Array.from(i),n).reverse()}(e,t),n._sortErrors=Dc(Object.keys(e)),t&&(n._excludedEdges=t),n}shape(e,t=[]){return this.clone().withMutation(n=>{let i=n._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),i=[...n._excludedEdges,...t]),n.setFields(Object.assign(n.fields,e),i)})}partial(){const e={};for(const[t,n]of Object.entries(this.fields))e[t]="optional"in n&&n.optional instanceof Function?n.optional():n;return this.setFields(e)}deepPartial(){return Fc(this)}pick(e){const t={};for(const n of e)this.fields[n]&&(t[n]=this.fields[n]);return this.setFields(t,this._excludedEdges.filter(([t,n])=>e.includes(t)&&e.includes(n)))}omit(e){const t=[];for(const n of Object.keys(this.fields))e.includes(n)||t.push(n);return this.pick(t)}from(e,t,n){let i=Ru.getter(e,!0);return this.transform(r=>{if(!r)return r;let s=r;return((e,t)=>{const n=[...Ru.normalizePath(t)];if(1===n.length)return n[0]in e;let i=n.pop(),r=Ru.getter(Ru.join(n),!0)(e);return!(!r||!(i in r))})(r,e)&&(s=Object.assign({},r),n||delete s[e],s[t]=i(r)),s})}json(){return this.transform(Ic)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||tc.exact,test(e){if(null==e)return!0;const t=Bc(this.schema,e);return 0===t.length||this.createError({params:{properties:t.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=tc.noUnknown){"boolean"!=typeof e&&(t=e,e=!0);let n=this.test({name:"noUnknown",exclusive:!0,message:t,test(t){if(null==t)return!0;const n=Bc(this.schema,t);return!e||0===n.length||this.createError({params:{unknown:n.join(", ")}})}});return n.spec.noUnknown=e,n}unknown(e=!0,t=tc.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const n={};for(const i of Object.keys(t))n[e(i)]=t[i];return n})}camelCase(){return this.transformKeys(Lu.camelCase)}snakeCase(){return this.transformKeys(Lu.snakeCase)}constantCase(){return this.transformKeys(e=>Lu.snakeCase(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),n=super.describe(e);n.fields={};for(const[r,s]of Object.entries(t.fields)){var i;let t=e;null!=(i=t)&&i.value&&(t=Object.assign({},t,{parent:t.value,value:t.value[r]})),n.fields[r]=s.describe(t)}return n}}function $c(e){return new Zc(e)}Vc.prototype=Gc.prototype;class Zc extends yc{constructor(e){super({type:"array",spec:{types:e},check:e=>Array.isArray(e)}),this.innerType=void 0,this.innerType=e}_cast(e,t){const n=super._cast(e,t);if(!this._typeCheck(n)||!this.innerType)return n;let i=!1;const r=n.map((e,r)=>{const s=this.innerType.cast(e,Object.assign({},t,{path:`${t.path||""}[${r}]`,parent:n,originalValue:e,value:e,index:r}));return s!==e&&(i=!0),s});return i?r:n}_validate(e,t={},n,i){var r;let s=this.innerType,o=null!=(r=t.recursive)?r:this.spec.recursive;null!=t.originalValue&&t.originalValue,super._validate(e,t,n,(r,a)=>{var l;if(!o||!s||!this._typeCheck(a))return void i(r,a);let u=new Array(a.length);for(let n=0;n<a.length;n++){var c;u[n]=s.asNestedTest({options:t,index:n,parent:a,parentPath:t.path,originalParent:null!=(c=t.originalValue)?c:e})}this.runTests({value:a,tests:u,originalValue:null!=(l=t.originalValue)?l:e,options:t},n,e=>i(e.concat(r),a))})}clone(e){const t=super.clone(e);return t.innerType=this.innerType,t}json(){return this.transform(Ic)}concat(e){let t=super.concat(e);return t.innerType=this.innerType,e.innerType&&(t.innerType=t.innerType?t.innerType.concat(e.innerType):e.innerType),t}of(e){let t=this.clone();if(!rc(e))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+Gu(e));return t.innerType=e,t.spec=Object.assign({},t.spec,{types:e}),t}length(e,t=nc.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t){return t=t||nc.min,this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t){return t=t||nc.max,this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}ensure(){return this.default(()=>[]).transform((e,t)=>this._typeCheck(e)?e:null==t?[]:[].concat(t))}compact(e){let t=e?(t,n,i)=>!e(t,n,i):e=>!!e;return this.transform(e=>null!=e?e.filter(t):e)}describe(e){const t=(e?this.resolve(e):this).clone(),n=super.describe(e);if(t.innerType){var i;let r=e;null!=(i=r)&&i.value&&(r=Object.assign({},r,{parent:r.value,value:r.value[0]})),n.innerType=t.innerType.describe(r)}return n}}$c.prototype=Zc.prototype;const qc="Данное поле обязательно для заполнения",Wc=()=>Oc(),Hc=(e=qc)=>Wc().required(e),Kc=Cc(),Yc=Kc.required(qc),Xc=$c(),Qc=Lc(),Jc=Qc.required(qc),eh=({items:e,onOpen:t,defaultValue:o=null})=>{const[a,l]=A.useState(o),u=A.useCallback(()=>{l(null)},[]);A.useEffect(()=>{o&&l(o)},[o]);const c=A.useId();return q(n,{id:c,children:e.map(({value:e,summary:n,getDetails:o})=>{const h=`${c}-accordion-${e}`;return W(i,{expanded:e===a,children:[q(r,{expandIcon:q(K,{}),onClick:()=>{l(n=>n===e?null:(t?.(e),e))},"aria-controls":`${h}-content`,id:`${h}-header`,children:n}),q(s,{children:o({onClose:u})})]},h)})})};if(!j)throw new Error("mobx-react-lite requires React with Hooks support");if(!function(e,t,n){return Lo(function(){var i=fo(e,n)[ci];"production"!==process.env.NODE_ENV&&t&&e[si]&&yn("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),null!=t||(t=function(e){return Hn(e,si)||jn(e,si,ti({},e[si])),e[si]}(e)),Zn(t).forEach(function(e){return i.make_(e,t[e])})}),e})throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function th(e){e()}function nh(e){return bs(e)}var ih,rh=function(){function e(e){var t=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=1e4),clearTimeout(t.sweepTimeout),t.sweepTimeout=void 0;var n=Date.now();t.registrations.forEach(function(i,r){n-i.registeredAt>=e&&(t.finalize(i.value),t.registrations.delete(r))}),t.registrations.size>0&&t.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){t.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this.registrations.set(n,{value:t,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.registrations.delete(e)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){void 0===this.sweepTimeout&&(this.sweepTimeout=setTimeout(this.sweep,1e4))}}),e}(),sh=new("undefined"!=typeof FinalizationRegistry?FinalizationRegistry:rh)(function(e){var t;null===(t=e.reaction)||void 0===t||t.dispose(),e.reaction=null}),oh={exports:{}},ah={};var lh,uh,ch={};
|
|
6
|
-
/**
|
|
7
|
-
* @license React
|
|
8
|
-
* use-sync-external-store-shim.development.js
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
11
|
-
*
|
|
12
|
-
* This source code is licensed under the MIT license found in the
|
|
13
|
-
* LICENSE file in the root directory of this source tree.
|
|
14
|
-
*/var hh,dh,fh=(uh||(uh=1,"production"===process.env.NODE_ENV?oh.exports=function(){if(ih)return ah;ih=1;var e=T,t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=e.useState,i=e.useEffect,r=e.useLayoutEffect,s=e.useDebugValue;function o(e){var n=e.getSnapshot;e=e.value;try{var i=n();return!t(e,i)}catch(e){return!0}}var a="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var a=t(),l=n({inst:{value:a,getSnapshot:t}}),u=l[0].inst,c=l[1];return r(function(){u.value=a,u.getSnapshot=t,o(u)&&c({inst:u})},[e,a,t]),i(function(){return o(u)&&c({inst:u}),e(function(){o(u)&&c({inst:u})})},[e]),s(a),a};return ah.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:a,ah}():oh.exports=(lh||(lh=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!n(e,i)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=T,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=t.useState,r=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue,a=!1,l=!1,u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(u,c){a||void 0===t.startTransition||(a=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var h=c();if(!l){var d=c();n(h,d)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}var f=(d=i({inst:{value:h,getSnapshot:c}}))[0].inst,p=d[1];return s(function(){f.value=h,f.getSnapshot=c,e(f)&&p({inst:f})},[u,h,c]),r(function(){return e(f)&&p({inst:f}),u(function(){e(f)&&p({inst:f})})},[u]),o(h),h};ch.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:u,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ch)),oh.exports);function ph(e){e.reaction=new Gr("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),null===(t=e.onStoreChange)||void 0===t||t.call(e)})}var mh=!0,_h="function"==typeof Symbol&&Symbol.for,gh=null!==(dh=null===(hh=Object.getOwnPropertyDescriptor(function(){},"name"))||void 0===hh?void 0:hh.configurable)&&void 0!==dh&&dh,yh=_h?Symbol.for("react.forward_ref"):"function"==typeof k&&k(function(e){return null}).$$typeof,vh=_h?Symbol.for("react.memo"):"function"==typeof F&&F(function(e){return null}).$$typeof;function bh(e,t){if(process.env.NODE_ENV,vh&&e.$$typeof===vh)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var n=!1,i=e,r=e.displayName||e.name;if(yh&&e.$$typeof===yh&&(n=!0,"function"!=typeof(i=e.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var s,o,a=function(e,t){return function(e,t){void 0===t&&(t="observed");var n=T.useRef(null);if(!n.current){var i={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return sh.unregister(i),i.onStoreChange=e,i.reaction||(ph(i),i.stateVersion=Symbol()),function(){var e;i.onStoreChange=null,null===(e=i.reaction)||void 0===e||e.dispose(),i.reaction=null}},getSnapshot:function(){return i.stateVersion}};n.current=i}var r,s,o=n.current;if(o.reaction||(ph(o),sh.register(n,o,o)),T.useDebugValue(o.reaction,nh),fh.useSyncExternalStore(o.subscribe,o.getSnapshot,o.getSnapshot),o.reaction.track(function(){try{r=e()}catch(e){s=e}}),s)throw s;return r}(function(){return i(e,t)},r)};return a.displayName=e.displayName,gh&&Object.defineProperty(a,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(a.contextTypes=e.contextTypes,"production"!==process.env.NODE_ENV&&mh&&(mh=!1,console.warn("[mobx-react-lite] Support for Legacy Context in function components will be removed in the next major release."))),n&&(a=k(a)),a=F(a),s=e,o=a,Object.keys(s).forEach(function(e){xh[e]||Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(s,e))}),"production"!==process.env.NODE_ENV&&Object.defineProperty(a,"contextTypes",{set:function(){var e,t;throw new Error("[mobx-react-lite] `".concat(this.displayName||(null===(e=this.type)||void 0===e?void 0:e.displayName)||(null===(t=this.type)||void 0===t?void 0:t.name)||"Component",".contextTypes` must be set before applying `observer`."))}}),a}var xh={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};process.env.NODE_ENV,function(e){e||(e=th,"production"!==process.env.NODE_ENV&&console.warn("[MobX] Failed to get unstable_batched updates from react-dom / react-native")),ys({reactionScheduler:e})}(Z),sh.finalizeAllImmediately;const wh=e=>{const{children:t,variant:n="contained",loading:i,icon:r,sx:s,...a}=e;return r?q(Y,{...a,loading:i,children:r}):q(o,{sx:{whiteSpace:"nowrap",padding:"5px 15px",textTransform:"none",...s},loading:i,loadingPosition:"start",variant:n,...a,children:t})},Eh={reset:te,edit:J,move:ee,save:ne,delete:Q,clear:X},Ah=a(l)(()=>({padding:0})),Th=({title:e,iconProps:t,...n})=>{const i=A.useId(),r=Eh[t.name],s=t.color??"primary";return e?q(u,{title:e,children:q(Ah,{id:i,...n,onClick:e=>{e.stopPropagation(),n.onClick?.(e)},children:q(r,{fontSize:"medium",color:s})})}):q(Ah,{id:i,...n,onClick:e=>{e.stopPropagation(),n.onClick?.(e)},children:q(r,{fontSize:"medium",color:s})})},kh=A.forwardRef(function(e,t){return q(c,{direction:"up",ref:t,...e})}),Sh=({notification:e,onDelete:t,disabled:n=!1,...i})=>{const r=A.useId(),[s,a]=A.useState(!1),l=()=>{a(!1)},c=A.useMemo(()=>({name:"delete",color:n?"disabled":"error"}),[n]);return W(A.Fragment,{children:[e?q(u,{title:e.title,children:q(Th,{...i,iconProps:c,onClick:()=>{a(!0)},disabled:n})}):q(Th,{...i,iconProps:c,onClick:t,disabled:n}),e?W(h,{slots:{transition:kh},open:s,onClose:l,children:[q(d,{id:`${r}-dialog-title`,children:e.title}),q(f,{children:q(p,{id:`${r}-dialog-text`,children:e.description})}),W(m,{children:[q(o,{variant:"contained",color:"error",sx:{textTransform:"none"},onClick:l,children:"Отмена"}),q(o,{variant:"contained",sx:{textTransform:"none"},onClick:()=>{t(),l()},children:"Подтвердить"})]})]}):null]})},Oh=a("input")({clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:1,overflow:"hidden",position:"absolute",bottom:0,left:0,whiteSpace:"nowrap",width:1}),Ph=({children:e,accept:t,onFilesLoad:n,...i})=>W(wh,{...i,component:"label",variant:"contained",startIcon:q(ie,{}),children:[e,q(Oh,{type:"file",accept:t,onChange:e=>{const{target:{files:t}}=e;t&&n({event:e,files:t})},multiple:!0})]});var Ch=bh(({name:e,title:t,description:n,onSuccess:i,onOpen:r,onClose:s,theme:o="info",agreeButton:a,disagreeButton:l,content:u})=>{const c=A.useId(),g=A.useId(),y=A.useId(),v=$o.getIsOpen(e),b=()=>{$o.close(e)};return A.useEffect(()=>{v?r?.():s?.()},[v]),W(h,{id:c,open:v,onClose:b,"aria-labelledby":g,"aria-describedby":y,children:[q(d,{id:g,sx:({palette:e})=>({background:e[o].main,color:e[o].contrastText}),children:t}),q(_,{}),W(f,{sx:({spacing:e})=>({display:"grid",gap:e(2)}),children:[q(p,{id:y,children:n}),u?W(A.Fragment,{children:[q(_,{}),u]}):null]}),q(_,{}),W(m,{children:[q(wh,{color:"error",onClick:b,disabled:l?.disabled,children:l?.text??"Закрыть"}),q(wh,{color:"success",onClick:()=>{i(),b()},disabled:a?.disabled,children:a?.text??"Подтвердить"})]})]})});const Rh=({children:e,sx:t,onClick:i,isSelected:r=!1,...s})=>q(n,{...s,sx:e=>{const{spacing:n,palette:s,varsCustom:o}=e,a=r?s.blue.light:s.white.main,l=i?"pointer":"default";return{p:n(2),borderRadius:o.border_radius_L,background:a,boxShadow:"\n 0 1px 2px rgba(0, 0, 0, 0.08),\n 0 2px 4px rgba(0, 0, 0, 0.08),\n 0 4px 8px rgba(0, 0, 0, 0.08),\n 0 8px 16px rgba(0, 0, 0, 0.08),\n 0 16px 32px rgba(0, 0, 0, 0.08)\n ",overflowX:"auto",cursor:l,...t?.(e)}},onClick:i,children:e});var Mh=e=>"checkbox"===e.type,Lh=e=>e instanceof Date,Nh=e=>null==e;const zh=e=>"object"==typeof e;var Dh=e=>!Nh(e)&&!Array.isArray(e)&&zh(e)&&!Lh(e),Ih=e=>Dh(e)&&e.target?Mh(e.target)?e.target.checked:e.target.value:e,Fh=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),jh="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Bh(e){if(e instanceof Date)return new Date(e);const t="undefined"!=typeof FileList&&e instanceof FileList;if(jh&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!(n||Dh(e)&&(e=>{const t=e.constructor&&e.constructor.prototype;return Dh(t)&&t.hasOwnProperty("isPrototypeOf")})(e)))return e;const i=n?[]:Object.create(Object.getPrototypeOf(e));for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(i[t]=Bh(e[t]));return i}var Uh=e=>/^\w*$/.test(e),Vh=e=>void 0===e,Gh=e=>Array.isArray(e)?e.filter(Boolean):[],$h=e=>Gh(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Zh=(e,t,n)=>{if(!t||!Dh(e))return n;const i=(Uh(t)?[t]:$h(t)).reduce((e,t)=>Nh(e)?e:e[t],e);return Vh(i)||i===e?Vh(e[t])?n:e[t]:i},qh=e=>"boolean"==typeof e,Wh=e=>"function"==typeof e,Hh=(e,t,n)=>{let i=-1;const r=Uh(t)?[t]:$h(t),s=r.length,o=s-1;for(;++i<s;){const t=r[i];let s=n;if(i!==o){const n=e[t];s=Dh(n)||Array.isArray(n)?n:isNaN(+r[i+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=s,e=e[t]}};const Kh="blur",Yh="focusout",Xh="change",Qh="onBlur",Jh="onChange",ed="onSubmit",td="onTouched",nd="all",id="max",rd="min",sd="maxLength",od="minLength",ad="pattern",ld="required",ud="validate",cd=T.createContext(null);cd.displayName="HookFormControlContext";const hd=()=>T.useContext(cd);var dd=(e,t,n,i=!0)=>{const r={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(r,s,{get:()=>{const r=s;return t._proxyFormState[r]!==nd&&(t._proxyFormState[r]=!i||nd),n&&(n[r]=!0),e[r]}});return r};const fd="undefined"!=typeof window?T.useLayoutEffect:T.useEffect;var pd=e=>"string"==typeof e,md=(e,t,n,i,r)=>pd(e)?(i&&t.watch.add(e),Zh(n,e,r)):Array.isArray(e)?e.map(e=>(i&&t.watch.add(e),Zh(n,e))):(i&&(t.watchAll=!0),n),_d=e=>Nh(e)||!zh(e);function gd(e,t,n=new WeakSet){if(_d(e)||_d(t))return Object.is(e,t);if(Lh(e)&&Lh(t))return Object.is(e.getTime(),t.getTime());const i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const s of i){const i=e[s];if(!r.includes(s))return!1;if("ref"!==s){const e=t[s];if(Lh(i)&&Lh(e)||Dh(i)&&Dh(e)||Array.isArray(i)&&Array.isArray(e)?!gd(i,e,n):!Object.is(i,e))return!1}}return!0}function yd(e){const t=hd(),{name:n,disabled:i,control:r=t,shouldUnregister:s,defaultValue:o,exact:a=!0}=e,l=Fh(r._names.array,n),u=T.useMemo(()=>Zh(r._formValues,n,Zh(r._defaultValues,n,o)),[r,n,o]),c=function(e){const t=hd(),{control:n=t,name:i,defaultValue:r,disabled:s,exact:o,compute:a}=e||{},l=T.useRef(r),u=T.useRef(a),c=T.useRef(void 0),h=T.useRef(n),d=T.useRef(i);u.current=a;const[f,p]=T.useState(()=>{const e=n._getWatch(i,l.current);return u.current?u.current(e):e}),m=T.useCallback(e=>{const t=md(i,n._names,e||n._formValues,!1,l.current);return u.current?u.current(t):t},[n._formValues,n._names,i]),_=T.useCallback(e=>{if(!s){const t=md(i,n._names,e||n._formValues,!1,l.current);if(u.current){const e=u.current(t);gd(e,c.current)||(p(e),c.current=e)}else p(t)}},[n._formValues,n._names,s,i]);fd(()=>(h.current===n&&gd(d.current,i)||(h.current=n,d.current=i,_()),n._subscribe({name:i,formState:{values:!0},exact:o,callback:e=>{_(e.values)}})),[n,o,i,_]),T.useEffect(()=>n._removeUnmounted());const g=h.current!==n,y=d.current,v=T.useMemo(()=>{if(s)return null;const e=!g&&!gd(y,i);return g||e?m():null},[s,g,i,y,m]);return null!==v?v:f}({control:r,name:n,defaultValue:u,exact:a}),h=function(e){const t=hd(),{control:n=t,disabled:i,name:r,exact:s}=e||{},[o,a]=T.useState(n._formState),l=T.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return fd(()=>n._subscribe({name:r,formState:l.current,exact:s,callback:e=>{!i&&a({...n._formState,...e})}}),[r,i,s]),T.useEffect(()=>{l.current.isValid&&n._setValid(!0)},[n]),T.useMemo(()=>dd(o,n,l.current,!1),[o,n])}({control:r,name:n,exact:a}),d=T.useRef(e),f=T.useRef(void 0),p=T.useRef(r.register(n,{...e.rules,value:c,...qh(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;const m=T.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Zh(h.errors,n)},isDirty:{enumerable:!0,get:()=>!!Zh(h.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Zh(h.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Zh(h.validatingFields,n)},error:{enumerable:!0,get:()=>Zh(h.errors,n)}}),[h,n]),_=T.useCallback(e=>p.current.onChange({target:{value:Ih(e),name:n},type:Xh}),[n]),g=T.useCallback(()=>p.current.onBlur({target:{value:Zh(r._formValues,n),name:n},type:Kh}),[n,r._formValues]),y=T.useCallback(e=>{const t=Zh(r._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>Wh(e.focus)&&e.focus(),select:()=>Wh(e.select)&&e.select(),setCustomValidity:t=>Wh(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>Wh(e.reportValidity)&&e.reportValidity()})},[r._fields,n]),v=T.useMemo(()=>({name:n,value:c,...qh(i)||h.disabled?{disabled:h.disabled||i}:{},onChange:_,onBlur:g,ref:y}),[n,i,h.disabled,_,g,y,c]);return T.useEffect(()=>{const e=r._options.shouldUnregister||s,t=f.current;t&&t!==n&&!l&&r.unregister(t),r.register(n,{...d.current.rules,...qh(d.current.disabled)?{disabled:d.current.disabled}:{}});const i=(e,t)=>{const n=Zh(r._fields,e);n&&n._f&&(n._f.mount=t)};if(i(n,!0),e){const e=Bh(Zh(r._options.defaultValues,n,d.current.defaultValue));Hh(r._defaultValues,n,e),Vh(Zh(r._formValues,n))&&Hh(r._formValues,n,e)}return!l&&r.register(n),f.current=n,()=>{(l?e&&!r._state.action:e)?r.unregister(n):i(n,!1)}},[n,r,l,s]),T.useEffect(()=>{r._setDisabledField({disabled:i,name:n})},[i,n,r]),T.useMemo(()=>({field:v,formState:h,fieldState:m}),[v,h,m])}const vd=e=>e.render(yd(e)),bd=T.createContext(null);bd.displayName="HookFormContext";const xd=()=>T.useContext(bd),wd=e=>{const{children:t,watch:n,getValues:i,getFieldState:r,setError:s,clearErrors:o,setValue:a,trigger:l,formState:u,resetField:c,reset:h,handleSubmit:d,unregister:f,control:p,register:m,setFocus:_,subscribe:g}=e;return T.createElement(bd.Provider,{value:T.useMemo(()=>({watch:n,getValues:i,getFieldState:r,setError:s,clearErrors:o,setValue:a,trigger:l,formState:u,resetField:c,reset:h,handleSubmit:d,unregister:f,control:p,register:m,setFocus:_,subscribe:g}),[o,p,u,r,i,d,m,h,c,s,_,a,g,l,f,n])},T.createElement(cd.Provider,{value:p},t))};var Ed=(e,t,n,i,r)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[i]:r||!0}}:{},Ad=e=>Array.isArray(e)?e:[e],Td=()=>{let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function kd(e,t){const n={};for(const i in e)if(e.hasOwnProperty(i)){const r=e[i],s=t[i];if(r&&Dh(r)&&s){const e=kd(r,s);Dh(e)&&(n[i]=e)}else e[i]&&(n[i]=s)}return n}var Sd=e=>Dh(e)&&!Object.keys(e).length,Od=e=>"file"===e.type,Pd=e=>{if(!jh)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Cd=e=>"select-multiple"===e.type,Rd=e=>"radio"===e.type,Md=e=>Pd(e)&&e.isConnected;function Ld(e,t){const n=Array.isArray(t)?t:Uh(t)?[t]:$h(t),i=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let i=0;for(;i<n;)e=Vh(e)?i++:e[t[i++]];return e}(e,n),r=n.length-1,s=n[r];return i&&delete i[s],0!==r&&(Dh(i)&&Sd(i)||Array.isArray(i)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!Vh(e[t]))return!1;return!0}(i))&&Ld(e,n.slice(0,-1)),e}function Nd(e){return Array.isArray(e)||Dh(e)&&!(e=>{for(const t in e)if(Wh(e[t]))return!0;return!1})(e)}function zd(e,t={}){for(const n in e){const i=e[n];Nd(i)?(t[n]=Array.isArray(i)?[]:{},zd(i,t[n])):Vh(i)||(t[n]=!0)}return t}function Dd(e,t,n){n||(n=zd(t));for(const i in e){const r=e[i];if(Nd(r))Vh(t)||_d(n[i])?n[i]=zd(r,Array.isArray(r)?[]:{}):Dd(r,Nh(t)?{}:t[i],n[i]);else{const e=t[i];n[i]=!gd(r,e)}}return n}const Id={value:!1,isValid:!1},Fd={value:!0,isValid:!0};var jd=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Vh(e[0].attributes.value)?Vh(e[0].value)||""===e[0].value?Fd:{value:e[0].value,isValid:!0}:Fd:Id}return Id},Bd=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:i})=>Vh(e)?e:t?""===e?NaN:e?+e:e:n&&pd(e)?new Date(e):i?i(e):e;const Ud={isValid:!1,value:null};var Vd=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Ud):Ud;function Gd(e){const t=e.ref;return Od(t)?t.files:Rd(t)?Vd(e.refs).value:Cd(t)?[...t.selectedOptions].map(({value:e})=>e):Mh(t)?jd(e.refs).value:Bd(Vh(t.value)?e.ref.value:t.value,e)}var $d=e=>e instanceof RegExp,Zd=e=>Vh(e)?e:$d(e)?e.source:Dh(e)?$d(e.value)?e.value.source:e.value:e,qd=e=>({isOnSubmit:!e||e===ed,isOnBlur:e===Qh,isOnChange:e===Jh,isOnAll:e===nd,isOnTouch:e===td});const Wd="AsyncFunction";var Hd=e=>!!e&&!!e.validate&&!!(Wh(e.validate)&&e.validate.constructor.name===Wd||Dh(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===Wd)),Kd=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const Yd=(e,t,n,i)=>{for(const r of n||Object.keys(e)){const n=Zh(e,r);if(n){const{_f:e,...s}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],r)&&!i)return!0;if(e.ref&&t(e.ref,e.name)&&!i)return!0;if(Yd(s,t))break}else if(Dh(s)&&Yd(s,t))break}}};function Xd(e,t,n){const i=Zh(e,n);if(i||Uh(n))return{error:i,name:n};const r=n.split(".");for(;r.length;){const i=r.join("."),s=Zh(t,i),o=Zh(e,i);if(s&&!Array.isArray(s)&&n!==i)return{name:n};if(o&&o.type)return{name:i,error:o};if(o&&o.root&&o.root.type)return{name:`${i}.root`,error:o.root};r.pop()}return{name:n}}var Qd=(e,t,n)=>{const i=Ad(Zh(e,n));return Hh(i,"root",t[n]),Hh(e,n,i),e};function Jd(e,t,n="validate"){if(pd(e)||Array.isArray(e)&&e.every(pd)||qh(e)&&!e)return{type:n,message:pd(e)?e:"",ref:t}}var ef=e=>Dh(e)&&!$d(e)?e:{value:e,message:""},tf=async(e,t,n,i,r,s)=>{const{ref:o,refs:a,required:l,maxLength:u,minLength:c,min:h,max:d,pattern:f,validate:p,name:m,valueAsNumber:_,mount:g}=e._f,y=Zh(n,m);if(!g||t.has(m))return{};const v=a?a[0]:o,b=e=>{r&&v.reportValidity&&(v.setCustomValidity(qh(e)?"":e||""),v.reportValidity())},x={},w=Rd(o),E=Mh(o),A=w||E,T=(_||Od(o))&&Vh(o.value)&&Vh(y)||Pd(o)&&""===o.value||""===y||Array.isArray(y)&&!y.length,k=Ed.bind(null,m,i,x),S=(e,t,n,i=sd,r=od)=>{const s=e?t:n;x[m]={type:e?i:r,message:s,ref:o,...k(e?i:r,s)}};if(s?!Array.isArray(y)||!y.length:l&&(!A&&(T||Nh(y))||qh(y)&&!y||E&&!jd(a).isValid||w&&!Vd(a).isValid)){const{value:e,message:t}=pd(l)?{value:!!l,message:l}:ef(l);if(e&&(x[m]={type:ld,message:t,ref:v,...k(ld,t)},!i))return b(t),x}if(!(T||Nh(h)&&Nh(d))){let e,t;const n=ef(d),r=ef(h);if(Nh(y)||isNaN(y)){const i=o.valueAsDate||new Date(y),s=e=>new Date((new Date).toDateString()+" "+e),a="time"==o.type,l="week"==o.type;pd(n.value)&&y&&(e=a?s(y)>s(n.value):l?y>n.value:i>new Date(n.value)),pd(r.value)&&y&&(t=a?s(y)<s(r.value):l?y<r.value:i<new Date(r.value))}else{const i=o.valueAsNumber||(y?+y:y);Nh(n.value)||(e=i>n.value),Nh(r.value)||(t=i<r.value)}if((e||t)&&(S(!!e,n.message,r.message,id,rd),!i))return b(x[m].message),x}if((u||c)&&!T&&(pd(y)||s&&Array.isArray(y))){const e=ef(u),t=ef(c),n=!Nh(e.value)&&y.length>+e.value,r=!Nh(t.value)&&y.length<+t.value;if((n||r)&&(S(n,e.message,t.message),!i))return b(x[m].message),x}if(f&&!T&&pd(y)){const{value:e,message:t}=ef(f);if($d(e)&&!y.match(e)&&(x[m]={type:ad,message:t,ref:o,...k(ad,t)},!i))return b(t),x}if(p)if(Wh(p)){const e=Jd(await p(y,n),v);if(e&&(x[m]={...e,...k(ud,e.message)},!i))return b(e.message),x}else if(Dh(p)){let e={};for(const t in p){if(!Sd(e)&&!i)break;const r=Jd(await p[t](y,n),v,t);r&&(e={...r,...k(t,r.message)},b(r.message),i&&(x[m]=e))}if(!Sd(e)&&(x[m]={ref:v,...e},!i))return x}return b(!0),x};const nf={mode:ed,reValidateMode:Jh,shouldFocusError:!0};function rf(e={}){let t,n={...nf,...e},i={submitCount:0,isDirty:!1,isReady:!1,isLoading:Wh(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},r={},s=(Dh(n.defaultValues)||Dh(n.values))&&Bh(n.defaultValues||n.values)||{},o=n.shouldUnregister?{}:Bh(s),a={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},u=0;const c={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},h={...c};let d={...h};const f={array:Td(),state:Td()},p=n.criteriaMode===nd,m=async e=>{if(!a.keepIsValid&&!n.disabled&&(h.isValid||d.isValid||e)){let e;n.resolver?(e=Sd((await b()).errors),_()):e=await x(r,!0),e!==i.isValid&&f.state.next({isValid:e})}},_=(e,t)=>{!n.disabled&&(h.isValidating||h.validatingFields||d.isValidating||d.validatingFields)&&((e||Array.from(l.mount)).forEach(e=>{e&&(t?Hh(i.validatingFields,e,t):Ld(i.validatingFields,e))}),f.state.next({validatingFields:i.validatingFields,isValidating:!Sd(i.validatingFields)}))},g=(e,t,n,i)=>{const l=Zh(r,e);if(l){const r=Zh(o,e,Vh(n)?Zh(s,e):n);Vh(r)||i&&i.defaultChecked||t?Hh(o,e,t?r:Gd(l._f)):A(e,r),a.mount&&!a.action&&m()}},y=(e,t,r,o,a)=>{let l=!1,u=!1;const c={name:e};if(!n.disabled){if(!r||o){(h.isDirty||d.isDirty)&&(u=i.isDirty,i.isDirty=c.isDirty=w(),l=u!==c.isDirty);const n=gd(Zh(s,e),t);u=!!Zh(i.dirtyFields,e),n?Ld(i.dirtyFields,e):Hh(i.dirtyFields,e,!0),c.dirtyFields=i.dirtyFields,l=l||(h.dirtyFields||d.dirtyFields)&&u!==!n}if(r){const t=Zh(i.touchedFields,e);t||(Hh(i.touchedFields,e,r),c.touchedFields=i.touchedFields,l=l||(h.touchedFields||d.touchedFields)&&t!==r)}l&&a&&f.state.next(c)}return l?c:{}},v=(e,r,s,o)=>{const a=Zh(i.errors,e),l=(h.isValid||d.isValid)&&qh(r)&&i.isValid!==r;var c;if(n.delayError&&s?(c=()=>((e,t)=>{Hh(i.errors,e,t),f.state.next({errors:i.errors})})(e,s),t=e=>{clearTimeout(u),u=setTimeout(c,e)},t(n.delayError)):(clearTimeout(u),t=null,s?Hh(i.errors,e,s):Ld(i.errors,e)),(s?!gd(a,s):a)||!Sd(o)||l){const t={...o,...l&&qh(r)?{isValid:r}:{},errors:i.errors,name:e};i={...i,...t},f.state.next(t)}},b=async e=>{_(e,!0);const t=await n.resolver(o,n.context,((e,t,n,i)=>{const r={};for(const n of e){const e=Zh(t,n);e&&Hh(r,n,e._f)}return{criteriaMode:n,names:[...e],fields:r,shouldUseNativeValidation:i}})(e||l.mount,r,n.criteriaMode,n.shouldUseNativeValidation));return t},x=async(t,r,s={valid:!0})=>{for(const a in t){const u=t[a];if(u){const{_f:t,...a}=u;if(t){const a=l.array.has(t.name),c=u._f&&Hd(u._f);c&&h.validatingFields&&_([t.name],!0);const d=await tf(u,l.disabled,o,p,n.shouldUseNativeValidation&&!r,a);if(c&&h.validatingFields&&_([t.name]),d[t.name]&&(s.valid=!1,r||e.shouldUseNativeValidation))break;!r&&(Zh(d,t.name)?a?Qd(i.errors,d,t.name):Hh(i.errors,t.name,d[t.name]):Ld(i.errors,t.name))}!Sd(a)&&await x(a,r,s)}}return s.valid},w=(e,t)=>!n.disabled&&(e&&t&&Hh(o,e,t),!gd(C(),s)),E=(e,t,n)=>md(e,l,{...a.mount?o:Vh(t)?s:pd(e)?{[e]:t}:t},n,t),A=(e,t,n={})=>{const i=Zh(r,e);let s=t;if(i){const n=i._f;n&&(!n.disabled&&Hh(o,e,Bd(t,n)),s=Pd(n.ref)&&Nh(t)?"":t,Cd(n.ref)?[...n.ref.options].forEach(e=>e.selected=s.includes(e.value)):n.refs?Mh(n.ref)?n.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(s)?e.checked=!!s.find(t=>t===e.value):e.checked=s===e.value||!!s)}):n.refs.forEach(e=>e.checked=e.value===s):Od(n.ref)?n.ref.value="":(n.ref.value=s,n.ref.type||f.state.next({name:e,values:Bh(o)})))}(n.shouldDirty||n.shouldTouch)&&y(e,s,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&P(e)},T=(e,t,n)=>{for(const i in t){if(!t.hasOwnProperty(i))return;const s=t[i],o=e+"."+i,a=Zh(r,o);(l.array.has(e)||Dh(s)||a&&!a._f)&&!Lh(s)?T(o,s,n):A(o,s,n)}},k=(e,t,n={})=>{const u=Zh(r,e),c=l.array.has(e),p=Bh(t);Hh(o,e,p),c?(f.array.next({name:e,values:Bh(o)}),(h.isDirty||h.dirtyFields||d.isDirty||d.dirtyFields)&&n.shouldDirty&&f.state.next({name:e,dirtyFields:Dd(s,o),isDirty:w(e,p)})):!u||u._f||Nh(p)?A(e,p,n):T(e,p,n),Kd(e,l)?f.state.next({...i,name:e,values:Bh(o)}):f.state.next({name:a.mount?e:void 0,values:Bh(o)})},S=async e=>{a.mount=!0;const s=e.target;let u=s.name,c=!0;const g=Zh(r,u),w=e=>{c=Number.isNaN(e)||Lh(e)&&isNaN(e.getTime())||gd(e,Zh(o,u,e))},E=qd(n.mode),A=qd(n.reValidateMode);if(g){let a,k;const S=s.type?Gd(g._f):Ih(e),O=e.type===Kh||e.type===Yh,C=!((T=g._f).mount&&(T.required||T.min||T.max||T.maxLength||T.minLength||T.pattern||T.validate)||n.resolver||Zh(i.errors,u)||g._f.deps)||((e,t,n,i,r)=>!r.isOnAll&&(!n&&r.isOnTouch?!(t||e):(n?i.isOnBlur:r.isOnBlur)?!e:!(n?i.isOnChange:r.isOnChange)||e))(O,Zh(i.touchedFields,u),i.isSubmitted,A,E),R=Kd(u,l,O);Hh(o,u,S),O?s&&s.readOnly||(g._f.onBlur&&g._f.onBlur(e),t&&t(0)):g._f.onChange&&g._f.onChange(e);const M=y(u,S,O),L=!Sd(M)||R;if(!O&&f.state.next({name:u,type:e.type,values:Bh(o)}),C)return(h.isValid||d.isValid)&&("onBlur"===n.mode?O&&m():O||m()),L&&f.state.next({name:u,...R?{}:M});if(!O&&R&&f.state.next({...i}),n.resolver){const{errors:e}=await b([u]);if(_([u]),w(S),c){const t=Xd(i.errors,r,u),n=Xd(e,r,t.name||u);a=n.error,u=n.name,k=Sd(e)}}else _([u],!0),a=(await tf(g,l.disabled,o,p,n.shouldUseNativeValidation))[u],_([u]),w(S),c&&(a?k=!1:(h.isValid||d.isValid)&&(k=await x(r,!0)));c&&(g._f.deps&&(!Array.isArray(g._f.deps)||g._f.deps.length>0)&&P(g._f.deps),v(u,k,a,M))}var T},O=(e,t)=>{if(Zh(i.errors,t)&&e.focus)return e.focus(),1},P=async(e,t={})=>{let s,o;const a=Ad(e);if(n.resolver){const t=await(async e=>{const{errors:t}=await b(e);if(_(e),e)for(const n of e){const e=Zh(t,n);e?Hh(i.errors,n,e):Ld(i.errors,n)}else i.errors=t;return t})(Vh(e)?e:a);s=Sd(t),o=e?!a.some(e=>Zh(t,e)):s}else e?(o=(await Promise.all(a.map(async e=>{const t=Zh(r,e);return await x(t&&t._f?{[e]:t}:t)}))).every(Boolean),(o||i.isValid)&&m()):o=s=await x(r);return f.state.next({...!pd(e)||(h.isValid||d.isValid)&&s!==i.isValid?{}:{name:e},...n.resolver||!e?{isValid:s}:{},errors:i.errors}),t.shouldFocus&&!o&&Yd(r,O,e?a:l.mount),o},C=(e,t)=>{let n={...a.mount?o:s};return t&&(n=kd(t.dirtyFields?i.dirtyFields:i.touchedFields,n)),Vh(e)?n:pd(e)?Zh(n,e):e.map(e=>Zh(n,e))},R=(e,t)=>({invalid:!!Zh((t||i).errors,e),isDirty:!!Zh((t||i).dirtyFields,e),error:Zh((t||i).errors,e),isValidating:!!Zh(i.validatingFields,e),isTouched:!!Zh((t||i).touchedFields,e)}),M=(e,t,n)=>{const s=(Zh(r,e,{_f:{}})._f||{}).ref,o=Zh(i.errors,e)||{},{ref:a,message:l,type:u,...c}=o;Hh(i.errors,e,{...c,...t,ref:s}),f.state.next({name:e,errors:i.errors,isValid:!1}),n&&n.shouldFocus&&s&&s.focus&&s.focus()},L=e=>f.state.subscribe({next:t=>{var n,r,a;n=e.name,r=t.name,a=e.exact,n&&r&&n!==r&&!Ad(n).some(e=>e&&(a?e===r:e.startsWith(r)||r.startsWith(e)))||!((e,t,n,i)=>{n(e);const{name:r,...s}=e;return Sd(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(e=>t[e]===(!i||nd))})(t,e.formState||h,U,e.reRenderRoot)||e.callback({values:{...o},...i,...t,defaultValues:s})}}).unsubscribe,N=(e,t={})=>{for(const a of e?Ad(e):l.mount)l.mount.delete(a),l.array.delete(a),t.keepValue||(Ld(r,a),Ld(o,a)),!t.keepError&&Ld(i.errors,a),!t.keepDirty&&Ld(i.dirtyFields,a),!t.keepTouched&&Ld(i.touchedFields,a),!t.keepIsValidating&&Ld(i.validatingFields,a),!n.shouldUnregister&&!t.keepDefaultValue&&Ld(s,a);f.state.next({values:Bh(o)}),f.state.next({...i,...t.keepDirty?{isDirty:w()}:{}}),!t.keepIsValid&&m()},z=({disabled:e,name:t})=>{if(qh(e)&&a.mount||e||l.disabled.has(t)){const n=l.disabled.has(t)!==!!e;e?l.disabled.add(t):l.disabled.delete(t),n&&a.mount&&!a.action&&m()}},D=(e,t={})=>{let i=Zh(r,e);const o=qh(t.disabled)||qh(n.disabled);return Hh(r,e,{...i||{},_f:{...i&&i._f?i._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),i?z({disabled:qh(t.disabled)?t.disabled:n.disabled,name:e}):g(e,!0,t.value),{...o?{disabled:t.disabled||n.disabled}:{},...n.progressive?{required:!!t.required,min:Zd(t.min),max:Zd(t.max),minLength:Zd(t.minLength),maxLength:Zd(t.maxLength),pattern:Zd(t.pattern)}:{},name:e,onChange:S,onBlur:S,ref:o=>{if(o){D(e,t),i=Zh(r,e);const n=Vh(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,a=(e=>Rd(e)||Mh(e))(n),l=i._f.refs||[];if(a?l.find(e=>e===n):n===i._f.ref)return;Hh(r,e,{_f:{...i._f,...a?{refs:[...l.filter(Md),n,...Array.isArray(Zh(s,e))?[{}]:[]],ref:{type:n.type,name:e}}:{ref:n}}}),g(e,!1,void 0,n)}else i=Zh(r,e,{}),i._f&&(i._f.mount=!1),(n.shouldUnregister||t.shouldUnregister)&&(!Fh(l.array,e)||!a.action)&&l.unMount.add(e)}}},I=()=>n.shouldFocusError&&Yd(r,O,l.mount),F=(e,t)=>async s=>{let a;s&&(s.preventDefault&&s.preventDefault(),s.persist&&s.persist());let u=Bh(o);if(f.state.next({isSubmitting:!0}),n.resolver){const{errors:e,values:t}=await b();_(),i.errors=e,u=Bh(t)}else await x(r);if(l.disabled.size)for(const e of l.disabled)Ld(u,e);if(Ld(i.errors,"root"),Sd(i.errors)){f.state.next({errors:{}});try{await e(u,s)}catch(e){a=e}}else t&&await t({...i.errors},s),I(),setTimeout(I);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Sd(i.errors)&&!a,submitCount:i.submitCount+1,errors:i.errors}),a)throw a},j=(e,t={})=>{const u=e?Bh(e):s,c=Bh(u),d=Sd(e),p=d?s:c;if(t.keepDefaultValues||(s=u),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(Dd(s,o))]);for(const t of Array.from(e)){const e=Zh(i.dirtyFields,t),n=Zh(o,t),r=Zh(p,t);e&&!Vh(n)?Hh(p,t,n):e||Vh(r)||k(t,r)}}else{if(jh&&Vh(e))for(const e of l.mount){const t=Zh(r,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Pd(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of l.mount)k(e,Zh(p,e));else r={}}o=n.shouldUnregister?t.keepDefaultValues?Bh(s):{}:Bh(p),f.array.next({values:{...p}}),f.state.next({values:{...p}})}l={mount:t.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!h.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!n.shouldUnregister&&!Sd(p),a.watch=!!n.shouldUnregister,a.keepIsValid=!!t.keepIsValid,a.action=!1,t.keepErrors||(i.errors={}),f.state.next({submitCount:t.keepSubmitCount?i.submitCount:0,isDirty:!d&&(t.keepDirty?i.isDirty:!(!t.keepDefaultValues||gd(e,s))),isSubmitted:!!t.keepIsSubmitted&&i.isSubmitted,dirtyFields:d?{}:t.keepDirtyValues?t.keepDefaultValues&&o?Dd(s,o):i.dirtyFields:t.keepDefaultValues&&e?Dd(s,e):t.keepDirty?i.dirtyFields:{},touchedFields:t.keepTouched?i.touchedFields:{},errors:t.keepErrors?i.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&i.isSubmitSuccessful,isSubmitting:!1,defaultValues:s})},B=(e,t)=>j(Wh(e)?e(o):e,{...n.resetOptions,...t}),U=e=>{i={...i,...e}},V={control:{register:D,unregister:N,getFieldState:R,handleSubmit:F,setError:M,_subscribe:L,_runSchema:b,_updateIsValidating:_,_focusError:I,_getWatch:E,_getDirty:w,_setValid:m,_setFieldArray:(e,t=[],l,u,c=!0,p=!0)=>{if(u&&l&&!n.disabled){if(a.action=!0,p&&Array.isArray(Zh(r,e))){const t=l(Zh(r,e),u.argA,u.argB);c&&Hh(r,e,t)}if(p&&Array.isArray(Zh(i.errors,e))){const t=l(Zh(i.errors,e),u.argA,u.argB);c&&Hh(i.errors,e,t),((e,t)=>{!Gh(Zh(e,t)).length&&Ld(e,t)})(i.errors,e)}if((h.touchedFields||d.touchedFields)&&p&&Array.isArray(Zh(i.touchedFields,e))){const t=l(Zh(i.touchedFields,e),u.argA,u.argB);c&&Hh(i.touchedFields,e,t)}(h.dirtyFields||d.dirtyFields)&&(i.dirtyFields=Dd(s,o)),f.state.next({name:e,isDirty:w(e,t),dirtyFields:i.dirtyFields,errors:i.errors,isValid:i.isValid})}else Hh(o,e,t)},_setDisabledField:z,_setErrors:e=>{i.errors=e,f.state.next({errors:i.errors,isValid:!1})},_getFieldArray:e=>Gh(Zh(a.mount?o:s,e,n.shouldUnregister?Zh(s,e,[]):[])),_reset:j,_resetDefaultValues:()=>Wh(n.defaultValues)&&n.defaultValues().then(e=>{B(e,n.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of l.unMount){const t=Zh(r,e);t&&(t._f.refs?t._f.refs.every(e=>!Md(e)):!Md(t._f.ref))&&N(e)}l.unMount=new Set},_disableForm:e=>{qh(e)&&(f.state.next({disabled:e}),Yd(r,(t,n)=>{const i=Zh(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},_subjects:f,_proxyFormState:h,get _fields(){return r},get _formValues(){return o},get _state(){return a},set _state(e){a=e},get _defaultValues(){return s},get _names(){return l},set _names(e){l=e},get _formState(){return i},get _options(){return n},set _options(e){n={...n,...e}}},subscribe:e=>(a.mount=!0,d={...d,...e.formState},L({...e,formState:{...c,...e.formState}})),trigger:P,register:D,handleSubmit:F,watch:(e,t)=>Wh(e)?f.state.subscribe({next:n=>"values"in n&&e(E(void 0,t),n)}):E(e,t,!0),setValue:k,getValues:C,reset:B,resetField:(e,t={})=>{Zh(r,e)&&(Vh(t.defaultValue)?k(e,Bh(Zh(s,e))):(k(e,t.defaultValue),Hh(s,e,Bh(t.defaultValue))),t.keepTouched||Ld(i.touchedFields,e),t.keepDirty||(Ld(i.dirtyFields,e),i.isDirty=t.defaultValue?w(e,Bh(Zh(s,e))):w()),t.keepError||(Ld(i.errors,e),h.isValid&&m()),f.state.next({...i}))},clearErrors:e=>{e&&Ad(e).forEach(e=>Ld(i.errors,e)),f.state.next({errors:e?i.errors:{}})},unregister:N,setError:M,setFocus:(e,t={})=>{const n=Zh(r,e),i=n&&n._f;if(i){const e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&Wh(e.select)&&e.select()})}},getFieldState:R};return{...V,formControl:V}}const sf=a(g)(()=>({color:"var(--color-white)",cursor:"default"})),of=({sx:e,...t})=>q(sf,{variant:"body1",sx:e,...t}),af=oe(re)({padding:0,marginRight:"5px",marginLeft:"10px","& .MuiSvgIcon-root":{color:"var(--color-orange-medium)"}});function lf({label:e,name:t,...n}){const i=A.useId(),{control:r,setValue:s,watch:o}=xd(),a=o(t),l=`${i}-${t}-${String(a)}`;return q(vd,{control:r,name:t,render:({field:t})=>{const{value:i,name:r}=t;return e?q(se,{color:"white",control:q(af,{...n,checked:i,onChange:(e,t)=>{s(r,t,{shouldValidate:!0})}}),label:q(of,{children:e})}):q(af,{...n,checked:i,onChange:(e,t)=>{s(r,t,{shouldValidate:!0})}})}},l)}function uf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var cf,hf,df,ff;var pf=function(){if(ff)return df;ff=1;var e=(hf||(hf=1,cf=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],i=0;i<e.rangeCount;i++)n.push(e.getRangeAt(i));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach(function(t){e.addRange(t)}),t&&t.focus()}}),cf),t={"text/plain":"Text","text/html":"Url",default:"Text"};return df=function(n,i){var r,s,o,a,l,u,c=!1;i||(i={}),r=i.debug||!1;try{if(o=e(),a=document.createRange(),l=document.getSelection(),(u=document.createElement("span")).textContent=n,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",function(e){if(e.stopPropagation(),i.format)if(e.preventDefault(),typeof e.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var s=t[i.format]||t.default;window.clipboardData.setData(s,n)}else e.clipboardData.clearData(),e.clipboardData.setData(i.format,n);i.onCopy&&(e.preventDefault(),i.onCopy(e.clipboardData))}),document.body.appendChild(u),a.selectNodeContents(u),l.addRange(a),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");c=!0}catch(e){r&&console.error("unable to copy using execCommand: ",e),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(i.format||"text",n),i.onCopy&&i.onCopy(window.clipboardData),c=!0}catch(e){r&&console.error("unable to copy using clipboardData: ",e),r&&console.error("falling back to prompt"),s=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in i?i.message:"Copy to clipboard: #{key}, Enter"),window.prompt(s,n)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(a):l.removeAllRanges()),u&&document.body.removeChild(u),o()}return c},df}();const mf=uf(pf),_f=({text:e,onCopy:t,options:n,children:i,...r})=>{const s=A.useCallback(r=>{const s=A.Children.only(i),o=mf(e,n);t&&t(e,o),s.props.onClick&&"function"==typeof s.props.onClick&&s.props.onClick(r)},[e,t,n,i]),o=A.Children.only(i);return A.cloneElement(o,{onClick:s,...r})},gf=a(of)(()=>({whiteSpace:"nowrap",cursor:"pointer"})),yf=({value:e,label:t,onCopySuccess:n,onCopyError:i,...r})=>{const s=String(e);return q(_f,{text:s,onCopy:(e,t)=>{t?(hn({message:"Значение успешно скопировано",variant:"success"}),n?.()):(hn({message:"При копировании значения возникла ошибка",variant:"error"}),i?.())},children:q(gf,{...r,children:t})})};var vf=function(e){var t=e.as,n=e.errors,i=e.name,r=e.message,s=e.render,o=function(e,t){if(null==e)return{};var n,i,r={},s=Object.keys(e);for(i=0;i<s.length;i++)t.indexOf(n=s[i])>=0||(r[n]=e[n]);return r}(e,["as","errors","name","message","render"]),a=xd(),l=Zh(n||a.formState.errors,i);if(!l)return null;var u=l.message,c=l.types,h=Object.assign({},o,{children:u||r});return A.isValidElement(t)?A.cloneElement(t,h):s?s({message:u||r,messages:c}):A.createElement(t||A.Fragment,h)};function bf({name:t}){const{palette:n}=e(),{formState:{errors:i}}=xd();return q(vf,{errors:i,name:t,render:({message:e})=>q(of,{variant:"body2",style:{color:n.error.main},children:e})})}function xf({form:e,sx:t,onSubmit:i,children:r}){const{handleSubmit:s}=e;return q(wd,{...e,children:q(n,{component:"form",sx:e=>{const{spacing:n}=e;return{display:"grid",gap:n(2),...t?.(e)}},onSubmit:s(i),children:r})})}const wf=()=>xd(),Ef=e=>q(y,{size:"small",...e});function Af({name:e,...t}){const{control:i}=xd(),r=A.useId();return q(vd,{control:i,name:e,render:({field:i})=>W(n,{sx:({spacing:e})=>({display:"grid",width:"100%",gap:e(1)}),children:[q(ce,{...t,...i,id:r,slots:{field:Ef}}),q(bf,{name:e})]})})}const Tf=({text:e="Нет данных"})=>q(g,{variant:"body2",sx:({palette:e})=>({textAlign:"center",color:e.grey[400]}),children:e});function kf({items:e,columnsCount:t=1,getContent:i,title:r,getKey:s,onClick:o,onClear:a,sx:l,isShowNoData:u=!0}){const c=A.useMemo(()=>e.length>0,[e.length]),h=A.useMemo(()=>Boolean(a)&&c,[a,c]);return W(n,{sx:({spacing:e,breakpoints:t})=>({display:"grid",gridTemplateColumns:"1fr",gap:e(2),...l?.root,[t.down("sm")]:{gap:e(1)}}),children:[r||a?W(n,{sx:({spacing:e})=>({display:"flex",alignItems:"center",justifyContent:"center",gap:e(1)}),children:[r?q(g,{variant:"h6",noWrap:!0,sx:{textAlign:"center",fontWeight:700,...l?.title},children:r}):null,h?q(Th,{iconProps:{name:"clear",color:"warning"},onClick:a}):null]}):null,c?q(v,{sx:({spacing:e,breakpoints:n})=>({display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:e(2),...l?.list,[n.down("sm")]:{gap:e(1)}}),disablePadding:!0,children:e.map((e,t)=>q(b,{onClick:()=>o?.(e,t),sx:()=>({...l?.item}),disablePadding:!0,children:i(e,t)},s(e,t)))}):q(A.Fragment,{children:u?q(Tf,{}):null})]})}const Sf="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function Of(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function Pf(e){return"nodeType"in e}function Cf(e){var t,n;return e?Of(e)?e:Pf(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function Rf(e){const{Document:t}=Cf(e);return e instanceof t}function Mf(e){return!Of(e)&&e instanceof Cf(e).HTMLElement}function Lf(e){return e instanceof Cf(e).SVGElement}function Nf(e){return e?Of(e)?e.document:Pf(e)?Rf(e)?e:Mf(e)||Lf(e)?e.ownerDocument:document:document:document}const zf=Sf?N:P;function Df(e){const t=S(e);return zf(()=>{t.current=e}),O(function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return null==t.current?void 0:t.current(...n)},[])}function If(e,t){void 0===t&&(t=[e]);const n=S(e);return zf(()=>{n.current!==e&&(n.current=e)},t),n}function Ff(e,t){const n=S();return M(()=>{const t=e(n.current);return n.current=t,t},[...t])}function jf(e){const t=Df(e),n=S(null),i=O(e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e},[]);return[n,i]}function Bf(e){const t=S();return P(()=>{t.current=e},[e]),t.current}let Uf={};function Vf(e,t){return M(()=>{if(t)return t;const n=null==Uf[e]?0:Uf[e]+1;return Uf[e]=n,e+"-"+n},[e,t])}function Gf(e){return function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return i.reduce((t,n)=>{const i=Object.entries(n);for(const[n,r]of i){const i=t[n];null!=i&&(t[n]=i+e*r)}return t},{...t})}}const $f=Gf(1),Zf=Gf(-1);function qf(e){if(!e)return!1;const{KeyboardEvent:t}=Cf(e.target);return t&&e instanceof t}function Wf(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=Cf(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const Hf=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Hf.Translate.toString(e),Hf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:i}=e;return t+" "+n+"ms "+i}}}),Kf="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Yf(e){return e.matches(Kf)?e:e.querySelector(Kf)}const Xf={display:"none"};function Qf(e){let{id:t,value:n}=e;return T.createElement("div",{id:t,style:Xf},n)}function Jf(e){let{id:t,announcement:n,ariaLiveType:i="assertive"}=e;return T.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":i,"aria-atomic":!0},n)}const ep=B(null);const tp={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},np={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function ip(e){let{announcements:t=np,container:n,hiddenTextDescribedById:i,screenReaderInstructions:r=tp}=e;const{announce:s,announcement:o}=function(){const[e,t]=j("");return{announce:O(e=>{null!=e&&t(e)},[]),announcement:e}}(),a=Vf("DndLiveRegion"),[l,u]=j(!1);if(P(()=>{u(!0)},[]),function(e){const t=D(ep);P(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}(M(()=>({onDragStart(e){let{active:n}=e;s(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:i}=e;t.onDragMove&&s(t.onDragMove({active:n,over:i}))},onDragOver(e){let{active:n,over:i}=e;s(t.onDragOver({active:n,over:i}))},onDragEnd(e){let{active:n,over:i}=e;s(t.onDragEnd({active:n,over:i}))},onDragCancel(e){let{active:n,over:i}=e;s(t.onDragCancel({active:n,over:i}))}}),[s,t])),!l)return null;const c=T.createElement(T.Fragment,null,T.createElement(Qf,{id:i,value:r.draggable}),T.createElement(Jf,{id:a,announcement:o}));return n?$(c,n):c}var rp;function sp(){}function op(e,t){return M(()=>({sensor:e,options:null!=t?t:{}}),[e,t])}function ap(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return M(()=>[...t].filter(e=>null!=e),[...t])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(rp||(rp={}));const lp=Object.freeze({x:0,y:0});function up(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function cp(e,t){let{data:{value:n}}=e,{data:{value:i}}=t;return n-i}function hp(e,t){let{data:{value:n}}=e,{data:{value:i}}=t;return i-n}function dp(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const fp=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:i}=e;const r=dp(t,t.left,t.top),s=[];for(const e of i){const{id:t}=e,i=n.get(t);if(i){const n=up(dp(i),r);s.push({id:t,data:{droppableContainer:e,value:n}})}}return s.sort(cp)};function pp(e,t){const n=Math.max(t.top,e.top),i=Math.max(t.left,e.left),r=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),o=r-i,a=s-n;if(i<r&&n<s){const n=t.width*t.height,i=e.width*e.height,r=o*a;return Number((r/(n+i-r)).toFixed(4))}return 0}const mp=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:i}=e;const r=[];for(const e of i){const{id:i}=e,s=n.get(i);if(s){const n=pp(s,t);n>0&&r.push({id:i,data:{droppableContainer:e,value:n}})}}return r.sort(hp)};function _p(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:lp}function gp(e){return function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return i.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}const yp=gp(1);const vp={ignoreTransform:!1};function bp(e,t){void 0===t&&(t=vp);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:i}=Cf(e).getComputedStyle(e);t&&(n=function(e,t,n){const i=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!i)return e;const{scaleX:r,scaleY:s,x:o,y:a}=i,l=e.left-o-(1-r)*parseFloat(n),u=e.top-a-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),c=r?e.width/r:e.width,h=s?e.height/s:e.height;return{width:c,height:h,top:u,right:l+c,bottom:u+h,left:l}}(n,t,i))}const{top:i,left:r,width:s,height:o,bottom:a,right:l}=n;return{top:i,left:r,width:s,height:o,bottom:a,right:l}}function xp(e){return bp(e,{ignoreTransform:!0})}function wp(e,t){const n=[];return e?function i(r){if(null!=t&&n.length>=t)return n;if(!r)return n;if(Rf(r)&&null!=r.scrollingElement&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!Mf(r)||Lf(r))return n;if(n.includes(r))return n;const s=Cf(e).getComputedStyle(r);return r!==e&&function(e,t){void 0===t&&(t=Cf(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const i=t[e];return"string"==typeof i&&n.test(i)})}(r,s)&&n.push(r),function(e,t){return void 0===t&&(t=Cf(e).getComputedStyle(e)),"fixed"===t.position}(r,s)?n:i(r.parentNode)}(e):n}function Ep(e){const[t]=wp(e,1);return null!=t?t:null}function Ap(e){return Sf&&e?Of(e)?e:Pf(e)?Rf(e)||e===Nf(e).scrollingElement?window:Mf(e)?e:null:null:null}function Tp(e){return Of(e)?e.scrollX:e.scrollLeft}function kp(e){return Of(e)?e.scrollY:e.scrollTop}function Sp(e){return{x:Tp(e),y:kp(e)}}var Op;function Pp(e){return!(!Sf||!e)&&e===document.scrollingElement}function Cp(e){const t={x:0,y:0},n=Pp(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},i={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=i.y,isRight:e.scrollLeft>=i.x,maxScroll:i,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(Op||(Op={}));const Rp={x:.2,y:.2};function Mp(e,t,n,i,r){let{top:s,left:o,right:a,bottom:l}=n;void 0===i&&(i=10),void 0===r&&(r=Rp);const{isTop:u,isBottom:c,isLeft:h,isRight:d}=Cp(e),f={x:0,y:0},p={x:0,y:0},m=t.height*r.y,_=t.width*r.x;return!u&&s<=t.top+m?(f.y=Op.Backward,p.y=i*Math.abs((t.top+m-s)/m)):!c&&l>=t.bottom-m&&(f.y=Op.Forward,p.y=i*Math.abs((t.bottom-m-l)/m)),!d&&a>=t.right-_?(f.x=Op.Forward,p.x=i*Math.abs((t.right-_-a)/_)):!h&&o<=t.left+_&&(f.x=Op.Backward,p.x=i*Math.abs((t.left+_-o)/_)),{direction:f,speed:p}}function Lp(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:i,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:i,bottom:r,width:e.clientWidth,height:e.clientHeight}}function Np(e){return e.reduce((e,t)=>$f(e,Sp(t)),lp)}const zp=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+Tp(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+kp(t),0)}]];class Dp{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=wp(t),i=Np(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,r]of zp)for(const s of t)Object.defineProperty(this,s,{get:()=>{const t=r(n),o=i[e]-t;return this.rect[s]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ip{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var i;null==(i=this.target)||i.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function Fp(e,t){const n=Math.abs(e.x),i=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+i**2)>t:"x"in t&&"y"in t?n>t.x&&i>t.y:"x"in t?n>t.x:"y"in t&&i>t.y}var jp,Bp;function Up(e){e.preventDefault()}function Vp(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(jp||(jp={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"}(Bp||(Bp={}));const Gp={start:[Bp.Space,Bp.Enter],cancel:[Bp.Esc],end:[Bp.Space,Bp.Enter,Bp.Tab]},$p=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Bp.Right:return{...n,x:n.x+25};case Bp.Left:return{...n,x:n.x-25};case Bp.Down:return{...n,y:n.y+25};case Bp.Up:return{...n,y:n.y-25}}};class Zp{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new Ip(Nf(t)),this.windowListeners=new Ip(Cf(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(jp.Resize,this.handleCancel),this.windowListeners.add(jp.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(jp.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=bp),!e)return;const{top:n,left:i,bottom:r,right:s}=t(e);Ep(e)&&(r<=0||s<=0||n>=window.innerHeight||i>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(lp)}handleKeyDown(e){if(qf(e)){const{active:t,context:n,options:i}=this.props,{keyboardCodes:r=Gp,coordinateGetter:s=$p,scrollBehavior:o="smooth"}=i,{code:a}=e;if(r.end.includes(a))return void this.handleEnd(e);if(r.cancel.includes(a))return void this.handleCancel(e);const{collisionRect:l}=n.current,u=l?{x:l.left,y:l.top}:lp;this.referenceCoordinates||(this.referenceCoordinates=u);const c=s(e,{active:t,context:n.current,currentCoordinates:u});if(c){const t=Zf(c,u),i={x:0,y:0},{scrollableAncestors:r}=n.current;for(const n of r){const r=e.code,{isTop:s,isRight:a,isLeft:l,isBottom:u,maxScroll:h,minScroll:d}=Cp(n),f=Lp(n),p={x:Math.min(r===Bp.Right?f.right-f.width/2:f.right,Math.max(r===Bp.Right?f.left:f.left+f.width/2,c.x)),y:Math.min(r===Bp.Down?f.bottom-f.height/2:f.bottom,Math.max(r===Bp.Down?f.top:f.top+f.height/2,c.y))},m=r===Bp.Right&&!a||r===Bp.Left&&!l,_=r===Bp.Down&&!u||r===Bp.Up&&!s;if(m&&p.x!==c.x){const e=n.scrollLeft+t.x,s=r===Bp.Right&&e<=h.x||r===Bp.Left&&e>=d.x;if(s&&!t.y)return void n.scrollTo({left:e,behavior:o});i.x=s?n.scrollLeft-e:r===Bp.Right?n.scrollLeft-h.x:n.scrollLeft-d.x,i.x&&n.scrollBy({left:-i.x,behavior:o});break}if(_&&p.y!==c.y){const e=n.scrollTop+t.y,s=r===Bp.Down&&e<=h.y||r===Bp.Up&&e>=d.y;if(s&&!t.x)return void n.scrollTo({top:e,behavior:o});i.y=s?n.scrollTop-e:r===Bp.Down?n.scrollTop-h.y:n.scrollTop-d.y,i.y&&n.scrollBy({top:-i.y,behavior:o});break}}this.handleMove(e,$f(Zf(c,this.referenceCoordinates),i))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function qp(e){return Boolean(e&&"distance"in e)}function Wp(e){return Boolean(e&&"delay"in e)}Zp.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:i=Gp,onActivation:r}=t,{active:s}=n;const{code:o}=e.nativeEvent;if(i.start.includes(o)){const t=s.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==r||r({event:e.nativeEvent}),!0)}return!1}}];class Hp{constructor(e,t,n){var i;void 0===n&&(n=function(e){const{EventTarget:t}=Cf(e);return e instanceof t?e:Nf(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:r}=e,{target:s}=r;this.props=e,this.events=t,this.document=Nf(s),this.documentListeners=new Ip(this.document),this.listeners=new Ip(n),this.windowListeners=new Ip(Cf(s)),this.initialCoordinates=null!=(i=Wf(r))?i:lp,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(jp.Resize,this.handleCancel),this.windowListeners.add(jp.DragStart,Up),this.windowListeners.add(jp.VisibilityChange,this.handleCancel),this.windowListeners.add(jp.ContextMenu,Up),this.documentListeners.add(jp.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Wp(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(qp(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:n,onPending:i}=this.props;i(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(jp.Click,Vp,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(jp.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:i,props:r}=this,{onMove:s,options:{activationConstraint:o}}=r;if(!i)return;const a=null!=(t=Wf(e))?t:lp,l=Zf(i,a);if(!n&&o){if(qp(o)){if(null!=o.tolerance&&Fp(l,o.tolerance))return this.handleCancel();if(Fp(l,o.distance))return this.handleStart()}return Wp(o)&&Fp(l,o.tolerance)?this.handleCancel():void this.handlePending(o,l)}e.cancelable&&e.preventDefault(),s(a)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Bp.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Kp={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Yp extends Hp{constructor(e){const{event:t}=e,n=Nf(t.target);super(e,Kp,n)}}Yp.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:i}=t;return!(!n.isPrimary||0!==n.button)&&(null==i||i({event:n}),!0)}}];const Xp={move:{name:"mousemove"},end:{name:"mouseup"}};var Qp;!function(e){e[e.RightClick=2]="RightClick"}(Qp||(Qp={}));(class extends Hp{constructor(e){super(e,Xp,Nf(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:i}=t;return n.button!==Qp.RightClick&&(null==i||i({event:n}),!0)}}];const Jp={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var em,tm;function nm(e){let{acceleration:t,activator:n=em.Pointer,canScroll:i,draggingRect:r,enabled:s,interval:o=5,order:a=tm.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:h,threshold:d}=e;const f=function(e){let{delta:t,disabled:n}=e;const i=Bf(t);return Ff(e=>{if(n||!i||!e)return im;const r={x:Math.sign(t.x-i.x),y:Math.sign(t.y-i.y)};return{x:{[Op.Backward]:e.x[Op.Backward]||-1===r.x,[Op.Forward]:e.x[Op.Forward]||1===r.x},y:{[Op.Backward]:e.y[Op.Backward]||-1===r.y,[Op.Forward]:e.y[Op.Forward]||1===r.y}}},[n,t,i])}({delta:h,disabled:!s}),[p,m]=function(){const e=S(null);return[O((t,n)=>{e.current=setInterval(t,n)},[]),O(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}(),_=S({x:0,y:0}),g=S({x:0,y:0}),y=M(()=>{switch(n){case em.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case em.DraggableRect:return r}},[n,r,l]),v=S(null),b=O(()=>{const e=v.current;if(!e)return;const t=_.current.x*g.current.x,n=_.current.y*g.current.y;e.scrollBy(t,n)},[]),x=M(()=>a===tm.TreeOrder?[...u].reverse():u,[a,u]);P(()=>{if(s&&u.length&&y){for(const e of x){if(!1===(null==i?void 0:i(e)))continue;const n=u.indexOf(e),r=c[n];if(!r)continue;const{direction:s,speed:a}=Mp(e,r,y,t,d);for(const e of["x","y"])f[e][s[e]]||(a[e]=0,s[e]=0);if(a.x>0||a.y>0)return m(),v.current=e,p(b,o),_.current=a,void(g.current=s)}_.current={x:0,y:0},g.current={x:0,y:0},m()}else m()},[t,b,i,m,s,o,JSON.stringify(y),JSON.stringify(f),p,u,x,c,JSON.stringify(d)])}(class extends Hp{constructor(e){super(e,Jp)}static setup(){return window.addEventListener(Jp.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Jp.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:i}=t;const{touches:r}=n;return!(r.length>1)&&(null==i||i({event:n}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(em||(em={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(tm||(tm={}));const im={x:{[Op.Backward]:!1,[Op.Forward]:!1},y:{[Op.Backward]:!1,[Op.Forward]:!1}};var rm,sm;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(rm||(rm={})),function(e){e.Optimized="optimized"}(sm||(sm={}));const om=new Map;function am(e,t){return Ff(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function lm(e){let{callback:t,disabled:n}=e;const i=Df(t),r=M(()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(i)},[n]);return P(()=>()=>null==r?void 0:r.disconnect(),[r]),r}function um(e){return new Dp(bp(e),e)}function cm(e,t,n){void 0===t&&(t=um);const[i,r]=j(null);function s(){r(i=>{if(!e)return null;var r;if(!1===e.isConnected)return null!=(r=null!=i?i:n)?r:null;const s=t(e);return JSON.stringify(i)===JSON.stringify(s)?i:s})}const o=function(e){let{callback:t,disabled:n}=e;const i=Df(t),r=M(()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(i)},[i,n]);return P(()=>()=>null==r?void 0:r.disconnect(),[r]),r}({callback(t){if(e)for(const n of t){const{type:t,target:i}=n;if("childList"===t&&i instanceof HTMLElement&&i.contains(e)){s();break}}}}),a=lm({callback:s});return zf(()=>{s(),e?(null==a||a.observe(e),null==o||o.observe(document.body,{childList:!0,subtree:!0})):(null==a||a.disconnect(),null==o||o.disconnect())},[e]),i}const hm=[];function dm(e,t){void 0===t&&(t=[]);const n=S(null);return P(()=>{n.current=null},t),P(()=>{const t=e!==lp;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Zf(e,n.current):lp}function fm(e){return M(()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null,[e])}const pm=[];function mm(e){let{measure:t}=e;const[n,i]=j(null),r=O(e=>{for(const{target:n}of e)if(Mf(n)){i(e=>{const i=t(n);return e?{...e,width:i.width,height:i.height}:i});break}},[t]),s=lm({callback:r}),o=O(e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Mf(t)?t:e}(e);null==s||s.disconnect(),n&&(null==s||s.observe(n)),i(n?t(n):null)},[t,s]),[a,l]=jf(o);return M(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const _m=[{sensor:Yp,options:{}},{sensor:Zp,options:{}}],gm={current:{}},ym={draggable:{measure:xp},droppable:{measure:xp,strategy:rm.WhileDragging,frequency:sm.Optimized},dragOverlay:{measure:bp}};class vm extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const bm={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new vm,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:sp},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ym,measureDroppableContainers:sp,windowRect:null,measuringScheduled:!1},xm=B({activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:sp,draggableNodes:new Map,over:null,measureDroppableContainers:sp}),wm=B(bm);function Em(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new vm}}}function Am(e,t){switch(t.type){case rp.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case rp.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case rp.DragEnd:case rp.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case rp.RegisterDroppable:{const{element:n}=t,{id:i}=n,r=new vm(e.droppable.containers);return r.set(i,n),{...e,droppable:{...e.droppable,containers:r}}}case rp.SetDroppableDisabled:{const{id:n,key:i,disabled:r}=t,s=e.droppable.containers.get(n);if(!s||i!==s.key)return e;const o=new vm(e.droppable.containers);return o.set(n,{...s,disabled:r}),{...e,droppable:{...e.droppable,containers:o}}}case rp.UnregisterDroppable:{const{id:n,key:i}=t,r=e.droppable.containers.get(n);if(!r||i!==r.key)return e;const s=new vm(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function Tm(e){let{disabled:t}=e;const{active:n,activatorEvent:i,draggableNodes:r}=D(xm),s=Bf(i),o=Bf(null==n?void 0:n.id);return P(()=>{if(!t&&!i&&s&&null!=o){if(!qf(s))return;if(document.activeElement===s.target)return;const e=r.get(o);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=Yf(e);if(t){t.focus();break}}})}},[i,t,r,o,s]),null}const km=B({...lp,scaleX:1,scaleY:1});var Sm;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Sm||(Sm={}));const Om=F(function(e){var t,n,i,r;let{id:s,accessibility:o,autoScroll:a=!0,children:l,sensors:u=_m,collisionDetection:c=mp,measuring:h,modifiers:d,...f}=e;const p=U(Am,void 0,Em),[m,_]=p,[g,y]=function(){const[e]=j(()=>new Set),t=O(t=>(e.add(t),()=>e.delete(t)),[e]);return[O(t=>{let{type:n,event:i}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,i)})},[e]),t]}(),[v,b]=j(Sm.Uninitialized),x=v===Sm.Initialized,{draggable:{active:w,nodes:E,translate:A},droppable:{containers:k}}=m,C=null!=w?E.get(w):null,R=S({initial:null,translated:null}),L=M(()=>{var e;return null!=w?{id:w,data:null!=(e=null==C?void 0:C.data)?e:gm,rect:R}:null},[w,C]),N=S(null),[z,D]=j(null),[I,F]=j(null),B=If(f,Object.values(f)),V=Vf("DndDescribedBy",s),G=M(()=>k.getEnabled(),[k]),$=M(()=>({draggable:{...ym.draggable,...null==q?void 0:q.draggable},droppable:{...ym.droppable,...null==q?void 0:q.droppable},dragOverlay:{...ym.dragOverlay,...null==q?void 0:q.dragOverlay}}),[null==(q=h)?void 0:q.draggable,null==q?void 0:q.droppable,null==q?void 0:q.dragOverlay]);var q;const{droppableRects:W,measureDroppableContainers:H,measuringScheduled:K}=function(e,t){let{dragging:n,dependencies:i,config:r}=t;const[s,o]=j(null),{frequency:a,measure:l,strategy:u}=r,c=S(e),h=function(){switch(u){case rm.Always:return!1;case rm.BeforeDragging:return n;default:return!n}}(),d=If(h),f=O(function(e){void 0===e&&(e=[]),d.current||o(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[d]),p=S(null),m=Ff(t=>{if(h&&!n)return om;if(!t||t===om||c.current!==e||null!=s){const t=new Map;for(let n of e){if(!n)continue;if(s&&s.length>0&&!s.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,i=e?new Dp(l(e),e):null;n.rect.current=i,i&&t.set(n.id,i)}return t}return t},[e,s,n,h,l]);return P(()=>{c.current=e},[e]),P(()=>{h||f()},[n,h]),P(()=>{s&&s.length>0&&o(null)},[JSON.stringify(s)]),P(()=>{h||"number"!=typeof a||null!==p.current||(p.current=setTimeout(()=>{f(),p.current=null},a))},[a,h,f,...i]),{droppableRects:m,measureDroppableContainers:f,measuringScheduled:null!=s}}(G,{dragging:x,dependencies:[A.x,A.y],config:$.droppable}),Y=function(e,t){const n=null!=t?e.get(t):void 0,i=n?n.node.current:null;return Ff(e=>{var n;return null==t?null:null!=(n=null!=i?i:e)?n:null},[i,t])}(E,w),X=M(()=>I?Wf(I):null,[I]),Q=function(){const e=!1===(null==z?void 0:z.autoScrollEnabled),t="object"==typeof a?!1===a.enabled:!1===a,n=x&&!e&&!t;if("object"==typeof a)return{...a,enabled:n};return{enabled:n}}(),J=function(e,t){return am(e,t)}(Y,$.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:i,config:r=!0}=e;const s=S(!1),{x:o,y:a}="boolean"==typeof r?{x:r,y:r}:r;zf(()=>{if(!o&&!a||!t)return void(s.current=!1);if(s.current||!i)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const r=_p(n(e),i);if(o||(r.x=0),a||(r.y=0),s.current=!0,Math.abs(r.x)>0||Math.abs(r.y)>0){const t=Ep(e);t&&t.scrollBy({top:r.y,left:r.x})}},[t,o,a,i,n])}({activeNode:null!=w?E.get(w):null,config:Q.layoutShiftCompensation,initialRect:J,measure:$.draggable.measure});const ee=cm(Y,$.draggable.measure,J),te=cm(Y?Y.parentElement:null),ne=S({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:W,draggableNodes:E,draggingNode:null,draggingNodeRect:null,droppableContainers:k,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ie=k.getNodeFor(null==(t=ne.current.over)?void 0:t.id),re=mm({measure:$.dragOverlay.measure}),se=null!=(n=re.nodeRef.current)?n:Y,oe=x?null!=(i=re.rect)?i:ee:null,ae=Boolean(re.nodeRef.current&&re.rect),le=_p(ue=ae?null:ee,am(ue));var ue;const ce=fm(se?Cf(se):null),he=function(e){const t=S(e),n=Ff(n=>e?n&&n!==hm&&e&&t.current&&e.parentNode===t.current.parentNode?n:wp(e):hm,[e]);return P(()=>{t.current=e},[e]),n}(x?null!=ie?ie:Y:null),de=function(e,t){void 0===t&&(t=bp);const[n]=e,i=fm(n?Cf(n):null),[r,s]=j(pm);function o(){s(()=>e.length?e.map(e=>Pp(e)?i:new Dp(t(e),e)):pm)}const a=lm({callback:o});return zf(()=>{null==a||a.disconnect(),o(),e.forEach(e=>null==a?void 0:a.observe(e))},[e]),r}(he),fe=function(e,t){let{transform:n,...i}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...i}),n):n}(d,{transform:{x:A.x-le.x,y:A.y-le.y,scaleX:1,scaleY:1},activatorEvent:I,active:L,activeNodeRect:ee,containerNodeRect:te,draggingNodeRect:oe,over:ne.current.over,overlayNodeRect:re.rect,scrollableAncestors:he,scrollableAncestorRects:de,windowRect:ce}),pe=X?$f(X,A):null,me=function(e){const[t,n]=j(null),i=S(e),r=O(e=>{const t=Ap(e.target);t&&n(e=>e?(e.set(t,Sp(t)),new Map(e)):null)},[]);return P(()=>{const t=i.current;if(e!==t){s(t);const o=e.map(e=>{const t=Ap(e);return t?(t.addEventListener("scroll",r,{passive:!0}),[t,Sp(t)]):null}).filter(e=>null!=e);n(o.length?new Map(o):null),i.current=e}return()=>{s(e),s(t)};function s(e){e.forEach(e=>{const t=Ap(e);null==t||t.removeEventListener("scroll",r)})}},[r,e]),M(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>$f(e,t),lp):Np(e):lp,[e,t])}(he),_e=dm(me),ge=dm(me,[ee]),ye=$f(fe,_e),ve=oe?yp(oe,fe):null,be=L&&ve?c({active:L,collisionRect:ve,droppableRects:W,droppableContainers:G,pointerCoordinates:pe}):null,xe=function(e,t){if(!e||0===e.length)return null;const[n]=e;return n[t]}(be,"id"),[we,Ee]=j(null),Ae=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(ae?fe:$f(fe,ge),null!=(r=null==we?void 0:we.rect)?r:null,ee),Te=S(null),ke=O((e,t)=>{let{sensor:n,options:i}=t;if(null==N.current)return;const r=E.get(N.current);if(!r)return;const s=e.nativeEvent,o=new n({active:N.current,activeNode:r,event:s,options:i,context:ne,onAbort(e){if(!E.get(e))return;const{onDragAbort:t}=B.current,n={id:e};null==t||t(n),g({type:"onDragAbort",event:n})},onPending(e,t,n,i){if(!E.get(e))return;const{onDragPending:r}=B.current,s={id:e,constraint:t,initialCoordinates:n,offset:i};null==r||r(s),g({type:"onDragPending",event:s})},onStart(e){const t=N.current;if(null==t)return;const n=E.get(t);if(!n)return;const{onDragStart:i}=B.current,r={activatorEvent:s,active:{id:t,data:n.data,rect:R}};Z(()=>{null==i||i(r),b(Sm.Initializing),_({type:rp.DragStart,initialCoordinates:e,active:t}),g({type:"onDragStart",event:r}),D(Te.current),F(s)})},onMove(e){_({type:rp.DragMove,coordinates:e})},onEnd:a(rp.DragEnd),onCancel:a(rp.DragCancel)});function a(e){return async function(){const{active:t,collisions:n,over:i,scrollAdjustedTranslate:r}=ne.current;let o=null;if(t&&r){const{cancelDrop:a}=B.current;if(o={activatorEvent:s,active:t,collisions:n,delta:r,over:i},e===rp.DragEnd&&"function"==typeof a){await Promise.resolve(a(o))&&(e=rp.DragCancel)}}N.current=null,Z(()=>{_({type:e}),b(Sm.Uninitialized),Ee(null),D(null),F(null),Te.current=null;const t=e===rp.DragEnd?"onDragEnd":"onDragCancel";if(o){const e=B.current[t];null==e||e(o),g({type:t,event:o})}})}}Te.current=o},[E]),Se=O((e,t)=>(n,i)=>{const r=n.nativeEvent,s=E.get(i);if(null!==N.current||!s||r.dndKit||r.defaultPrevented)return;const o={active:s};!0===e(n,t.options,o)&&(r.dndKit={capturedBy:t.sensor},N.current=i,ke(n,t))},[E,ke]),Oe=function(e,t){return M(()=>e.reduce((e,n)=>{const{sensor:i}=n;return[...e,...i.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}))]},[]),[e,t])}(u,Se);!function(e){P(()=>{if(!Sf)return;const t=e.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(const e of t)null==e||e()}},e.map(e=>{let{sensor:t}=e;return t}))}(u),zf(()=>{ee&&v===Sm.Initializing&&b(Sm.Initialized)},[ee,v]),P(()=>{const{onDragMove:e}=B.current,{active:t,activatorEvent:n,collisions:i,over:r}=ne.current;if(!t||!n)return;const s={active:t,activatorEvent:n,collisions:i,delta:{x:ye.x,y:ye.y},over:r};Z(()=>{null==e||e(s),g({type:"onDragMove",event:s})})},[ye.x,ye.y]),P(()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:i,scrollAdjustedTranslate:r}=ne.current;if(!e||null==N.current||!t||!r)return;const{onDragOver:s}=B.current,o=i.get(xe),a=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,l={active:e,activatorEvent:t,collisions:n,delta:{x:r.x,y:r.y},over:a};Z(()=>{Ee(a),null==s||s(l),g({type:"onDragOver",event:l})})},[xe]),zf(()=>{ne.current={activatorEvent:I,active:L,activeNode:Y,collisionRect:ve,collisions:be,droppableRects:W,draggableNodes:E,draggingNode:se,draggingNodeRect:oe,droppableContainers:k,over:we,scrollableAncestors:he,scrollAdjustedTranslate:ye},R.current={initial:oe,translated:ve}},[L,Y,be,ve,E,se,oe,W,k,we,he,ye]),nm({...Q,delta:A,draggingRect:ve,pointerCoordinates:pe,scrollableAncestors:he,scrollableAncestorRects:de});const Pe=M(()=>({active:L,activeNode:Y,activeNodeRect:ee,activatorEvent:I,collisions:be,containerNodeRect:te,dragOverlay:re,draggableNodes:E,droppableContainers:k,droppableRects:W,over:we,measureDroppableContainers:H,scrollableAncestors:he,scrollableAncestorRects:de,measuringConfiguration:$,measuringScheduled:K,windowRect:ce}),[L,Y,ee,I,be,te,re,E,k,W,we,H,he,de,$,K,ce]),Ce=M(()=>({activatorEvent:I,activators:Oe,active:L,activeNodeRect:ee,ariaDescribedById:{draggable:V},dispatch:_,draggableNodes:E,over:we,measureDroppableContainers:H}),[I,Oe,L,ee,_,V,E,we,H]);return T.createElement(ep.Provider,{value:y},T.createElement(xm.Provider,{value:Ce},T.createElement(wm.Provider,{value:Pe},T.createElement(km.Provider,{value:Ae},l)),T.createElement(Tm,{disabled:!1===(null==o?void 0:o.restoreFocus)})),T.createElement(ip,{...o,hiddenTextDescribedById:V}))}),Pm=B(null),Cm="button";function Rm(e){let{id:t,data:n,disabled:i=!1,attributes:r}=e;const s=Vf("Draggable"),{activators:o,activatorEvent:a,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:h,over:d}=D(xm),{role:f=Cm,roleDescription:p="draggable",tabIndex:m=0}=null!=r?r:{},_=(null==l?void 0:l.id)===t,g=D(_?km:Pm),[y,v]=jf(),[b,x]=jf(),w=function(e,t){return M(()=>e.reduce((e,n)=>{let{eventName:i,handler:r}=n;return e[i]=e=>{r(e,t)},e},{}),[e,t])}(o,t),E=If(n);zf(()=>(h.set(t,{id:t,key:s,node:y,activatorNode:b,data:E}),()=>{const e=h.get(t);e&&e.key===s&&h.delete(t)}),[h,t]);return{active:l,activatorEvent:a,activeNodeRect:u,attributes:M(()=>({role:f,tabIndex:m,"aria-disabled":i,"aria-pressed":!(!_||f!==Cm)||void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[i,f,m,_,p,c.draggable]),isDragging:_,listeners:i?void 0:w,node:y,over:d,setNodeRef:v,setActivatorNodeRef:x,transform:g}}const Mm={timeout:25};function Lm(e,t,n){const i=e.slice();return i.splice(n<0?i.length+n:n,0,i.splice(t,1)[0]),i}function Nm(e,t){return e.reduce((e,n,i)=>{const r=t.get(n);return r&&(e[i]=r),e},Array(e.length))}function zm(e){return null!==e&&e>=0}const Dm=e=>{let{rects:t,activeIndex:n,overIndex:i,index:r}=e;const s=Lm(t,i,n),o=t[r],a=s[r];return a&&o?{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}:null},Im={scaleX:1,scaleY:1},Fm=e=>{var t;let{activeIndex:n,activeNodeRect:i,index:r,rects:s,overIndex:o}=e;const a=null!=(t=s[n])?t:i;if(!a)return null;if(r===n){const e=s[o];return e?{x:0,y:n<o?e.top+e.height-(a.top+a.height):e.top-a.top,...Im}:null}const l=function(e,t,n){const i=e[t],r=e[t-1],s=e[t+1];if(!i)return 0;if(n<t)return r?i.top-(r.top+r.height):s?s.top-(i.top+i.height):0;return s?s.top-(i.top+i.height):r?i.top-(r.top+r.height):0}(s,r,n);return r>n&&r<=o?{x:0,y:-a.height-l,...Im}:r<n&&r>=o?{x:0,y:a.height+l,...Im}:{x:0,y:0,...Im}};const jm="Sortable",Bm=T.createContext({activeIndex:-1,containerId:jm,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Dm,disabled:{draggable:!1,droppable:!1}});function Um(e){let{children:t,id:n,items:i,strategy:r=Dm,disabled:s=!1}=e;const{active:o,dragOverlay:a,droppableRects:l,over:u,measureDroppableContainers:c}=D(wm),h=Vf(jm,n),d=Boolean(null!==a.rect),f=M(()=>i.map(e=>"object"==typeof e&&"id"in e?e.id:e),[i]),p=null!=o,m=o?f.indexOf(o.id):-1,_=u?f.indexOf(u.id):-1,g=S(f),y=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(f,g.current),v=-1!==_&&-1===m||y,b=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(s);zf(()=>{y&&p&&c(f)},[y,f,p,c]),P(()=>{g.current=f},[f]);const x=M(()=>({activeIndex:m,containerId:h,disabled:b,disableTransforms:v,items:f,overIndex:_,useDragOverlay:d,sortedRects:Nm(f,l),strategy:r}),[m,h,b.draggable,b.droppable,v,f,_,l,d,r]);return T.createElement(Bm.Provider,{value:x},t)}const Vm=e=>{let{id:t,items:n,activeIndex:i,overIndex:r}=e;return Lm(n,i,r).indexOf(t)},Gm=e=>{let{containerId:t,isSorting:n,wasDragging:i,index:r,items:s,newIndex:o,previousItems:a,previousContainerId:l,transition:u}=e;return!(!u||!i)&&((a===s||r!==o)&&(!!n||o!==r&&t===l))},$m={duration:200,easing:"ease"},Zm="transform",qm=Hf.Transition.toString({property:Zm,duration:0,easing:"linear"}),Wm={roleDescription:"sortable"};function Hm(e){let{animateLayoutChanges:t=Gm,attributes:n,disabled:i,data:r,getNewIndex:s=Vm,id:o,strategy:a,resizeObserverConfig:l,transition:u=$m}=e;const{items:c,containerId:h,activeIndex:d,disabled:f,disableTransforms:p,sortedRects:m,overIndex:_,useDragOverlay:g,strategy:y}=D(Bm),v=function(e,t){var n,i;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(i=null==e?void 0:e.droppable)?i:t.droppable}}(i,f),b=c.indexOf(o),x=M(()=>({sortable:{containerId:h,index:b,items:c},...r}),[h,r,b,c]),w=M(()=>c.slice(c.indexOf(o)),[c,o]),{rect:E,node:A,isOver:T,setNodeRef:k}=function(e){let{data:t,disabled:n=!1,id:i,resizeObserverConfig:r}=e;const s=Vf("Droppable"),{active:o,dispatch:a,over:l,measureDroppableContainers:u}=D(xm),c=S({disabled:n}),h=S(!1),d=S(null),f=S(null),{disabled:p,updateMeasurementsFor:m,timeout:_}={...Mm,...r},g=If(null!=m?m:i),y=lm({callback:O(()=>{h.current?(null!=f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{u(Array.isArray(g.current)?g.current:[g.current]),f.current=null},_)):h.current=!0},[_]),disabled:p||!o}),v=O((e,t)=>{y&&(t&&(y.unobserve(t),h.current=!1),e&&y.observe(e))},[y]),[b,x]=jf(v),w=If(t);return P(()=>{y&&b.current&&(y.disconnect(),h.current=!1,y.observe(b.current))},[b,y]),P(()=>(a({type:rp.RegisterDroppable,element:{id:i,key:s,disabled:n,node:b,rect:d,data:w}}),()=>a({type:rp.UnregisterDroppable,key:s,id:i})),[i]),P(()=>{n!==c.current.disabled&&(a({type:rp.SetDroppableDisabled,id:i,key:s,disabled:n}),c.current.disabled=n)},[i,s,n,a]),{active:o,rect:d,isOver:(null==l?void 0:l.id)===i,node:b,over:l,setNodeRef:x}}({id:o,data:x,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:w,...l}}),{active:C,activatorEvent:R,activeNodeRect:L,attributes:N,setNodeRef:z,listeners:I,isDragging:F,over:B,setActivatorNodeRef:U,transform:V}=Rm({id:o,data:x,attributes:{...Wm,...n},disabled:v.draggable}),G=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return M(()=>e=>{t.forEach(t=>t(e))},t)}(k,z),$=Boolean(C),Z=$&&!p&&zm(d)&&zm(_),q=!g&&F,W=q&&Z?V:null,H=Z?null!=W?W:(null!=a?a:y)({rects:m,activeNodeRect:L,activeIndex:d,overIndex:_,index:b}):null,K=zm(d)&&zm(_)?s({id:o,items:c,activeIndex:d,overIndex:_}):b,Y=null==C?void 0:C.id,X=S({activeId:Y,items:c,newIndex:K,containerId:h}),Q=c!==X.current.items,J=t({active:C,containerId:h,isDragging:F,isSorting:$,id:o,index:b,items:c,newIndex:X.current.newIndex,previousItems:X.current.items,previousContainerId:X.current.containerId,transition:u,wasDragging:null!=X.current.activeId}),ee=function(e){let{disabled:t,index:n,node:i,rect:r}=e;const[s,o]=j(null),a=S(n);return zf(()=>{if(!t&&n!==a.current&&i.current){const e=r.current;if(e){const t=bp(i.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==a.current&&(a.current=n)},[t,n,i,r]),P(()=>{s&&o(null)},[s]),s}({disabled:!J,index:b,node:A,rect:E});return P(()=>{$&&X.current.newIndex!==K&&(X.current.newIndex=K),h!==X.current.containerId&&(X.current.containerId=h),c!==X.current.items&&(X.current.items=c)},[$,K,h,c]),P(()=>{if(Y===X.current.activeId)return;if(null!=Y&&null==X.current.activeId)return void(X.current.activeId=Y);const e=setTimeout(()=>{X.current.activeId=Y},50);return()=>clearTimeout(e)},[Y]),{active:C,activeIndex:d,attributes:N,data:x,rect:E,index:b,newIndex:K,items:c,isOver:T,isSorting:$,isDragging:F,listeners:I,node:A,overIndex:_,over:B,setNodeRef:G,setActivatorNodeRef:U,setDroppableNodeRef:k,setDraggableNodeRef:z,transform:null!=ee?ee:H,transition:function(){if(ee||Q&&X.current.newIndex===b)return qm;if(q&&!qf(R)||!u)return;if($||J)return Hf.Transition.toString({...u,property:Zm});return}()}}Bp.Down,Bp.Right,Bp.Up,Bp.Left;const Km=({id:e,sx:t,children:i})=>{const{isDragging:r}=Rm({id:e}),{attributes:s,listeners:o,setNodeRef:a,transform:l,transition:u}=Hm({id:e,strategy:Fm,transition:{duration:300,easing:"cubic-bezier(0.25, 1, 0.5, 1)"}}),c={...t?.default,...r?t?.dragging:{},transform:Hf.Translate.toString(l),transition:u,cursor:"pointer"};return q(n,{ref:a,style:c,...o,...s,children:i})};function Ym({items:e,getItem:t,getId:n,onDragEnd:i,sx:r,title:s,draggableSx:o}){const a=ap(op(Yp,{activationConstraint:{distance:8}}));return q(Om,{sensors:a,collisionDetection:fp,onDragEnd:t=>{const{active:r,over:s}=t,o=e.findIndex(e=>n(e)===r.id),a=e.findIndex(e=>n(e)===s?.id),l=Lm(e,o,a);i(l)},children:q(Um,{items:e.map(n),strategy:Fm,children:q(kf,{items:e,sx:r,title:s,getKey:n,getContent:(e,i)=>{const r=n(e);return q(Km,{id:r,sx:o,children:t(e,i)},r)}})})})}const Xm={x:0,y:0};const Qm=e=>{let{transform:t,draggingNodeRect:n,windowRect:i}=e;return n&&i?function(e,t,n){const i={...e};return t.top+e.y<=n.top?i.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(i.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?i.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(i.x=n.left+n.width-t.right),i}(t,n,i):t};
|
|
15
|
-
/*! js-cookie v3.0.5 | MIT */function Jm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}!function e(t,n){function i(e,i,r){if("undefined"!=typeof document){"number"==typeof(r=Jm({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var o in r)r[o]&&(s+="; "+o,!0!==r[o]&&(s+="="+r[o].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+s}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},r=0;r<n.length;r++){var s=n[r].split("="),o=s.slice(1).join("=");try{var a=decodeURIComponent(s[0]);if(i[a]=t.read(o,a),e===a)break}catch(e){}}return e?i[e]:i}},remove:function(e,t){i(e,"",Jm({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,Jm({},this.attributes,t))},withConverter:function(t){return e(Jm({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});var e_,t_,n_,i_,r_={exports:{}};
|
|
16
|
-
/*!
|
|
17
|
-
* screenfull
|
|
18
|
-
* v5.2.0 - 2021-11-03
|
|
19
|
-
* (c) Sindre Sorhus; MIT License
|
|
20
|
-
*/e_||(e_=1,t_=r_,function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},t=t_.exports,n=function(){for(var t,n=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],i=0,r=n.length,s={};i<r;i++)if((t=n[i])&&t[1]in e){for(i=0;i<t.length;i++)s[n[0][i]]=t[i];return s}return!1}(),i={change:n.fullscreenchange,error:n.fullscreenerror},r={request:function(t,i){return new Promise(function(r,s){var o=function(){this.off("change",o),r()}.bind(this);this.on("change",o);var a=(t=t||e.documentElement)[n.requestFullscreen](i);a instanceof Promise&&a.then(o).catch(s)}.bind(this))},exit:function(){return new Promise(function(t,i){if(this.isFullscreen){var r=function(){this.off("change",r),t()}.bind(this);this.on("change",r);var s=e[n.exitFullscreen]();s instanceof Promise&&s.then(r).catch(i)}else t()}.bind(this))},toggle:function(e,t){return this.isFullscreen?this.exit():this.request(e,t)},onchange:function(e){this.on("change",e)},onerror:function(e){this.on("error",e)},on:function(t,n){var r=i[t];r&&e.addEventListener(r,n,!1)},off:function(t,n){var r=i[t];r&&e.removeEventListener(r,n,!1)},raw:n};n?(Object.defineProperties(r,{isFullscreen:{get:function(){return Boolean(e[n.fullscreenElement])}},element:{enumerable:!0,get:function(){return e[n.fullscreenElement]}},isEnabled:{enumerable:!0,get:function(){return Boolean(e[n.fullscreenEnabled])}}}),t?t_.exports=r:window.screenfull=r):t?t_.exports={isEnabled:!1}:window.screenfull={isEnabled:!1}}()),"development"===process.env.NODE_ENV||process.env.NODE_ENV;const s_="undefined"!=typeof window,o_="undefined"!=typeof navigator;s_&&(null==(i_=window)||null==(n_=i_.navigator)?void 0:n_.userAgent)&&/iP(?:ad|hone|od)/.test(window.navigator.userAgent);const a_=o_?navigator:void 0;function l_(e){return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}a_&&(a_.connection||a_.mozConnection||a_.webkitConnection);const u_=()=>{const e=S({}).current,t=S({width:0,height:0}),n=fh.useSyncExternalStore(l_,()=>{const n={width:window.innerWidth,height:window.innerHeight};return((t,n)=>{for(const i in e){const e=i;if(n[e]!==t[e])return!1}return!0})(t.current,n)?t.current:(t.current=n,n)},()=>t.current);return{get width(){return e.width=!0,n.width},get height(){return e.height=!0,n.height}}};T.use;const c_=({width:e,zIndex:t,boxRef:i,map:r,position:s,children:o})=>{const a=A.useId(),{attributes:l,listeners:u,setNodeRef:c,transform:h}=Rm({id:a});return q(n,{ref:e=>{c(e),i&&(i.current=e)},onMouseDown:()=>{r?.dragging.disable()},onMouseUp:()=>{r?.dragging.enable()},onTouchStart:()=>{r?.dragging.disable()},onTouchEnd:()=>{r?.dragging.enable()},sx:()=>{const n={position:"absolute",left:s.x,top:s.y,width:e,zIndex:t,cursor:"grab"};return h&&(n.transform=Hf.Translate.toString(h)),n},...u,...l,children:o})},h_=({defaultBrowserPosition:e,onUpdate:t,sx:n,children:i,...r})=>{const s=A.useId(),o=u_(),[a,l]=A.useState(Xm),u=A.useRef(null),c=A.useCallback(e=>{const{current:t}=u;if(t){return{top:e.y,right:o.width-t.clientWidth-e.x,left:e.x,bottom:o.height-t.clientHeight-e.y}}},[o.height,o.width]),h=A.useCallback(({top:e,right:t,bottom:n,left:i})=>{const{current:r}=u;if(r){const s={...Xm};return e&&(s.y=e),n&&(s.y=o.height-r.clientHeight-n),i&&(s.x=i),t&&(s.x=o.width-r.clientWidth-t),s}},[o.height,o.width]),d=ap(op(Yp,{activationConstraint:{distance:8}})),f=A.useCallback(({delta:e})=>{l(n=>{const i=structuredClone(n);i.x+=e.x,i.y+=e.y;const r=c(i);return t&&r&&t(r),i})},[t,c]);return A.useEffect(()=>{const t=h(e);t&&l(t)},[e,h]),q(Om,{id:s,sensors:d,modifiers:[Qm],onDragEnd:f,children:q(c_,{...r,position:a,boxRef:u,children:q(Rh,{sx:n,children:i})})})},d_=B(null),f_={didCatch:!1,error:null};class p_ extends z{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=f_}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){const{error:t}=this.state;null!==t&&(this.props.onReset?.({args:e,reason:"imperative-api"}),this.setState(f_))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){const{didCatch:n}=this.state,{resetKeys:i}=this.props;n&&null!==t.error&&function(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}(e.resetKeys,i)&&(this.props.onReset?.({next:i,prev:e.resetKeys,reason:"keys"}),this.setState(f_))}render(){const{children:e,fallbackRender:t,FallbackComponent:n,fallback:i}=this.props,{didCatch:r,error:s}=this.state;let o=e;if(r){const e={error:s,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)o=t(e);else if(n)o=C(n,e);else{if(void 0===i)throw s;o=i}}return C(d_.Provider,{value:{didCatch:r,error:s,resetErrorBoundary:this.resetErrorBoundary}},o)}}const m_=({resetErrorBoundary:e})=>W(n,{role:"alert",sx:{padding:"20px",background:"#fee"},children:[q(g,{variant:"h2",children:"Ошибка приложения"}),q(wh,{onClick:e,children:"Попробовать снова"})]}),__=({children:e,FallbackComponent:t=m_})=>q(p_,{FallbackComponent:t,children:e});function g_(e){const{name:t,type:i}=e,r=A.useId(),{control:s}=xd();return q(vd,{name:t,control:s,render:({field:s})=>W(n,{sx:({spacing:e})=>({display:"grid",width:"100%",gap:e(1)}),children:[q(Ef,{id:r,size:"small",...e,...s,onChange:e=>{const{target:t}=e,{value:n}=t;if("number"===i)""===n?s.onChange():s.onChange(Number(n));else s.onChange(e)}}),q(bf,{name:t})]})})}var y_,v_;!function(e){e.ONE_WAY='"OneWay"',e.POINT_ADDRESS='"PointAddress"',e.BUILDING_AREA='"MapBuildingECArea"',e.BUILTUP_AREA='"MapAdminBuiltupArea"',e.ADMIN_AREA='"MapAdminArea"',e.OCEAN_AREA='"MapOceanArea"',e.OCEAN_AREA_LABEL='"MapOceanAreaLabel"',e.FACILITY_AREA='"MapFacilityArea"',e.FACILITY_AREA_LABEL='"MapFacilityAreaLabel"',e.LANDUSE_AREA='"MapLanduseArea"',e.LANDUSE_AREA_LABEL='"MapLanduseAreaLabel"',e.NATURE_FIELD='"MapNatureField"',e.NATURE_FOREST='"MapNatureForest"',e.LINK='"Link"',e.RAILROAD_LINK='"MapRailroadLink"',e.WATER_LINK='"MapWaterLink"',e.WATER_AREA='"MapWaterArea"',e.WATER_AREA_LABEL='"MapWaterAreaLabel"',e.WATER_LAKE_LABEL='"MapWaterLakeLabel"',e.POI='"POI"',e.CITY_POI='"CityPOI"',e.CONDITIONS='"Conditions"',e.ROAD_POLY='"RoadPoly"',e.PARKING_LINE='"ParkingLine"',e.LANE_MARKING_LINE='"LaneMarkingLine"',e.LANE_MARKING_POLY='"LaneMarkingPoly"',e.LANE_MARKING_ARROW='"LaneMarkingArrow"',e.TRAFFIC_SIGN='"TrafficSign"',e.TRAFFIC_SIGNAL='"TrafficSignal"',e.CAMERA='"Camera"',e.PILLAR='"Pillar"'}(y_||(y_={})),function(e){e.TILE="tile",e.NATURE_TILE="nature_tile",e.MSK="msk"}(v_||(v_={}));const b_=e=>{const t=[],n={source:e,layer:y_.BUILDING_AREA,minzoom:15},i={id:fn(),data:n,extruded:{draw:{polygons:{style:"buildings",extrude:"function() {\n return $zoom >= 17;\n }"}}},draw:{polygons:{color:"#DDB07B",height:{property:"height"}},lines:{color:"#DB933F",width:"2px",cap:"round",join:"round"}}};return t.push(i),t},x_=e=>{const t=[],n={source:e,layer:y_.BUILTUP_AREA},i={id:fn(),data:n,draw:{polygons:{color:"#CFC8C8"}}};return t.push(i),t},w_=e=>{const t=[],n={source:e,layer:y_.ADMIN_AREA},i={id:fn(),data:n,draw:{polygons:{color:"#D3D2CF"}}},r={id:fn(),data:n,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'R';\n\n return isFilter;\n }",draw:{lines:{color:"#696969",width:"1px",cap:"round",join:"round"}}},s={id:fn(),data:n,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'D' && $zoom >= 12;\n\n return isFilter;\n }",draw:{lines:{color:"#696969",dash:[4,7],width:"1px",cap:"round",join:"round"}}};return t.push(i,r,s),t},E_={size:20,extension:"png"},A_=e=>{const t=[],n={source:e,layer:y_.CAMERA},i={},r="camera";i[r]={url:_n(`msk/${r}/${r}_${E_.size}.${E_.extension}`),filtering:"mipmap",sprites:{base:[0,0,E_.size,E_.size]}};const s={id:fn(),data:n,draw:{points:{collide:!1,texture:r,size:E_.size,sprite:"base",placement:"midpoint"}},textures:i,sublayers:{}};return t.push(s),t},T_=e=>{const t=[],n={source:e,layer:y_.CITY_POI},i={id:fn(),data:n,filter:"function() {\n const { capital_order8, capital_order2, capital_order1, poi_name, priority } = feature;\n\n if ($zoom >= 9 && $zoom < 13) {\n return priority < 8;\n }\n\n if ($zoom <= 11) {\n return capital_order8 === 'Y';\n }\n\n if ($zoom >= 15) {\n return capital_order2 !== 'Y';\n }\n\n return true;\n }\n ",draw:{text:{text_source:"poi_name",priority:"function () {\n const { priority } = feature;\n\n if ($zoom <= 15) {\n return priority;\n }\n\n return 1;\n }\n ",font:{fill:"black",size:"function() {\n const { capital_order8 } = feature;\n\n if (capital_order8 === 'Y') {\n return '16px';\n }\n\n return '12px';\n }",weight:"function() {\n const { capital_order2 } = feature;\n\n if (capital_order2 === 'Y') {\n return 'bold';\n }\n\n return 'normal';\n }",stroke:{color:"white",width:"2px"}}}}};return t.push(i),t};var k_;!function(e){e.traffic_signal="traffic_signal",e.pedestrian_crossing="pedestrian_crossing",e.physical="physical",e.gate="gate"}(k_||(k_={}));const S_=e=>{const t=[],n={source:e,layer:y_.CONDITIONS};return Object.values(k_).forEach(e=>{const i={id:fn(),filter:`function() {\n const { type } = feature;\n\n const isType = type === '${e}';\n\n switch(type) {\n case '${k_.gate}': {\n return $zoom >= 18 && isType;\n }\n\n default: {\n return isType;\n }\n }\n }`,data:n,draw:{points:{texture:e,sprite:"base",placement:"midpoint"}}};t.push(i)}),t},O_=e=>{const t=[],n={id:fn(),data:{source:e,layer:y_.FACILITY_AREA},draw:{polygons:{color:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '2000408': {\n return '#DBBAC4';\n }\n\n case '1900403': {\n return '#B6C3C7';\n }\n\n case '1907403': {\n return '#A3B9C0';\n }\n\n case '2000123': {\n return '#E4BA7D';\n }\n\n case '2000124': {\n return '#BFE6E3';\n }\n\n case '2000200': {\n return '#A0A9A8';\n }\n\n case '2000403': {\n return '#AF7136';\n }\n\n case '2000420': {\n return '#89AC76';\n }\n\n case '2000457': {\n return '#9494C0';\n }\n\n default: {\n return '#E1D4D4';\n }\n }\n }",order:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '1907403': {\n return 301;\n }\n\n default: {\n return 300;\n }\n }\n }"},lines:{color:"#857F7F",width:"2px",cap:"round",join:"round"}}},i={id:fn(),data:{source:e,layer:y_.FACILITY_AREA_LABEL},draw:{text:{text_source:"name",font:{fill:"function() {\n const { feature_type } = feature;\n\n switch(feature_type) {\n case '1900403':\n case '1907403': {\n return '#256D7B';\n }\n\n case '2000420':\n case '2000460':\n case '2000123': {\n return '#00541F';\n }\n\n case '2000408': {\n return '#5E2129';\n }\n\n case '2000124': {\n return '#3E5F8A';\n }\n\n case '2000200': {\n return '#464451';\n }\n\n case '2000403': {\n return '#B03F35';\n }\n\n case '2000457': {\n return '#6A5ACD';\n }\n\n case '1700215':\n case '900159':\n case '900158': {\n return '#474A51';\n }\n\n default: {\n return black;\n }\n }\n }",size:"12px",stroke:{color:"white",width:"3px"}}}}};return t.push(n,i),t},P_={source:v_.TILE,layer:y_.LANDUSE_AREA},C_={source:v_.TILE,layer:y_.LANDUSE_AREA_LABEL},R_={600102:{color:"#3E9A8C"},900103:{color:"#96BE7D"},900140:{color:"#3E9A8C"},509998:{color:"#ECD175"},900130:{color:"#96BE7D"},900150:{color:"#96BE7D"}},M_=()=>({id:fn(),data:C_,filter:"function() {\n return $zoom >= 15;\n }",draw:{text:{text_source:"name",font:{size:"13px",fill:"function() {\n const { feature_type } = feature;\n\n switch(feature_type) {\n case '509998': {\n return '#CD7F32';\n }\n\n default: {\n return '#00541F';\n }\n }\n }",stroke:{color:"white",width:"3px"}}}}}),L_=({featureType:e,color:t})=>({id:fn(),data:P_,filter:`function() {\n const { feature_type } = feature;\n\n const isFilter = feature_type === '${e}';\n\n return isFilter;\n }`,draw:{polygons:{color:t}}}),N_=()=>{const e=[];Object.entries(R_).forEach(([t,{color:n}])=>{const i=L_({featureType:t,color:n});e.push(i)});const t=M_();return e.push(t),e},z_=e=>{const t=[],n={source:e,layer:y_.LANE_MARKING_ARROW},i={id:fn(),data:n,draw:{polygons:{color:"white"}}};return t.push(i),t},D_=["-1.0","-0.5","-0.3","0.0","0.3","0.5","0.7","1.0","1.5","2.0"],I_=[[5],[4,3],[2,1]],F_="function() {\n const { functional_class, tunnel, tollway } = feature;\n\n const alpha = tunnel ? 0.89 : 1;\n\n const getRGB = (hex, alpha) => {\n const r = +(parseInt(hex.slice(1, 3), 16) / 255).toFixed(2);\n const g = +(parseInt(hex.slice(3, 5), 16) / 255).toFixed(2);\n const b = +(parseInt(hex.slice(5, 7), 16) / 255).toFixed(2);\n\n return [r, g, b, alpha];\n }\n\n if (tollway) {\n return '#D72740';\n }\n\n switch (functional_class) {\n case 1:\n case 2: {\n const color = getRGB('#D1747F', alpha);\n\n return color;\n }\n\n case 3:\n case 4: {\n const color = getRGB('#B1A7AA', alpha);\n\n return color;\n }\n\n case 5: {\n const color = getRGB('#D5CEC3', alpha);\n\n return color;\n }\n }\n}",j_="function() {\n const { functional_class, road_number } = feature;\n\n const getScale = () => {\n if ($zoom <= 15 && $zoom >= 14) { return 7; }\n\n if ($zoom <= 13 && $zoom >= 12) { return 9; }\n\n if ($zoom <= 5) { return 400; }\n\n if ($zoom <= 7) { return 200; }\n\n if ($zoom < 12) { return 50; }\n\n return 1;\n }\n\n const scale = getScale();\n\n switch(functional_class) {\n case 1:\n case 2: {\n return 8 * scale;\n }\n\n case 3:\n case 4: {\n return 7 * scale;\n }\n\n case 5: {\n if (Boolean(road_number)) {\n return 7 * scale;\n }\n\n return 6;\n }\n }\n}",B_={text_source:"street_name",font:{fill:"black",size:"14px",stroke:{color:"white",width:"3px"}}},U_={text:{text_source:"road_number",font:{fill:"#181bff",size:"16px",weight:"bold",underline:!0,background:{color:"black"}}}},V_={text:B_,lines:{color:F_,width:j_,cap:"round",join:"round"}},G_={lines:{color:F_,width:j_,outline:{color:"function() {\n const { functional_class, access_id, tollway } = feature;\n\n if (tollway) {\n return '#B9263B';\n }\n\n switch(functional_class) {\n case 5: {\n return '#989898';\n }\n\n case 3:\n case 4: {\n return '#8F6E78';\n }\n\n case 1:\n case 2: {\n return '#9A414B';\n }\n }\n}",width:"function() {\n const { functional_class, access_id } = feature;\n\n switch(functional_class) {\n case 5: {\n switch (access_id) {\n case 32: {\n return 0;\n }\n\n default: {\n return 1;\n }\n }\n }\n\n default: {\n return 1;\n }\n }\n}"}}},$_={text:B_,lines:{color:"#BABCC2",width:10,cap:"round",join:"round"}},Z_={filter:"function() {\n return global.links.getIsLowMobility(feature);\n }",draw:{lines:{width:4}}},q_={filter:"function() {\n return global.links.getIsConstruction(feature);\n }",draw:{lines:{width:3,color:"#9AA096",dash:[2,1]}}},W_={filter:"function() {\n return global.links.getIsFunctionalClass(feature);\n }",draw:{lines:{width:2,color:"#9AA096",dash:[2,1]}}},H_=e=>{const t=[],n={source:e,layer:y_.LINK},i={id:fn(),data:n,draw:U_};return t.push(i),D_.forEach(i=>{const r=[],s=[];I_.forEach(t=>{const o=[],a=[];t.forEach(t=>{const r=(({source:e,zLvl:t,functionClass:n})=>e===v_.MSK?{base:{default:`function() {\n const { functional_class, z_lvl = '0.0', tollway } = feature;\n\n const isFilter = $zoom <= 16 && z_lvl === '${t}' && +functional_class === ${n} && tollway === false;\n\n return isFilter;\n }`,tollway:`function() {\n const { functional_class, z_lvl = '0.0', tollway } = feature;\n\n const isFilter = $zoom <= 16 && z_lvl === '${t}' && +functional_class === ${n} && tollway === true;\n\n return isFilter;\n }`},border:{default:`function() {\n const { functional_class, z_lvl = '0.0', tollway } = feature;\n\n const isFilter = $zoom <= 16 && tollway === false && z_lvl === '${t}' && +functional_class === ${n} && !global.links.getIsConstruction(feature) && !global.links.getIsFunctionalClass(feature);\n\n return isFilter;\n }`,tollway:`function() {\n const { functional_class, z_lvl = '0.0', tollway } = feature;\n\n const isFilter = $zoom <= 16 && tollway === true && z_lvl === '${t}' && +functional_class === ${n} && !global.links.getIsConstruction(feature) && !global.links.getIsFunctionalClass(feature);\n\n return isFilter;\n }`}}:{base:{default:`function() {\n const { functional_class, z_lvl = '0.0', tollway } = feature;\n\n const isFilter = z_lvl === '${t}' && +functional_class === ${n} && tollway === false;\n\n return isFilter;\n }`,tollway:`function() {\n const { functional_class, z_lvl = '0.0', tollway } = feature;\n\n const isFilter = z_lvl === '${t}' && +functional_class === ${n} && tollway === true;\n\n return isFilter;\n }`},border:{default:`function() {\n const { functional_class, z_lvl = '0.0', tollway } = feature;\n\n const isFilter = tollway === false && z_lvl === '${t}' && +functional_class === ${n} && !global.links.getIsConstruction(feature) && !global.links.getIsFunctionalClass(feature);\n\n return isFilter;\n }`,tollway:`function() {\n const { functional_class, z_lvl = '0.0', tollway } = feature;\n\n const isFilter = tollway === true && z_lvl === '${t}' && +functional_class === ${n} && !global.links.getIsConstruction(feature) && !global.links.getIsFunctionalClass(feature);\n\n return isFilter;\n }`}})({source:e,zLvl:i,functionClass:t}),s=(({zLvl:e,functionClass:t})=>`function() {\n const { functional_class, z_lvl = '0.0', tollway } = feature;\n\n const isFilter = $zoom > 16 && z_lvl === '${e}' && +functional_class === ${t};\n\n return isFilter;\n }`)({zLvl:i,functionClass:t}),l={id:fn(),data:n,filter:r.base.default,draw:V_,sublayers:{construction:{...q_},functionalClassAccessId32:{...W_},lowMobility:{...Z_}}},u={id:fn(),data:n,filter:r.base.tollway,draw:V_,sublayers:{construction:{...q_},functionalClassAccessId32:{...W_},lowMobility:{...Z_}}},c={id:fn(),data:n,filter:s,draw:$_,sublayers:{functionalClassAccessId32:{...W_}}},h={id:fn(),data:n,filter:r.border.default,draw:G_,sublayers:{lowMobility:{...Z_}}},d={id:fn(),data:n,filter:r.border.tollway,draw:G_,sublayers:{lowMobility:{...Z_}}};if(e===v_.MSK)o.push(c);o.push(l,u),a.push(h,d)}),r.push(...o),s.push(...a)}),t.push(...s,...r)}),t},K_={source:v_.NATURE_TILE,layer:y_.NATURE_FIELD},Y_=()=>{const e=[],t={id:fn(),data:K_,draw:{polygons:{color:"#EBEEC7"}}};return e.push(t),e},X_={source:v_.NATURE_TILE,layer:y_.NATURE_FOREST},Q_={900202:{color:"#96BE7D"}},J_=({featureType:e,color:t})=>({id:fn(),data:X_,filter:`function() {\n const { feature_type } = feature;\n\n const isFilter = feature_type === '${e}';\n\n return isFilter;\n }`,draw:{polygons:{color:t}}}),eg=()=>{const e=[];return Object.entries(Q_).forEach(([t,{color:n}])=>{const i=J_({featureType:t,color:n}),r=L_({featureType:t,color:n});e.push(i,r)}),e},tg=e=>{const t=[],n={id:fn(),data:{source:e,layer:y_.OCEAN_AREA},draw:{polygons:{color:"#7DBEE4"}}},i={id:fn(),data:{source:e,layer:y_.OCEAN_AREA_LABEL},draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"18px",stroke:{color:"white",width:"3px"}}}}};return t.push(n,i),t},ng=e=>{const t=[],n={id:fn(),data:{source:e,layer:y_.ONE_WAY},draw:{points:{texture:"arrow",sprite:"base",angle:"function() {\n const { bearing } = feature;\n \n return bearing;\n }\n "}}};return t.push(n),t},ig={size:20,extension:"png"},rg=e=>{const t=[],n={source:e,layer:y_.PILLAR},i={},r="pillar";i[r]={url:_n(`msk/${r}/${r}_${ig.size}.${ig.extension}`),filtering:"mipmap",sprites:{base:[0,0,ig.size,ig.size]}};const s={id:fn(),data:n,draw:{points:{collide:!1,texture:r,size:ig.size,sprite:"base",placement:"midpoint"}},textures:i,sublayers:{}};return t.push(s),t},sg='function() {\n const { poi_name, cat_id } = feature;\n\n switch (+cat_id) {\n case 4100: {\n const text = poi_name.replaceAll(/(Метро-|Станция-|МЦД-)/g, "");\n\n return text;\n }\n\n default: {\n return poi_name;\n }\n }\n}',og=[3578,4013,4100,5400,5511,5512,5540,5541,5800,5813,5999,6e3,7011,7389,7832,7929,7990,8060,8410,9517,9530,9565,9583,9718,9992],ag=e=>{const t={};switch(e){case 4100:t[`_${e}-metro`]={filter:`function() {\n const { poi_name, cat_id } = feature;\n\n const isMetro = poi_name.startsWith('Метро-');\n const isStation = poi_name.startsWith('Станция-');\n\n const isCatId = +cat_id === ${e};\n\n const isFilter = isCatId && (isMetro || isStation);\n\n return isFilter;\n }`,draw:{points:lg({texture:`POI_${e}(metro)`})}},t[`_${e}-diameter`]={filter:`function() {\n const { cat_id, poi_name } = feature;\n\n const isDiameter = poi_name.startsWith('МЦД-');\n\n const isCatId = +cat_id === ${e};\n\n const isFilter = isCatId && isDiameter;\n\n return isFilter;\n }`,draw:{points:lg({texture:`POI_${e}(diameter)`,size:[41,15]})}};break;case 9530:t[`_${e}-mail`]={filter:`function() {\n const { cat_id, poi_name = '' } = feature;\n\n const isCatId = +cat_id === ${e};\n\n const isMail = poi_name.startsWith('Почта');\n\n const isFilter = isCatId && isMail;\n\n return isFilter;\n }`,draw:{points:lg({texture:`POI_${e}(Mail)`})}},t[`_${e}-delivery`]={filter:`function() {\n const { cat_id, poi_name = '' } = feature;\n\n const isCatId = +cat_id === ${e};\n \n const isMail = poi_name.startsWith('Почта');\n\n const isFilter = isCatId && !isMail;\n\n return isFilter;\n }`,draw:{points:lg({texture:`POI_${e}(Delivery)`})}};break;case 9992:{const n={mosque:1,church:2,temple:3,davidStar:4,mortar:6};Object.entries(n).forEach(([n,i])=>{t[`_${e}-${n}`]={filter:`function() {\n const { cat_id, subcat_id } = feature;\n\n const isCatId = +cat_id === ${e};\n const isSubcatId = +subcat_id === ${i};\n\n const isFilter = isCatId && isSubcatId;\n\n return isFilter;\n }`,draw:{points:lg({texture:`POI_${e}(${n})`})}}});break}default:t[`_${e}`]={filter:`function() {\n const { cat_id } = feature;\n\n const isFilter = +cat_id === ${e};\n\n return isFilter;\n }`,draw:{points:lg({texture:`POI_${e}`})}}}return t},lg=({texture:e,size:t=20})=>({texture:e,size:t,sprite:"base",placement:"midpoint"}),ug=og.reduce((e,t)=>({...e,...ag(t)}),{}),cg=e=>{const t=[],n={id:fn(),data:{source:e,layer:y_.POI},draw:{points:{text:{text_source:sg,font:{fill:"#464544",size:"12px"}}}},sublayers:ug};return t.push(n),t},hg=e=>{const t=[],n={source:e,layer:y_.POINT_ADDRESS,minzoom:15},i={id:fn(),data:n,draw:{text:{text_source:"address",font:{fill:"black",size:"12px"}}}};return t.push(i),t},dg=e=>{const t=[],n={source:e,layer:y_.RAILROAD_LINK},i={id:fn(),data:n,draw:{lines:{color:"#A3A8A",width:5,dash:[1,2],dash_background_color:[0,0,0],join:"round"}}};return t.push(i),t},fg={fileName:"traffic-sign",extension:"svg",dopsCount:2,widths:{map:20,preview:40}},pg={1.1:{title:"Железнодорожный переезд со шлагбаумом",height:20,type:"Предупреждающие знаки"},1.2:{title:"Железнодорожный переезд без шлагбаума",height:20,type:"Предупреждающие знаки"},"1.3.1":{title:"Однопутная железная дорога",height:20,type:"Предупреждающие знаки"},"1.3.2":{title:"Многопутная железная дорога",height:20,type:"Предупреждающие знаки"},"1.4.1":{title:"Приближение к железнодорожному переезду",height:40,type:"Предупреждающие знаки"},"1.4.2":{title:"Приближение к железнодорожному переезду",height:40,type:"Предупреждающие знаки"},"1.4.3":{title:"Приближение к железнодорожному переезду",height:40,type:"Предупреждающие знаки"},"1.4.4":{title:"Приближение к железнодорожному переезду",height:40,type:"Предупреждающие знаки"},"1.4.5":{title:"Приближение к железнодорожному переезду",height:40,type:"Предупреждающие знаки"},"1.4.6":{title:"Приближение к железнодорожному переезду",height:40,type:"Предупреждающие знаки"},1.5:{title:"Пересечение с трамвайной линией",height:20,type:"Предупреждающие знаки"},1.6:{title:"Пересечение равнозначных дорог",height:20,type:"Предупреждающие знаки"},1.7:{title:"Пересечение с круговым движением",height:20,type:"Предупреждающие знаки"},1.8:{title:"Светофорное регулирование",height:20,type:"Предупреждающие знаки"},1.9:{title:"Разводной мост",height:20,type:"Предупреждающие знаки"},"1.10":{title:"Выезд на набережную",height:20,type:"Предупреждающие знаки"},"1.11.1":{title:"Опасный поворот (правый)",height:20,type:"Предупреждающие знаки"},"1.11.2":{title:"Опасный поворот (левый)",height:20,type:"Предупреждающие знаки"},"1.12.1":{title:"Опасные повороты",height:20,type:"Предупреждающие знаки"},"1.12.2":{title:"Опасные повороты",height:20,type:"Предупреждающие знаки"},1.13:{title:"Крутой спуск",height:20,type:"Предупреждающие знаки"},1.14:{title:"Крутой подъём",height:20,type:"Предупреждающие знаки"},1.15:{title:"Скользкая дорога",height:20,type:"Предупреждающие знаки"},1.16:{title:"Неровная дорога",height:20,type:"Предупреждающие знаки"},1.17:{title:"Искусственная неровность",height:20,type:"Предупреждающие знаки"},1.18:{title:"Выброс гравия",height:20,type:"Предупреждающие знаки"},1.19:{title:"Опасная обочина",height:20,type:"Предупреждающие знаки"},"1.20.1":{title:"Сужение дороги",height:20,type:"Предупреждающие знаки"},"1.20.2":{title:"Сужение дороги",height:20,type:"Предупреждающие знаки"},"1.20.3":{title:"Сужение дороги",height:20,type:"Предупреждающие знаки"},1.21:{title:"Двустороннее движение",height:20,type:"Предупреждающие знаки"},1.22:{title:"Пешеходный переход",height:20,type:"Предупреждающие знаки"},1.23:{title:"Дети",height:20,type:"Предупреждающие знаки"},1.24:{title:"Пересечение с велосипедной дорожкой или велопешеходной дорожкой",height:20,type:"Предупреждающие знаки"},1.25:{title:"Дорожные работы",height:20,type:"Предупреждающие знаки"},1.26:{title:"Перегон скота",height:20,type:"Предупреждающие знаки"},1.27:{title:"Дикие животные",height:20,type:"Предупреждающие знаки"},1.28:{title:"Падение камней",height:20,type:"Предупреждающие знаки"},1.29:{title:"Боковой ветер",height:20,type:"Предупреждающие знаки"},"1.30":{title:"Низколетящие самолёты",height:20,type:"Предупреждающие знаки"},1.31:{title:"Тоннель",height:20,type:"Предупреждающие знаки"},1.32:{title:"Затор",height:20,type:"Предупреждающие знаки"},1.33:{title:"Прочие опасности",height:20,type:"Предупреждающие знаки"},"1.34.1 A":{title:"Направление поворота",height:20,type:"Предупреждающие знаки"},"1.34.1 B":{title:"Направление поворота",height:20,type:"Предупреждающие знаки"},"1.34.1 C":{title:"Направление поворота",height:20,type:"Предупреждающие знаки"},"1.34.2 A":{title:"Направление поворота",height:20,type:"Предупреждающие знаки"},"1.34.2 B":{title:"Направление поворота",height:20,type:"Предупреждающие знаки"},"1.34.2 C":{title:"Направление поворота",height:20,type:"Предупреждающие знаки"},"1.34.3 A":{title:"Направление поворота",height:20,type:"Предупреждающие знаки"},"1.34.3 B":{title:"Направление поворота",height:20,type:"Предупреждающие знаки"},1.35:{title:"Участок перекрёстка",height:20,type:"Предупреждающие знаки"},2.1:{title:"Главная дорога",height:20,type:"Знаки приоритета"},2.2:{title:"Конец главной дороги",height:20,type:"Знаки приоритета"},"2.3.1":{title:"Пересечение со второстепенной дорогой",height:20,type:"Знаки приоритета"},"2.3.2":{title:"Примыкание второстепенной дороги",height:20,type:"Знаки приоритета"},"2.3.3":{title:"Примыкание второстепенной дороги",height:20,type:"Знаки приоритета"},"2.3.4":{title:"Примыкание второстепенной дороги",height:20,type:"Знаки приоритета"},"2.3.5":{title:"Примыкание второстепенной дороги",height:20,type:"Знаки приоритета"},"2.3.6":{title:"Примыкание второстепенной дороги",height:20,type:"Знаки приоритета"},"2.3.7":{title:"Примыкание второстепенной дороги",height:20,type:"Знаки приоритета"},2.4:{title:"Уступите дорогу",height:20,type:"Знаки приоритета"},2.5:{title:"Движение без остановки запрещено",height:20,type:"Знаки приоритета"},2.6:{title:"Преимущество встречного движения",height:20,type:"Знаки приоритета"},2.7:{title:"Преимущество перед встречным движением",height:20,type:"Знаки приоритета"},3.1:{title:"Въезд запрещён",height:20,type:"Запрещающие знаки"},3.2:{title:"Движение запрещено",height:20,type:"Запрещающие знаки"},3.3:{title:"Движение механических транспортных средств запрещено",height:20,type:"Запрещающие знаки"},3.4:{title:"Движение грузовых автомобилей запрещено",height:20,type:"Запрещающие знаки"},3.5:{title:"Движение мотоциклов запрещено",height:20,type:"Запрещающие знаки"},3.6:{title:"Движение тракторов запрещено",height:20,type:"Запрещающие знаки"},3.7:{title:"Движение с прицепом запрещено",height:20,type:"Запрещающие знаки"},3.8:{title:"Движение гужевых повозок запрещено",height:20,type:"Запрещающие знаки"},3.9:{title:"Движение на велосипедах запрещено",height:20,type:"Запрещающие знаки"},"3.10":{title:"Движение пешеходов запрещено",height:20,type:"Запрещающие знаки"},3.11:{title:"Ограничение массы",height:20,type:"Запрещающие знаки"},3.12:{title:"Ограничение массы, приходящейся на ось транспортного средства",height:20,type:"Запрещающие знаки"},3.13:{title:"Ограничение высоты",height:20,type:"Запрещающие знаки"},3.14:{title:"Ограничение ширины",height:20,type:"Запрещающие знаки"},3.15:{title:"Ограничение длины",height:20,type:"Запрещающие знаки"},3.16:{title:"Ограничение минимальной дистанции",height:20,type:"Запрещающие знаки"},"3.17.1":{title:"Таможня",height:20,type:"Запрещающие знаки"},"3.17.2":{title:"Опасность",height:20,type:"Запрещающие знаки"},"3.17.3":{title:"Контроль",height:20,type:"Запрещающие знаки"},"3.18.1":{title:"Поворот направо запрещён",height:20,type:"Запрещающие знаки"},"3.18.2":{title:"Поворот налево запрещён",height:20,type:"Запрещающие знаки"},3.19:{title:"Разворот запрещён",height:20,type:"Запрещающие знаки"},"3.20":{title:"Обгон запрещён",height:20,type:"Запрещающие знаки"},3.21:{title:"Конец зоны запрещения обгона",height:20,type:"Запрещающие знаки"},3.22:{title:"Обгон грузовым автомобилям запрещён",height:20,type:"Запрещающие знаки"},3.23:{title:"Конец зоны запрещения обгона грузовым автомобилям",height:20,type:"Запрещающие знаки"},"3.24-50":{title:"Ограничение максимальной скорости",height:20,type:"Запрещающие знаки"},"3.25-50":{title:"Конец зоны ограничения максимальной скорости",height:20,type:"Запрещающие знаки"},3.26:{title:"Подача звукового сигнала запрещена",height:20,type:"Запрещающие знаки"},3.27:{title:"Остановка запрещена",height:20,type:"Запрещающие знаки"},3.28:{title:"Стоянка запрещена",height:20,type:"Запрещающие знаки"},3.29:{title:"Стоянка запрещена по нечётным числам месяца.",height:20,type:"Запрещающие знаки"},"3.30":{title:"Стоянка запрещена по чётным числам месяца",height:20,type:"Запрещающие знаки"},3.31:{title:"Конец зоны всех ограничений",height:20,type:"Запрещающие знаки"},3.32:{title:"Движение транспортных средств с опасными грузами запрещено",height:20,type:"Запрещающие знаки"},3.33:{title:"Движение транспортных средств с взрывчатыми и легковоспламеняющимися грузами запрещено",height:20,type:"Запрещающие знаки"},3.34:{title:"Движение автобусов запрещено",height:20,type:"Запрещающие знаки"},3.35:{title:"Движение на средствах индивидуальной мобильности запрещено",height:20,type:"Запрещающие знаки"},"4.1.1":{title:"Движение прямо",height:20,type:"Предписывающие знаки"},"4.1.2":{title:"Движение направо",height:20,type:"Предписывающие знаки"},"4.1.3":{title:"Движение налево",height:20,type:"Предписывающие знаки"},"4.1.4":{title:"Движение прямо или направо",height:20,type:"Предписывающие знаки"},"4.1.5":{title:"Движение прямо или налево",height:20,type:"Предписывающие знаки"},"4.1.6":{title:"Движение направо или налево",height:20,type:"Предписывающие знаки"},"4.2.1":{title:"Объезд препятствия справа",height:20,type:"Предписывающие знаки"},"4.2.2":{title:"Объезд препятствия слева",height:20,type:"Предписывающие знаки"},"4.2.3":{title:"Объезд препятствия справа или слева",height:20,type:"Предписывающие знаки"},4.3:{title:"Круговое движение",height:20,type:"Предписывающие знаки"},"4.4.1":{title:"Велосипедная дорожка",height:20,type:"Предписывающие знаки"},"4.4.2":{title:"Конец велосипедной дорожки",height:20,type:"Предписывающие знаки"},"4.5.1":{title:"Пешеходная дорожка",height:20,type:"Предписывающие знаки"},"4.5.2":{title:"Пешеходная и велосипедная дорожка с совмещённым движением",height:20,type:"Предписывающие знаки"},"4.5.3":{title:"Конец пешеходной и велосипедной дорожки с совмещённым движением",height:20,type:"Предписывающие знаки"},"4.5.4":{title:"Пешеходная и велосипедная дорожка с разделением движения",height:20,type:"Предписывающие знаки"},"4.5.5":{title:"Пешеходная и велосипедная дорожка с разделением движения",height:20,type:"Предписывающие знаки"},"4.5.6":{title:"Конец пешеходной и велосипедной дорожки с разделением движения",height:20,type:"Предписывающие знаки"},"4.5.7":{title:"Конец пешеходной и велосипедной дорожки с разделением движения",height:20,type:"Предписывающие знаки"},"4.6-50":{title:"Ограничение минимальной скорости",height:20,type:"Предписывающие знаки"},"4.7-50":{title:"Конец зоны ограничения минимальной скорости",height:20,type:"Предписывающие знаки"},"4.8.1":{title:"Направление движения транспортных средств с опасными грузами",height:30,type:"Предписывающие знаки"},"4.8.2":{title:"Направление движения транспортных средств с опасными грузами",height:30,type:"Предписывающие знаки"},"4.8.3":{title:"Направление движения транспортных средств с опасными грузами",height:30,type:"Предписывающие знаки"},5.1:{title:"Автомагистраль",height:30,type:"Знаки особых предписаний"},5.2:{title:"Конец автомагистрали",height:30,type:"Знаки особых предписаний"},5.3:{title:"Дорога для автомобилей",height:30,type:"Знаки особых предписаний"},5.4:{title:"Конец дороги для автомобилей",height:30,type:"Знаки особых предписаний"},5.5:{title:"Дорога с односторонним движением",height:20,type:"Знаки особых предписаний"},5.6:{title:"Конец дороги с односторонним движением",height:20,type:"Знаки особых предписаний"},"5.7.1":{title:"Выезд на дорогу с односторонним движением",height:20,type:"Знаки особых предписаний"},"5.7.2":{title:"Выезд на дорогу с односторонним движением",height:20,type:"Знаки особых предписаний"},5.8:{title:"Реверсивное движение",height:20,type:"Знаки особых предписаний"},5.9:{title:"Конец реверсивного движения",height:20,type:"Знаки особых предписаний"},"5.10":{title:"Выезд на дорогу с реверсивным движением",height:20,type:"Знаки особых предписаний"},"5.11.1":{title:"Дорога с полосой для маршрутных транспортных средств",height:20,type:"Знаки особых предписаний"},"5.11.2":{title:"Дорога с полосой для велосипедистов",height:20,type:"Знаки особых предписаний"},"5.12.1":{title:"Конец дороги с полосой для маршрутных транспортных средств",height:20,type:"Знаки особых предписаний"},"5.12.2":{title:"Конец дороги с полосой для велосипедистов",height:20,type:"Знаки особых предписаний"},"5.13.1":{title:"Выезд на дорогу с полосой для маршрутных транспортных средств",height:20,type:"Знаки особых предписаний"},"5.13.2":{title:"Выезд на дорогу с полосой для маршрутных транспортных средств",height:20,type:"Знаки особых предписаний"},"5.13.3":{title:"Выезд на дорогу с полосой для велосипедистов",height:20,type:"Знаки особых предписаний"},"5.13.4":{title:"Выезд на дорогу с полосой для велосипедистов",height:20,type:"Знаки особых предписаний"},"5.14.1":{title:"Полоса для маршрутных транспортных средств",height:20,type:"Знаки особых предписаний"},"5.14.2":{title:"Полоса для велосипедистов",height:20,type:"Знаки особых предписаний"},"5.14.3":{title:"Конец полосы для маршрутных транспортных средств",height:20,type:"Знаки особых предписаний"},"5.14.4":{title:"Конец полосы для велосипедистов",height:20,type:"Знаки особых предписаний"},"5.15.1":{title:"Направления движения по полосам",height:20,type:"Знаки особых предписаний"},"5.15.2 A":{title:"Направления движения по полосе",height:20,type:"Знаки особых предписаний"},"5.15.2 B":{title:"Направления движения по полосе",height:20,type:"Знаки особых предписаний"},"5.15.2 C":{title:"Направления движения по полосе",height:20,type:"Знаки особых предписаний"},"5.15.2 D":{title:"Направления движения по полосе",height:20,type:"Знаки особых предписаний"},"5.15.2 E":{title:"Направления движения по полосе",height:20,type:"Знаки особых предписаний"},"5.15.2 F":{title:"Направления движения по полосе",height:20,type:"Знаки особых предписаний"},"5.15.2 G":{title:"Направления движения по полосе",height:20,type:"Знаки особых предписаний"},"5.15.2 H":{title:"Направления движения по полосе",height:20,type:"Знаки особых предписаний"},"5.15.2 I":{title:"Направления движения по полосе",height:20,type:"Знаки особых предписаний"},"5.15.2 K":{title:"Направления движения по полосе",height:20,type:"Знаки особых предписаний"},"5.15.3 A":{title:"Начало полосы",height:20,type:"Знаки особых предписаний"},"5.15.3 B":{title:"Начало полосы",height:20,type:"Знаки особых предписаний"},"5.15.3 C":{title:"Начало полосы",height:20,type:"Знаки особых предписаний"},"5.15.4 A":{title:"Начало полосы",height:20,type:"Знаки особых предписаний"},"5.15.4 B":{title:"Начало полосы",height:20,type:"Знаки особых предписаний"},"5.15.5":{title:"Конец полосы",height:20,type:"Знаки особых предписаний"},"5.15.6":{title:"Конец полосы",height:20,type:"Знаки особых предписаний"},"5.15.7 A":{title:"Направление движения по полосам",height:20,type:"Знаки особых предписаний"},"5.15.7 B":{title:"Направление движения по полосам",height:20,type:"Знаки особых предписаний"},"5.15.7 C":{title:"Направление движения по полосам",height:20,type:"Знаки особых предписаний"},"5.15.8":{title:"Число полос",height:20,type:"Знаки особых предписаний"},5.16:{title:"Место остановки автобуса и (или) троллейбуса",height:30,type:"Знаки особых предписаний"},5.17:{title:"Место остановки трамвая",height:30,type:"Знаки особых предписаний"},5.18:{title:"Место стоянки легковых такси",height:30,type:"Знаки особых предписаний"},"5.19.1":{title:"Пешеходный переход",height:20,type:"Знаки особых предписаний"},"5.19.2":{title:"Пешеходный переход",height:20,type:"Знаки особых предписаний"},"5.19.3":{title:"Диагональный пешеходный переход",height:20,type:"Знаки особых предписаний"},"5.19.4 A":{title:"Диагональный пешеходный переход",height:20,type:"Знаки особых предписаний"},"5.19.4 B":{title:"Диагональный пешеходный переход",height:20,type:"Знаки особых предписаний"},"5.20":{title:"Искусственная неровность",height:20,type:"Знаки особых предписаний"},5.21:{title:"Жилая зона",height:30,type:"Знаки особых предписаний"},5.22:{title:"Конец жилой зоны",height:30,type:"Знаки особых предписаний"},"5.23.1":{title:"Начало населённого пункта",height:20,type:"Знаки особых предписаний"},"5.23.2":{title:"Начало населённого пункта",height:20,type:"Знаки особых предписаний"},"5.24.1":{title:"Конец населённого пункта",height:20,type:"Знаки особых предписаний"},"5.24.2":{title:"Конец населённого пункта",height:20,type:"Знаки особых предписаний"},5.25:{title:"Начало населённого пункта",height:20,type:"Знаки особых предписаний"},5.26:{title:"Конец населённого пункта",height:20,type:"Знаки особых предписаний"},5.27:{title:"Зона с ограничением стоянки",height:30,type:"Знаки особых предписаний"},5.28:{title:"Конец зоны с ограничением стоянки",height:30,type:"Знаки особых предписаний"},5.29:{title:"Зона регулируемой стоянки",height:30,type:"Знаки особых предписаний"},"5.30":{title:"Конец зоны регулируемой стоянки",height:30,type:"Знаки особых предписаний"},5.31:{title:"Зона с ограничением максимальной скорости",height:30,type:"Знаки особых предписаний"},5.32:{title:"Конец зоны с ограничением максимальной скорости",height:30,type:"Знаки особых предписаний"},5.33:{title:"Пешеходная зона",height:30,type:"Знаки особых предписаний"},5.34:{title:"Конец пешеходной зоны",height:30,type:"Знаки особых предписаний"},5.35:{title:"Зона с ограничением экологического класса механических транспортных средств",height:30,type:"Знаки особых предписаний"},5.36:{title:"Конец зоны с ограничением экологического класса механических транспортных средств",height:30,type:"Знаки особых предписаний"},"5.37 A":{title:"Зона с ограничением экологического класса по видам транспортных средств",height:30,type:"Знаки особых предписаний"},"5.37 B":{title:"Зона с ограничением экологического класса по видам транспортных средств",height:30,type:"Знаки особых предписаний"},"5.38 A":{title:"Конец зоны с ограничением экологического класса по видам транспортных средств",height:30,type:"Знаки особых предписаний"},"5.38 B":{title:"Конец зоны с ограничением экологического класса по видам транспортных средств",height:30,type:"Знаки особых предписаний"},5.39:{title:"Велосипедная зона",height:30,type:"Знаки особых предписаний"},"5.40":{title:"Конец велосипедной зоны",height:30,type:"Знаки особых предписаний"},6.1:{title:"Общие ограничения максимальной скорости",height:30,type:"Информационные знаки"},"6.2-50":{title:"Рекомендуемая скорость",height:20,type:"Информационные знаки"},"6.3.1":{title:"Место для разворота",height:20,type:"Информационные знаки"},"6.3.2":{title:"Зона для разворота",height:20,type:"Информационные знаки"},"6.4 A":{title:"Парковка (парковочное место)",height:20,type:"Информационные знаки"},"6.4 B":{title:"Парковка (платные услуги)",height:20,type:"Информационные знаки"},"6.4 C":{title:"Парковка (только для инвалидов)",height:20,type:"Информационные знаки"},6.5:{title:"Полоса аварийной остановки",height:20,type:"Информационные знаки"},6.6:{title:"Подземный пешеходный переход",height:20,type:"Информационные знаки"},6.7:{title:"Надземный пешеходный переход",height:20,type:"Информационные знаки"},"6.8.1":{title:"Тупик",height:20,type:"Информационные знаки"},"6.8.2":{title:"Тупик",height:20,type:"Информационные знаки"},"6.8.3":{title:"Тупик",height:20,type:"Информационные знаки"},"6.9.1 A":{title:"Предварительный указатель направлений",height:20,type:"Информационные знаки"},"6.9.1 B":{title:"Предварительный указатель направлений",height:20,type:"Информационные знаки"},"6.9.1 C":{title:"Предварительный указатель направлений",height:20,type:"Информационные знаки"},"6.9.1 D":{title:"Предварительный указатель направлений",height:20,type:"Информационные знаки"},"6.9.1 E":{title:"Предварительный указатель направлений",height:20,type:"Информационные знаки"},"6.9.1 F":{title:"Предварительный указатель направлений",height:20,type:"Информационные знаки"},"6.9.2 A":{title:"Предварительный указатель направления",height:20,type:"Информационные знаки"},"6.9.2 B":{title:"Предварительный указатель направления",height:20,type:"Информационные знаки"},"6.9.2 C":{title:"Предварительный указатель направления",height:20,type:"Информационные знаки"},"6.9.3":{title:"Схема движения",height:20,type:"Информационные знаки"},"6.10.1 A":{title:"Указатель направлений",height:20,type:"Информационные знаки"},"6.10.1 B":{title:"Указатель направлений",height:20,type:"Информационные знаки"},"6.10.1 C":{title:"Указатель направлений",height:20,type:"Информационные знаки"},"6.10.1 D":{title:"Указатель направлений",height:20,type:"Информационные знаки"},"6.10.1 E":{title:"Указатель направлений",height:20,type:"Информационные знаки"},"6.10.1 F":{title:"Указатель направлений",height:20,type:"Информационные знаки"},"6.10.1 G":{title:"Указатель направлений",height:20,type:"Информационные знаки"},"6.10.2 A":{title:"Указатель направления",height:20,type:"Информационные знаки"},"6.10.2 B":{title:"Указатель направления",height:20,type:"Информационные знаки"},"6.11 A":{title:"Наименование объекта",height:20,type:"Информационные знаки"},"6.11 B":{title:"Наименование объекта",height:20,type:"Информационные знаки"},"6.11 C":{title:"Наименование объекта",height:20,type:"Информационные знаки"},"6.11 D":{title:"Наименование объекта",height:20,type:"Информационные знаки"},"6.12 A":{title:"Указатель расстояний",height:20,type:"Информационные знаки"},"6.12 B":{title:"Указатель расстояний",height:20,type:"Информационные знаки"},"6.12 C":{title:"Указатель расстояний",height:20,type:"Информационные знаки"},"6.13 A":{title:"Километровый знак",height:20,type:"Информационные знаки"},"6.13 B":{title:"Километровый знак",height:20,type:"Информационные знаки"},"6.13 C":{title:"Километровый знак",height:20,type:"Информационные знаки"},"6.13 D":{title:"Километровый знак",height:20,type:"Информационные знаки"},"6.13 E":{title:"Километровый знак",height:20,type:"Информационные знаки"},"6.14.1 A":{title:"Номер маршрута",height:20,type:"Информационные знаки"},"6.14.1 B":{title:"Номер маршрута",height:20,type:"Информационные знаки"},"6.14.1 C":{title:"Номер маршрута",height:20,type:"Информационные знаки"},"6.14.1 D":{title:"Номер маршрута",height:20,type:"Информационные знаки"},"6.14.2 A":{title:"Номер маршрута",height:20,type:"Информационные знаки"},"6.14.2 B":{title:"Номер маршрута",height:20,type:"Информационные знаки"},"6.14.2 C":{title:"Номер маршрута",height:20,type:"Информационные знаки"},"6.15.1":{title:"Направление движения для грузовых автомобилей",height:20,type:"Информационные знаки"},"6.15.2":{title:"Направление движения для грузовых автомобилей",height:20,type:"Информационные знаки"},"6.15.3":{title:"Направление движения для грузовых автомобилей",height:20,type:"Информационные знаки"},6.16:{title:"Стоп-линия",height:20,type:"Информационные знаки"},6.17:{title:"Схема объезда",height:25,type:"Информационные знаки"},"6.18.1":{title:"Направление объезда",height:20,type:"Информационные знаки"},"6.18.2":{title:"Направление объезда",height:20,type:"Информационные знаки"},"6.18.3":{title:"Направление объезда",height:20,type:"Информационные знаки"},"6.19.1":{title:"Предварительный указатель перестроения на другую проезжую часть",height:25,type:"Информационные знаки"},"6.19.2":{title:"Предварительный указатель перестроения на другую проезжую часть",height:25,type:"Информационные знаки"},"6.20.1":{title:"Аварийный выход",height:20,type:"Информационные знаки"},"6.20.2":{title:"Аварийный выход",height:20,type:"Информационные знаки"},"6.21.1":{title:"Направление движения к аварийному выходу",height:20,type:"Информационные знаки"},"6.21.2":{title:"Направление движения к аварийному выходу",height:20,type:"Информационные знаки"},6.22:{title:"Фотовидеофиксация",height:20,type:"Информационные знаки"},7.1:{title:"Пункт медицинской помощи",height:30,type:"Знаки сервиса"},7.2:{title:"Больница",height:30,type:"Знаки сервиса"},7.3:{title:"Автозаправочная станция",height:30,type:"Знаки сервиса"},7.4:{title:"Техническое обслуживание автомобилей",height:30,type:"Знаки сервиса"},7.5:{title:"Мойка автомобилей",height:30,type:"Знаки сервиса"},7.6:{title:"Телефон",height:30,type:"Знаки сервиса"},7.7:{title:"Пункт питания",height:30,type:"Знаки сервиса"},7.8:{title:"Питьевая вода",height:30,type:"Знаки сервиса"},7.9:{title:"Гостиница или мотель",height:30,type:"Знаки сервиса"},"7.10":{title:"Кемпинг",height:30,type:"Знаки сервиса"},7.11:{title:"Место отдыха",height:30,type:"Знаки сервиса"},7.12:{title:"Пост ДПС",height:30,type:"Знаки сервиса"},7.13:{title:"Полиция",height:30,type:"Знаки сервиса"},"7.14.1":{title:"Пункт таможенного контроля",height:30,type:"Знаки сервиса"},"7.14.2":{title:"Пункт транспортного контроля",height:30,type:"Знаки сервиса"},7.15:{title:"Зона приёма радиостанции, передающей информацию о дорожном движении",height:30,type:"Знаки сервиса"},7.16:{title:"Зона радиосвязи с аварийными службами",height:30,type:"Знаки сервиса"},7.17:{title:"Бассейн или пляж",height:30,type:"Знаки сервиса"},7.18:{title:"Туалет",height:30,type:"Знаки сервиса"},7.19:{title:"Телефон экстренной связи",height:30,type:"Знаки сервиса"},"7.20":{title:"Огнетушитель",height:30,type:"Знаки сервиса"},7.21:{title:"Автозаправочная станция с возможностью зарядки электромобилей",height:30,type:"Знаки сервиса"}},mg={"8.1.1":{title:"Расстояние до объекта",height:20,type:"Знаки дополнительной информации"},"8.1.2":{title:"Расстояние до объекта",height:20,type:"Знаки дополнительной информации"},"8.1.3":{title:"Расстояние до объекта",height:20,type:"Знаки дополнительной информации"},"8.1.4":{title:"Расстояние до объекта",height:20,type:"Знаки дополнительной информации"},"8.2.1":{title:"Зона действия",height:20,type:"Знаки дополнительной информации"},"8.2.2":{title:"Зона действия",height:40,type:"Знаки дополнительной информации"},"8.2.3":{title:"Зона действия",height:40,type:"Знаки дополнительной информации"},"8.2.4":{title:"Зона действия",height:40,type:"Знаки дополнительной информации"},"8.2.5":{title:"Зона действия",height:20,type:"Знаки дополнительной информации"},"8.2.6":{title:"Зона действия",height:20,type:"Знаки дополнительной информации"},"8.3.1":{title:"Направления действия",height:20,type:"Знаки дополнительной информации"},"8.3.2":{title:"Направления действия",height:20,type:"Знаки дополнительной информации"},"8.3.3":{title:"Направления действия",height:20,type:"Знаки дополнительной информации"},"8.4.1":{title:"Вид транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.4.2":{title:"Вид транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.4.3.1":{title:"Вид транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.4.3.2":{title:"Вид транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.4.4":{title:"Вид транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.4.5":{title:"Вид транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.4.6":{title:"Вид транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.4.7.1":{title:"Вид транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.4.7.2":{title:"Вид транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.4.8":{title:"Вид транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.4.9":{title:"Кроме вида транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.4.10":{title:"Кроме вида транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.4.11":{title:"Кроме вида транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.4.12":{title:"Кроме вида транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.4.13":{title:"Кроме вида транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.4.14":{title:"Кроме вида транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.4.15":{title:"Кроме вида транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.5.1":{title:"Субботние, воскресные и праздничные дни",height:20,type:"Знаки дополнительной информации"},"8.5.2":{title:"Рабочие дни",height:20,type:"Знаки дополнительной информации"},"8.5.3":{title:"Дни недели",height:20,type:"Знаки дополнительной информации"},"8.5.4":{title:"Время действия",height:20,type:"Знаки дополнительной информации"},"8.5.5":{title:"Время действия",height:20,type:"Знаки дополнительной информации"},"8.5.6":{title:"Время действия",height:20,type:"Знаки дополнительной информации"},"8.5.7":{title:"Время действия",height:20,type:"Знаки дополнительной информации"},"8.6.1":{title:"Способ постановки транспортного средства на стоянку",height:20,type:"Знаки дополнительной информации"},"8.6.2":{title:"Способ постановки транспортного средства на стоянку",height:20,type:"Знаки дополнительной информации"},"8.6.3":{title:"Способ постановки транспортного средства на стоянку",height:20,type:"Знаки дополнительной информации"},"8.6.4":{title:"Способ постановки транспортного средства на стоянку",height:20,type:"Знаки дополнительной информации"},"8.6.5":{title:"Способ постановки транспортного средства на стоянку",height:20,type:"Знаки дополнительной информации"},"8.6.6":{title:"Способ постановки транспортного средства на стоянку",height:20,type:"Знаки дополнительной информации"},"8.6.7":{title:"Способ постановки транспортного средства на стоянку",height:20,type:"Знаки дополнительной информации"},"8.6.8":{title:"Способ постановки транспортного средства на стоянку",height:20,type:"Знаки дополнительной информации"},"8.6.9":{title:"Способ постановки транспортного средства на стоянку",height:20,type:"Знаки дополнительной информации"},8.7:{title:"Стоянка с неработающим двигателем",height:20,type:"Знаки дополнительной информации"},8.8:{title:"Платные услуги",height:20,type:"Знаки дополнительной информации"},"8.9.1":{title:"Ограничение продолжительности стоянки",height:20,type:"Знаки дополнительной информации"},"8.9.2":{title:"Стоянка только для владельцев парковочных разрешений",height:20,type:"Знаки дополнительной информации"},"8.9.3":{title:"Стоянка только транспортных средств дипломатического корпуса",height:20,type:"Знаки дополнительной информации"},"8.10":{title:"Место для осмотра автомобилей",height:20,type:"Знаки дополнительной информации"},8.11:{title:"Ограничение разрешённой максимальной массы",height:20,type:"Знаки дополнительной информации"},8.12:{title:"Опасная обочина",height:20,type:"Знаки дополнительной информации"},8.13:{title:"Направление главной дороги",height:20,type:"Знаки дополнительной информации"},"8.13 B":{title:"Направление главной дороги",height:20,type:"Знаки дополнительной информации"},8.14:{title:"Полоса движения",height:20,type:"Знаки дополнительной информации"},8.15:{title:"Слепые пешеходы",height:20,type:"Знаки дополнительной информации"},8.16:{title:"Влажное покрытие",height:20,type:"Знаки дополнительной информации"},8.17:{title:"Инвалиды",height:20,type:"Знаки дополнительной информации"},8.18:{title:"Кроме инвалидов",height:20,type:"Знаки дополнительной информации"},8.19:{title:"Класс опасного груза",height:20,type:"Знаки дополнительной информации"},"8.20.1":{title:"Тип тележки транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.20.2":{title:"Тип тележки транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.21.1":{title:"Вид маршрутного транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.21.2":{title:"Вид маршрутного транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.21.3":{title:"Вид маршрутного транспортного средства",height:20,type:"Знаки дополнительной информации"},"8.22.1":{title:"Препятствие",height:68,type:"Знаки дополнительной информации"},"8.22.2":{title:"Препятствие",height:68,type:"Знаки дополнительной информации"},"8.22.3":{title:"Препятствие",height:68,type:"Знаки дополнительной информации"},8.24:{title:"Работает эвакуатор",height:20,type:"Знаки дополнительной информации"},8.25:{title:"Экологический класс транспортного средства",height:20,type:"Знаки дополнительной информации"},8.26:{title:"Зарядка электромобилей",height:20,type:"Знаки дополнительной информации"}},_g={...pg,...mg},gg=e=>{const t=[],n={source:e,layer:y_.TRAFFIC_SIGN},i={},r={};Object.keys(pg).forEach(e=>{const t=`${fg.fileName}-${e}`,{height:n}=pg[e],s=yg({type:"map",number:e});i[t]={url:s,filtering:"mipmap",sprites:{base:[0,0,fg.widths.map,n]}},r[t]={filter:`function() {\n const { traffic_sign_number } = feature;\n\n const isFilter = traffic_sign_number === '${e}';\n\n return isFilter;\n }`,draw:{points:{collide:!1,texture:t,size:[fg.widths.map,n],sprite:"base",placement:"midpoint"}}}});const s={id:fn(),data:n,textures:i,sublayers:r};return t.push(s),t},yg=({type:e,number:t})=>{const n=fg.widths[e];return _n(`msk/${fg.fileName}_${n}/${t}.${fg.extension}`)},vg=e=>{const t={};e.forEach(({traffic_sign_number:e,traffic_sign_title:n,traffic_sign_type:i,height:r})=>{t[e]={title:n,height:Number(r),type:i}}),dn(t)},bg={size:20,extension:"svg"},xg=e=>{const t=[],n={source:e,layer:y_.TRAFFIC_SIGNAL},i={},r="traffic_signal";i[r]={url:_n(`msk/${r}/${r}_${bg.size}.${bg.extension}`),filtering:"mipmap",sprites:{base:[0,0,bg.size,bg.size]}};const s={id:fn(),data:n,draw:{points:{collide:!1,texture:r,size:bg.size,sprite:"base",placement:"midpoint"}},textures:i,sublayers:{}};return t.push(s),t},wg=e=>{const t=[],n={id:fn(),data:{source:e,layer:y_.WATER_AREA},draw:{polygons:{color:"#7DBEE4"},lines:{color:"#7DBEE4",width:20,cap:"round",join:"round"}}},i={id:fn(),data:{source:e,layer:y_.WATER_AREA_LABEL},filter:"function() {\n const { display_class } = feature;\n\n if ($zoom >= 14) {\n return true;\n } else {\n return display_class <= 4;\n }\n }",draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"14px",stroke:{color:"white",width:"3px"}}}}},r={id:fn(),data:{source:e,layer:y_.WATER_LAKE_LABEL},filter:"function() {\n const { display_class } = feature;\n\n if ($zoom >= 14) {\n return true;\n } else {\n return display_class <= 4;\n }\n }",draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"14px",stroke:{color:"white",width:"3px"}}}}};return t.push(n,i,r),t},Eg=e=>{const t=[],n={},i={source:e,layer:y_.WATER_LINK},r={id:fn(),data:i};return n.geometry={draw:{lines:{color:"#7DBEE4",width:5,cap:"round",join:"round"}}},n.text={filter:"function() {\n return $zoom >= 10;\n }",draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"14px",stroke:{color:"white",width:"3px"}}}}},r.sublayers=n,t.push(r),t},Ag="white",Tg=.5,kg={1.1:{color:Ag,width:Tg},1.2:{color:Ag,width:Tg},1.5:{color:Ag,width:Tg,dash:[4,10]},1.6:{color:Ag,width:Tg,dash:[5,5]},1.7:{color:Ag,width:Tg,dash:[4,10]},"1.7-blue":{color:"blue",width:Tg,dash:[4,10]},1.8:{color:Ag,width:Tg},1.12:{color:Ag,width:1.5},"1.14.3":{color:Ag,width:Tg,dash:[3,8]},"1.16.1":{color:Ag,width:Tg},"1.16.2":{color:Ag,width:Tg},"1.16.3":{color:Ag,width:Tg},"1.16.x":{color:Ag,width:Tg},"1.17.1":{color:"yellow",width:Tg},1.26:{color:"yellow",width:Tg}};var Sg;!function(e){e.ROAD="Road",e.TUNNEL="Tunnel",e.TRAM="Tram",e.CURB="Curb",e.BRIDGE="Bridge"}(Sg||(Sg={}));const Og={[Sg.ROAD]:"#BABCC2",[Sg.TUNNEL]:"#EAEBEE",[Sg.TRAM]:"#ADA8A8",[Sg.CURB]:"#D2D9E6",[Sg.BRIDGE]:"#E1DFDD"},Pg=({id:e,data:{source:t,layer:n}})=>`${e}-${t}-${n}`,Cg=({layer:e,order:t,eventHandlers:n})=>{const i=structuredClone(e),{draw:r,sublayers:s}=i,o=Boolean(n?.[e.data.layer]);if(r){const{points:e,lines:n,polygons:s,text:a,styles:l}=r;e&&(r.points={...structuredClone(e),order:t,interactive:o}),n&&(r.lines={...structuredClone(n),order:t,interactive:o}),s&&(r.polygons={...structuredClone(s),order:t,interactive:o}),a&&(r.text={...structuredClone(a),order:t,interactive:o}),l&&(r.styles=Object.entries(l).reduce((e,[n,i])=>({...e,[n]:{...structuredClone(i),order:t}}),{})),i.draw=structuredClone(r)}return s&&(Object.entries(s).forEach(([e,n])=>{if(n){const{draw:i}=n;if(i){const{points:e,lines:r,polygons:s,text:a}=i;a&&(i.text={...structuredClone(a),order:t,interactive:o}),e&&(i.points={...structuredClone(e),order:t,interactive:o}),r&&(i.lines={...structuredClone(r),order:t,interactive:o}),s&&(i.polygons={...structuredClone(s),order:t,interactive:o}),n.draw=structuredClone(i)}s[e]=structuredClone(n)}}),i.sublayers=structuredClone(s)),i},Rg=e=>{const t=w_(e),n=Y_(),i=eg(),r=x_(e),s=O_(e),o=N_(),a=wg(e),l=tg(e),u=[];if(e===v_.MSK)u.push(...t,...r,...s,...o,...a,...l);else u.push(...t,...i,...r,...s,...n,...o,...a,...l);return u},Mg=e=>{const t=H_(e),n=dg(e),i=Eg(e),r=ng(e),s=S_(e),o=[...i,...n,...t];if(e===v_.MSK);else o.push(...r,...s);return o},Lg=e=>{const t=cg(e),n=T_(e);return[...t,...hg(e),...n,...gg(e),...xg(e),...A_(e),...rg(e)]},Ng=e=>{const t=[],n=b_(e),i=Rg(e),r=Mg(e),s=Lg(e),o=(e=>{const t=[],n={source:e,layer:y_.ROAD_POLY};return Object.values(Sg).forEach(e=>{const i={id:fn(),data:n,filter:`function() {\n const { type } = feature;\n\n const isFilter = type === '${e}';\n\n return isFilter;\n }`,draw:{polygons:{color:Og[e]}}};t.push(i)}),t})(e),a=(e=>{const t=[],n={source:e,layer:y_.LANE_MARKING_POLY},i={id:fn(),data:n,filter:"function() {\n const { poly_number } = feature;\n\n const isFilter = poly_number === '1.14.1';\n\n return isFilter;\n }",draw:{styles:{zebra_crossing:{attributes:{a_angle:"function() {\n return feature.angle;\n }"}}}}};return t.push(i),t})(e),l=(e=>{const t=[],n={source:e,layer:y_.LANE_MARKING_LINE},i=Object.entries(kg).reduce((e,[t,n])=>{const i={filter:`function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '${t}';\n\n return isFilter;\n }`,draw:{lines:n}};return{...e,[t]:i}},{}),r={id:fn(),data:n,sublayers:i},s={"1.3-left":{id:fn(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.3';\n\n return isFilter;\n }",draw:{lines:{color:Ag,width:Tg,offset:-.5}}},"1.3-right":{id:fn(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.3';\n\n return isFilter;\n }",draw:{lines:{color:Ag,width:Tg,offset:Tg}}},"1.11r-left":{id:fn(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11r';\n\n return isFilter;\n }",draw:{lines:{color:Ag,width:Tg,offset:-.5}}},"1.11r-right":{id:fn(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11r';\n\n return isFilter;\n }",draw:{lines:{color:Ag,width:Tg,offset:Tg,dash:[5,5]}}},"1.11l-left":{id:fn(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11l';\n\n return isFilter;\n }",draw:{lines:{color:Ag,width:Tg,offset:-.5,dash:[5,5]}}},"1.11l-right":{id:fn(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11l';\n\n return isFilter;\n }",draw:{lines:{color:Ag,width:Tg,offset:Tg}}},"1.25-left":{id:fn(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.25';\n\n return isFilter;\n }",draw:{lines:{color:Ag,width:1,offset:-.5,dash:[1,1],dash_background_color:[0,0,0,0]}}},"1.25-right":{id:fn(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.25';\n\n return isFilter;\n }",draw:{lines:{color:"rgba(0,0,0,0)",width:1,offset:.5,dash:[1,1],dash_background_color:[1,1,1]}}}};return t.push(r,...Object.values(s)),t})(e),u=z_(e),c=(e=>{const t=[],n={source:e,layer:y_.PARKING_LINE},i={id:fn(),data:n,draw:{lines:{color:"white",width:1}}};return t.push(i),t})(e);if(e===v_.MSK)t.push(...i,...r,...o,...a,...u,...l,...c,...n,...s);else t.push(...i,...r,...n,...s);return t},zg=e=>`${e.getFullYear()}-${`${e.getUTCMonth()+1}`.padStart(2,"0")}-${`${e.getUTCDate()}`.padStart(2,"0")}`,Dg=e=>{const t={[ve.CREATE]:"",[ve.UPDATE]:"",[ve.DELETE]:""};return Object.values(ve).forEach(n=>{t[n]=`${e}-${n}`}),t},Ig=256,Fg={[v_.TILE]:"https://dalganmap.ru/api/tiles/get_tile/{z}/{x}/{y}.mvt",[v_.NATURE_TILE]:"https://dalganmap.ru/api/tiles/get_nature_tile/{z}/{x}/{y}.mvt",[v_.MSK]:"https://dalganmap.ru/api/tiles/get_tile/{z}/{x}/{y}.mvt"};function jg(e,t){return Object.freeze({...e,...t})}const Bg=B(null);function Ug(){const e=V(Bg);if(null==e)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return e}const Vg=function(e,t){return null==t?function(t,n){const i=S(void 0);return i.current||(i.current=e(t,n)),i}:function(n,i){const r=S(void 0);r.current||(r.current=e(n,i));const s=S(n),{instance:o}=r.current;return P(function(){s.current!==n&&(t(o,n,s.current),s.current=n)},[o,n,t]),r}}(function({children:e,...t},n){const i=new Ya.Control.Layers(void 0,void 0,t);return r=i,s=jg(n,{layersControl:i}),Object.freeze({instance:r,context:s,container:o});var r,s,o},function(e,t,n){t.collapsed!==n.collapsed&&(!0===t.collapsed?e.collapse():e.expand())});var Gg;const $g=function(e){function t(t,n){const{instance:i,context:r}=e(t).current;G(n,()=>i);const{children:s}=t;return null==s?null:T.createElement(Bg,{value:r},s)}return k(t)}((Gg=Vg,function(e){const t=Ug(),n=Gg(e,t),{instance:i}=n.current,r=S(e.position),{position:s}=e;return P(function(){return i.addTo(t.map),function(){i.remove()}},[t.map,i]),P(function(){null!=s&&s!==r.current&&(i.setPosition(s),r.current=s)},[i,s]),n}));function Zg(e){return function(t){const n=Ug(),i=S(t),[r,s]=j(null),{layersControl:o,map:a}=n,l=O(t=>{null!=o&&(i.current.checked&&a.addLayer(t),e(o,t,i.current.name),s(t))},[e,o,a]),u=O(e=>{o?.removeLayer(e),s(null)},[o]),c=M(()=>jg(n,{layerContainer:{addLayer:l,removeLayer:u}}),[n,l,u]);return P(()=>{null!==r&&i.current!==t&&(!0!==t.checked||null!=i.current.checked&&!1!==i.current.checked?!0!==i.current.checked||null!=t.checked&&!1!==t.checked||a.removeLayer(r):a.addLayer(r),i.current=t)}),t.children?T.createElement(Bg,{value:c},t.children):null}}$g.BaseLayer=Zg(function(e,t,n){e.addBaseLayer(t,n)}),$g.Overlay=Zg(function(e,t,n){e.addOverlay(t,n)});var qg={global:{links:{getIsConstruction:"function (feature) {\n const { construction } = feature;\n\n return construction;\n}\n",getIsFunctionalClass:"function (feature) {\n const { functional_class, access_id } = feature;\n\n return functional_class === 5 && access_id === 32;\n}\n",getIsLowMobility:"function (feature) {\n const { functional_class, low_mobility } = feature;\n\n return functional_class === 5 && low_mobility === 1;\n}\n"}},cameras:{camera1:{type:"perspective",vanishing_point:[0,-500]}},textures:{arrow:{url:"https://dalganmap.ru/api-image/images/arrow-20.png",sprites:{base:[0,0,20,20]}},"traffic-signal":{url:"https://dalganmap.ru/api-image/images/conditions/traffic-signal.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},pedestrian_crossing:{url:"https://dalganmap.ru/api-image/images/conditions/pedestrian_crossing.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},physical:{url:"https://dalganmap.ru/api-image/images/conditions/physical.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},gate:{url:"https://dalganmap.ru/api-image/images/conditions/gate.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_3578:{url:"https://dalganmap.ru/api-image/images/POI/3578.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5813:{url:"https://dalganmap.ru/api-image/images/POI/5813.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5541:{url:"https://dalganmap.ru/api-image/images/POI/5541.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5540:{url:"https://dalganmap.ru/api-image/images/POI/5540.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9530(Mail)":{url:"https://dalganmap.ru/api-image/images/POI/mail.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9530(Delivery)":{url:"https://dalganmap.ru/api-image/images/POI/delivery.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5400:{url:"https://dalganmap.ru/api-image/images/POI/5400.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_6000:{url:"https://dalganmap.ru/api-image/images/POI/6000.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9565:{url:"https://dalganmap.ru/api-image/images/POI/9565.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9583:{url:"https://dalganmap.ru/api-image/images/POI/9583.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_8060:{url:"https://dalganmap.ru/api-image/images/POI/8060.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5511:{url:"https://dalganmap.ru/api-image/images/POI/5511.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5512:{url:"https://dalganmap.ru/api-image/images/POI/5512.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5800:{url:"https://dalganmap.ru/api-image/images/POI/5800.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5999:{url:"https://dalganmap.ru/api-image/images/POI/5999.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7011:{url:"https://dalganmap.ru/api-image/images/POI/7011.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7389:{url:"https://dalganmap.ru/api-image/images/POI/7389.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7832:{url:"https://dalganmap.ru/api-image/images/POI/7832.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7929:{url:"https://dalganmap.ru/api-image/images/POI/7929.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7990:{url:"https://dalganmap.ru/api-image/images/POI/7990.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7999:{url:"https://dalganmap.ru/api-image/images/POI/7999.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_8410:{url:"https://dalganmap.ru/api-image/images/POI/8410.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9517:{url:"https://dalganmap.ru/api-image/images/POI/9517.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9718:{url:"https://dalganmap.ru/api-image/images/POI/9718.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(mosque)":{url:"https://dalganmap.ru/api-image/images/POI/9992_mosque.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(church)":{url:"https://dalganmap.ru/api-image/images/POI/9992_church.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(temple)":{url:"https://dalganmap.ru/api-image/images/POI/9992_temple.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(davidStar)":{url:"https://dalganmap.ru/api-image/images/POI/9992_davidStar.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(mortar)":{url:"https://dalganmap.ru/api-image/images/POI/9992_mortar.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_4100(metro)":{url:"https://dalganmap.ru/api-image/images/POI/4100_metro.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_4100(diameter)":{url:"https://dalganmap.ru/api-image/images/POI/4100_diameter.png",filtering:"mipmap",sprites:{base:[0,0,41,15]}},POI_4013:{url:"https://dalganmap.ru/api-image/images/POI/4013.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}}},layers:null,styles:{buildings:{base:"polygons",shaders:{blocks:{color:"color.rgb;\n"}}}},lights:{light1:{type:"directional",direction:[.1,.5,-1],diffuse:.7,ambient:.5}},sources:null};class Wg{props;constructor(e){this.props=e,this._initLayer()}_initLayer(){if(yu.instance.isValidApiKey){const e=this._createLayer();if(e){const{scene:t}=e;t.subscribe({load:({config:e})=>{this.config=e,this.isReady=!0,this._init()}}),this.layer=e,this.props.onCreate?.({layer:e}),this._addHandlers(e)}}}_createLayer(){if(window.Tangram){return window.Tangram.leafletLayer({scene:qg})}}_addHandlers(e){e.addEventListener("load",({sourceTarget:t})=>{this.props.onLoad?.({layer:e});const n=t._map;e.setSelectionEvents({click:({feature:e,leaflet_event:t})=>{if(e){const{source_layer:n,properties:i}=e;this.props.eventHandlers?.[n]?.click?.({leaflet_event:t,properties:i})}},hover:({feature:e,leaflet_event:t})=>{const i=n.getContainer();if(e){const{source_layer:n,properties:r}=e;i.style.cursor="pointer",this.props.eventHandlers?.[n]?.hover?.({leaflet_event:t,properties:r})}else i.style.cursor="default"}})},this),e.addEventListener("add",()=>{this.props.onAdd?.({layer:e})},this),e.addEventListener("remove",()=>{this.props.onRemove?.({layer:e})},this)}destroy(){this.layer&&(this.props.onDestroy?.({layer:this.layer}),this.layer.clearAllEventListeners(),this.layer.remove()),this.layer=null}_init(){this.addStyle({name:"zebra_crossing",style:{base:"polygons",lighting:!1,shaders:{attributes:{a_angle:{type:"float",default:0}},uniforms:{u_stripe_width:1},blocks:{filter:"\n vec3 pos = worldPosition().xyz;\n\n float ang = radians(a_angle);\n\n vec2 dir = vec2(sin(ang), cos(ang));\n\n float positionAlongLine = dot(pos.xy, dir);\n\n float stripe = step(1.0, mod(positionAlongLine / u_stripe_width, 2.0));\n\n color.rgb = mix(vec3(1.0, 1.0, 1.0), vec3(1.0, 0.8, 0.0), stripe);\n \n color.a = 1.0;\n "}}}});(this.props.defaultLayers??[]).forEach(e=>{this.addLayer(e)}),Object.values(v_).forEach(e=>{this.addSource(e)})}_layer=null;get layer(){return this._layer}set layer(e){this._layer=e}_config=null;get config(){return this._config}set config(e){this._config=e}_isReady=!1;get isReady(){return this._isReady}set isReady(e){this._isReady=e}get scene(){if(null===this.layer)return null;const{scene:e}=this.layer;return e}addStyle({name:e,style:t}){this.config&&this.scene&&(this.config.styles[e]=structuredClone(t),this.scene.updateConfig({rebuild:!0}))}addSource(e){if(this.config&&this.scene){const t=Fg[e];this.config.sources[e]={tile_size:256,url:t,type:"MVT"},this.scene.updateConfig({rebuild:!0})}}deleteSource(e){this.config&&this.scene&&(delete this.config.sources[e],this.scene.updateConfig({rebuild:!0}))}getSource(e){let t=null;return this.config&&(t=structuredClone(this.config.sources[e])),t}updateSource(e,t){this.config&&this.scene&&(this.config.sources[e].url=t,this.scene.updateConfig({rebuild:!0}))}reloadSource(e){this.deleteSource(e),this.addSource(e)}addLayer(e){if(this.config&&this.scene){const t=this.getLayers().length+1,n=Cg({layer:e,order:t,eventHandlers:this.props.eventHandlers}),i=Pg(n),{sublayers:r,draw:s,textures:o}=n;if(s){const{styles:e={}}=s;e&&(n.draw={...structuredClone(n.draw),...structuredClone(e)})}this.config.layers[i]={...structuredClone(n),...structuredClone(r)},this.config.textures={...structuredClone(this.config.textures),...structuredClone(o)},this.scene.updateConfig({rebuild:!0})}}deleteLayers(){if(this.config){const{layers:e}=this.config;Object.values(e).forEach(e=>{this.deleteLayer(e)})}}deleteLayer(e){const t=Pg(e);this.config&&this.scene&&(delete this.config.layers[t],this.scene.updateConfig({rebuild:!0}))}getLayers(){const e=[];return this.config&&e.push(...Object.keys(this.config.layers)),e}getLayerVisibility(e){let t=!0;const n=Pg(e);if(this.config){const{visible:e=!0}=this.config.layers[n];t=e}return t}toggleLayerVisibility({layer:e,visible:t}){const n=Pg(e);this.config&&this.scene&&(this.config.layers[n].visible=t,this.scene.updateConfig({rebuild:!0}))}}const Hg=({layers:e})=>{const t=A.useRef(null),n=Ug().map;return A.useEffect(()=>{const{current:i}=t,r=Ya.tileLayer("http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}",{minZoom:2,maxZoom:25,maxNativeZoom:19,subdomains:["mt0","mt1","mt2","mt3"]});i&&i.addBaseLayer(r,"Google Satellite"),new Wg({defaultLayers:e,onCreate:({layer:e})=>{i&&(i.addBaseLayer(e,"Dartcom"),e.addTo(n))},onDestroy:({layer:e})=>{i&&(i.removeLayer(e),n.removeLayer(e))}})},[]),q($g,{ref:t,position:"bottomleft"})},Kg=e=>q(x,{...e}),Yg={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",bgcolor:"background.paper",border:"2px solid #000",boxShadow:24,p:4,maxHeight:"90vh",overflowX:"auto",overflowY:"auto"};var Xg=bh(({name:e,children:t,onClose:n,onOpen:i})=>{const r=A.useId(),s=du.getIsOpen(e);return A.useEffect(()=>{s?i?.({name:e}):n?.({name:e})},[s]),q(de,{open:s,onClose:()=>{du.close(e)},"aria-labelledby":`modal-${r}-title`,"aria-describedby":`modal-${r}-description`,children:q(he,{sx:({breakpoints:e})=>({...Yg,[e.up("sm")]:{minWidth:400},[e.down("sm")]:{minWidth:"80vw"}}),children:t})})});function Qg({name:e,items:t,label:n,sx:i,getLabel:r,getValue:s,getKey:o}){const{watch:a,resetField:l,setValue:u}=xd(),c=a(e),h=A.useId(),d=t.find(e=>s(e)===c)??null;return q(w,{value:d,options:t,id:h,getOptionLabel:e=>r(e),getOptionKey:e=>o(e),sx:{minWidth:150,...i},size:"small",onChange:(t,n)=>{n?u(e,s(n)):l(e)},renderInput:e=>q(Ef,{...e,label:n})})}const Jg=({items:e,initialValue:t,onChange:i})=>{const[r,s]=A.useState(()=>t??e[0].value),o=A.useId();return A.useEffect(()=>{t&&s(t)},[t]),W(fe,{value:r,children:[q(n,{sx:{borderBottom:1,borderColor:"divider"},children:q(pe,{"aria-label":`tabs-${o}`,onChange:(e,t)=>{s(t),i?.(t)},children:e.map(({label:e,value:t})=>q(E,{label:e,value:t,sx:{textTransform:"none"}},`${o}-tab-${t}`))})}),e.map(({content:e,value:t})=>q(me,{value:t,children:e},`${o}-tab-panel-${t}`))]})};var ey,ty={exports:{}};
|
|
21
|
-
/* @license
|
|
22
|
-
Papa Parse
|
|
23
|
-
v5.5.3
|
|
24
|
-
https://github.com/mholt/PapaParse
|
|
25
|
-
License: MIT
|
|
26
|
-
*/var ny=(ey||(ey=1,ty.exports=function e(){var t,n="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n?n:{},i=!n.document&&!!n.postMessage,r=n.IS_PAPA_WORKER||!1,s={},o=0,a={};function l(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=v(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new f(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,t){var i=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<i){let t=this._config.newline;t||(s=this._config.quoteChar||'"',t=this._handle.guessLineEndings(e,s)),e=[...e.split(t).slice(i)].join(t)}this.isFirstChunk&&x(this._config.beforeFirstChunk)&&void 0!==(s=this._config.beforeFirstChunk(e))&&(e=s),this.isFirstChunk=!1,this._halted=!1,i=this._partialLine+e;var s=(this._partialLine="",this._handle.parse(i,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(e=s.meta.cursor,this._finished||(this._partialLine=i.substring(e-this._baseIndex),this._baseIndex=e),s&&s.data&&(this._rowCount+=s.data.length),i=this._finished||this._config.preview&&this._rowCount>=this._config.preview,r)n.postMessage({results:s,workerId:a.WORKER_ID,finished:i});else if(x(this._config.chunk)&&!t){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=s=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!i||!x(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),i||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(e){x(this._config.error)?this._config.error(e):r&&this._config.error&&n.postMessage({workerId:a.WORKER_ID,error:e,finished:!1})}}function u(e){var t;(e=e||{}).chunkSize||(e.chunkSize=a.RemoteChunkSize),l.call(this,e),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),i||(t.onload=b(this._chunkLoaded,this),t.onerror=b(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var e,n=this._config.downloadRequestHeaders;for(e in n)t.setRequestHeader(e,n[e])}var r;this._config.chunkSize&&(r=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+r));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}i&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(e=>null!==(e=e.getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1)(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(new Error(e))}}function c(e){(e=e||{}).chunkSize||(e.chunkSize=a.LocalChunkSize),l.call(this,e);var t,n,i="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,i?((t=new FileReader).onload=b(this._chunkLoaded,this),t.onerror=b(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input,r=(this._config.chunkSize&&(r=Math.min(this._start+this._config.chunkSize,this._input.size),e=n.call(e,this._start,r)),t.readAsText(e,this._config.encoding));i||this._chunkLoaded({target:{result:r}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function h(e){var t;l.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,n;if(!this._finished)return e=this._config.chunkSize,t=e?(n=t.substring(0,e),t.substring(e)):(n=t,""),this._finished=!t,this.parseChunk(n)}}function d(e){l.call(this,e=e||{});var t=[],n=!0,i=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){i&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):n=!0},this._streamData=b(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),n&&(n=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=b(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=b(function(){this._streamCleanUp(),i=!0,this._streamData("")},this),this._streamCleanUp=b(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function f(e){var t,n,i,r,s=Math.pow(2,53),o=-s,l=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,u=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,c=this,h=0,d=0,f=!1,_=!1,g=[],y={data:[],errors:[],meta:{}};function b(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function w(){if(y&&i&&(A("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),i=!1),e.skipEmptyLines&&(y.data=y.data.filter(function(e){return!b(e)})),E()){if(y)if(Array.isArray(y.data[0])){for(var t=0;E()&&t<y.data.length;t++)y.data[t].forEach(c);y.data.splice(0,1)}else y.data.forEach(c);function c(t,n){x(e.transformHeader)&&(t=e.transformHeader(t,n)),g.push(t)}}function n(t,n){for(var i=e.header?{}:[],r=0;r<t.length;r++){var a=r,c=t[r];c=((t,n)=>(t=>(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping)))(t)?"true"===n||"TRUE"===n||"false"!==n&&"FALSE"!==n&&((e=>{if(l.test(e)&&(e=parseFloat(e),o<e&&e<s))return 1})(n)?parseFloat(n):u.test(n)?new Date(n):""===n?null:n):n)(a=e.header?r>=g.length?"__parsed_extra":g[r]:a,c=e.transform?e.transform(c,a):c),"__parsed_extra"===a?(i[a]=i[a]||[],i[a].push(c)):i[a]=c}return e.header&&(r>g.length?A("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+r,d+n):r<g.length&&A("FieldMismatch","TooFewFields","Too few fields: expected "+g.length+" fields but parsed "+r,d+n)),i}var r;y&&(e.header||e.dynamicTyping||e.transform)&&(r=1,!y.data.length||Array.isArray(y.data[0])?(y.data=y.data.map(n),r=y.data.length):y.data=n(y.data,0),e.header&&y.meta&&(y.meta.fields=g),d+=r)}function E(){return e.header&&0===g.length}function A(e,t,n,i){e={type:e,code:t,message:n},void 0!==i&&(e.row=i),y.errors.push(e)}x(e.step)&&(r=e.step,e.step=function(t){y=t,E()?w():(w(),0!==y.data.length&&(h+=t.data.length,e.preview&&h>e.preview?n.abort():(y.data=y.data[0],r(y,c))))}),this.parse=function(r,s,o){var l=e.quoteChar||'"';return e.newline||(e.newline=this.guessLineEndings(r,l)),i=!1,e.delimiter?x(e.delimiter)&&(e.delimiter=e.delimiter(r),y.meta.delimiter=e.delimiter):((l=((t,n,i,r,s)=>{var o,l,u,c;s=s||[",","\t","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var h=0;h<s.length;h++){for(var d,f=s[h],p=0,_=0,g=0,y=(u=void 0,new m({comments:r,delimiter:f,newline:n,preview:10}).parse(t)),v=0;v<y.data.length;v++)i&&b(y.data[v])?g++:(_+=d=y.data[v].length,void 0===u?u=d:0<d&&(p+=Math.abs(d-u),u=d));0<y.data.length&&(_/=y.data.length-g),(void 0===l||p<=l)&&(void 0===c||c<_)&&1.99<_&&(l=p,o=f,c=_)}return{successful:!!(e.delimiter=o),bestDelimiter:o}})(r,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess)).successful?e.delimiter=l.bestDelimiter:(i=!0,e.delimiter=a.DefaultDelimiter),y.meta.delimiter=e.delimiter),l=v(e),e.preview&&e.header&&l.preview++,t=r,n=new m(l),y=n.parse(t,s,o),w(),f?{meta:{paused:!0}}:y||{meta:{paused:!1}}},this.paused=function(){return f},this.pause=function(){f=!0,n.abort(),t=x(e.chunk)?"":t.substring(n.getCharIndex())},this.resume=function(){c.streamer._halted?(f=!1,c.streamer.parseChunk(t,!0)):setTimeout(c.resume,3)},this.aborted=function(){return _},this.abort=function(){_=!0,n.abort(),y.meta.aborted=!0,x(e.complete)&&e.complete(y),t=""},this.guessLineEndings=function(e,t){e=e.substring(0,1048576),t=new RegExp(p(t)+"([^]*?)"+p(t),"gm");var n=(e=e.replace(t,"")).split("\r");if(e=1<(t=e.split("\n")).length&&t[0].length<n[0].length,1===n.length||e)return"\n";for(var i=0,r=0;r<n.length;r++)"\n"===n[r][0]&&i++;return i>=n.length/2?"\r\n":"\r"}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){var t=(e=e||{}).delimiter,n=e.newline,i=e.comments,r=e.step,s=e.preview,o=e.fastMode,l=null,u=!1,c=null==e.quoteChar?'"':e.quoteChar,h=c;if(void 0!==e.escapeChar&&(h=e.escapeChar),("string"!=typeof t||-1<a.BAD_DELIMITERS.indexOf(t))&&(t=","),i===t)throw new Error("Comment character same as delimiter");!0===i?i="#":("string"!=typeof i||-1<a.BAD_DELIMITERS.indexOf(i))&&(i=!1),"\n"!==n&&"\r"!==n&&"\r\n"!==n&&(n="\n");var d=0,f=!1;this.parse=function(a,m,_){if("string"!=typeof a)throw new Error("Input must be a string");var g=a.length,y=t.length,v=n.length,b=i.length,w=x(r),E=[],A=[],T=[],k=d=0;if(!a)return F();if(o||!1!==o&&-1===a.indexOf(c)){for(var S=a.split(n),O=0;O<S.length;O++){if(T=S[O],d+=T.length,O!==S.length-1)d+=n.length;else if(_)return F();if(!i||T.substring(0,b)!==i){if(w){if(E=[],N(T.split(t)),j(),f)return F()}else N(T.split(t));if(s&&s<=O)return E=E.slice(0,s),F(!0)}}return F()}for(var P=a.indexOf(t,d),C=a.indexOf(n,d),R=new RegExp(p(h)+p(c),"g"),M=a.indexOf(c,d);;)if(a[d]===c)for(M=d,d++;;){if(-1===(M=a.indexOf(c,M+1)))return _||A.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:E.length,index:d}),D();if(M===g-1)return D(a.substring(d,M).replace(R,c));if(c===h&&a[M+1]===h)M++;else if(c===h||0===M||a[M-1]!==h){-1!==P&&P<M+1&&(P=a.indexOf(t,M+1));var L=z(-1===(C=-1!==C&&C<M+1?a.indexOf(n,M+1):C)?P:Math.min(P,C));if(a.substr(M+1+L,y)===t){T.push(a.substring(d,M).replace(R,c)),a[d=M+1+L+y]!==c&&(M=a.indexOf(c,d)),P=a.indexOf(t,d),C=a.indexOf(n,d);break}if(L=z(C),a.substring(M+1+L,M+1+L+v)===n){if(T.push(a.substring(d,M).replace(R,c)),I(M+1+L+v),P=a.indexOf(t,d),M=a.indexOf(c,d),w&&(j(),f))return F();if(s&&E.length>=s)return F(!0);break}A.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:E.length,index:d}),M++}}else if(i&&0===T.length&&a.substring(d,d+b)===i){if(-1===C)return F();d=C+v,C=a.indexOf(n,d),P=a.indexOf(t,d)}else if(-1!==P&&(P<C||-1===C))T.push(a.substring(d,P)),d=P+y,P=a.indexOf(t,d);else{if(-1===C)break;if(T.push(a.substring(d,C)),I(C+v),w&&(j(),f))return F();if(s&&E.length>=s)return F(!0)}return D();function N(e){E.push(e),k=d}function z(e){var t=0;return-1!==e&&(e=a.substring(M+1,e))&&""===e.trim()?e.length:t}function D(e){return _||(void 0===e&&(e=a.substring(d)),T.push(e),d=g,N(T),w&&j()),F()}function I(e){d=e,N(T),T=[],C=a.indexOf(n,d)}function F(i){if(e.header&&!m&&E.length&&!u){var r=E[0],s=Object.create(null),o=new Set(r);let t=!1;for(let n=0;n<r.length;n++){let i=r[n];if(s[i=x(e.transformHeader)?e.transformHeader(i,n):i]){let e,a=s[i];for(;e=i+"_"+a,a++,o.has(e););o.add(e),r[n]=e,s[i]++,t=!0,(l=null===l?{}:l)[e]=i}else s[i]=1,r[n]=i;o.add(i)}t&&console.warn("Duplicate headers found and renamed."),u=!0}return{data:E,errors:A,meta:{delimiter:t,linebreak:n,aborted:f,truncated:!!i,cursor:k+(m||0),renamedHeaders:l}}}function j(){r(F()),E=[],A=[]}},this.abort=function(){f=!0},this.getCharIndex=function(){return d}}function _(e){var t=e.data,n=s[t.workerId],i=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var r={abort:function(){i=!0,g(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(x(n.userStep)){for(var o=0;o<t.results.data.length&&(n.userStep({data:t.results.data[o],errors:t.results.errors,meta:t.results.meta},r),!i);o++);delete t.results}else x(n.userChunk)&&(n.userChunk(t.results,r,t.file),delete t.results)}t.finished&&!i&&g(t.workerId,t.results)}function g(e,t){var n=s[e];x(n.userComplete)&&n.userComplete(t),n.terminate(),delete s[e]}function y(){throw new Error("Not implemented.")}function v(e){if("object"!=typeof e||null===e)return e;var t,n=Array.isArray(e)?[]:{};for(t in e)n[t]=v(e[t]);return n}function b(e,t){return function(){e.apply(t,arguments)}}function x(e){return"function"==typeof e}return a.parse=function(t,i){var r=(i=i||{}).dynamicTyping||!1;if(x(r)&&(i.dynamicTypingFunction=r,r={}),i.dynamicTyping=r,i.transform=!!x(i.transform)&&i.transform,!i.worker||!a.WORKERS_SUPPORTED)return r=null,a.NODE_STREAM_INPUT,"string"==typeof t?(t=(e=>65279!==e.charCodeAt(0)?e:e.slice(1))(t),r=new(i.download?u:h)(i)):!0===t.readable&&x(t.read)&&x(t.on)?r=new d(i):(n.File&&t instanceof File||t instanceof Object)&&(r=new c(i)),r.stream(t);(r=(()=>{var t;return!!a.WORKERS_SUPPORTED&&(t=(()=>{var t=n.URL||n.webkitURL||null,i=e.toString();return a.BLOB_URL||(a.BLOB_URL=t.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",i,")();"],{type:"text/javascript"})))})(),(t=new n.Worker(t)).onmessage=_,t.id=o++,s[t.id]=t)})()).userStep=i.step,r.userChunk=i.chunk,r.userComplete=i.complete,r.userError=i.error,i.step=x(i.step),i.chunk=x(i.chunk),i.complete=x(i.complete),i.error=x(i.error),delete i.worker,r.postMessage({input:t,config:i,workerId:r.id})},a.unparse=function(e,t){var n=!1,i=!0,r=",",s="\r\n",o='"',l=o+o,u=!1,c=null,h=!1,d=((()=>{if("object"==typeof t){if("string"!=typeof t.delimiter||a.BAD_DELIMITERS.filter(function(e){return-1!==t.delimiter.indexOf(e)}).length||(r=t.delimiter),"boolean"!=typeof t.quotes&&"function"!=typeof t.quotes&&!Array.isArray(t.quotes)||(n=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(u=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(o=t.quoteChar),"boolean"==typeof t.header&&(i=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");c=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+o),t.escapeFormulae instanceof RegExp?h=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(h=/^[=+\-@\t\r].*$/)}})(),new RegExp(p(o),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return f(null,e,u);if("object"==typeof e[0])return f(c||Object.keys(e[0]),e,u)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||c),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),f(e.fields||[],e.data||[],u);throw new Error("Unable to serialize unrecognized input");function f(e,t,n){var o="",a=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0<e.length),l=!Array.isArray(t[0]);if(a&&i){for(var u=0;u<e.length;u++)0<u&&(o+=r),o+=m(e[u],u);0<t.length&&(o+=s)}for(var c=0;c<t.length;c++){var h=(a?e:t[c]).length,d=!1,f=a?0===Object.keys(t[c]).length:0===t[c].length;if(n&&!a&&(d="greedy"===n?""===t[c].join("").trim():1===t[c].length&&0===t[c][0].length),"greedy"===n&&a){for(var p=[],_=0;_<h;_++){var g=l?e[_]:_;p.push(t[c][g])}d=""===p.join("").trim()}if(!d){for(var y=0;y<h;y++){0<y&&!f&&(o+=r);var v=a&&l?e[y]:y;o+=m(t[c][v],y)}c<t.length-1&&(!n||0<h&&!f)&&(o+=s)}}return o}function m(e,t){var i,s;return null==e?"":e.constructor===Date?JSON.stringify(e).slice(1,25):(s=!1,h&&"string"==typeof e&&h.test(e)&&(e="'"+e,s=!0),i=e.toString().replace(d,l),(s=s||!0===n||"function"==typeof n&&n(e,t)||Array.isArray(n)&&n[t]||((e,t)=>{for(var n=0;n<t.length;n++)if(-1<e.indexOf(t[n]))return!0;return!1})(i,a.BAD_DELIMITERS)||-1<i.indexOf(r)||" "===i.charAt(0)||" "===i.charAt(i.length-1))?o+i+o:i)}},a.RECORD_SEP=String.fromCharCode(30),a.UNIT_SEP=String.fromCharCode(31),a.BYTE_ORDER_MARK="\ufeff",a.BAD_DELIMITERS=["\r","\n",'"',a.BYTE_ORDER_MARK],a.WORKERS_SUPPORTED=!i&&!!n.Worker,a.NODE_STREAM_INPUT=1,a.LocalChunkSize=10485760,a.RemoteChunkSize=5242880,a.DefaultDelimiter=",",a.Parser=m,a.ParserHandle=f,a.NetworkStreamer=u,a.FileStreamer=c,a.StringStreamer=h,a.ReadableStreamStreamer=d,n.jQuery&&((t=n.jQuery).fn.parse=function(e){var i=e.config||{},r=[];return this.each(function(e){if("INPUT"!==t(this).prop("tagName").toUpperCase()||"file"!==t(this).attr("type").toLowerCase()||!n.FileReader||!this.files||0===this.files.length)return!0;for(var s=0;s<this.files.length;s++)r.push({file:this.files[s],inputElem:this,instanceConfig:t.extend({},i)})}),s(),this;function s(){if(0===r.length)x(e.complete)&&e.complete();else{var n,i,s,l,u=r[0];if(x(e.before)){var c=e.before(u.file,u.inputElem);if("object"==typeof c){if("abort"===c.action)return n="AbortError",i=u.file,s=u.inputElem,l=c.reason,void(x(e.error)&&e.error({name:n},i,s,l));if("skip"===c.action)return void o();"object"==typeof c.config&&(u.instanceConfig=t.extend(u.instanceConfig,c.config))}else if("skip"===c)return void o()}var h=u.instanceConfig.complete;u.instanceConfig.complete=function(e){x(h)&&h(e,u.file,u.inputElem),o()},a.parse(u.file,u.instanceConfig)}}function o(){r.splice(0,1),s()}}),r&&(n.onmessage=function(e){e=e.data,void 0===a.WORKER_ID&&e&&(a.WORKER_ID=e.workerId),"string"==typeof e.input?n.postMessage({workerId:a.WORKER_ID,results:a.parse(e.input,e.config),finished:!0}):(n.File&&e.input instanceof File||e.input instanceof Object)&&(e=a.parse(e.input,e.config))&&n.postMessage({workerId:a.WORKER_ID,results:e,finished:!0})}),(u.prototype=Object.create(l.prototype)).constructor=u,(c.prototype=Object.create(l.prototype)).constructor=c,(h.prototype=Object.create(h.prototype)).constructor=h,(d.prototype=Object.create(l.prototype)).constructor=d,a}()),ty.exports),iy=we(ny);function ry(e,t){return iy.parse(e,t)}function sy(e,t){iy.parse(e,Object.assign({},{download:!0},t))}function oy(e,t){return void 0===t&&(t={}),iy.unparse(e,t)}"function"==typeof SuppressedError&&SuppressedError,iy.BAD_DELIMITERS,iy.RECORD_SEP,iy.UNIT_SEP,iy.WORKERS_SUPPORTED,iy.LocalChunkSize,iy.DefaultDelimiter;const ay=({onDataParsed:e,onError:t,delimiter:n=",",header:i=!0,dynamicTyping:r=!0,skipEmptyLines:s=!0,worker:o=!1})=>{const{readString:a}={readString:ry,readRemoteFile:sy,jsonToCSV:oy},[l,u]=A.useState(!1),[c,h]=A.useState(null);return q(Ph,{accept:".csv",loading:l,error:c,onFilesLoad:({files:l})=>{const c=l[0];u(!0),h(null),c.text().then(l=>{a(l,{delimiter:n,header:i,dynamicTyping:r,skipEmptyLines:s,worker:o,complete:n=>{if(n.errors.length>0){const e=n.errors.map(({type:e,message:t})=>`${e}: ${t}`).join("; ");h(e),t?.(new Error(e))}else{const t=n.data,i=n.meta.fields||[];e?.(t,i)}},error:e=>{const n=e.message||"Ошибка при парсинге CSV";h(n),t?.(new Error(n))}})}).catch(e=>{const n=e instanceof Error?e.message:"Неизвестная ошибка";h(n),t?.(new Error(n))}).finally(()=>{u(!1)})},children:"Загрузить файлы csv"})};var ly={createDocument:function(e){return(new DOMParser).parseFromString(e.trim(),"text/xml")}},uy=Uint8Array,cy=Uint16Array,hy=Int32Array,dy=new uy([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),fy=new uy([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),py=new uy([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),my=function(e,t){for(var n=new cy(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new hy(n[30]);for(i=1;i<30;++i)for(var s=n[i];s<n[i+1];++s)r[s]=s-n[i]<<5|i;return{b:n,r:r}},_y=my(dy,2),gy=_y.b,yy=_y.r;gy[28]=258,yy[258]=28;for(var vy=my(fy,0).b,by=new cy(32768),xy=0;xy<32768;++xy){var wy=(43690&xy)>>1|(21845&xy)<<1;wy=(61680&(wy=(52428&wy)>>2|(13107&wy)<<2))>>4|(3855&wy)<<4,by[xy]=((65280&wy)>>8|(255&wy)<<8)>>1}var Ey=function(e,t,n){for(var i=e.length,r=0,s=new cy(t);r<i;++r)e[r]&&++s[e[r]-1];var o,a=new cy(t);for(r=1;r<t;++r)a[r]=a[r-1]+s[r-1]<<1;if(n){o=new cy(1<<t);var l=15-t;for(r=0;r<i;++r)if(e[r])for(var u=r<<4|e[r],c=t-e[r],h=a[e[r]-1]++<<c,d=h|(1<<c)-1;h<=d;++h)o[by[h]>>l]=u}else for(o=new cy(i),r=0;r<i;++r)e[r]&&(o[r]=by[a[e[r]-1]++]>>15-e[r]);return o},Ay=new uy(288);for(xy=0;xy<144;++xy)Ay[xy]=8;for(xy=144;xy<256;++xy)Ay[xy]=9;for(xy=256;xy<280;++xy)Ay[xy]=7;for(xy=280;xy<288;++xy)Ay[xy]=8;var Ty=new uy(32);for(xy=0;xy<32;++xy)Ty[xy]=5;var ky=Ey(Ay,9,1),Sy=Ey(Ty,5,1),Oy=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Py=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(7&t)&n},Cy=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},Ry=function(e){return(e+7)/8|0},My=function(e,t,n){return(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length),new uy(e.subarray(t,n))},Ly=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ny=function(e,t,n){var i=new Error(t||Ly[e]);if(i.code=e,Error.captureStackTrace&&Error.captureStackTrace(i,Ny),!n)throw i;return i},zy=new uy(0),Dy=function(e,t){return e[t]|e[t+1]<<8},Iy=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Fy=function(e,t){return Iy(e,t)+4294967296*Iy(e,t+4)};function jy(e,t){return function(e,t,n,i){var r=e.length,s=i?i.length:0;if(!r||t.f&&!t.l)return n||new uy(0);var o=!n,a=o||2!=t.i,l=t.i;o&&(n=new uy(3*r));var u=function(e){var t=n.length;if(e>t){var i=new uy(Math.max(2*t,e));i.set(n),n=i}},c=t.f||0,h=t.p||0,d=t.b||0,f=t.l,p=t.d,m=t.m,_=t.n,g=8*r;do{if(!f){c=Py(e,h,1);var y=Py(e,h+1,3);if(h+=3,!y){var v=e[(C=Ry(h)+4)-4]|e[C-3]<<8,b=C+v;if(b>r){l&&Ny(0);break}a&&u(d+v),n.set(e.subarray(C,b),d),t.b=d+=v,t.p=h=8*b,t.f=c;continue}if(1==y)f=ky,p=Sy,m=9,_=5;else if(2==y){var x=Py(e,h,31)+257,w=Py(e,h+10,15)+4,E=x+Py(e,h+5,31)+1;h+=14;for(var A=new uy(E),T=new uy(19),k=0;k<w;++k)T[py[k]]=Py(e,h+3*k,7);h+=3*w;var S=Oy(T),O=(1<<S)-1,P=Ey(T,S,1);for(k=0;k<E;){var C,R=P[Py(e,h,O)];if(h+=15&R,(C=R>>4)<16)A[k++]=C;else{var M=0,L=0;for(16==C?(L=3+Py(e,h,3),h+=2,M=A[k-1]):17==C?(L=3+Py(e,h,7),h+=3):18==C&&(L=11+Py(e,h,127),h+=7);L--;)A[k++]=M}}var N=A.subarray(0,x),z=A.subarray(x);m=Oy(N),_=Oy(z),f=Ey(N,m,1),p=Ey(z,_,1)}else Ny(1);if(h>g){l&&Ny(0);break}}a&&u(d+131072);for(var D=(1<<m)-1,I=(1<<_)-1,F=h;;F=h){var j=(M=f[Cy(e,h)&D])>>4;if((h+=15&M)>g){l&&Ny(0);break}if(M||Ny(2),j<256)n[d++]=j;else{if(256==j){F=h,f=null;break}var B=j-254;if(j>264){var U=dy[k=j-257];B=Py(e,h,(1<<U)-1)+gy[k],h+=U}var V=p[Cy(e,h)&I],G=V>>4;if(V||Ny(3),h+=15&V,z=vy[G],G>3&&(U=fy[G],z+=Cy(e,h)&(1<<U)-1,h+=U),h>g){l&&Ny(0);break}a&&u(d+131072);var $=d+B;if(d<z){var Z=s-z,q=Math.min(z,$);for(Z+d<0&&Ny(3);d<q;++d)n[d]=i[Z+d]}for(;d<$;++d)n[d]=n[d-z]}}t.l=f,t.p=F,t.b=d,t.f=c,f&&(c=1,t.m=m,t.d=p,t.n=_)}while(!c);return d!=n.length&&o?My(n,0,d):n.subarray(0,d)}(e,{i:2},t&&t.out,t&&t.dictionary)}var By="undefined"!=typeof TextDecoder&&new TextDecoder;try{By.decode(zy,{stream:!0})}catch(iy){}function Uy(e,t){if(t){for(var n="",i=0;i<e.length;i+=16384)n+=String.fromCharCode.apply(null,e.subarray(i,i+16384));return n}if(By)return By.decode(e);var r=function(e){for(var t="",n=0;;){var i=e[n++],r=(i>127)+(i>223)+(i>239);if(n+r>e.length)return{s:t,r:My(e,n-1)};r?3==r?(i=((15&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|i>>10,56320|1023&i)):t+=1&r?String.fromCharCode((31&i)<<6|63&e[n++]):String.fromCharCode((15&i)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(i)}}(e),s=r.s;return(n=r.r).length&&Ny(8),s}var Vy=function(e,t){return t+30+Dy(e,t+26)+Dy(e,t+28)},Gy=function(e,t,n){var i=Dy(e,t+28),r=Uy(e.subarray(t+46,t+46+i),!(2048&Dy(e,t+8))),s=t+46+i,o=Iy(e,t+20),a=n&&4294967295==o?$y(e,s):[o,Iy(e,t+24),Iy(e,t+42)],l=a[0],u=a[1],c=a[2];return[Dy(e,t+10),l,u,r,s+Dy(e,t+30)+Dy(e,t+32),c]},$y=function(e,t){for(;1!=Dy(e,t);t+=4+Dy(e,t+2));return[Fy(e,t+12),Fy(e,t+4),Fy(e,t+20)]};function Zy(e){var t=function(e){for(var t={},n=e.length-22;101010256!=Iy(e,n);--n)(!n||e.length-n>65558)&&Ny(13);var i=Dy(e,n+8);if(!i)return{};var r=Iy(e,n+16),s=4294967295==r||65535==i;if(s){var o=Iy(e,n-12);(s=101075792==Iy(e,o))&&(i=Iy(e,o+32),r=Iy(e,o+48))}for(var a=0;a<i;++a){var l=Gy(e,r,s),u=l[0],c=l[1],h=l[2],d=l[3],f=l[4],p=l[5],m=Vy(e,p);r=f,u?8==u?t[d]=jy(e.subarray(m,m+c),{out:new uy(h)}):Ny(14,"unknown compression type "+u):t[d]=My(e,m,m+c)}return t}(new Uint8Array(e));return Promise.resolve(function(e){for(var t=[],n=0,i=Object.keys(e);n<i.length;n++){var r=i[n];t[r]=Uy(e[r])}return t}(t))}function qy(e,t){for(var n=0;n<e.childNodes.length;){var i=e.childNodes[n];if(1===i.nodeType&&Yy(i)===t)return i;n++}}function Wy(e,t){for(var n=[],i=0;i<e.childNodes.length;){var r=e.childNodes[i];1===r.nodeType&&Yy(r)===t&&n.push(r),i++}return n}function Hy(e,t,n){for(var i=0;i<e.childNodes.length;){var r=e.childNodes[i];t?1===r.nodeType&&Yy(r)===t&&n(r,i):n(r,i),i++}}var Ky=/.+\:/;function Yy(e){return e.tagName.replace(Ky,"")}function Xy(e){return 1===e.nodeType}function Qy(e){for(var t=0;t<e.childNodes.length;){if(Xy(e.childNodes[t]))return e.childNodes[t];t++}}function Jy(e){if(1!==e.nodeType)return e.textContent;for(var t="<"+Yy(e),n=0;n<e.attributes.length;)t+=" "+e.attributes[n].name+'="'+e.attributes[n].value+'"',n++;t+=">";for(var i=0;i<e.childNodes.length;)t+=Jy(e.childNodes[i]),i++;return t+="</"+Yy(e)+">"}function ev(e){var t,n,i=e.documentElement;return t=function(e){var t=qy(e,"t");if(t)return t.textContent;var n="";return Hy(e,"r",function(e){n+=qy(e,"t").textContent}),n},n=[],Hy(i,"si",function(e,i){n.push(t(e,i))}),n}function tv(e,t){var n=t.createDocument(e),i={},r=function(e){return qy(e.documentElement,"workbookPr")}(n);r&&"1"===r.getAttribute("date1904")&&(i.epoch1904=!0),i.sheets=[];return function(e){return Wy(qy(e.documentElement,"sheets"),"sheet")}(n).forEach(function(e){e.getAttribute("name")&&i.sheets.push({id:e.getAttribute("sheetId"),name:e.getAttribute("name"),relationId:e.getAttribute("r:id")})}),i}function nv(e,t){var n=t.createDocument(e),i={sheets:{},sharedStrings:void 0,styles:void 0};return function(e){return Wy(e.documentElement,"Relationship")}(n).forEach(function(e){var t=e.getAttribute("Target");switch(e.getAttribute("Type")){case"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles":i.styles=iv(t);break;case"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings":i.sharedStrings=iv(t);break;case"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet":i.sheets[e.getAttribute("Id")]=iv(t)}}),i}function iv(e){return"/"===e[0]?e.slice(1):"xl/"+e}function rv(e){"@babel/helpers - typeof";return rv="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},rv(e)}function sv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function ov(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sv(Object(n),!0).forEach(function(t){av(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function av(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==rv(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==rv(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===rv(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lv(e,t){if(!e)return{};var n=t.createDocument(e),i=function(e){var t=qy(e.documentElement,"cellStyleXfs");return t?Wy(t,"xf"):[]}(n).map(cv),r=function(e){var t=qy(e.documentElement,"numFmts");return t?Wy(t,"numFmt"):[]}(n).map(uv).reduce(function(e,t){return e[t.id]=t,e},[]);return function(e){var t=qy(e.documentElement,"cellXfs");return t?Wy(t,"xf"):[]}(n).map(function(e){return e.hasAttribute("xfId")?ov(ov({},i[e.xfId]),cv(e,r)):cv(e,r)})}function uv(e){return{id:e.getAttribute("numFmtId"),template:e.getAttribute("formatCode")}}function cv(e,t){var n={};if(e.hasAttribute("numFmtId")){var i=e.getAttribute("numFmtId");t[i]?n.numberFormat=t[i]:n.numberFormat={id:i}}return n}function hv(e,t){t&&t.epoch1904&&(e+=1462);return new Date(Math.round(24*(e-25569)*36e5))}function dv(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return fv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fv(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function fv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function pv(e,t,n){if(e){var i=t[e];if(!i)throw new Error("Cell style not found: ".concat(e));if(!i.numberFormat)return!1;if(mv.indexOf(Number(i.numberFormat.id))>=0||n.dateFormat&&i.numberFormat.template===n.dateFormat||!1!==n.smartDateParser&&i.numberFormat.template&&function(e){for(var t,n=dv((e=(e=(e=e.toLowerCase()).replace(_v,"")).replace(gv,"")).split(/\W+/));!(t=n()).done;){var i=t.value;if(yv.indexOf(i)<0)return!1}return!0}(i.numberFormat.template))return!0}}var mv=[14,15,16,17,18,19,20,21,22,27,30,36,45,46,47,50,57],_v=/^\[\$-414\]/,gv=/;@$/;var yv=["ss","mm","h","hh","am","pm","d","dd","m","mm","mmm","mmmm","yy","yyyy","e"];function vv(e,t,n){var i=n.getInlineStringValue,r=n.getInlineStringXml,s=n.getStyleId,o=n.styles,a=n.values,l=n.properties,u=n.options;switch(t||(t="n"),t){case"str":e=bv(e,u);break;case"inlineStr":if(void 0===(e=i()))throw new Error('Unsupported "inline string" cell value structure: '.concat(r()));e=bv(e,u);break;case"s":var c=Number(e);if(isNaN(c))throw new Error('Invalid "shared" string index: '.concat(e));if(c>=a.length)throw new Error('An out-of-bounds "shared" string index: '.concat(e));e=bv(e=a[c],u);break;case"b":if("1"===e)e=!0;else{if("0"!==e)throw new Error('Unsupported "boolean" cell value: '.concat(e));e=!1}break;case"z":e=void 0;break;case"e":e=function(e){switch(e){case 0:return"#NULL!";case 7:return"#DIV/0!";case 15:return"#VALUE!";case 23:return"#REF!";case 29:return"#NAME?";case 36:return"#NUM!";case 42:return"#N/A";case 43:return"#GETTING_DATA";default:return"#ERROR_".concat(e)}}(e);break;case"d":if(void 0===e)break;var h=new Date(e);if(isNaN(h.valueOf()))throw new Error('Unsupported "date" cell value: '.concat(e));e=h;break;case"n":if(void 0===e)break;e=pv(s(),o,u)?hv(e=xv(e),l):(u.parseNumber||xv)(e);break;default:throw new TypeError("Cell type not supported: ".concat(t))}return void 0===e&&(e=null),e}function bv(e,t){return!1!==t.trim&&(e=e.trim()),""===e&&(e=void 0),e}function xv(e){var t=Number(e);if(isNaN(t))throw new Error('Invalid "numeric" cell value: '.concat(e));return t}var wv=["","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];function Ev(e){for(var t=0,n=0;n<e.length;)t*=26,t+=wv.indexOf(e[n]),n++;return t}function Av(e){return e=e.split(/(\d+)/),[parseInt(e[1]),Ev(e[0].trim())]}function Tv(e,t,n,i,r,s,o){var a,l=Av(e.getAttribute("r")),u=function(e,t){return qy(t,"v")}(0,e),c=u&&u.textContent;return e.hasAttribute("t")&&(a=e.getAttribute("t")),{row:l[0],column:l[1],value:vv(c,a,{getInlineStringValue:function(){return function(e,t){var n=Qy(t);if(n&&"is"===Yy(n)){var i=Qy(n);if(i&&"t"===Yy(i))return i.textContent}}(0,e)},getInlineStringXml:function(){return Jy(e)},getStyleId:function(){return e.getAttribute("s")},styles:r,values:i,properties:s,options:o})}}function kv(e,t,n,i,r,s){var o=function(e){var t=qy(e.documentElement,"sheetData"),n=[];return Hy(t,"row",function(e){Hy(e,"c",function(e){n.push(e)})}),n}(e);return 0===o.length?[]:o.map(function(e){return Tv(e,0,0,n,i,r,s)})}function Sv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,s,o,a=[],l=!0,u=!1;try{if(s=(n=n.call(e)).next,0===t);else for(;!(l=(i=s.call(n)).done)&&(a.push(i.value),a.length!==t);l=!0);}catch(e){u=!0,r=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw r}}return a}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Ov(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ov(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ov(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Pv(e){var t=function(e){var t=qy(e.documentElement,"dimension");if(t)return t.getAttribute("ref")}(e);if(t)return 1===(t=t.split(":").map(Av).map(function(e){var t=Sv(e,2);return{row:t[0],column:t[1]}})).length&&(t=[t[0],t[0]]),t}function Cv(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Rv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Rv(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Rv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Mv(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Lv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Lv(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Lv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Nv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,s,o,a=[],l=!0,u=!1;try{if(s=(n=n.call(e)).next,0===t);else for(;!(l=(i=s.call(n)).done)&&(a.push(i.value),a.length!==t);l=!0);}catch(e){u=!0,r=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw r}}return a}}(e,t)||zv(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zv(e,t){if(e){if("string"==typeof e)return Dv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dv(e,t):void 0}}function Dv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Iv(e,t){var n=e.dimensions,i=e.cells;if(0===i.length)return[];var r=Nv(n,2);r[0];for(var s=r[1],o=s.column,a=s.row,l=new Array(a),u=0;u<a;){l[u]=new Array(o);for(var c=0;c<o;)l[u][c]=null,c++;u++}for(var h,d=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=zv(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(i);!(h=d()).done;){var f=h.value,p=f.row-1,m=f.column-1;m<o&&p<a&&(l[p][m]=f.value)}var _=t.rowIndexSourceMap;if(_)for(var g=0;g<l.length;)_[g]=g,g++;return l=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.rowIndexSourceMap,i=t.accessor,r=void 0===i?function(e){return e}:i,s=t.onlyTrimAtTheEnd,o=e.length-1;o>=0;){for(var a,l=!0,u=Cv(e[o]);!(a=u()).done;)if(null!==r(a.value)){l=!1;break}if(l)e.splice(o,1),n&&n.splice(o,1);else if(s)break;o--}return e}(function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.accessor,i=void 0===n?function(e){return e}:n,r=t.onlyTrimAtTheEnd,s=e[0].length-1;s>=0;){for(var o,a=!0,l=Mv(e);!(o=l()).done;)if(null!==i(o.value[s])){a=!1;break}if(a)for(var u=0;u<e.length;)e[u].splice(s,1),u++;else if(r)break;s--}return e}(l,{onlyTrimAtTheEnd:!0}),{onlyTrimAtTheEnd:!0,rowIndexSourceMap:_}),t.transformData&&(l=t.transformData(l)),l}function Fv(e){"@babel/helpers - typeof";return Fv="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},Fv(e)}function jv(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Bv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Bv(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Bv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Uv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function Vv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Uv(Object(n),!0).forEach(function(t){Gv(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Uv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Gv(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Fv(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==Fv(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Fv(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $v(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.sheet||(n=Vv({sheet:1},n));var i=function(t){if(!e[t])throw new Error('"'.concat(t,'" file not found inside the *.xlsx file zip archive'));return e[t]},r=nv(i("xl/_rels/workbook.xml.rels"),t),s=r.sharedStrings?function(e,t){return e?ev(t.createDocument(e)):[]}(i(r.sharedStrings),t):[],o=r.styles?lv(i(r.styles),t):{},a=tv(i("xl/workbook.xml"),t);if(n.getSheets)return a.sheets.map(function(e){return{name:e.name}});var l=function(e,t){if("number"==typeof e){var n=t[e-1];return n&&n.relationId}for(var i,r=jv(t);!(i=r()).done;){var s=i.value;if(s.name===e)return s.relationId}}(n.sheet,a.sheets);if(!l||!r.sheets[l])throw function(e,t){var n=t&&t.map(function(e,t){return'"'.concat(e.name,'" (#').concat(t+1,")")}).join(", ");return new Error("Sheet ".concat("number"==typeof e?"#"+e:'"'+e+'"'," not found in the *.xlsx file.").concat(t?" Available sheets: "+n+".":""))}(n.sheet,a.sheets);var u=function(e,t,n,i,r,s){var o=t.createDocument(e),a=kv(o,0,n,i,r,s),l=Pv(o)||function(e){var t=function(e,t){return e-t},n=e.map(function(e){return e.row}).sort(t),i=e.map(function(e){return e.column}).sort(t),r=n[0],s=n[n.length-1];return[{row:r,column:i[0]},{row:s,column:i[i.length-1]}]}(a);return{cells:a,dimensions:l}}(i(r.sheets[l]),t,s,o,a,n),c=Iv(u,n=Vv({rowIndexSourceMap:[]},n));return n.properties?{data:c,properties:a}:c}function Zv(e){"@babel/helpers - typeof";return Zv="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},Zv(e)}function qv(e){var t=Kv();return function(){var n,i=Xv(e);if(t){var r=Xv(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return function(e,t){if(t&&("object"===Zv(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Wv(e){var t="function"==typeof Map?new Map:void 0;return Wv=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return Hv(e,arguments,Xv(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Yv(i,e)},Wv(e)}function Hv(e,t,n){return Hv=Kv()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&Yv(r,n.prototype),r},Hv.apply(null,arguments)}function Kv(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function Yv(e,t){return Yv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Yv(e,t)}function Xv(e){return Xv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Xv(e)}var Qv=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Yv(e,t)}(n,Wv(Error));var e,t=qv(n);function n(e){var i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(i=t.call(this,"invalid")).reason=e,i}return e=n,Object.defineProperty(e,"prototype",{writable:!1}),e}();function Jv(e){if("string"==typeof e){var t=e;if(e=Number(e),String(e)!==t)throw new Qv("not_a_number")}if("number"!=typeof e)throw new Qv("not_a_number");if(isNaN(e))throw new Qv("invalid_number");if(!isFinite(e))throw new Qv("out_of_bounds");return e}function eb(e){if("string"==typeof e)return e;if("number"==typeof e){if(isNaN(e))throw new Qv("invalid_number");if(!isFinite(e))throw new Qv("out_of_bounds");return String(e)}throw new Qv("not_a_string")}function tb(e){if("boolean"==typeof e)return e;throw new Qv("not_a_boolean")}var nb=["isColumnOriented","ignoreEmptyRows","rowIndexSourceMap"];function ib(e){"@babel/helpers - typeof";return ib="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},ib(e)}function rb(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,s,o,a=[],l=!0,u=!1;try{if(s=(n=n.call(e)).next,0===t);else for(;!(l=(i=s.call(n)).done)&&(a.push(i.value),a.length!==t);l=!0);}catch(e){u=!0,r=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw r}}return a}}(e,t)||sb(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sb(e,t){if(e){if("string"==typeof e)return ob(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ob(e,t):void 0}}function ob(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function ab(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},s=Object.keys(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function lb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function ub(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lb(Object(n),!0).forEach(function(t){cb(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function cb(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==ib(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==ib(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ib(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var hb={schemaPropertyValueForMissingColumn:void 0,schemaPropertyValueForMissingValue:null,schemaPropertyShouldSkipRequiredValidationForMissingColumn:function(){return!1},getEmptyObjectValue:function(){return null},getEmptyArrayValue:function(){return null},isColumnOriented:!1,ignoreEmptyRows:!0,arrayValueSeparator:","};function db(e,t,n){var i=n=n?ub(ub({},hb),n):hb,r=i.isColumnOriented,s=i.ignoreEmptyRows,o=i.rowIndexSourceMap,a=ab(i,nb),l=o&&o.slice();!function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var i=n[t],r=e[i];if("object"===ib(r.type)&&!Array.isArray(r.type))throw new Error("When defining a nested schema, use a `schema` property instead of a `type` property");if(!r.schema&&!r.column)throw new Error('"column" not defined for schema entry "'.concat(i,'".'))}}(t),r&&(e=gb(e)),s&&(e=e.filter(function(e,t){return!e.every(function(e){return null===e})||(l&&l.splice(t,1),!1)}));for(var u=e[0],c=[],h=[],d=1;d<e.length;d++){var f=fb(t,e[d],d,void 0,u,h,a);c.push(f)}if(l)for(var p,m=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=sb(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(h);!(p=m()).done;){var _=p.value;_.row=l[_.row-1]+1}return{rows:c,errors:h}}function fb(e,t,n,i,r,s,o){for(var a={},l=!0,u=function(e){var t=e.schemaEntry,i=e.value,r=e.error,s=e.reason,o={error:r,row:n+1,column:t.column,value:i};return s&&(o.reason=s),t.type&&(o.type=t.type),o},c=[],h=function(){var h,p,m,_,g=f[d],y=e[g],v=g,b=y.column,x="".concat(i||"",".").concat(v),w=r.indexOf(b),E=w<0;if(E||(h=t[w]),y.schema)p=fb(y.schema,t,n,x,r,s,o);else if(E)"schemaPropertyValueForMissingColumn"in o&&(p=o.schemaPropertyValueForMissingColumn);else if(void 0===h)"schemaPropertyValueForMissingValue"in o&&(p=o.schemaPropertyValueForMissingValue);else if(null===h)"schemaPropertyValueForMissingValue"in o&&(p=o.schemaPropertyValueForMissingValue);else if(Array.isArray(y.type)){var A=function(e,t){var n=[],i=0;for(;i<e.length;){var r=rb(_b(e,t,i),2),s=r[0];i+=r[1]+t.length,n.push(s.trim())}return n}(h,o.arrayValueSeparator).map(function(e){if(!m){var t=pb(e,y,o);return t.error&&(p=e,m=t.error,_=t.reason),t.value}});if(!m){var T=A.every(yb);p=T?o.getEmptyArrayValue(A,{path:x}):A}}else{var k=pb(h,y,o);m=k.error,_=k.reason,p=m?h:k.value}!m&&yb(p)&&y.required&&c.push({schemaEntry:y,value:p,isMissingColumn:E}),m?s.push(u({schemaEntry:y,value:p,error:m,reason:_})):(l&&!yb(p)&&(l=!1),void 0!==p&&(a[v]=p))},d=0,f=Object.keys(e);d<f.length;d++)h();if(l)return o.getEmptyObjectValue(a,{path:i});for(var p=0,m=c;p<m.length;p++){var _=m[p],g=_.schemaEntry,y=_.value;if(!(_.isMissingColumn&&o.schemaPropertyShouldSkipRequiredValidationForMissingColumn(g.column,{object:a}))){var v=g.required;("boolean"==typeof v?v:v(a))&&s.push(u({schemaEntry:g,value:y,error:"required"}))}}return a}function pb(e,t,n){if(null===e)return{value:null};var i;if(t.parse)throw new Error("`schemaEntry.parse` property was renamed to `schemaEntry.type`");if(i=t.type?function(e,t,n){switch(t){case String:return mb(e,eb);case Number:return mb(e,Jv);case Date:return mb(e,function(e){return function(e,t){var n=t.properties;if(e instanceof Date){if(isNaN(e.valueOf()))throw new Qv("out_of_bounds");return e}if("number"==typeof e){if(isNaN(e))throw new Qv("invalid_number");if(!isFinite(e))throw new Qv("out_of_bounds");var i=hv(e,n);if(isNaN(i.valueOf()))throw new Qv("out_of_bounds");return i}throw new Qv("not_a_date")}(e,{properties:n.properties})});case Boolean:return mb(e,tb);default:if("function"==typeof t)return mb(e,t);throw new Error("Unsupported schema type: ".concat(t&&t.name||t))}}(e,Array.isArray(t.type)?t.type[0]:t.type,n):{value:e},i.error)return i;if(null!==i.value){if(t.oneOf&&t.oneOf.indexOf(i.value)<0)return{error:"invalid",reason:"unknown"};if(t.validate)try{t.validate(i.value)}catch(e){return{error:e.message}}}return i}function mb(e,t){try{var n=t(e);return void 0===n?{value:null}:{value:n}}catch(e){var i={error:e.message};return e.reason&&(i.reason=e.reason),i}}function _b(e,t,n){for(var i=0,r="";n+i<e.length;){var s=e[n+i];if(s===t)return[r,i];if('"'===s){var o=_b(e,'"',n+i+1);r+=o[0],i+=1+o[1]+1}else r+=s,i++}return[r,i]}var gb=function(e){return e[0].map(function(t,n){return e.map(function(e){return e[n]})})};function yb(e){return null==e}function vb(e){"@babel/helpers - typeof";return vb="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},vb(e)}var bb=["schema"];function xb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function wb(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xb(Object(n),!0).forEach(function(t){Eb(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Eb(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==vb(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==vb(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===vb(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ab(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},s=Object.keys(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Tb(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(t=e,t instanceof File||t instanceof Blob?t.arrayBuffer().then(Zy):Zy(t)).then(function(e){return function(e,t,n){var i=n.schema,r=Ab(n,bb);if(r.map)throw new Error("`map` option was removed. Pass a `schema` option instead.");var s=$v(e,t,wb(wb({},r),{},{properties:i||r.properties}));return i?db(s.data,i,wb(wb({},r),{},{properties:s.properties})):s}(e,ly,n)})}const kb=({onParsed:e})=>{const[t,n]=A.useState(!1);return q(Ph,{accept:".xlsx, .xls",loading:t,onFilesLoad:({files:t})=>{const i=t[0];n(!0),Tb(i).then(t=>{e(t)}).finally(()=>{n(!1)})},children:"Загрузить файлы excel"})},Sb=({children:e})=>q(n,{sx:{display:"flex",alignItems:"center",height:"100vh",width:"100vw",overflow:"hidden"},children:q(n,{sx:{margin:"auto",maxWidth:"400px",width:"100%"},children:q(Rh,{children:e})})}),Ob={username:"",password:""},Pb=(e,t,n)=>{if(e&&"reportValidity"in e){const i=Zh(n,t);e.setCustomValidity(i&&i.message||""),e.reportValidity()}},Cb=(e,t)=>{for(const n in t.fields){const i=t.fields[n];i&&i.ref&&"reportValidity"in i.ref?Pb(i.ref,n,e):i&&i.refs&&i.refs.forEach(t=>Pb(t,n,e))}},Rb=(e,t)=>{t.shouldUseNativeValidation&&Cb(e,t);const n={};for(const i in e){const r=Zh(t.fields,i),s=Object.assign(e[i]||{},{ref:r&&r.ref});if(Mb(t.names||Object.keys(e),i)){const e=Object.assign({},Zh(n,i));Hh(e,"root",s),Hh(n,i,e)}else Hh(n,i,s)}return n},Mb=(e,t)=>{const n=Lb(t);return e.some(e=>Lb(e).match(`^${n}\\.\\d+`))};function Lb(e){return e.replace(/\]|\[/g,"")}const Nb=Hc(),zb=Hc(),Db=function(e,t,n){return void 0===n&&(n={}),function(i,r,s){try{return Promise.resolve(function(o,a){try{var l=(null!=t&&t.context&&"development"===process.env.NODE_ENV&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e["sync"===n.mode?"validateSync":"validate"](i,Object.assign({abortEarly:!1},t,{context:r}))).then(function(e){return s.shouldUseNativeValidation&&Cb({},s),{values:n.raw?Object.assign({},i):e,errors:{}}}))}catch(e){return a(e)}return l&&l.then?l.then(void 0,a):l}(0,function(e){if(!e.inner)throw e;return{values:{},errors:Rb((t=e,n=!s.shouldUseNativeValidation&&"all"===s.criteriaMode,(t.inner||[]).reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),n){var i=e[t.path].types,r=i&&i[t.type];e[t.path]=Ed(t.path,n,e,t.type,r?[].concat(r,t.message):t.message)}return e},{})),s)};var t,n}))}catch(e){return Promise.reject(e)}}}(Vc().shape({username:Nb,password:zb})),Ib=({onSuccess:e,onError:t})=>{const n=Eu(),i=xu(),r=function(e={}){const t=T.useRef(void 0),n=T.useRef(void 0),[i,r]=T.useState({isDirty:!1,isValidating:!1,isLoading:Wh(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Wh(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:i},e.defaultValues&&!Wh(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:n,...r}=rf(e);t.current={...r,formState:i}}const s=t.current.control;return s._options=e,fd(()=>{const e=s._subscribe({formState:s._proxyFormState,callback:()=>r({...s._formState}),reRenderRoot:!0});return r(e=>({...e,isReady:!0})),s._formState.isReady=!0,e},[s]),T.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),T.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),T.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),T.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),T.useEffect(()=>{if(s._proxyFormState.isDirty){const e=s._getDirty();e!==i.isDirty&&s._subjects.state.next({isDirty:e})}},[s,i.isDirty]),T.useEffect(()=>{var t;e.values&&!gd(e.values,n.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),(null===(t=s._options.resetOptions)||void 0===t?void 0:t.keepIsValid)||s._setValid(),n.current=e.values,r(e=>({...e}))):s._resetDefaultValues()},[s,e.values]),T.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=T.useMemo(()=>dd(i,s),[s,i]),t.current}({defaultValues:Ob,resolver:Db}),{register:s,formState:{isValid:o}}=r,a=A.useCallback(e=>{n.mutate({body:e})},[n]);return A.useEffect(()=>{if(n.error){t(n.error);const{response:e}=n.error;if(e){const{data:{detail:t}}=e;i({message:t,variant:"error"})}}},[n.error]),A.useEffect(()=>{n.data&&e(n.data)},[n.data]),q(Sb,{children:W(xf,{form:r,onSubmit:a,sx:()=>({justifyContent:"center",justifyItems:"center",alignContent:"center",alignItems:"center"}),children:[q(g,{variant:"h4",children:"Авторизация"}),q(g_,{...s("username"),label:"Логин",placeholder:"Введите логин"}),q(g_,{...s("password"),label:"Пароль",placeholder:"Введите пароль",type:"password"}),q(wh,{type:"submit",disabled:!o,children:"Войти"})]})})};var Fb=bh(({onUnauthorized:e,children:t})=>(A.useEffect(()=>{cu.isUnauthorized&&e()},[cu.isUnauthorized]),q(A.Fragment,{children:t})));const jb=({children:e,configOptions:t})=>{const[n,i]=A.useState(null),[r,s]=A.useState("");return A.useEffect(()=>(yu.initialize({...t,onCheck:e=>{const{valid:n,reason:r}=e;s(r),i(n),t.onCheck?.(e)}}),()=>{yu.deactivate()}),[t]),null===n?q(Kg,{color:"primary"}):n?q(A.Fragment,{children:e}):q(g,{color:"error",children:r})};function Bb(e,t){if(void 0!==e.one&&1===t)return e.one;const n=t%10,i=t%100;return 1===n&&11!==i?e.singularNominative.replace("{{count}}",String(t)):n>=2&&n<=4&&(i<10||i>20)?e.singularGenitive.replace("{{count}}",String(t)):e.pluralGenitive.replace("{{count}}",String(t))}function Ub(e){return(t,n)=>n?.addSuffix?n.comparison&&n.comparison>0?e.future?Bb(e.future,t):"через "+Bb(e.regular,t):e.past?Bb(e.past,t):Bb(e.regular,t)+" назад":Bb(e.regular,t)}const Vb={lessThanXSeconds:Ub({regular:{one:"меньше секунды",singularNominative:"меньше {{count}} секунды",singularGenitive:"меньше {{count}} секунд",pluralGenitive:"меньше {{count}} секунд"},future:{one:"меньше, чем через секунду",singularNominative:"меньше, чем через {{count}} секунду",singularGenitive:"меньше, чем через {{count}} секунды",pluralGenitive:"меньше, чем через {{count}} секунд"}}),xSeconds:Ub({regular:{singularNominative:"{{count}} секунда",singularGenitive:"{{count}} секунды",pluralGenitive:"{{count}} секунд"},past:{singularNominative:"{{count}} секунду назад",singularGenitive:"{{count}} секунды назад",pluralGenitive:"{{count}} секунд назад"},future:{singularNominative:"через {{count}} секунду",singularGenitive:"через {{count}} секунды",pluralGenitive:"через {{count}} секунд"}}),halfAMinute:(e,t)=>t?.addSuffix?t.comparison&&t.comparison>0?"через полминуты":"полминуты назад":"полминуты",lessThanXMinutes:Ub({regular:{one:"меньше минуты",singularNominative:"меньше {{count}} минуты",singularGenitive:"меньше {{count}} минут",pluralGenitive:"меньше {{count}} минут"},future:{one:"меньше, чем через минуту",singularNominative:"меньше, чем через {{count}} минуту",singularGenitive:"меньше, чем через {{count}} минуты",pluralGenitive:"меньше, чем через {{count}} минут"}}),xMinutes:Ub({regular:{singularNominative:"{{count}} минута",singularGenitive:"{{count}} минуты",pluralGenitive:"{{count}} минут"},past:{singularNominative:"{{count}} минуту назад",singularGenitive:"{{count}} минуты назад",pluralGenitive:"{{count}} минут назад"},future:{singularNominative:"через {{count}} минуту",singularGenitive:"через {{count}} минуты",pluralGenitive:"через {{count}} минут"}}),aboutXHours:Ub({regular:{singularNominative:"около {{count}} часа",singularGenitive:"около {{count}} часов",pluralGenitive:"около {{count}} часов"},future:{singularNominative:"приблизительно через {{count}} час",singularGenitive:"приблизительно через {{count}} часа",pluralGenitive:"приблизительно через {{count}} часов"}}),xHours:Ub({regular:{singularNominative:"{{count}} час",singularGenitive:"{{count}} часа",pluralGenitive:"{{count}} часов"}}),xDays:Ub({regular:{singularNominative:"{{count}} день",singularGenitive:"{{count}} дня",pluralGenitive:"{{count}} дней"}}),aboutXWeeks:Ub({regular:{singularNominative:"около {{count}} недели",singularGenitive:"около {{count}} недель",pluralGenitive:"около {{count}} недель"},future:{singularNominative:"приблизительно через {{count}} неделю",singularGenitive:"приблизительно через {{count}} недели",pluralGenitive:"приблизительно через {{count}} недель"}}),xWeeks:Ub({regular:{singularNominative:"{{count}} неделя",singularGenitive:"{{count}} недели",pluralGenitive:"{{count}} недель"}}),aboutXMonths:Ub({regular:{singularNominative:"около {{count}} месяца",singularGenitive:"около {{count}} месяцев",pluralGenitive:"около {{count}} месяцев"},future:{singularNominative:"приблизительно через {{count}} месяц",singularGenitive:"приблизительно через {{count}} месяца",pluralGenitive:"приблизительно через {{count}} месяцев"}}),xMonths:Ub({regular:{singularNominative:"{{count}} месяц",singularGenitive:"{{count}} месяца",pluralGenitive:"{{count}} месяцев"}}),aboutXYears:Ub({regular:{singularNominative:"около {{count}} года",singularGenitive:"около {{count}} лет",pluralGenitive:"около {{count}} лет"},future:{singularNominative:"приблизительно через {{count}} год",singularGenitive:"приблизительно через {{count}} года",pluralGenitive:"приблизительно через {{count}} лет"}}),xYears:Ub({regular:{singularNominative:"{{count}} год",singularGenitive:"{{count}} года",pluralGenitive:"{{count}} лет"}}),overXYears:Ub({regular:{singularNominative:"больше {{count}} года",singularGenitive:"больше {{count}} лет",pluralGenitive:"больше {{count}} лет"},future:{singularNominative:"больше, чем через {{count}} год",singularGenitive:"больше, чем через {{count}} года",pluralGenitive:"больше, чем через {{count}} лет"}}),almostXYears:Ub({regular:{singularNominative:"почти {{count}} год",singularGenitive:"почти {{count}} года",pluralGenitive:"почти {{count}} лет"},future:{singularNominative:"почти через {{count}} год",singularGenitive:"почти через {{count}} года",pluralGenitive:"почти через {{count}} лет"}})},Gb={date:oa({formats:{full:"EEEE, d MMMM y 'г.'",long:"d MMMM y 'г.'",medium:"d MMM y 'г.'",short:"dd.MM.y"},defaultWidth:"full"}),time:oa({formats:{full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},defaultWidth:"full"}),dateTime:oa({formats:{any:"{{date}}, {{time}}"},defaultWidth:"any"})},$b=["воскресенье","понедельник","вторник","среду","четверг","пятницу","субботу"];function Zb(e){const t=$b[e];return 2===e?"'во "+t+" в' p":"'в "+t+" в' p"}const qb={lastWeek:(e,t,n)=>{const i=e.getDay();return $a(e,t,n)?Zb(i):function(e){const t=$b[e];switch(e){case 0:return"'в прошлое "+t+" в' p";case 1:case 2:case 4:return"'в прошлый "+t+" в' p";case 3:case 5:case 6:return"'в прошлую "+t+" в' p"}}(i)},yesterday:"'вчера в' p",today:"'сегодня в' p",tomorrow:"'завтра в' p",nextWeek:(e,t,n)=>{const i=e.getDay();return $a(e,t,n)?Zb(i):function(e){const t=$b[e];switch(e){case 0:return"'в следующее "+t+" в' p";case 1:case 2:case 4:return"'в следующий "+t+" в' p";case 3:case 5:case 6:return"'в следующую "+t+" в' p"}}(i)},other:"P"},Wb={ordinalNumber:(e,t)=>{const n=Number(e),i=t?.unit;let r;return r="date"===i?"-е":"week"===i||"minute"===i||"second"===i?"-я":"-й",n+r},era:ua({values:{narrow:["до н.э.","н.э."],abbreviated:["до н. э.","н. э."],wide:["до нашей эры","нашей эры"]},defaultWidth:"wide"}),quarter:ua({values:{narrow:["1","2","3","4"],abbreviated:["1-й кв.","2-й кв.","3-й кв.","4-й кв."],wide:["1-й квартал","2-й квартал","3-й квартал","4-й квартал"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:ua({values:{narrow:["Я","Ф","М","А","М","И","И","А","С","О","Н","Д"],abbreviated:["янв.","фев.","март","апр.","май","июнь","июль","авг.","сент.","окт.","нояб.","дек."],wide:["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"]},defaultWidth:"wide",formattingValues:{narrow:["Я","Ф","М","А","М","И","И","А","С","О","Н","Д"],abbreviated:["янв.","фев.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],wide:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"]},defaultFormattingWidth:"wide"}),day:ua({values:{narrow:["В","П","В","С","Ч","П","С"],short:["вс","пн","вт","ср","чт","пт","сб"],abbreviated:["вск","пнд","втр","срд","чтв","птн","суб"],wide:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"]},defaultWidth:"wide"}),dayPeriod:ua({values:{narrow:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утро",afternoon:"день",evening:"веч.",night:"ночь"},abbreviated:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утро",afternoon:"день",evening:"веч.",night:"ночь"},wide:{am:"ДП",pm:"ПП",midnight:"полночь",noon:"полдень",morning:"утро",afternoon:"день",evening:"вечер",night:"ночь"}},defaultWidth:"any",formattingValues:{narrow:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утра",afternoon:"дня",evening:"веч.",night:"ночи"},abbreviated:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утра",afternoon:"дня",evening:"веч.",night:"ночи"},wide:{am:"ДП",pm:"ПП",midnight:"полночь",noon:"полдень",morning:"утра",afternoon:"дня",evening:"вечера",night:"ночи"}},defaultFormattingWidth:"wide"})},Hb={ordinalNumber:da({matchPattern:/^(\d+)(-?(е|я|й|ое|ье|ая|ья|ый|ой|ий|ый))?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:ha({matchPatterns:{narrow:/^((до )?н\.?\s?э\.?)/i,abbreviated:/^((до )?н\.?\s?э\.?)/i,wide:/^(до нашей эры|нашей эры|наша эра)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^д/i,/^н/i]},defaultParseWidth:"any"}),quarter:ha({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^[1234](-?[ыои]?й?)? кв.?/i,wide:/^[1234](-?[ыои]?й?)? квартал/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:ha({matchPatterns:{narrow:/^[яфмаисонд]/i,abbreviated:/^(янв|фев|март?|апр|ма[йя]|июн[ья]?|июл[ья]?|авг|сент?|окт|нояб?|дек)\.?/i,wide:/^(январ[ья]|феврал[ья]|марта?|апрел[ья]|ма[йя]|июн[ья]|июл[ья]|августа?|сентябр[ья]|октябр[ья]|октябр[ья]|ноябр[ья]|декабр[ья])/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^я/i,/^ф/i,/^м/i,/^а/i,/^м/i,/^и/i,/^и/i,/^а/i,/^с/i,/^о/i,/^н/i,/^я/i],any:[/^я/i,/^ф/i,/^мар/i,/^ап/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^ав/i,/^с/i,/^о/i,/^н/i,/^д/i]},defaultParseWidth:"any"}),day:ha({matchPatterns:{narrow:/^[впсч]/i,short:/^(вс|во|пн|по|вт|ср|чт|че|пт|пя|сб|су)\.?/i,abbreviated:/^(вск|вос|пнд|пон|втр|вто|срд|сре|чтв|чет|птн|пят|суб).?/i,wide:/^(воскресень[ея]|понедельника?|вторника?|сред[аы]|четверга?|пятниц[аы]|суббот[аы])/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^в/i,/^п/i,/^в/i,/^с/i,/^ч/i,/^п/i,/^с/i],any:[/^в[ос]/i,/^п[он]/i,/^в/i,/^ср/i,/^ч/i,/^п[ят]/i,/^с[уб]/i]},defaultParseWidth:"any"}),dayPeriod:ha({matchPatterns:{narrow:/^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,abbreviated:/^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,wide:/^([дп]п|полночь|полдень|утр[оа]|день|дня|вечера?|ноч[ьи])/i},defaultMatchWidth:"wide",parsePatterns:{any:{am:/^дп/i,pm:/^пп/i,midnight:/^полн/i,noon:/^полд/i,morning:/^у/i,afternoon:/^д[ен]/i,evening:/^в/i,night:/^н/i}},defaultParseWidth:"any"})},Kb={code:"ru",formatDistance:(e,t,n)=>Vb[e](t,n),formatLong:Gb,formatRelative:(e,t,n,i)=>{const r=qb[e];return"function"==typeof r?r(t,n,i):r},localize:Wb,match:Hb,options:{weekStartsOn:1,firstWeekContainsDate:1}},Yb=e=>q(_e,{...e,dateAdapter:ge,adapterLocale:Kb}),Xb=({children:e})=>{const[t,n]=A.useState(!1);return A.useEffect(()=>{(async()=>{try{await Promise.resolve().then(function(){return ux}),await Promise.resolve().then(function(){return hx}),await Promise.resolve().then(function(){return px}),await Promise.resolve().then(function(){return gx}),await Promise.resolve().then(function(){return Ax}),await Promise.resolve().then(function(){return Sx}),n(!0)}catch{n(!1)}})()},[]),t?q(A.Fragment,{children:e}):null},Qb=({children:e})=>q(nu,{client:lu.client,children:e}),Jb=({children:e,themeOptions:t})=>{const n=A.useMemo(()=>{const e=ae({...t,palette:{...t?.palette,blue:{main:"#0070f0",light:"#73aff4"},white:{main:"white"},black:{main:"black"},grey:{400:"#a5a5a5"}},cssVariables:!0,varsCustom:{border_radius_L:"12px"}});return le(e)},[t]);return q(ue,{theme:n,children:e})},ex=({children:e,themeOptions:t})=>q(ln,{children:q(_u,{children:q(Jb,{themeOptions:t,children:q(Yb,{children:q(Qb,{children:q(Xb,{children:e})})})})})});var tx,nx,ix={};function rx(e,t){if(tx)if(nx){var n="var shared_chunk = {}; ("+tx+")(shared_chunk); ("+nx+")(shared_chunk);",i={};tx(i),(ix=t(i)).workerURL=window.URL.createObjectURL(new Blob([n],{type:"text/javascript"}))}else nx=t;else tx=t}rx(0,function(e){const t={};try{window instanceof Window&&window.document instanceof HTMLDocument&&(t.is_worker=!1,t.is_main=!0)}catch(e){t.is_worker=!0,t.is_main=!1,self.window={document:{}},self.document=self.window.document}function n(e){return n="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},n(e)}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t);if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==n(t)?t:t+""}function r(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s,o="v0.22.0",a=s={},l=0,u={};function c(e){var t=[];"string"==typeof e&&(t=e.split("."),e=t.pop());var n=s.targets;for(let e=0;e<t.length;e++){if(!n[t[e]])return[];n=n[t[e]]}return[e,n]}function h(e,t=null,n=null,i=[]){if(!e)return i;if(Array.isArray(e))e.forEach((t,n)=>h(t,e,n,i));else if("object"==typeof e)if(e instanceof ArrayBuffer)i.push({object:e,parent:t,property:n});else if(e.buffer instanceof ArrayBuffer)i.push({object:e.buffer,parent:t,property:n});else for(let t in e)h(e[t],e,t,i);return i}function d(e){Array.isArray(e)&&e.filter(e=>e.parent&&e.property).forEach(e=>delete e.parent[e.property])}s.targets={},s.addTarget=function(e,t){s.targets[e]=t},s.removeTarget=function(e){e&&delete s.targets[e]},s.withTransferables=function(...e){if(!(this instanceof s.withTransferables))return new s.withTransferables(...e);this.value=e,this.transferables=h(this.value)},t.is_main&&(s.postMessage=function(e,t,...n){if(Array.isArray(e))return Promise.all(e.map(e=>s.postMessage(e,t,...n)));let i={};"object"==typeof t&&(i=t,t=t.method);var r=new Promise((e,i)=>{u[l]={method:t,message:n,resolve:e,reject:i}});let o,a=[];return n&&1===n.length&&n[0]instanceof s.withTransferables&&(a=n[0].transferables,n=n[0].value),o={type:"main_send",message_id:l,method:t,message:n},i.stringify&&(o=JSON.stringify(o)),e.postMessage(o,a.map(e=>e.object)),d(a),a.length>0&&_("trace",`'${t}' transferred ${a.length} objects to worker thread`),l++,r},s.addWorker=function(e){if(!(e instanceof Worker))throw Error("Worker broker could not add non-Worker object",e);e.addEventListener("message",function(t){let n="string"==typeof t.data?JSON.parse(t.data):t.data,i=n.message_id;if("worker_reply"===n.type)u[i]&&(n.error?u[i].reject(n.error):u[i].resolve(n.message),delete u[i]);else if("worker_send"===n.type&&null!=i){let t,r,o,a,l;try{if([a,o]=c(n.method),!o)throw Error(`Worker broker could not dispatch message type ${n.method} on target ${n.target} because no object with that name is registered on main thread`);if(l="function"==typeof o[a]&&o[a],!l)throw Error(`Worker broker could not dispatch message type ${n.method} on target ${n.target} because object has no method with that name`);t=l.apply(o,n.message)}catch(e){r=e}let u,h=[];t instanceof Promise?t.then(t=>{t instanceof s.withTransferables&&(h=t.transferables,t=t.value[0]),u={type:"main_reply",message_id:i,message:t},e.postMessage(u,h.map(e=>e.object)),d(h),h.length>0&&_("trace",`'${a}' transferred ${h.length} objects to worker thread`)},t=>{e.postMessage({type:"main_reply",message_id:i,error:t instanceof Error?`${t.message}: ${t.stack}`:t})}):(t instanceof s.withTransferables&&(h=t.transferables,t=t.value[0]),u={type:"main_reply",message_id:i,message:t,error:r instanceof Error?`${r.message}: ${r.stack}`:r},e.postMessage(u,h.map(e=>e.object)),d(h),h.length>0&&_("trace",`'${a}' transferred ${h.length} objects to worker thread`))}})},s.getMessages=function(){return u},s.getMessageId=function(){return l}),t.is_worker&&(s.postMessage=function(e,...t){let n={};"object"==typeof e&&(n=e,e=e.method);var i=new Promise((n,i)=>{u[l]={method:e,message:t,resolve:n,reject:i}});let r,o=[];return t&&1===t.length&&t[0]instanceof s.withTransferables&&(o=t[0].transferables,t=t[0].value),r={type:"worker_send",message_id:l,method:e,message:t},n.stringify&&(r=JSON.stringify(r)),self.postMessage(r,o.map(e=>e.object)),d(o),o.length>0&&_("trace",`'${e}' transferred ${o.length} objects to main thread`),l++,i},self.addEventListener("message",function(e){let t="string"==typeof e.data?JSON.parse(e.data):e.data,n=t.message_id;if("main_reply"===t.type)u[n]&&(t.error?u[n].reject(t.error):u[n].resolve(t.message),delete u[n]);else if("main_send"===t.type&&null!=n){let i,r,o,a,l;try{if([a,o]=c(t.method),!o)throw Error(`Worker broker could not dispatch message type ${t.method} on target ${t.target} because no object with that name is registered on main thread`);if(l="function"==typeof o[a]&&o[a],!l)throw Error(`Worker broker could not dispatch message type ${t.method} because worker has no method with that name`);i=l.apply(o,t.message)}catch(e){r=e}let u,h=[];i instanceof Promise?i.then(e=>{e instanceof s.withTransferables&&(h=e.transferables,e=e.value[0]),u={type:"worker_reply",message_id:n,message:e},self.postMessage(u,h.map(e=>e.object)),d(h),h.length>0&&_("trace",`'${a}' transferred ${h.length} objects to main thread`)},e=>{self.postMessage({type:"worker_reply",message_id:n,error:e instanceof Error?`${e.message}: ${e.stack}`:e})}):(i instanceof s.withTransferables&&(h=i.transferables,i=i.value[0]),u={type:"worker_reply",message_id:n,message:i,error:r instanceof Error?`${r.message}: ${r.stack}`:r},self.postMessage(u,h.map(e=>e.object)),d(h),h.length>0&&_("trace",`'${a}' transferred ${h.length} objects to main thread`))}}));const f={silent:-1,error:0,warn:1,info:2,debug:3,trace:4},p={};let m={};function _(e,...n){let i="object"==typeof e?e.level:e;if(f[i]<=f[_.level]){if(t.is_worker)return a.postMessage({method:"_logProxy",stringify:!0},e,...n);{if("object"==typeof e&&!0===e.once){if(m[JSON.stringify(n)])return Promise.resolve(!1);m[JSON.stringify(n)]=!0}let r=function(e){if(t.is_main)return p[e]=p[e]||(console[e]?console[e]:console.log).bind(console),p[e]}(i);n.length>1?r(`Tangram ${o} [${i}]: ${n[0]}`,...n.slice(1)):r(`Tangram ${o} [${i}]: ${n[0]}`)}return Promise.resolve(!0)}return Promise.resolve(!1)}_.level="info",_.workers=null,_.setLevel=function(e){_.level=e,t.is_main&&Array.isArray(_.workers)&&a.postMessage(_.workers,"_logSetLevelProxy",e)},t.is_main&&(_.setWorkers=function(e){_.workers=e},_.reset=function(){m={}}),a.addTarget("_logProxy",_),a.addTarget("_logSetLevelProxy",_.setLevel);const g={};let y;a.addTarget("Utils",g),g.isSafari=function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},g.isMicrosoft=function(){return/(Trident\/7.0|Edge[ /](\d+[.\d]+))/i.test(navigator.userAgent)},g._requests={},g._proxy_requests={},g.io=function(e,n=6e4,i="text",r="GET",s={},o=null,l=!1){if(t.is_worker&&g.isMicrosoft())return _("debug","Proxying request for URL to worker",e),o&&(g._proxy_requests[o]=!0),a.postMessage("Utils.io",e,n,i,r,s,o,!0);var u=new XMLHttpRequest,c=new Promise((t,o)=>{if(u.open(r,e,!0),u.timeout=n,u.responseType=i,s&&"object"==typeof s)for(let e in s)u.setRequestHeader(e,s[e]);u.onload=()=>{200===u.status?["text","json"].indexOf(u.responseType)>-1?t({body:u.responseText,status:u.status}):t({body:u.response,status:u.status}):204===u.status?t({body:null,status:u.status}):o(Error("Request error with a status of "+u.statusText))},u.onerror=e=>{o(Error("There was a network error"+e.toString()))},u.ontimeout=e=>{o(Error("timeout "+e.toString()))},u.send()});return c=c.then(e=>(o&&delete g._requests[o],l?a.withTransferables(e):e)),o&&(g._requests[o]=u),c},g.cancelRequest=function(e){if(t.is_worker&&g._proxy_requests[e])return a.postMessage("Utils.cancelRequest",e);g._requests[e]?(_("trace",`Cancelling network request key '${e}'`),g._requests[e].abort(),delete g._requests[e]):_("trace",`Could not find network request key '${e}'`)},g.serializeWithFunctions=function(e){return"function"==typeof e?e.toString():JSON.stringify(e,function(e,t){return"function"==typeof t?t.toString():t})},g.use_high_density_display=!0,g.updateDevicePixelRatio=function(){let e=g.device_pixel_ratio;return g.device_pixel_ratio=g.use_high_density_display&&window.devicePixelRatio||1,g.device_pixel_ratio!==e},t.is_main&&g.updateDevicePixelRatio(),g.isPowerOf2=function(e){return!(e&e-1)},g.interpolate=function(e,t,n){if(!Array.isArray(t)||!Array.isArray(t[0]))return t;if(t.length<1)return t;var i,r,s,o,a;if(e<=t[0][0])o=t[0][1],"function"==typeof n&&(o=n(o));else if(e>=t[t.length-1][0])o=t[t.length-1][1],"function"==typeof n&&(o=n(o));else for(var l=0;l<t.length-1;l++)if(e>=t[l][0]&&e<t[l+1][0]){if(i=t[l][0],r=t[l+1][0],Array.isArray(t[l][1])){o=[];for(var u=0;u<t[l][1].length;u++)"function"==typeof n?(a=n(t[l][1][u]),s=n(t[l+1][1][u])-a,o[u]=s*(e-i)/(r-i)+a):(s=t[l+1][1][u]-t[l][1][u],o[u]=s*(e-i)/(r-i)+t[l][1][u])}else"function"==typeof n?(a=n(t[l][1]),o=(s=n(t[l+1][1])-a)*(e-i)/(r-i)+a):o=(s=t[l+1][1]-t[l][1])*(e-i)/(r-i)+t[l][1];break}return o},g.toCSSColor=function(e){if(null!=e)return 1===e[3]?`rgb(${e.slice(0,3).map(e=>Math.round(255*e)).join(", ")})`:`rgba(${e.map((e,t)=>t<3&&Math.round(255*e)||e).join(", ")})`};var v=y={draw_label_collision_boxes:!1,draw_label_texture_boxes:!1,suppress_label_fade_in:!1,suppress_label_snap_animation:!1,show_hidden_labels:!1,layer_stats:!1,wireframe:!1};function b(e){if("string"==typeof e&&-1===e.search(/^(data|blob):/)){let t=e.indexOf("?");t>-1&&(e=e.substr(0,t));let n=e.indexOf("#");return n>-1&&(e=e.substr(0,n)),e.substr(0,e.lastIndexOf("/")+1)||""}return""}function x(e){if("string"==typeof e)return!(e.search(/^(http|https|data|blob):/)>-1||"//"===e.substr(0,2))}let w;function E(e,t){e=e.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var n=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===n?"":decodeURIComponent(n[1].replace(/\+/g," "))}const A={id:0,queue:[],max_time:20,start_time:null,state:{},add(e){e.id=A.id++,e.max_time=e.max_time||A.max_time,e.pause_factor=e.pause_factor||1;let t=new Promise((t,n)=>{e.resolve=t,e.reject=n});return e.promise=t,e.elapsed=0,e.total_elapsed=0,e.stats={calls:0},this.queue.push(e),this.start_time=this.start_time||performance.now(),this.elapsed=performance.now()-this.start_time,(this.elapsed<A.max_time||e.immediate)&&this.process(e),e.promise},remove(e){let t=this.queue.indexOf(e);t>-1&&this.queue.splice(t,1)},process(e){if(!this.state.user_moving_view||!1!==e.user_moving_view)return e.pause?(e.pause--,!0):(e.stats.calls++,e.start_time=performance.now(),e.run(e))},processAll(){this.start_time=this.start_time||performance.now();for(let e=0;e<this.queue.length;e++){let t=this.queue[e];if(!0!==this.process(t)&&(t.pause||(t.pause=t.elapsed>t.max_time?t.pause_factor:0),t.total_elapsed+=t.elapsed),this.elapsed=performance.now()-this.start_time,this.elapsed>=A.max_time){this.start_time=null;break}}},finish(e,t){return e.elapsed=performance.now()-e.start_time,e.total_elapsed+=e.elapsed,this.remove(e),e.resolve(t),e.promise},cancel(e){let t;e.cancel instanceof Function&&(t=e.cancel(e)),e.resolve(t)},shouldContinue(e){return e.elapsed=performance.now()-e.start_time,this.elapsed=performance.now()-this.start_time,e.elapsed<e.max_time&&this.elapsed<A.max_time},removeForTile(e){for(let t=this.queue.length-1;t>=0;t--)this.queue[t].tile_id===e&&(this.cancel(this.queue[t]),this.queue.splice(t,1))},setState(e){this.state=e}};function T(e){let t=[];return Object.assign(e,{subscribe(e){-1===t.indexOf(e)&&t.push(e)},unsubscribe(e){let n=t.indexOf(e);n>-1&&t.splice(n,1)},unsubscribeAll(){t=[]},trigger(e,...n){t.forEach(t=>{if("function"==typeof t[e])try{t[e](...n)}catch(t){_("warn",`Caught exception in listener for event '${e}':`,t)}})},hasSubscribersFor(e){let n=!1;return t.forEach(t=>{"function"==typeof t[e]&&(n=!0)}),n}})}function k(e,t){let n={};return t.forEach(t=>n[t]=e[t]),n}class S{constructor(e,t,n={}){n=S.sliceOptions(n),this.gl=e,this.texture=e.createTexture(),this.texture&&(this.valid=!0),this.bind(),this.name=t,this.retain_count=0,this.config_type=null,this.loading=null,this.loaded=!1,this.filtering=n.filtering,this.density=n.density||1,this.sprites=n.sprites,this.texcoords={},this.sizes={},this.css_sizes={},this.aspects={},this.setData(1,1,new Uint8Array([0,0,0,0]),{filtering:"nearest"}),this.loaded=!1,S.textures[this.name]&&(this.retain_count=S.textures[this.name].retain_count,S.textures[this.name].retain_count=0,S.textures[this.name].destroy()),S.textures[this.name]=this,S.texture_configs[this.name]=JSON.stringify(Object.assign({name:t},n)),this.load(n),_("trace",`creating Texture ${this.name}`)}destroy({force:e}={}){this.retain_count>0&&!e?_("error",`Texture '${this.name}': destroying texture with retain count of '${this.retain_count}'`):this.valid&&(this.gl.deleteTexture(this.texture),this.texture=null,S.textures[this.name]===this&&(delete S.textures[this.name],delete S.texture_configs[this.name]),this.valid=!1,_("trace",`destroying Texture ${this.name}`))}retain(){this.retain_count++}release(){this.retain_count<=0&&_("error",`Texture '${this.name}': releasing texture with retain count of '${this.retain_count}'`),this.retain_count--,this.retain_count<=0&&this.destroy()}bind(e=0){this.valid&&(S.activeUnit!==e&&(this.gl.activeTexture(this.gl.TEXTURE0+e),S.activeUnit=e,S.boundTexture=null),S.boundTexture!==this.texture&&(this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),S.boundTexture=this.texture))}load(e){return e?(this.loading=null,"string"==typeof e.url?(this.config_type="url",this.setUrl(e.url,e)):e.element?(this.config_type="element",this.setElement(e.element,e)):e.data&&e.width&&e.height&&(this.config_type="data",this.setData(e.width,e.height,e.data,e)),this.loading=this.loading&&this.loading.then(()=>(this.calculateSprites(),this))||Promise.resolve(this),this.loading):this.loading||Promise.resolve(this)}setUrl(e,t={}){if(this.valid)return this.url=e,this.loading=new Promise(e=>{let n=new Image;n.onload=()=>{try{if("data:"===this.url.slice(0,5)){const e=document.createElement("canvas"),i=e.getContext("2d");e.width=n.width,e.height=n.height,i.drawImage(n,0,0),this.setElement(e,t)}else this.setElement(n,t)}catch(e){this.loaded=!1,_("warn",`Texture '${this.name}': failed to load url: '${this.url}'`,e,t),S.trigger("warning",{message:`Failed to load texture from ${this.url}`,error:e,texture:t})}this.loaded=!0,e(this)},n.onerror=n=>{this.loaded=!1,_("warn",`Texture '${this.name}': failed to load url: '${this.url}'`,n,t),S.trigger("warning",{message:`Failed to load texture from ${this.url}`,error:n,texture:t}),e(this)},g.isSafari()&&"data:"===this.url.slice(0,5)||(n.crossOrigin="anonymous"),n.src=this.url}),this.loading}setData(e,t,n,i={}){return this.width=e,this.height=t,Array.isArray(n)&&(n=new Uint8Array(n)),this.update(n,i),this.setFiltering(i),this.loaded=!0,this.loading=Promise.resolve(this),this.loading}setElement(e,t){let n=e;if("string"==typeof e&&(e=document.querySelector(e)),e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement)this.update(e,t),this.setFiltering(t);else{this.loaded=!1;let e=`the 'element' parameter (\`element: ${JSON.stringify(n)}\`) must be a CSS `;e+="selector string, or a <canvas>, <image> or <video> object",_("warn",`Texture '${this.name}': ${e}`,t),S.trigger("warning",{message:`Failed to load texture because ${e}`,texture:t})}return this.loaded=!0,this.loading=Promise.resolve(this),this.loading}update(e,t={}){this.valid&&(this.bind(),e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLImageElement&&e.complete?(this.width=e.width,this.height=e.height,this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1!==t.UNPACK_FLIP_Y_WEBGL),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.UNPACK_PREMULTIPLY_ALPHA_WEBGL||!1),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)):(this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,null),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,null),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.width,this.height,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)),S.trigger("update",this))}setFiltering(e={}){if(this.valid){e.filtering=e.filtering||"linear";var t=this.gl;this.bind(),g.isPowerOf2(this.width)&&g.isPowerOf2(this.height)?(this.power_of_2=!0,t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,e.TEXTURE_WRAP_S||e.repeat&&t.REPEAT||t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,e.TEXTURE_WRAP_T||e.repeat&&t.REPEAT||t.CLAMP_TO_EDGE),"mipmap"===e.filtering?(this.filtering="mipmap",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.generateMipmap(t.TEXTURE_2D)):"linear"===e.filtering?(this.filtering="linear",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):"nearest"===e.filtering&&(this.filtering="nearest",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST))):(this.power_of_2=!1,t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),"nearest"===e.filtering?(this.filtering="nearest",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)):(this.filtering="linear",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR))),S.trigger("update",this)}}calculateSprites(){if(this.sprites)for(let e in this.sprites){let t=this.sprites[e];this.texcoords[e]=S.getTexcoordsForSprite([t[0],t[1]],[t[2],t[3]],[this.width,this.height]),this.sizes[e]=[t[2],t[3]],this.css_sizes[e]=[t[2]/this.density,t[3]/this.density],this.aspects[e]=t[2]/t[3]}}byteSize(){return Math.round(this.width*this.height*4*("mipmap"==this.filtering?1.33:1))}}S.create=function(e,t,n){return new S(e,t,n)},S.retain=function(e){S.textures[e]&&S.textures[e].retain()},S.release=function(e){S.textures[e]&&S.textures[e].release()},S.destroy=function(e){Object.keys(S.textures).forEach(t=>{var n=S.textures[t];n.gl===e&&n.destroy({force:!0})})},S.getSpriteInfo=function(e,t){let n=S.textures[e];return n&&{size:n.sizes[t],css_size:n.css_sizes[t],aspect:n.aspects[t],texcoords:n.texcoords[t]}},S.getTexcoordsForSprite=function(e,t,n){var i=n[1]-e[1]-t[1];return[e[0]/n[0],i/n[1],(t[0]+e[0])/n[0],(t[1]+i)/n[1]]},S.createFromObject=function(e,t){let n=[];if(t)for(let i in t){let r=t[i];if(r.skip_create)continue;if(!S.changed(i,r))continue;let s=S.create(e,i,r);n.push(s.loading)}return Promise.all(n)},S.default="__default",S.createDefault=function(e){return S.create(e,S.default)},S.sliceOptions=function(e){return{filtering:e.filtering,sprites:e.sprites,url:e.url,element:e.element,data:e.data,width:e.width,height:e.height,density:e.density,repeat:e.repeat,TEXTURE_WRAP_S:e.TEXTURE_WRAP_S,TEXTURE_WRAP_T:e.TEXTURE_WRAP_T,UNPACK_FLIP_Y_WEBGL:e.UNPACK_FLIP_Y_WEBGL,UNPACK_PREMULTIPLY_ALPHA_WEBGL:e.UNPACK_PREMULTIPLY_ALPHA_WEBGL}},S.changed=function(e,t){let n=S.textures[e];if(n){if("element"===n.config_type||null!=t.element)return!0;if(t=S.sliceOptions(t),S.texture_configs[e]===JSON.stringify(Object.assign({name:e},t)))return!1}return!0},S.getInfo=function(e){if(e||(e=Object.keys(S.textures)),Array.isArray(e))return Promise.all(e.map(e=>S.getInfo(e)));var t=S.textures[e];return t?(t.loading||Promise.resolve(t)).then(()=>({name:t.name,width:t.width,height:t.height,density:t.density,css_size:[t.width/t.density,t.height/t.density],aspect:t.width/t.height,sprites:t.sprites,texcoords:t.texcoords,sizes:t.sizes,css_sizes:t.css_sizes,aspects:t.aspects,filtering:t.filtering,power_of_2:t.power_of_2,valid:t.valid})):Promise.resolve(null)},S.syncTexturesToWorker=function(e){return a.postMessage("Texture.getInfo",e).then(e=>(e&&e.filter(e=>e).forEach(e=>S.textures[e.name]=e),S.textures))},S.getMaxTextureSize=function(e){return e.getParameter(e.MAX_TEXTURE_SIZE)},S.textures={},S.texture_configs={},S.boundTexture=null,S.activeUnit=null,a.addTarget("Texture",S),T(S);var O={parseUniforms:function(e={}){var t=[];for(const[n,i]of Object.entries(e))if("number"==typeof i)t.push({type:"float",method:"1f",name:n,value:i,path:[n]});else if(Array.isArray(i)){if("number"==typeof i[0])i.length>=2&&i.length<=4?t.push({type:"vec"+i.length,method:i.length+"fv",name:n,value:i,path:[n]}):i.length>4&&t.push({type:"float[]",method:"1fv",name:n+"[0]",value:i,path:[n]});else if("string"==typeof i[0])for(let e=0;e<i.length;e++)t.push({type:"sampler2D",method:"1i",name:n+"["+e+"]",value:i[e],path:[n,e]});else if(Array.isArray(i[0])&&"number"==typeof i[0][0]&&i[0].length>=2&&i[0].length<=4)for(let e=0;e<i.length;e++)t.push({type:"vec"+i[0].length,method:i[0].length+"fv",name:n+"["+e+"]",value:i[e],path:[n,e]})}else"boolean"==typeof i?t.push({type:"bool",method:"1i",name:n,value:i,path:[n]}):"string"==typeof i&&t.push({type:"sampler2D",method:"1i",name:n,value:i,path:[n]});return t},defineVariable:function(e,t){var n,i;if("number"==typeof t)n="float";else if(Array.isArray(t))"number"==typeof t[0]?t.length>=2&&t.length<=4?n="vec"+t.length:(n="float",i=t.length):"string"==typeof t[0]?(n="sampler2D",i=t.length):Array.isArray(t[0])&&"number"==typeof t[0][0]&&t[0].length>=2&&t[0].length<=4&&(n="vec"+t[0].length,i=t.length);else if("boolean"==typeof t)n="bool";else{if("string"!=typeof t)return;n="sampler2D"}var r="";return r+=`${n} ${e}`,i&&(r+=`[${i}]`),r+";\n"},defineUniform:function(e,t){var n=O.defineVariable(e,t);if(n)return"uniform "+n},expandVec3:function(e,t=1){let n;if(Array.isArray(e)){if(2!==e.length)return e;n=[...e,t].map(parseFloat)}else n=[e,e,e].map(parseFloat);if(n&&n.every(e=>"number"==typeof e&&!isNaN(e)))return n},expandVec4:function(e,t=1){let n;if(Array.isArray(e)){if(3!==e.length)return e;n=[...e,t].map(parseFloat)}else n=[e,e,e,t].map(parseFloat);if(n&&n.every(e=>"number"==typeof e&&!isNaN(e)))return n}};let P=[];function C(e,t){let n=P.filter(t=>t[0]===e)[0];return n=n&&n[1],n||(P.push([e,{}]),n=P[P.length-1][1]),n[t]||(n[t]=e.getExtension(t)),n[t]}function R(e){var t,n,i=0;if(0===e.length)return i;for(t=0,n=e.length;t<n;t++)i=(i<<5)-i+e.charCodeAt(t),i|=0;return i}function M(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var L,N,z=(N||(N=1,L=function(e){e=String(e);for(var t,n=[];t=e.match(/ERROR\:([^\n]+)/);){e=e.slice(t.index+1);var i=(o=t[1].trim()).split(":"),r=i.slice(2).join(":").trim(),s=parseInt(i[0],10),o=parseInt(i[1],10);n.push({message:r,file:s,line:o})}return n}),L),D=M(z);const I=/^\s*#pragma.*$/gm,F=/\\\s*\n/gm;class j{constructor(e,t,n,i){i=i||{},this.gl=e,this.program=null,this.compiled=!1,this.compiling=!1,this.error=null,this.defines=Object.assign({},i.defines||{}),this.blocks=Object.assign({},i.blocks||{}),this.block_scopes=Object.assign({},i.block_scopes||{}),this.extensions=i.extensions||[],this.dependent_uniforms=i.uniforms,this.uniforms={},this.attribs={},this.vertex_source=t,this.fragment_source=n,this.id=j.id++,this.name=i.name}destroy(){this.gl.useProgram(null),this.gl.deleteProgram(this.program),this.program=null,this.uniforms={},this.attribs={},this.compiled=!1}use(){this.compiled&&(j.current!==this&&this.gl.useProgram(this.program),j.current=this)}compile(){if(this.compiling)throw new Error(`ShaderProgram.compile(): skipping for ${this.id} (${this.name}) because already compiling`);this.compiling=!0,this.compiled=!1,this.error=null,this.computed_vertex_source=this.vertex_source,this.computed_fragment_source=this.fragment_source;let e=this.checkExtensions();var t,n=this.buildDefineList(),i=this.buildShaderBlockList();for(var r in i){var s=i[r];if(s&&(!Array.isArray(s)||0!==s.length)){t=new RegExp("^\\s*#pragma\\s+tangram:\\s+"+r+"\\s*$","m");var o=this.computed_vertex_source.match(t),a=this.computed_fragment_source.match(t);if(null!=o||null!=a){var l="";s.forEach(e=>{let t=`${e.scope}, ${e.key}, ${e.num}`;l+=`\n// tangram-block-start: ${t}\n`,l+=e.source,l+=`\n// tangram-block-end: ${t}\n`}),null!=o&&(this.computed_vertex_source=this.computed_vertex_source.replace(t,l)),null!=a&&(this.computed_fragment_source=this.computed_fragment_source.replace(t,l)),n["TANGRAM_BLOCK_"+r.replace(/[\s-]+/g,"_").toUpperCase()]=!0}}}this.computed_vertex_source=this.computed_vertex_source.replace(I,""),this.computed_fragment_source=this.computed_fragment_source.replace(I,""),this.ensureUniforms(this.dependent_uniforms);let u="",c=this.gl.getShaderPrecisionFormat(this.gl.FRAGMENT_SHADER,this.gl.HIGH_FLOAT);u=c&&c.precision>0?"precision highp float;\n":"precision mediump float;\n",n.TANGRAM_VERTEX_SHADER=!0,n.TANGRAM_FRAGMENT_SHADER=!1,this.computed_vertex_source=u+j.buildDefineString(n)+this.computed_vertex_source,n.TANGRAM_VERTEX_SHADER=!1,n.TANGRAM_FRAGMENT_SHADER=!0,this.computed_fragment_source=j.buildExtensionString(e)+u+j.buildDefineString(n)+this.computed_fragment_source,this.computed_vertex_source=this.computed_vertex_source.replace(F,""),this.computed_fragment_source=this.computed_fragment_source.replace(F,"");try{this.program=j.updateProgram(this.gl,this.program,this.computed_vertex_source,this.computed_fragment_source),this.compiled=!0,this.compiling=!1}catch(e){throw this.program=null,this.compiled=!1,this.compiling=!1,this.error=e,this.error.vertex_shader_source=this.computed_vertex_source,this.error.fragment_shader_source=this.computed_fragment_source,"vertex"!==e.type&&"fragment"!==e.type||(this.shader_errors=e.errors,this.shader_errors.forEach(t=>{t.type=e.type,t.block=this.block(e.type,t.line),t.line=this.block(e.type,t.line)}),this.error.shader_errors=this.shader_errors),e}this.computed_vertex_source=null,this.computed_fragment_source=null,this.use(),this.refreshUniforms(),this.refreshAttributes()}buildDefineList(){var e,t={};for(e in j.defines)t[e]=j.defines[e];for(e in this.defines)t[e]=this.defines[e];return t}buildShaderBlockList(){let e,t={};for(e in j.blocks)t[e]=[],Array.isArray(j.blocks[e])?t[e].push(...j.blocks[e].map((t,n)=>({key:e,source:t,num:n,scope:"ShaderProgram"}))):t[e]=[{key:e,source:j.blocks[e],num:0,scope:"ShaderProgram"}];for(e in this.blocks)if(t[e]=t[e]||[],Array.isArray(this.blocks[e])){let n=this.block_scopes&&this.block_scopes[e]||[],i=null,r=0;for(let s=0;s<this.blocks[e].length;s++)n[s]!==i&&(i=n[s],r=0),t[e].push({key:e,source:this.blocks[e][s],num:r,scope:i||this.name}),r++}else t[e].push({key:e,source:this.blocks[e],num:0,scope:this.name});return t}ensureUniforms(e){if(!e)return;const t=Object.entries(e).map(([e,t])=>O.defineUniform(e,t)).filter(e=>e);this.computed_vertex_source=t.join("\n")+this.computed_vertex_source,this.computed_fragment_source=t.join("\n")+this.computed_fragment_source}setUniforms(e,t=!0){this.compiled&&(t&&(this.texture_unit=0),O.parseUniforms(e).forEach(({name:e,type:t,value:n,method:i})=>{"sampler2D"===t?this.setTextureUniform(e,n):this.uniform(i,e,n)}))}saveUniforms(e){let t=e||this.uniforms;for(let e in t){let t=this.uniforms[e];t&&(t.saved_value=t.value)}this.saved_texture_unit=this.texture_unit||0}restoreUniforms(e){let t=e||this.uniforms;for(let e in t){let t=this.uniforms[e];t&&t.saved_value&&(t.value=t.saved_value,this.updateUniform(t))}this.texture_unit=this.saved_texture_unit||0}setTextureUniform(e,t){var n=S.textures[t];null!=n?(n.bind(this.texture_unit),this.uniform("1i",e,this.texture_unit),this.texture_unit++):_("warn",`Cannot find texture '${t}'`)}uniform(e,t,n){if(!this.compiled)return;this.uniforms[t]=this.uniforms[t]||{};let i=this.uniforms[t];i.name=t,void 0===i.location&&(i.location=this.gl.getUniformLocation(this.program,t)),i.method=e,i.value=n,this.updateUniform(i)}updateUniform(e){this.compiled&&e&&null!=e.location&&(this.use(),this.commitUniform(e))}commitUniform(e){let t=e.location,n=e.value;switch(e.method){case"1i":this.gl.uniform1i(t,n);break;case"1f":this.gl.uniform1f(t,n);break;case"2f":this.gl.uniform2f(t,n[0],n[1]);break;case"3f":this.gl.uniform3f(t,n[0],n[1],n[2]);break;case"4f":this.gl.uniform4f(t,n[0],n[1],n[2],n[3]);break;case"1iv":this.gl.uniform1iv(t,n);break;case"3iv":this.gl.uniform3iv(t,n);break;case"1fv":this.gl.uniform1fv(t,n);break;case"2fv":this.gl.uniform2fv(t,n);break;case"3fv":this.gl.uniform3fv(t,n);break;case"4fv":this.gl.uniform4fv(t,n);break;case"Matrix3fv":this.gl.uniformMatrix3fv(t,!1,n);break;case"Matrix4fv":this.gl.uniformMatrix4fv(t,!1,n)}}refreshUniforms(){if(this.compiled)for(var e in this.uniforms){let t=this.uniforms[e];t.location=this.gl.getUniformLocation(this.program,e),this.updateUniform(t)}}refreshAttributes(){this.attribs={}}attribute(e){if(this.compiled){var t=this.attribs[e]=this.attribs[e]||{};return null!=t.location||(t.name=e,t.location=this.gl.getAttribLocation(this.program,e)),t}}source(e){return"vertex"===e?this.computed_vertex_source:"fragment"===e?this.computed_fragment_source:void 0}lines(e){let t=this.source(e);return t?t.split("\n"):[]}line(e,t){let n=this.lines(e);if(n)return n[t]}block(e,t){let n,i=this.lines(e);for(let e=0;e<t&&e<i.length;e++){let t=i[e],r=t.match(/\/\/ tangram-block-start: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/);r&&r.length>1?n={scope:r[1],name:r[2],num:r[3]}:(r=t.match(/\/\/ tangram-block-end: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/),r&&r.length>1&&(n=null)),n&&(n.line=null==n.line?-1:n.line+1,n.source=t)}return n}checkExtensions(){let e=[];return this.extensions.forEach(t=>{let n=C(this.gl,t),i=`TANGRAM_EXTENSION_${t}`;this.defines[i]=null!=n,n?e.push(t):_("debug",`Could not enable extension '${t}'`)}),e}}j.id=0,j.current=null,j.defines={},j.blocks={},j.reset=function(){j.programs_by_source={},j.shaders_by_source={}},j.reset(),j.buildDefineString=function(e){var t="";for(var n in e)null!=e[n]&&!1!==e[n]&&("boolean"==typeof e[n]&&!0===e[n]?t+="#define "+n+"\n":"number"==typeof e[n]&&Math.floor(e[n])===e[n]?t+="#define "+n+" "+e[n].toFixed(1)+"\n":t+="#define "+n+" "+e[n]+"\n");return t},j.buildExtensionString=function(e){let t="";return(e=e||[]).forEach(e=>{t+=`#ifdef GL_${e}\n#extension GL_${e} : enable\n#endif\n`}),t},j.addBlock=function(e,...t){j.blocks[e]=j.blocks[e]||[],j.blocks[e].push(...t)},j.removeBlock=function(e){j.blocks[e]=[]},j.replaceBlock=function(e,...t){j.removeBlock(e),j.addBlock(e,...t)},j.updateProgram=function(e,t,n,i){let r=R(e._tangram_id+"::"+n+"::"+i);if(j.programs_by_source[r])return _("trace","Reusing identical source GL program object"),j.programs_by_source[r];var s=j.createShader(e,n,e.VERTEX_SHADER),o=j.createShader(e,i,e.FRAGMENT_SHADER);if(e.useProgram(null),null!=t)for(var a=e.getAttachedShaders(t),l=0;l<a.length;l++)e.detachShader(t,a[l]);else t=e.createProgram();if(null==s||null==o)return t;if(e.attachShader(t,s),e.attachShader(t,o),e.bindAttribLocation(t,0,"a_position"),e.linkProgram(t),!e.getProgramParameter(t,e.LINK_STATUS)){let r=new Error(`WebGL program error:\n VALIDATE_STATUS: ${e.getProgramParameter(t,e.VALIDATE_STATUS)}\n ERROR: ${e.getError()}\n --- Vertex Shader ---\n ${n}\n --- Fragment Shader ---\n ${i}`);throw Object.assign(new Error(r),{type:"program"})}return j.programs_by_source[r]=t,t},j.createShader=function(e,t,n){let i=R(e._tangram_id+"::"+t);if(j.shaders_by_source[i])return _("trace","Reusing identical source GL shader object"),j.shaders_by_source[i];let r=e.createShader(n);if(e.shaderSource(r,t),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS)){let t=n===e.VERTEX_SHADER?"vertex":"fragment",i=e.getShaderInfoLog(r),s=D(i);throw Object.assign(new Error(i),{type:t,errors:s})}return j.shaders_by_source[i]=r,r};var B,U={disabled:!1,bound_vao:[],init(e){let t;!0!==this.disabled&&(t=C(e,"OES_vertex_array_object")),null!=t?_("info","Vertex Array Object extension available"):!0!==this.disabled?_("warn","Vertex Array Object extension NOT available"):_("warn","Vertex Array Object extension force disabled")},getExtension(e,t){if(!0!==this.disabled)return C(e,t)},create(e,t,n){let i={};i.setup=t,i.teardown=n;let r=this.getExtension(e,"OES_vertex_array_object");return null!=r&&(i._vao=r.createVertexArrayOES(),r.bindVertexArrayOES(i._vao)),i.setup(),i},getCurrentBinding(e){let t=this.bound_vao.filter(t=>t[0]===e)[0];return t&&t[1]},setCurrentBinding(e,t){let n=this.bound_vao,i=n.filter(t=>t[0]===e)[0];null==i?n.push([e,t]):i[1]=t},bind(e,t){let n=this.getExtension(e,"OES_vertex_array_object");if(null!=t)null!=n&&null!=t._vao?(n.bindVertexArrayOES(t._vao),this.setCurrentBinding(e,t)):t.setup();else{let t=this.getCurrentBinding(e);null!=n?n.bindVertexArrayOES(null):null!=t&&"function"==typeof t.teardown&&t.teardown(),this.setCurrentBinding(e,null)}},destroy(e,t){let n=this.getExtension(e,"OES_vertex_array_object");null!=n&&null!=t&&null!=t._vao&&(n.deleteVertexArrayOES(t._vao),t._vao=null)}};function V(e,...t){for(let n=0;n<t.length;n++){let i=t[n];if(i)for(let t in i){let n=i[t];null===n||"object"!=typeof n||Array.isArray(n)?void 0!==n&&(e[t]=n):null===e[t]||"object"!=typeof e[t]||Array.isArray(e[t])?e[t]=V({},n):e[t]=V(e[t],n)}}return e}var G=B={};B.default_source_max_zoom=18,B.default_view_max_zoom=20,B.max_style_zoom=25,B.tile_size=256,B.half_circumference_meters=20037508.342789244,B.circumference_meters=2*B.half_circumference_meters,B.min_zoom_meters_per_pixel=B.circumference_meters/B.tile_size;let $=[];B.metersPerPixel=function(e){return $[e]=$[e]||B.min_zoom_meters_per_pixel/Math.pow(2,e),$[e]};let Z=[];B.metersPerTile=function(e){return Z[e]=Z[e]||B.circumference_meters/Math.pow(2,e),Z[e]},B.tile_scale=4096,B.units_per_pixel=B.tile_scale/B.tile_size,B.height_scale=16;let q=[];B.unitsPerMeter=function(e){return q[e]=q[e]||B.tile_scale/(B.tile_size*B.metersPerPixel(e)),q[e]},B.metersForTile=function(e){return{x:e.x*B.circumference_meters/Math.pow(2,e.z)-B.half_circumference_meters,y:-(e.y*B.circumference_meters/Math.pow(2,e.z)-B.half_circumference_meters)}},B.tileForMeters=function([e,t],n){return{x:Math.floor((e+B.half_circumference_meters)/(B.circumference_meters/Math.pow(2,n))),y:Math.floor((-t+B.half_circumference_meters)/(B.circumference_meters/Math.pow(2,n))),z:n}},B.wrapTile=function({x:e,y:t,z:n},i={x:!0,y:!1}){var r=(1<<n)-1;return i.x&&(e&=r),i.y&&(t&=r),{x:e,y:t,z:n}},B.metersToLatLng=function(e){return e[0]/=B.half_circumference_meters,e[1]/=B.half_circumference_meters,e[1]=(2*Math.atan(Math.exp(e[1]*Math.PI))-Math.PI/2)/Math.PI,e[0]*=180,e[1]*=180,e},B.latLngToMeters=function(e){return e[1]=Math.log(Math.tan(e[1]*Math.PI/360+Math.PI/4))/Math.PI,e[1]*=B.half_circumference_meters,e[0]*=B.half_circumference_meters/180,e},B.tileSpaceToLatlng=function(e,t,n){const i=B.unitsPerMeter(t);return B.transformGeometry(e,e=>{e[0]=e[0]/i+n.x,e[1]=e[1]/i+n.y,B.metersToLatLng(e)}),e},B.copyGeometry=function(e){if(null==e)return;let t={type:e.type};return"Point"===e.type?t.coordinates=[e.coordinates[0],e.coordinates[1]]:"LineString"===e.type||"MultiPoint"===e.type?t.coordinates=e.coordinates.map(e=>[e[0],e[1]]):"Polygon"===e.type||"MultiLineString"===e.type?t.coordinates=e.coordinates.map(e=>e.map(e=>[e[0],e[1]])):"MultiPolygon"===e.type&&(t.coordinates=e.coordinates.map(e=>e.map(e=>e.map(e=>[e[0],e[1]])))),t},B.transformGeometry=function(e,t){null!=e&&("Point"===e.type?t(e.coordinates):"LineString"===e.type||"MultiPoint"===e.type?e.coordinates.forEach(t):"Polygon"===e.type||"MultiLineString"===e.type?e.coordinates.forEach(e=>e.forEach(t)):"MultiPolygon"===e.type&&e.coordinates.forEach(e=>{e.forEach(e=>e.forEach(t))}))},B.boxIntersect=function(e,t){return!(t.sw.x>e.ne.x||t.ne.x<e.sw.x||t.sw.y>e.ne.y||t.ne.y<e.sw.y)},B.findBoundingBox=function(e){for(var t=1/0,n=-1/0,i=1/0,r=-1/0,s=e[0].length,o=0;o<s;o++){var a=e[0][o];a[0]<t&&(t=a[0]),a[1]<i&&(i=a[1]),a[0]>n&&(n=a[0]),a[1]>r&&(r=a[1])}return[t,i,n,r]},B.geometryType=function(e){return"Polygon"===e||"MultiPolygon"===e?"polygon":"LineString"===e||"MultiLineString"===e?"line":"Point"===e||"MultiPoint"===e?"point":void 0},B.centroid=function(e,t=!0){if(!e||0===e.length)return;let n,i=0,r=0,s=0,o=e[0],a=o.length;t&&(n=o[0],o=o.map(e=>[e[0]-n[0],e[1]-n[1]]));for(let e=0,t=a-1;e<a;t=e,e++){let n=o[e],a=o[t],l=n[1]*a[0]-a[1]*n[0];i+=(n[0]+a[0])*l,r+=(n[1]+a[1])*l,s+=3*l}if(!s)return;let l=[i/s,r/s];return t&&(l[0]+=n[0],l[1]+=n[1]),l},B.multiCentroid=function(e){let t=0,n=null;for(let i=0;i<e.length;i++){let r=B.centroid(e[i]);r&&(n=n||[0,0],n[0]+=r[0],n[1]+=r[1],t++)}return t>0&&(n[0]/=t,n[1]/=t),n},B.signedPolygonRingAreaSum=function(e){let t=0,n=e.length;for(let i=0;i<n-1;i++){let n=e[i],r=e[i+1];t+=n[0]*r[1]-r[0]*n[1]}return t+=e[n-1][0]*e[0][1]-e[0][0]*e[n-1][1],t},B.polygonRingArea=function(e){return Math.abs(B.signedPolygonRingAreaSum(e))/2},B.polygonArea=function(e){if(e)return B.polygonRingArea(e[0])},B.multiPolygonArea=function(e){let t=0;for(let n=0;n<e.length;n++)t+=B.polygonArea(e[n]);return t},B.ringWinding=function(e){let t=B.signedPolygonRingAreaSum(e);return t>0?"CW":t<0?"CCW":void 0};const W={functions:{},num_functions:0,num_cached:0};function H(e,t){if("string"==typeof e)e=K(e,t);else if(null!=e&&"object"==typeof e)for(let n in e)e[n]=H(e[n],t);return e}function K(e,t){let n="string"==typeof e&&e.match(/^\s*function[^(]*\(([^)]*)\)\s*?\{([\s\S]*)\}$/m);if(n&&n.length>2)try{const e=n[2],i="function"==typeof t?t(e):e,r=R(i);if(void 0===W.functions[r]){let t=n[1].length>0&&n[1].split(",").map(e=>e.trim()).filter(e=>e);t=t.length>0?t:["context"],W.functions[r]=new Function(t.toString(),i),W.functions[r].source=e,W.num_functions++}else W.num_cached++;return W.functions[r]}catch(t){return e}return e}var Y,X={},Q=M(function(){if(Y)return X;Y=1;var e={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function t(e){return(e=Math.round(e))<0?0:e>255?255:e}function n(e){return e<0?0:e>1?1:e}function i(e){return"%"===e[e.length-1]?t(parseFloat(e)/100*255):t(parseInt(e))}function r(e){return"%"===e[e.length-1]?n(parseFloat(e)/100):n(parseFloat(e))}function s(e,t,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?e+(t-e)*n*6:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e}try{X.parseCSSColor=function(n){var o,a=n.replace(/ /g,"").toLowerCase();if(a in e)return e[a].slice();if("#"===a[0])return 4===a.length?(o=parseInt(a.substr(1),16))>=0&&o<=4095?[(3840&o)>>4|(3840&o)>>8,240&o|(240&o)>>4,15&o|(15&o)<<4,1]:null:7===a.length&&(o=parseInt(a.substr(1),16))>=0&&o<=16777215?[(16711680&o)>>16,(65280&o)>>8,255&o,1]:null;var l=a.indexOf("("),u=a.indexOf(")");if(-1!==l&&u+1===a.length){var c=a.substr(0,l),h=a.substr(l+1,u-(l+1)).split(","),d=1;switch(c){case"rgba":if(4!==h.length)return null;d=r(h.pop());case"rgb":return 3!==h.length?null:[i(h[0]),i(h[1]),i(h[2]),d];case"hsla":if(4!==h.length)return null;d=r(h.pop());case"hsl":if(3!==h.length)return null;var f=(parseFloat(h[0])%360+360)%360/360,p=r(h[1]),m=r(h[2]),_=m<=.5?m*(p+1):m+p-m*p,g=2*m-_;return[t(255*s(g,_,f+1/3)),t(255*s(g,_,f)),t(255*s(g,_,f-1/3)),d];default:return null}}return null}}catch(e){}return X}());const J={},ee=e=>Math.max(e,0),te=e=>isNaN(e)?0:e,ne=e=>Array.isArray(e)?e.map(parseFloat).map(te):te(parseFloat(e)),ie=e=>Array.isArray(e)?e.map(ne).map(ee):ee(ne(e));Object.assign(J,{clampPositive:ee,noNaN:te,parseNumber:ne,parsePositiveNumber:ie}),J.wrapFunction=function(e){return`\n var feature = context.feature.properties;\n var global = context.global;\n var $zoom = context.zoom;\n var $layer = context.layer;\n var $source = context.source;\n var $geometry = context.geometry;\n var $meters_per_pixel = context.meters_per_pixel;\n var $id = context.id;\n\n var val = (function(){ ${e} }());\n\n if (typeof val === 'number' && isNaN(val)) {\n val = null; // convert NaNs to nulls\n }\n\n return val;\n `},J.zeroPair=Object.freeze([0,0]),J.defaults={color:[1,1,1,1],width:1,size:1,extrude:!1,height:20,min_height:0,order:0,z:0,outline:{color:[0,0,0,0],width:0},material:{ambient:1,diffuse:1}},J.macros={"Style.color.pseudoRandomColor":function(){return[parseInt(feature.id,16)/100%1*.7,parseInt(feature.id,16)/1e4%1*.7,parseInt(feature.id,16)/1e6%1*.7,1]},"Style.color.randomColor":function(){return[.7*Math.random(),.7*Math.random(),.7*Math.random(),1]}},J.getFeatureParseContext=function(e,t,n){return{feature:e,id:e.id,tile:t,global:n,zoom:t.style_z,geometry:G.geometryType(e.geometry.type),meters_per_pixel:t.meters_per_pixel,meters_per_pixel_sq:t.meters_per_pixel_sq,units_per_meter_overzoom:t.units_per_meter_overzoom}};const re={STATIC:0,DYNAMIC:1,ZOOM:2};J.CACHE_TYPE=re,J.createPropertyCache=function(e,t=null,n=null){if(null==e)return;if(e.value)return{value:e.value,zoom:e.zoom?{}:null,type:e.type};let i={value:e,type:re.STATIC};return Array.isArray(i.value)&&Array.isArray(i.value[0])?(i.zoom={},i.type=re.ZOOM):"function"==typeof i.value&&(i.type=re.DYNAMIC,i.dynamic_transform="function"==typeof n?n:null),"function"==typeof t&&(i.zoom?i.value=i.value.map((e,n)=>[e[0],t(e[1],n)]):"function"!=typeof i.value&&(i.value=t(i.value,0))),i},J.createColorPropertyCache=function(e){return J.createPropertyCache(e,e=>"Style.color.pseudoRandomColor"===e?K(J.wrapFunction(J.macros["Style.color.pseudoRandomColor"])):"Style.color.randomColor"===e?J.macros["Style.color.randomColor"]:e)};const se=e=>"string"==typeof e&&"%"===e[e.length-1],oe=e=>"auto"===e,ae=e=>se(e)||oe(e),le="'size' can specify either width or height as derived from aspect ratio, but not both";function ue(e,t){return J.createPropertyCache(e.value,(n,i)=>(Array.isArray(n)?(n=n.map((t,n)=>e.has_ratio[i][n]?t:ie(t)).map((n,r)=>e.has_pct[i][r]?t.css_size[r]*n/100:n),e.has_ratio[i][0]?n[0]=n[1]*t.aspect:e.has_ratio[i][1]&&(n[1]=n[0]/t.aspect)):(n=ie(n),n=e.has_pct[i]?t.css_size.map(e=>e*n/100):[n,n]),n))}function ce(e,t){try{return e(t)}catch(n){_("warn",`Property function in layer '${t.layers[t.layers.length-1]}' failed with\n`,`error ${n.stack}\n`,`function '${e.source}'\n`,t.feature,t)}}J.createPointSizePropertyCache=function(e,t){let n=null,i=null;if(se(e))n=[!0];else if(Array.isArray(e)){if(Array.isArray(e[0])){if(e.some(e=>Array.isArray(e[1])?e[1].some(e=>ae(e)):se(e[1]))&&(n=e.map(e=>Array.isArray(e[1])?e[1].map(e=>se(e)):se(e[1])),i=e.map(e=>Array.isArray(e[1])&&e[1].map(e=>oe(e))),i.some(e=>Array.isArray(e)&&e.every(e=>e))))throw le}else if(e.some(ae)&&(n=[e.map(se)],i=[e.map(oe)],i[0].every(e=>e)))throw le}else if(oe(e))throw"this value only allowed as half of an array, eg [16px, auto]:";if(n||i){if(!t)throw"% or 'auto' keywords can only be used to specify point size when a texture is defined";(e={value:e}).has_pct=n,e.has_ratio=i,e.sprites={}}else e=J.createPropertyCache(e,ie);return e},J.evalCachedPointSizeProperty=function(e,t,n,i){if(null!=e)return e.has_pct||e.has_ratio?t?(e.sprites[t.sprite]||(e.sprites[t.sprite]=ue(e,t)),J.evalCachedProperty(e.sprites[t.sprite],i)):(e.texture=e.texture||ue(e,n),J.evalCachedProperty(e.texture,i)):J.evalCachedProperty(e,i)},J.evalCachedProperty=function(e,t){return null==e?void 0:e.dynamic?ce(e.dynamic,t):e.static?e.static:e.zoom&&e.zoom[t.zoom]?e.zoom[t.zoom]:"function"==typeof e.value?(e.dynamic_transform?e.dynamic=function(t){return e.dynamic_transform(e.value(t))}:e.dynamic=e.value,ce(e.dynamic,t)):Array.isArray(e.value)&&Array.isArray(e.value[0])?(e.zoom=e.zoom||{},e.zoom[t.zoom]=g.interpolate(t.zoom,e.value),e.zoom[t.zoom]):(e.static=e.value,e.static)},J.convertUnits=function(e,t){if(null!=e.value)return"px"===e.units?e.value*G.metersPerPixel(t.zoom):e.value;if("string"==typeof e)"px"===e.trim().slice(-2)?(e=ne(e),e*=G.metersPerPixel(t.zoom)):e=ne(e);else if(Array.isArray(e))return Array.isArray(e[0])?e.map(e=>[e[0],J.convertUnits(e[1],t)]):e.map(e=>J.convertUnits(e,t));return e},J.parseUnits=function(e){var t={value:ne(e)};return 0!==t.value&&"string"==typeof e&&"px"===e.trim().slice(-2)&&(t.units="px"),t},J.evalCachedDistanceProperty=function(e,t){return null==e?void 0:e.dynamic?ce(e.dynamic,t):e.zoom&&e.zoom[t.zoom]?e.zoom[t.zoom]:"function"==typeof e.value?(e.dynamic=e.value,ce(e.dynamic,t)):e.zoom?(e.zoom[t.zoom]=g.interpolate(t.zoom,e.value,e=>J.convertUnits(e,t)),e.zoom[t.zoom]):J.convertUnits(e.value,t)},J.string_colors={},J.colorForString=function(e){if(J.string_colors[e])return J.string_colors[e];let t=Q.parseCSSColor(e);return t&&4===t.length?(t[0]/=255,t[1]/=255,t[2]/=255):t=J.defaults.color,J.string_colors[e]=t,t},J.evalCachedColorProperty=function(e,t={}){if(null!=e){if(e.dynamic){let n=ce(e.dynamic,t);return"string"==typeof n&&(n=J.colorForString(n)),n&&null==n[3]&&(n[3]=1),n}if(e.static)return e.static;if(e.zoom&&e.zoom[t.zoom])return e.zoom[t.zoom];if("function"==typeof e.value){e.dynamic=e.value;let n=ce(e.dynamic,t);return"string"==typeof n&&(n=J.colorForString(n)),n&&null==n[3]&&(n[3]=1),n}if("string"==typeof e.value)return e.static=J.colorForString(e.value),e.static;if(e.zoom){if(!e.zoom_preprocessed){for(let t=0;t<e.value.length;t++){let n=e.value[t];n&&"string"==typeof n[1]&&(n[1]=J.colorForString(n[1]))}e.zoom_preprocessed=!0}return e.zoom[t.zoom]=g.interpolate(t.zoom,e.value),e.zoom[t.zoom][3]=e.zoom[t.zoom][3]||1,e.zoom[t.zoom]}return e.static=e.value.map(e=>e),e.static&&null==e.static[3]&&(e.static[3]=1),e.static}},J.evalCachedColorPropertyWithAlpha=function(e,t,n){const i=J.evalCachedColorProperty(e,n);if(null!=i&&null!=t){const e=J.evalCachedProperty(t,n);if(null!=e)return[i[0],i[1],i[2],e]}return i},J.parseColor=function(e,t={}){if("function"==typeof e&&(e=ce(e,t)),"string"==typeof e)e=J.colorForString(e);else if(Array.isArray(e)&&Array.isArray(e[0])){for(let t=0;t<e.length;t++){let n=e[t];"string"==typeof n[1]&&(n[1]=J.colorForString(n[1]))}t.zoom&&(e=g.interpolate(t.zoom,e))}return Array.isArray(e)?null==(e=e.map(e=>e))[3]&&(e[3]=1):e=[0,0,0,1],e},J.calculateOrder=function(e,t){return"function"==typeof e?e=ce(e,t):"string"==typeof e&&(e=t.feature.properties[e]?t.feature.properties[e]:ie(e)),e},J.evalProperty=function(e,t){return"function"==typeof e?ce(e,t):e};class he{constructor(e,t,n){this.gl=e,this.workers=t,this._lock_fn="function"==typeof n&&n,this.init()}init(){this.requests={},this.feature=null,this.read_delay=0,this.read_delay_timer=null,this.pixels=null,this.fbo=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.fbo_size={width:256,height:256};var e=S.create(this.gl,"__selection_fbo",{filtering:"nearest"});e.setData(this.fbo_size.width,this.fbo_size.height,null,{filtering:"nearest"}),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,e.texture,0);var t=this.gl.createRenderbuffer();this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,t),this.gl.renderbufferStorage(this.gl.RENDERBUFFER,this.gl.DEPTH_COMPONENT16,this.fbo_size.width,this.fbo_size.height),this.gl.framebufferRenderbuffer(this.gl.FRAMEBUFFER,this.gl.DEPTH_ATTACHMENT,this.gl.RENDERBUFFER,t),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null)}destroy(){this.gl&&this.fbo&&(this.gl.deleteFramebuffer(this.fbo),this.fbo=null,this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null))}get locked(){return this._lock_fn&&this._lock_fn()||!1}bind(){this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.gl.viewport(0,0,this.fbo_size.width,this.fbo_size.height),this.gl.clearColor(...he.defaultColor)}getFeatureAt(e,{radius:t}){return!e||e.x<0||e.y<0||e.x>1||e.y>1?Promise.resolve({feature:null,changed:!1}):new Promise((n,i)=>{this.selection_request_id=this.selection_request_id+1||0,this.requests[this.selection_request_id]={id:this.selection_request_id,point:e,radius:t,resolve:n,reject:i}})}pendingRequests(){return Object.keys(this.requests).length?this.requests:null}hasPendingRequests(){return null!=this.pendingRequests()}clearPendingRequests(){for(var e in this.requests){var t=this.requests[e];t.sent||(t.reject({request:t}),delete this.requests[e])}}read(){null!=this.read_delay_timer&&clearTimeout(this.read_delay_timer),this.read_delay_timer=setTimeout(()=>{if(!this.locked){var e=this.gl;for(var t in e.bindFramebuffer(e.FRAMEBUFFER,this.fbo),this.requests){var n=this.requests[t];if(n.sent)continue;let i,r,s=255,{point:o,radius:l}=n;if(l){let e=Math.min(this.fbo_size.width,this.fbo_size.height);r={x:Math.min(Math.ceil(2*l.x*this.fbo_size.width),e),y:Math.min(Math.ceil(2*l.y*this.fbo_size.height),e)}}else l={x:0,y:0},r={x:1,y:1};if((null==this.pixels||this.pixels.byteLength<r.x*r.y*4)&&(this.pixels=new Uint8Array(r.x*r.y*4)),this.pixels.fill instanceof Function)this.pixels.fill(0);else for(let e=0;e<this.pixels.length;e++)this.pixels[e]=0;e.readPixels(Math.round((o.x-l.x)*this.fbo_size.width),Math.round((1-o.y-l.y)*this.fbo_size.height),r.x,r.y,e.RGBA,e.UNSIGNED_BYTE,this.pixels);let u=4*(Math.round(r.y/2)*r.x+Math.round(r.x/2)),c=this.pixels[u]+(this.pixels[u+1]<<8)+(this.pixels[u+2]<<16);if(c>0)i=c+(this.pixels[u+3]<<24)>>>0,s=this.pixels[u+3];else{let e=-1>>>0;u=0;for(let t=0;t<r.y;t++)for(let n=0;n<r.x;n++,u+=4)if(c=this.pixels[u]+(this.pixels[u+1]<<8)+(this.pixels[u+2]<<16),c>0){let o=(n-r.x/2)*(n-r.x/2)+(t-r.y/2)*(t-r.y/2);o<=e&&(i=c+(this.pixels[u+3]<<24)>>>0,s=this.pixels[u+3],e=o)}}255!==s?null!=this.workers[s]&&a.postMessage(this.workers[s],"self.getFeatureSelection",{id:n.id,key:i}).then(e=>{this.finishRead(e)}):this.finishRead({id:n.id}),n.sent=!0}e.bindFramebuffer(e.FRAMEBUFFER,null)}},this.read_delay)}finishRead(e){var t=this.requests[e.id];if(t){var n=e.feature,i=!1;(null!=n&&null==this.feature||null==n&&null!=this.feature||null!=n&&null!=this.feature&&JSON.stringify(n)!==JSON.stringify(this.feature))&&(i=!0),this.feature=n,t.resolve({feature:n,changed:i,request:t}),delete this.requests[e.id]}else _("error","FeatureSelection.finishRead(): could not find message",e)}static makeEntry(e){this.map_entry++;var t=255&this.map_entry,n=this.map_entry>>8&255,i=this.map_entry>>16&255,r=this.map_prefix,s=t/255,o=n/255,a=i/255,l=r/255,u=t+(n<<8)+(i<<16)+(r<<24)>>>0;return this.map[u]={color:[s,o,a,l]},this.map_size++,this.tiles[e.key]||(this.tiles[e.key]={entries:[],tile:{key:e.key,coords:e.coords,style_z:e.style_z,source:e.source,generation:e.generation}}),this.tiles[e.key].entries.push(u),this.map[u]}static makeColor(e,t,n){var i=this.makeEntry(t);return i.feature={id:e.id,properties:e.properties,source_name:n.source,source_layer:n.layer,layers:n.layers,tile:this.tiles[t.key].tile},i.color}static reset(e){Array.isArray(e)?e.forEach(e=>this.clearSource(e)):(this.tiles={},this.map={},this.map_size=0,this.map_entry=0)}static clearSource(e){for(let t in this.tiles)this.tiles[t].tile.source===e&&this.clearTile(t)}static clearTile(e){this.tiles[e]&&(this.tiles[e].entries.forEach(e=>delete this.map[e]),this.map_size-=this.tiles[e].entries.length,delete this.tiles[e])}static getMapSize(){return this.map_size}static setPrefix(e){this.map_prefix=e}}var de;he.map={},he.tiles={},he.map_size=0,he.map_entry=0,he.map_prefix=0,he.defaultColor=[0,0,0,1];var fe=de={};de.BYTE=5120,de.UNSIGNED_BYTE=5121,de.SHORT=5122,de.UNSIGNED_SHORT=5123,de.INT=5124,de.UNSIGNED_INT=5125,de.FLOAT=5126;class pe{constructor(e,t,n,i,r){r=r||{},this.gl=e,this.vertex_data=t,this.element_data=n,this.vertex_layout=i,this.vertex_buffer=this.gl.createBuffer(),this.buffer_size=this.vertex_data.byteLength,this.draw_mode=r.draw_mode||this.gl.TRIANGLES,this.data_usage=r.data_usage||this.gl.STATIC_DRAW,this.vertices_per_geometry=3,this.uniforms=r.uniforms,this.textures=r.textures,this.retain=r.retain||!1,this.created_at=+new Date,this.fade_in_time=r.fade_in_time||0,this.vertex_count=this.vertex_data.byteLength/this.vertex_layout.stride,this.element_count=0,this.vaos={},this.toggle_element_array=!1,this.element_data?(this.toggle_element_array=!0,this.element_count=this.element_data.length,this.geometry_count=this.element_count/this.vertices_per_geometry,this.element_type=this.element_data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT,this.element_buffer=this.gl.createBuffer(),this.buffer_size+=this.element_data.byteLength,this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.element_buffer),this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER,this.element_data,this.data_usage)):this.geometry_count=this.vertex_count/this.vertices_per_geometry,this.upload(),this.retain||(delete this.vertex_data,delete this.element_data),this.valid=!0}render(e={}){if(!this.valid)return!1;var t=e.program||j.current;t.use(),this.uniforms&&(t.saveUniforms(this.uniforms),t.setUniforms(this.uniforms,!1));let n=(+new Date-this.created_at)/1e3;return t.uniform("1f","u_visible_time",n),this.bind(t),this.toggle_element_array?this.gl.drawElements(this.draw_mode,this.element_count,this.element_type,0):this.gl.drawArrays(this.draw_mode,0,this.vertex_count),U.bind(this.gl,null),this.uniforms&&t.restoreUniforms(this.uniforms),n<this.fade_in_time}bind(e){let t=this.vaos[e.id];t?U.bind(this.gl,t):this.vaos[e.id]=U.create(this.gl,()=>{this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.toggle_element_array&&this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.element_buffer),this.vertex_layout.enableDynamicAttributes(this.gl,e)}),this.vertex_layout.enableStaticAttributes(this.gl,e)}upload(){this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.vertex_data,this.data_usage)}destroy(){if(!this.valid)return!1;this.valid=!1;for(let e in this.vaos)U.destroy(this.gl,this.vaos[e]);return this.gl.deleteBuffer(this.vertex_buffer),this.vertex_buffer=null,this.element_buffer&&(this.gl.deleteBuffer(this.element_buffer),this.element_buffer=null),delete this.vertex_data,delete this.element_data,this.textures&&this.textures.forEach(e=>S.release(e)),!0}}const me=["emission","ambient","diffuse","specular"];class _e{constructor(e){e=e||{},me.forEach(t=>{const n=e[t];null!=n&&(n.texture?this[t]={texture:n.texture,mapping:n.mapping||"spheremap",scale:O.expandVec3(null!=n.scale?n.scale:1),amount:O.expandVec4(null!=n.amount?n.amount:1)}:"number"==typeof n||Array.isArray(n)?this[t]={amount:O.expandVec4(n)}:this[t]="string"==typeof n?{amount:J.parseColor(n)}:n)}),this.specular&&(this.specular.shininess=e.shininess?parseFloat(e.shininess):.2),null!=e.normal&&(this.normal={texture:e.normal.texture,mapping:e.normal.mapping||"triplanar",scale:O.expandVec3(null!=e.normal.scale?e.normal.scale:1),amount:null!=e.normal.amount?e.normal.amount:1})}static isValid(e){return null!=e&&(null!=e.emission||null!=e.ambient||null!=e.diffuse||null!=e.specular)}inject(e){me.forEach(t=>{let n=`TANGRAM_MATERIAL_${t.toUpperCase()}`,i=n+"_TEXTURE";e.defines[n]=null!=this[t],this[t]&&this[t].texture&&(e.defines[i]=!0,e.defines[i+"_"+this[t].mapping.toUpperCase()]=!0,e.defines[`TANGRAM_MATERIAL_TEXTURE_${this[t].mapping.toUpperCase()}`]=!0,e.texcoords=e.texcoords||"uv"===this[t].mapping)}),this.normal&&this.normal.texture&&(e.defines.TANGRAM_MATERIAL_NORMAL_TEXTURE=!0,e.defines["TANGRAM_MATERIAL_NORMAL_TEXTURE_"+this.normal.mapping.toUpperCase()]=!0,e.defines[`TANGRAM_MATERIAL_TEXTURE_${this.normal.mapping.toUpperCase()}`]=!0,e.texcoords=e.texcoords||"uv"===this.normal.mapping),e.replaceShaderBlock(_e.block,"/*\n\nDefines globals:\nmaterial\nlight_accumulator_*\n\n*/\n\n\n// MATERIALS\n//\nstruct Material {\n #ifdef TANGRAM_MATERIAL_EMISSION\n vec4 emission;\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\n vec3 emissionScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT\n vec4 ambient;\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\n vec3 ambientScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n vec4 diffuse;\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\n vec3 diffuseScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n vec4 specular;\n float shininess;\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\n vec3 specularScale;\n #endif\n #endif\n\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\n vec3 normalScale;\n float normalAmount;\n #endif\n};\n\n// Note: uniform is copied to a global instance to allow modification\nuniform Material u_material;\nMaterial material;\n\n#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\nuniform sampler2D u_material_emission_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\nuniform sampler2D u_material_ambient_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\nuniform sampler2D u_material_diffuse_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\nuniform sampler2D u_material_specular_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nuniform sampler2D u_material_normal_texture;\n#endif\n\n// Global light accumulators for each property\nvec4 light_accumulator_ambient = vec4(vec3(0.0), 1.);\nvec4 light_accumulator_diffuse = vec4(vec3(0.0), 1.);\n#ifdef TANGRAM_MATERIAL_SPECULAR\n vec4 light_accumulator_specular = vec4(vec3(0.0), 1.);\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_SPHEREMAP\nvec4 getSphereMap (in sampler2D _tex, in vec3 _eyeToPoint, in vec3 _normal, in vec2 _skew) {\n // Normalized vector from camera to surface\n vec3 eye = normalize(_eyeToPoint);\n\n // Adjust for camera skew\n eye.xy -= _skew;\n eye = normalize(eye);\n\n // Reflection of eye off of surface normal\n vec3 r = reflect(eye, _normal);\n\n // Map reflected vector onto the surface of a sphere\n r.z += 1.0;\n float m = 2. * length(r);\n\n // Adjust xy to account for spherical shape, and center in middle of texture\n vec2 uv = r.xy / m + .5;\n\n // Sample the environment map\n return texture2D(_tex, uv);\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_TRIPLANAR\nvec3 getTriPlanarBlend (in vec3 _normal) {\n vec3 blending = abs(_normal);\n blending = normalize(max(blending, 0.00001));\n float b = (blending.x + blending.y + blending.z);\n return blending / b;\n}\n\nvec4 getTriPlanar (in sampler2D _tex, in vec3 _pos, in vec3 _normal, in vec3 _scale) {\n vec3 blending = getTriPlanarBlend(_normal);\n vec4 xaxis = texture2D(_tex, fract(_pos.yz * _scale.x));\n vec4 yaxis = texture2D(_tex, fract(_pos.xz * _scale.y));\n vec4 zaxis = texture2D(_tex, fract(_pos.xy * _scale.z));\n return xaxis * blending.x + yaxis * blending.y + zaxis * blending.z;\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_PLANAR\nvec4 getPlanar (in sampler2D _tex, in vec3 _pos, in vec2 _scale) {\n return texture2D( _tex, fract(_pos.xy * _scale.x) );\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nvoid calculateNormal (inout vec3 _normal) {\n // Get NORMALMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_UV\n _normal += texture2D(u_material_normal_texture, fract(v_texcoord*material.normalScale.xy)).rgb*2.0-1.0;\n #endif\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_PLANAR\n vec3 normalTex = getPlanar(u_material_normal_texture, v_world_position.xyz, material.normalScale.xy).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_TRIPLANAR\n vec3 normalTex = getTriPlanar(u_material_normal_texture, v_world_position.xyz, _normal, material.normalScale).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n _normal = normalize(_normal);\n}\n#endif\n\nvoid calculateMaterial (in vec3 _eyeToPoint, inout vec3 _normal) {\n // get EMISSION TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_UV\n material.emission *= texture2D(u_material_emission_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_PLANAR\n material.emission *= getPlanar(u_material_emission_texture, v_world_position.xyz, material.emissionScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_TRIPLANAR\n material.emission *= getTriPlanar(u_material_emission_texture, v_world_position.xyz, _normal, material.emissionScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_SPHEREMAP\n material.emission *= getSphereMap(u_material_emission_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get AMBIENT TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_UV\n material.ambient *= texture2D(u_material_ambient_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_PLANAR\n material.ambient *= getPlanar(u_material_ambient_texture, v_world_position.xyz, material.ambientScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_TRIPLANAR\n material.ambient *= getTriPlanar(u_material_ambient_texture, v_world_position.xyz, _normal, material.ambientScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_SPHEREMAP\n material.ambient *= getSphereMap(u_material_ambient_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get DIFFUSE TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_UV\n material.diffuse *= texture2D(u_material_diffuse_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_PLANAR\n material.diffuse *= getPlanar(u_material_diffuse_texture, v_world_position.xyz, material.diffuseScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_TRIPLANAR\n material.diffuse *= getTriPlanar(u_material_diffuse_texture, v_world_position.xyz, _normal, material.diffuseScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_SPHEREMAP\n material.diffuse *= getSphereMap(u_material_diffuse_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get SPECULAR TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_UV\n material.specular *= texture2D(u_material_specular_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_PLANAR\n material.specular *= getPlanar(u_material_specular_texture, v_world_position.xyz, material.specularScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_TRIPLANAR\n material.specular *= getTriPlanar(u_material_specular_texture, v_world_position.xyz, _normal, material.specularScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_SPHEREMAP\n material.specular *= getSphereMap(u_material_specular_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n}\n","Material"),e.addShaderBlock("setup","\nmaterial = u_material;\n","Material")}setupProgram(e){me.forEach(t=>{this[t]&&(this[t].texture?(e.setTextureUniform(`u_material_${t}_texture`,this[t].texture),e.uniform("3fv",`u_material.${t}Scale`,this[t].scale),e.uniform("4fv",`u_material.${t}`,this[t].amount)):this[t].amount&&e.uniform("4fv",`u_material.${t}`,this[t].amount))}),this.specular&&e.uniform("1f","u_material.shininess",this.specular.shininess),this.normal&&this.normal.texture&&(e.setTextureUniform("u_material_normal_texture",this.normal.texture),e.uniform("3fv","u_material.normalScale",this.normal.scale),e.uniform("1f","u_material.normalAmount",this.normal.amount))}}var ge;_e.block="material";var ye=ge={};ge.copy=function(e){for(var t=[],n=e.length,i=0;i<n;i++)t[i]=e[i];return t},ge.neg=function(e){for(var t=[],n=e.length,i=0;i<n;i++)t[i]=-e[i];return t},ge.add=function(e,t){for(var n=[],i=Math.min(e.length,t.length),r=0;r<i;r++)n[r]=e[r]+t[r];return n},ge.sub=function(e,t){for(var n=[],i=Math.min(e.length,t.length),r=0;r<i;r++)n[r]=e[r]-t[r];return n},ge.signed_area=function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(t[1]-e[1])},ge.mult=function(e,t){var n,i=[],r=e.length;if("number"==typeof t)for(n=0;n<r;n++)i[n]=e[n]*t;else for(r=Math.min(e.length,t.length),n=0;n<r;n++)i[n]=e[n]*t[n];return i},ge.div=function(e,t){var n,i=[];if("number"==typeof t)for(n=0;n<e.length;n++)i[n]=e[n]/t;else{var r=Math.min(e.length,t.length);for(n=0;n<r;n++)i[n]=e[n]/t[n]}return i},ge.perp=function(e,t){return[t[1]-e[1],e[0]-t[0]]},ge.rot=function(e,t){var n=Math.cos(t),i=Math.sin(t);return[e[0]*n-e[1]*i,e[0]*i+e[1]*n]},ge.angle=function([e,t]){return Math.atan2(t,e)},ge.angleBetween=function(e,t){var n=ge.dot(ge.normalize(ge.copy(e)),ge.normalize(ge.copy(t)));return n>1&&(n=1),Math.acos(n)},ge.isEqual=function(e,t){for(var n=e.length,i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0},ge.lengthSq=function(e){return 2===e.length?e[0]*e[0]+e[1]*e[1]:e.length>=3?e[0]*e[0]+e[1]*e[1]+e[2]*e[2]:0},ge.length=function(e){return Math.sqrt(ge.lengthSq(e))},ge.normalize=function(e){var t;if(2===e.length){if(1===(t=e[0]*e[0]+e[1]*e[1]))return e;0!==(t=Math.sqrt(t))?(e[0]/=t,e[1]/=t):(e[0]=0,e[1]=0)}else if(e.length>=3){if(1===(t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2]))return e;0!==(t=Math.sqrt(t))?(e[0]/=t,e[1]/=t,e[2]/=t):(e[0]=0,e[1]=0,e[2]=0)}return e},ge.cross=function(e,t){return 2===e.length?e[0]*t[1]-e[1]*t[0]:3===e.length?[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]:void 0},ge.dot=function(e,t){for(var n=0,i=Math.min(e.length,t.length),r=0;r<i;r++)n+=e[r]*t[r];return n};class ve{constructor(e,t){this.name=t.name,this.view=e,null==t.ambient||"number"==typeof t.ambient?this.ambient=O.expandVec3(t.ambient||0):this.ambient=J.parseColor(t.ambient).slice(0,3),null==t.diffuse||"number"==typeof t.diffuse?this.diffuse=O.expandVec3(null!=t.diffuse?t.diffuse:1):this.diffuse=J.parseColor(t.diffuse).slice(0,3),null==t.specular||"number"==typeof t.specular?this.specular=O.expandVec3(t.specular||0):this.specular=J.parseColor(t.specular).slice(0,3)}static create(e,t){if(ve.types[t.type])return new ve.types[t.type](e,t)}static setMode(e,t){!0===e&&(e="fragment"),e=ve.enabled&&(null!=e?e:"fragment"),t.defines.TANGRAM_LIGHTING_FRAGMENT="fragment"===e,t.defines.TANGRAM_LIGHTING_VERTEX="vertex"===e}static inject(e){if(j.removeBlock(ve.block),!ve.enabled)return;let t="";if(e&&Object.keys(e).length>0){let n={};for(let t in e)n[e[t].type]=!0;for(let e in n)ve.types[e].inject();for(let n in e)e[n].inject(),t+=`calculateLight(${n}, _eyeToPoint, _normal);\n`}let n=`\n vec4 calculateLighting(in vec3 _eyeToPoint, in vec3 _normal, in vec4 _color) {\n\n // Do initial material calculations over normal, emission, ambient, diffuse and specular values\n calculateMaterial(_eyeToPoint,_normal);\n\n // Un roll the loop of individual ligths to calculate\n ${t}\n\n // Final light intensity calculation\n vec4 color = vec4(vec3(0.), _color.a); // start with vertex color alpha\n\n #ifdef TANGRAM_MATERIAL_EMISSION\n color.rgb = material.emission.rgb;\n color.a *= material.emission.a;\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.ambient.rgb;\n color.a *= material.ambient.a;\n #else\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.diffuse.rgb;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color.rgb += light_accumulator_diffuse.rgb * _color.rgb * material.diffuse.rgb;\n color.a *= material.diffuse.a;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n color.rgb += light_accumulator_specular.rgb * material.specular.rgb;\n color.a *= material.specular.a;\n #endif\n\n // Clamp final color\n color = clamp(color, 0.0, 1.0);\n\n return color;\n }`;j.addBlock(ve.block,n)}inject(){let e=`\n uniform ${this.struct_name} u_${this.name};\n ${this.struct_name} ${this.name};\n `,t=`\n ${this.name} = u_${this.name};\n\n `;j.addBlock(ve.block,e),j.addBlock("setup",t)}update(){}setupProgram(e){e.uniform("3fv",`u_${this.name}.ambient`,this.ambient),e.uniform("3fv",`u_${this.name}.diffuse`,this.diffuse),e.uniform("3fv",`u_${this.name}.specular`,this.specular)}}ve.types={},ve.block="lighting",ve.enabled=!0,ve.types.ambient=class extends ve{constructor(e,t){super(e,t),this.type="ambient",this.struct_name="AmbientLight"}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nlight_accumulator_*\n\n*/\n\nstruct AmbientLight {\n vec3 ambient;\n};\n\nvoid calculateLight(in AmbientLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n light_accumulator_ambient.rgb += _light.ambient;\n}\n")}setupProgram(e){e.uniform("3fv",`u_${this.name}.ambient`,this.ambient)}},ve.types.directional=class extends ve{constructor(e,t){if(super(e,t),this.type="directional",this.struct_name="DirectionalLight",t.direction)this._direction=t.direction;else{let e=135,n=Math.sin(60*Math.PI/180);this._direction=[Math.cos(Math.PI*e/180)*n,Math.sin(Math.PI*e/180)*n,-.5],null==t.ambient&&(this.ambient=O.expandVec3(.5))}this.direction=this._direction.map(parseFloat)}get direction(){return this._direction}set direction(e){this._direction=ye.normalize(ye.copy(e))}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct DirectionalLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec3 direction;\n};\n\nvoid calculateLight(in DirectionalLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n light_accumulator_ambient.rgb += _light.ambient;\n\n float nDotVP = clamp(dot(_normal, -_light.direction), 0.0, 1.0);\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(_light.direction, _normal);\n float eyeDotR = max(dot(normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf;\n #endif\n}\n")}setupProgram(e){super.setupProgram(e),e.uniform("3fv",`u_${this.name}.direction`,this.direction)}};class be extends ve{constructor(e,t){super(e,t),this.type="point",this.struct_name="PointLight",this.position=t.position||[0,0,"100px"],this.position_eye=[],this.origin=t.origin||"ground",this.attenuation=isNaN(parseFloat(t.attenuation))?0:parseFloat(t.attenuation),t.radius?Array.isArray(t.radius)&&2===t.radius.length?this.radius=t.radius:this.radius=[null,t.radius]:this.radius=null}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct PointLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n};\n\nvoid calculateLight(in PointLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // Normalize the vector from surface to light position\n float nDotVP = clamp(dot(VP, _normal), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // Computer accumulators\n light_accumulator_ambient.rgb += _light.ambient * attenuation;\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n float pf = 0.0; // power factor for shiny speculars\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(0.0, dot(-normalize(_eyeToPoint), reflectVector));\n pf = pow(eyeDotR, material.shininess);\n }\n\n light_accumulator_specular.rgb += _light.specular * pf * attenuation;\n #endif\n}\n")}inject(){super.inject(),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT=0!==this.attenuation,j.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS=null!=this.radius&&null!=this.radius[0],j.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS=null!=this.radius}update(){this.updateEyePosition()}updateEyePosition(){if("world"===this.origin){const e=G.latLngToMeters([...this.position]);this.position_eye[0]=e[0]-this.view.camera.position_meters[0],this.position_eye[1]=e[1]-this.view.camera.position_meters[1],this.position_eye[2]=J.convertUnits(this.position[2],{zoom:this.view.zoom,meters_per_pixel:G.metersPerPixel(this.view.zoom)}),this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2]}else"ground"!==this.origin&&"camera"!==this.origin||(this.position_eye=J.convertUnits(this.position,{zoom:this.view.zoom,meters_per_pixel:G.metersPerPixel(this.view.zoom)}),"ground"===this.origin&&(this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2]));this.position_eye[3]=1}setupProgram(e){super.setupProgram(e),e.uniform("4fv",`u_${this.name}.position`,this.position_eye),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT&&e.uniform("1f",`u_${this.name}.attenuationExponent`,this.attenuation),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS&&e.uniform("1f",`u_${this.name}.innerRadius`,J.convertUnits(this.radius[0],{zoom:this.view.zoom,meters_per_pixel:G.metersPerPixel(this.view.zoom)})),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS&&e.uniform("1f",`u_${this.name}.outerRadius`,J.convertUnits(this.radius[1],{zoom:this.view.zoom,meters_per_pixel:G.metersPerPixel(this.view.zoom)}))}}ve.types.point=be,ve.types.spotlight=class extends be{constructor(e,t){super(e,t),this.type="spotlight",this.struct_name="SpotLight",this.direction=this._direction=(t.direction||[0,0,-1]).map(parseFloat),this.exponent=t.exponent?parseFloat(t.exponent):.2,this.angle=t.angle?parseFloat(t.angle):20}get direction(){return this._direction}set direction(e){this._direction=ye.normalize(ye.copy(e))}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct SpotLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n\n vec3 direction;\n float spotCosCutoff;\n float spotExponent;\n};\n\nvoid calculateLight(in SpotLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // normal . light direction\n float nDotVP = clamp(dot(_normal, VP), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // spotlight attenuation factor\n float spotAttenuation = 0.0;\n\n // See if point on surface is inside cone of illumination\n float spotDot = clamp(dot(-VP, _light.direction), 0.0, 1.0);\n\n if (spotDot >= _light.spotCosCutoff) {\n spotAttenuation = pow(spotDot, _light.spotExponent);\n }\n\n light_accumulator_ambient.rgb += _light.ambient * attenuation * spotAttenuation;\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation * spotAttenuation;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n // Power factor for shiny speculars\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(dot(-normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf * attenuation * spotAttenuation;\n #endif\n}\n")}setupProgram(e){super.setupProgram(e),e.uniform("3fv",`u_${this.name}.direction`,this.direction),e.uniform("1f",`u_${this.name}.spotCosCutoff`,Math.cos(3.14159*this.angle/180)),e.uniform("1f",`u_${this.name}.spotExponent`,this.exponent)}};class xe extends Error{constructor(e){super(),this.name="MethodNotImplemented",this.message="Method "+e+" must be implemented in subclass"}}class we{constructor(e,t){this.validate(e),this.config=e,this.sources=t,this.id=e.id,this.name=e.name,this.pad_scale=e.pad_scale||1e-5,this.default_winding=null,this.rasters=[],Array.isArray(e.rasters)&&e.rasters.forEach(e=>{-1===this.rasters.indexOf(e)&&this.rasters.push(e)}),this.preprocess=e.preprocess,"function"==typeof this.preprocess&&this.preprocess.bind(this),this.transform=e.transform,"function"==typeof this.transform&&this.transform.bind(this),this.extra_data=e.extra_data,this.scripts=e.scripts,this.setZooms(e),this.zoom_offset=null!=e.zoom_offset?e.zoom_offset:0,this.zoom_offset<0&&(_({level:"warn",once:!0},`Data source '${this.name}' zoom_offset must not be negative – setting to 0.`),this.zoom_offset=0),this.setTileSize(e.tile_size),this.min_display_zoom=Math.max(e.min_display_zoom||0,this.zooms[0]),this.max_display_zoom=null!=e.max_display_zoom?e.max_display_zoom:null}static register(e,t){e&&t&&(we.types[e]=t)}static create(e,t){if("function"==typeof we.types[e.type]){const n=we.types[e.type](e);if(n)return new n(e,t)}}static tileLayoutChanged(e,t){if(!e||!t)return!0;const n=["max_zoom","zooms","min_display_zoom","max_display_zoom","bounds","tile_size","zoom_offset"],i=k(e.config,n),r=k(t.config,n);return JSON.stringify(i)!==JSON.stringify(r)}static projectData(e){var t=+new Date;for(var n in e.layers)for(var i=e.layers[n].features.length,r=0;r<i;r++){var s=e.layers[n].features[r];G.transformGeometry(s.geometry,this.projectCoord)}void 0!==e.debug&&(e.debug.projection=+new Date-t)}static projectCoord(e){G.latLngToMeters(e)}static scaleData(e,{coords:{z:t},min:n}){let i=G.unitsPerMeter(t);for(var r in e.layers)for(var s=e.layers[r].features.length,o=0;o<s;o++){var a=e.layers[r].features[o];G.transformGeometry(a.geometry,e=>{e[0]=(e[0]-n.x)*i,e[1]=(e[1]-n.y)*i*-1})}}load(e){return e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[...this.rasters],this._load(e).then(e=>{for(let t in e.source_data.layers){let n=e.source_data.layers[t];n&&n.features&&n.features.forEach(e=>{G.transformGeometry(e.geometry,e=>{e[1]=-e[1],this.pad_scale&&(e[0]=Math.round(e[0]*(1+this.pad_scale)-G.tile_scale*this.pad_scale/2),e[1]=Math.round(e[1]*(1+this.pad_scale)-G.tile_scale*this.pad_scale/2))}),this.updateDefaultWinding(e.geometry)})}return e.default_winding=this.default_winding||"CCW",e})}_load(){throw new xe("_load")}copyTileData(e,t){return _("trace",`Copy tile data from ${e.key} to ${t.key}`),t.source_data={layers:e.source_data.layers},t.rasters=[...e.rasters],t.pad_scale=e.pad_scale,t.default_winding=e.default_winding,t}setZooms({max_zoom:e,zooms:t}){if(this.max_zoom=null!=e?e:G.default_source_max_zoom,Array.isArray(t))this.zooms=t,this.max_zoom=this.zooms[this.zooms.length-1];else{this.zooms=[];for(let e=0;e<=this.max_zoom;e++)this.zooms[e]=e}}setTileSize(e){this.tile_size=e||256,("number"!=typeof this.tile_size||this.tile_size<256||!g.isPowerOf2(this.tile_size))&&(_({level:"warn",once:!0},`Data source '${this.name}': 'tile_size' parameter must be a number that is a power of 2 greater than or equal to 256, but was '${e}'`),this.tile_size=256),this.zoom_bias=Math.log2(this.tile_size)-8+this.zoom_offset}updateDefaultWinding(e){return null==this.default_winding&&("Polygon"===e.type?this.default_winding=G.ringWinding(e.coordinates[0]):"MultiPolygon"===e.type&&(this.default_winding=G.ringWinding(e.coordinates[0][0]))),this.default_winding}includesTile(e,t){if(e.z<this.min_display_zoom||null!=this.max_display_zoom&&t>this.max_display_zoom)return!1;for(let t=0;t<this.rasters.length;t++){const n=this.rasters[t];if(this.sources[n]&&this.sources[n]!==this&&!this.sources[n].includesTile(e,e.z))return!1}return!0}validate(){}}we.types={};let Ee=0;class Ae extends we{constructor(e,t){super(e,t),this.response_type="";let[n,i]=function(e,t){if(!t||0===Object.keys(t).length)return[e,[]];var n=e.indexOf("?"),i=e.indexOf("#"),r="";i>-1&&(r=e.slice(i),e=e.slice(0,i)),-1===n&&(n=e.length,e+="?"),n++;var s="",o=[];for(var a in t)""===E(a,e)?s+=`${a}=${t[a]}&`:o.push([a,t[a]]);return[e=e.slice(0,n)+s+e.slice(n)+r,o]}(e.url,e.url_params);this.url=n,i.forEach(([t,n])=>{_({level:"warn",once:!0},`Data source '${this.name}': parameter '${t}' already present in URL '${e.url}', skipping value '${t}=${n}' specified in 'url_params'`)}),e.request_headers&&"object"==typeof e.request_headers&&(this.request_headers=e.request_headers)}_load(e){let t=this.formatURL(this.url,e),n=e.source_data;return n.url=t,e.debug=e.debug||{},e.debug.network=+new Date,new Promise(i=>{let r=Ee+++"-"+t,s=g.io(t,6e4,this.response_type,"GET",this.request_headers,r);n.request_id=r,n.error=null,s.then(({body:t})=>{e.debug.response_size=t&&(t.length||t.byteLength),e.debug.network=+new Date-e.debug.network,e.debug.parsing=+new Date,null!=t&&"function"==typeof this.preprocess&&(t=this.preprocess(t)),(t=t instanceof Promise?t:Promise.resolve(t)).then(t=>{null!=t?this.parseSourceData(e,n,t):n.layers={},e.debug.parsing=+new Date-e.debug.parsing,i(e)})}).catch(t=>{n.error=t.stack,i(e)})})}validate(e){if("string"!=typeof e.url)throw Error("Network data source must provide a string `url` property")}formatURL(){throw new xe("formatURL")}parseSourceData(){throw new xe("parseSourceData")}}class Te extends Ae{constructor(e,t){super(e,t),this.tiled=!0,this.bounds=this.parseBounds(e),this.builds_geometry_tiles=!1,this.tms=!0===e.tms,this.url&&this.url.search("{s}")>-1&&(Array.isArray(e.url_subdomains)&&e.url_subdomains.length>0?(this.url_subdomains=e.url_subdomains,this.next_url_subdomain=0):_({level:"warn",once:!0},`Data source '${this.name}': source URL includes '{s}' subdomain marker ('${this.url}'), but no subdomains were specified in 'url_subdomains' parameter`)),this.url&&this.url.search("{r}")>-1&&(Array.isArray(e.url_density_scales)&&e.url_density_scales.length>0?this.url_density_scales=e.url_density_scales:this.url_density_scales=[1,2])}parseBounds(e){if(Array.isArray(e.bounds)&&4===e.bounds.length){const[t,n,i,r]=e.bounds;return{latlng:[...e.bounds],meters:{min:G.latLngToMeters([t,r]),max:G.latLngToMeters([i,n])},tiles:{min:{},max:{}}}}}checkBounds(e,t){if(t){e=G.wrapTile(e);let n=t.tiles.min[e.z];n||(n=t.tiles.min[e.z]=G.tileForMeters(t.meters.min,e.z));let i=t.tiles.max[e.z];if(i||(i=t.tiles.max[e.z]=G.tileForMeters(t.meters.max,e.z)),e.y<n.y||e.y>i.y)return!1;if(n.x<=i.x){if(e.x<n.x||e.x>i.x)return!1}else if(e.x>i.x&&e.x<n.x)return!1}return!0}includesTile(e,t){return!!super.includesTile(e,t)&&!!this.checkBounds(e,this.bounds)}formatURL(e,t){let n=G.wrapTile(t.coords,{x:!0});this.tms&&(n.y=Math.pow(2,n.z)-1-n.y);let i=e.replace("{x}",n.x).replace("{y}",n.y).replace("{z}",n.z).replace("{r}",this.getDensityModifier()).replace("{q}",this.toQuadKey(n));return null!=this.url_subdomains&&(i=i.replace("{s}",this.url_subdomains[this.next_url_subdomain]),this.next_url_subdomain=(this.next_url_subdomain+1)%this.url_subdomains.length),i}getDensityModifier(){if(this.url_density_scales){const e=g.device_pixel_ratio;let t=this.url_density_scales.filter(t=>e>=t).reverse()[0];if(t=null!=t?t:this.url_density_scales[0],t>1)return`@${t}x`}return""}toQuadKey({x:e,y:t,z:n}){let i="";for(let r=n;r>0;r--){let n=0,s=1<<r-1;e&s&&n++,t&s&&(n+=2),i+=n.toString()}return i}static urlHasTilePattern(e){return e&&(e.search("{x}")>-1&&e.search("{y}")>-1&&e.search("{z}")>-1||e.search("{q}")>-1)}}const ke={coord(e){return{x:e.x,y:e.y,z:e.z,key:this.coordKey(e)}},coordKey:({x:e,y:t,z:n})=>e+"/"+t+"/"+n,key(e,t,n){if(!(e.y<0||e.y>=1<<e.z||e.z<0))return[t.name,e.x,e.y,e.z,n].join("/")},normalizedKey(e,t,n){return this.key(this.normalizedCoord(e,t),t,n)},normalizedCoord(e,t){return t.zoom_bias&&(e=this.coordAtZoom(e,Math.max(e.z-t.zoom_bias,t.zooms[0]))),this.coordForTileZooms(e,t.zooms)},coordAtZoom({x:e,y:t,z:n},i){if(n!==(i=Math.max(0,i))){let r=Math.pow(2,n-i);e=Math.floor(e/r),t=Math.floor(t/r),n=i}return this.coord({x:e,y:t,z:n})},coordForTileZooms({x:e,y:t,z:n},i){const r=this.findZoomInRange(n,i);return r!==n?this.coordAtZoom({x:e,y:t,z:n},r):this.coord({x:e,y:t,z:n})},findZoomInRange:(e,t)=>t.filter(t=>e>=t).reverse()[0]||t[0],isDescendant(e,t){if(t.z>e.z){let{x:n,y:i}=this.coordAtZoom(t,e.z);return e.x===n&&e.y===i}return!1},parent({coords:e,source:t,style_z:n}){if(n>0){n--;const i=Math.max(n-t.zoom_bias,t.zooms[0]),r=this.coordForTileZooms(this.coordAtZoom(e,i),t.zooms);return r.z>n?null:{key:this.key(r,t,n),coords:r,style_z:n,source:t}}},children({coords:e,source:t,style_z:n},i={}){n++;const r=this.coordForTileZooms(this.coordAtZoom(e,n-t.zoom_bias),t.zooms);if(r.z===e.z)return[{key:this.key(r,t,n),coords:r,style_z:n,source:t}];{const s=this.key(r,t,n);if(i[t.id]=i[t.id]||{},null==i[t.id][s]){const o=Math.pow(2,r.z-e.z),a=e.x*o,l=e.y*o;let u=[];for(let e=a;e<a+o;e++)for(let i=l;i<l+o;i++){let s=this.coord({x:e,y:i,z:r.z});u.push({key:this.key(s,t,n),coords:s,style_z:n,source:t})}i[t.id][s]=u}return i[t.id][s]}}};class Se extends Te{constructor(e,t){super(e,t),-1===this.rasters.indexOf(this.name)&&this.rasters.unshift(this.name),this.filtering=e.filtering,this.textures={}}async load(e){e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[...this.rasters];let t=G.tile_scale;return e.source_data.layers={_default:{type:"FeatureCollection",features:[{geometry:{type:"Polygon",coordinates:[[[0,0],[t,0],[t,-t],[0,-t],[0,0]]]},properties:{}}]}},e.default_winding="CW",e}async tileTexture(e){let t=this.adjustRasterTileZoom(e),n=t.key;if(!this.textures[n]){let e=this.formatURL(this.url,{coords:t});this.textures[n]={name:e,url:e,filtering:this.filtering,coords:t}}return this.textures[n]}adjustRasterTileZoom(e){let t=e.coords;const n=this.sources[e.source];if(n!==this){let i=this.zoom_bias-n.zoom_bias;i>0?t=ke.normalizedCoord(e.coords,{zoom_bias:i,zooms:this.zooms}):(i<0&&_({level:"warn",once:!0},`Raster source '${this.name}' supports higher zoom detail than source '${n.name}' it's attached to. Downsampling this source ${-i} extra zoom levels to match.`),t=ke.coordForTileZooms(t,this.zooms))}return t}}class Oe extends Se{constructor(e,t){super(e,t),this.load_image={},this.alpha=null!=e.alpha?Math.max(Math.min(e.alpha,1),0):null,this.mask_alpha=!0,this.preserve_tiles_within_zoom=0,this.max_display_density=e.max_display_density,Array.isArray(e.composite)?this.images=e.composite.map(e=>({url:e.url,bounds:this.parseBounds(e),alpha:null!=e.alpha?Math.max(Math.min(e.alpha,1),0):null})):this.images=[{url:this.url,bounds:this.bounds,alpha:this.alpha}]}async tileTexture(e,{blend:t,generation:n}){let i=this.adjustRasterTileZoom(e);const r="opaque"!==t,s=`raster-${this.name}-${i.key}-${r?"alpha":"opaque"}-${n}`;if(S.textures[s])return{name:s,coords:i,skip_create:!0};let o=g.device_pixel_ratio;this.max_display_density&&(o=Math.min(o,this.max_display_density)),o*=2;const a=document.createElement("canvas"),l=a.getContext("2d");a.width=this.tile_size*o,a.height=this.tile_size*o,l.imageSmoothingEnabled="nearest"!==this.filtering;const u=this.images.filter(t=>this.checkBounds(e.coords,t.bounds));return await Promise.all(u.map(t=>{const n=r?null!=t.alpha?t.alpha:this.alpha:1;return this.drawImage(t.url,t.bounds,n,e,o,l)})),{name:s,element:a,filtering:this.filtering,coords:i}}async drawImage(e,t,n,i,r,s){const o=R(e);this.load_image[o]=this.load_image[o]||this.loadImage(e);const a=await this.load_image[o],l=G.metersPerPixel(i.coords.z)/r/(this.tile_size/G.tile_size),u=(t.meters.min[0]-i.min.x)/l,c=-(t.meters.min[1]-i.min.y)/l,h=(t.meters.max[0]-t.meters.min[0])/l,d=-(t.meters.max[1]-t.meters.min[1])/l;s.globalAlpha=null!=n?n:1,s.drawImage(a,u,c,h,d)}loadImage(e){return new Promise(t=>{let n=new Image;n.onload=()=>t(n),n.onerror=n=>{_("warn",`Raster source '${this.name}': failed to load url: '${e}'`,n),t(null)},g.isSafari()&&"data:"===e.slice(0,5)||(n.crossOrigin="anonymous"),n.src=e})}includesTile(e,t){return!!we.prototype.includesTile.call(this,e,t)&&this.images.some(t=>this.checkBounds(e,t.bounds))}validate(e){let t="Raster data source must provide a string `url` parameter, or an array of `composite` raster ";t+="image objects that each have a `url` parameter";let n="Raster data source must provide a `bounds` parameter, or an array of `composite` raster ";if(n+="image objects that each have a `bounds` parameter",Array.isArray(e.composite)){if(e.composite.some(e=>"string"!=typeof e.url))throw Error(t);if(e.composite.some(e=>!(Array.isArray(e.bounds)&&4===e.bounds.length)))throw Error(n);if(null!=e.url||null!=e.bounds)throw Error("Raster data source must have *either* a single image specified as `url` and `bounds `parameters, or an array of `composite` raster image objects, each with `url` and `bounds`.")}else{if("string"!=typeof e.url)throw Error(t);if(!Array.isArray(e.bounds)||4!==e.bounds.length)throw Error(n)}}}function Pe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function Ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pe(Object(n),!0).forEach(function(t){r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}we.register("Raster",e=>Se.urlHasTilePattern(e.url)?Se:Oe);var Re={init({generation:e,styles:t,sources:n={},introspection:i}={}){this.setGeneration(e),this.styles=t,this.sources=n,this.defines=Object.prototype.hasOwnProperty.call(this,"defines")&&this.defines||{},this.shaders=Object.prototype.hasOwnProperty.call(this,"shaders")&&this.shaders||{},this.introspection=i||!1,this.selection=this.selection||this.introspection||!1,this.compile_setup=!1,this.program=null,this.selection_program=null,this.feature_style={},this.vertex_template=[],this.tile_data={},this.stencil_proxy_tiles=!0,this.variants={},this.vertex_layouts={},this.defines.TANGRAM_WORLD_POSITION_WRAP=1e5,this.blend=this.blend||"opaque","opaque"!==this.blend?null==this.blend_order&&(this.blend_order=this.default_blend_orders[this.blend]):this.blend_order=this.default_blend_orders[this.blend],this.defines[`TANGRAM_BLEND_${this.blend.toUpperCase()}`]=!0,this.removeShaderBlock("setup"),this.material instanceof _e||(_e.isValid(this.material)||(this.material=J.defaults.material),this.material=new _e(this.material)),this.material.inject(this),ve.setMode(this.lighting,this),this.setupRasters(),this.setupCustomAttributes(),this.initialized=!0},destroy(){this.program&&(this.program.destroy(),this.program=null),this.selection_program&&(this.selection_program.destroy(),this.selection_program=null),a.removeTarget(this.main_thread_target),this.gl=null,this.initialized=!1},reset(){},baseStyle(){return this.base||this.name},setGeneration(e){this.generation=e,this.main_thread_target=["Style",this.name,this.generation].join("_"),t.is_main&&a.addTarget(this.main_thread_target,this)},startData(e){this.tile_data[e.id]=this.tile_data[e.id]||{meshes:{},uniforms:{},textures:[]}},async endData(e){var t=this.tile_data[e.id];if(this.tile_data[e.id]=null,t&&Object.keys(t.meshes).length>0){for(let e in t.meshes){let n=t.meshes[e];0!==n.vertex_data.vertex_count?(n.vertex_data.end(),n.vertex_elements=n.vertex_data.element_buffer,n.vertex_data=n.vertex_data.vertex_buffer):delete t.meshes[e]}return this.buildRasterTextures(e,t)}return null},hasDataForTile(e){return null!=this.tile_data[e.id]},getTileMesh(e,t){const n=this.tile_data[e.id].meshes;if(null==n[t.key]){const e=this.vertexLayoutForMeshVariant(t);n[t.key]={variant:t,vertex_data:e.createVertexData()}}return n[t.key]},vertexLayoutForMeshVariant(){},meshVariantTypeForDraw(){},addFeature(e,t,n){let i=n.tile;if(i.generation!==this.generation)return;this.tile_data[i.id]||this.startData(i);let r=this.parseFeature(e,t,n);r&&this.buildGeometry(e.geometry,r,n)>0&&(e.generation=this.generation)},buildGeometry(e,t,n){let i;if("Polygon"===e.type?i=this.buildPolygons([e.coordinates],t,n):"MultiPolygon"===e.type?i=this.buildPolygons(e.coordinates,t,n):"LineString"===e.type?i=this.buildLines([e.coordinates],t,n):"MultiLineString"===e.type?i=this.buildLines(e.coordinates,t,n):"Point"===e.type?i=this.buildPoints([e.coordinates],t,n):"MultiPoint"===e.type&&(i=this.buildPoints(e.coordinates,t,n)),i>0&&v.layer_stats){let e=n.tile;e.debug.layers=e.debug.layers||{list:{},tree:{}};let t=e.debug.layers.list,r=e.debug.layers.tree,s={};n.layers.forEach(e=>{Me(t,e,1,i,{[this.name]:i},{[this.baseStyle()]:i});let n=r,o=s,a=e.split(":");for(let e=0;e<a.length;e++){let t=a[e];n[t]=n[t]||{features:0,geoms:0,styles:{},base:{}},null==o[t]&&(o[t]={},Me(n,t,1,i,{[this.name]:i},{[this.baseStyle()]:i})),e<a.length-1&&(n[t].layers=n[t].layers||{}),n=n[t].layers,o=o[t]}})}return i},parseFeature(e,t,n){try{var i=this.feature_style;if(i.order=this.parseOrder(t.order,n),null==i.order&&"overlay"!==this.blend){let e=`Layer '${t.layers.join(", ")}', draw group '${t.group}': `;return e+="'order' parameter is required unless blend mode is 'overlay'",null!=t.order&&(e+="; 'order' was set to a dynamic value (e.g. string tied to feature property, ",e+="or JS function), but evaluated to null for one or more features"),void _({level:"warn",once:!0},e)}if(!(i=this._parseFeature(e,t,n)))return;if(this.shaders.attributes){i.attributes=i.attributes||{};for(const e in this.shaders.attributes)i.attributes[e]=J.evalCachedProperty(t.attributes&&t.attributes[e],n),"number"!=typeof i.attributes[e]&&(i.attributes[e]=0)}return this.selection?i.interactive=J.evalProperty(t.interactive,n):i.interactive=!1,!0===i.interactive?i.selection_color=he.makeColor(e,n.tile,n):i.selection_color=he.defaultColor,i}catch(t){_("error","Style.parseFeature: style parsing error",e,i,t.stack)}},_parseFeature(){return this.feature_style},preprocess(e){if(!e.preprocessed){if(this.draw)for(let t in this.draw){let n=this.draw[t];"object"!=typeof n||Array.isArray(n)?null==e[t]&&(e[t]=n):e[t]=V({},n,e[t])}if(this.selection?this.introspection&&(e.interactive=!0):e.interactive=!1,!(e=this._preprocess(e)))return;if(this.shaders.attributes){e.attributes=e.attributes||{};for(const t in this.shaders.attributes)e.attributes[t]=J.createPropertyCache(null!=e.attributes[t]?e.attributes[t]:0)}e.preprocessed=!0}return e},_preprocess:e=>e,parseOrder:(e,t)=>"number"!=typeof e?J.calculateOrder(e,t):e,scaleOrder:e=>2*e,parseColor(e,t){return e?J.evalCachedColorProperty(e,t):this.shaders.blocks.color||this.shaders.blocks.filter?J.defaults.color:void 0},buildPolygons:()=>0,buildLines:()=>0,buildPoints:()=>0,setGL(e){this.gl=e,this.max_texture_size=S.getMaxTextureSize(this.gl)},makeMesh(e,t,n={}){let i=this.vertexLayoutForMeshVariant(n.variant);return v.wireframe?(t=function(e){const t=new Uint16Array(2*e.length);for(let n=0;n<e.length;n+=3)t.set([e[n],e[n+1],e[n+1],e[n+2],e[n+2],e[n]],2*n);return t}(t),new pe(this.gl,e,t,i,Ce(Ce({},n),{},{draw_mode:this.gl.LINES}))):new pe(this.gl,e,t,i,n)},render:e=>e.render(),getProgram(e="program"){this.compileSetup();const t=this[e];if(t&&!t.error){if(!t.compiled){_("debug",`Compiling style '${this.name}', program key '${e}'`);try{t.compile()}catch(t){throw _("error",`Style: error compiling program for style '${this.name}' (program key '${e}')`,this,t.stack,t.type,t.shader_errors),t}}return t}},compileSetup(){if(!this.compile_setup){if(!this.gl)throw new Error(`style.compile(): skipping for ${this.name} because no GL context`);var e=this.buildDefineList();if(this.selection){var t=Object.assign({},e);t.TANGRAM_FEATURE_SELECTION=!0}var n=this.shaders&&this.shaders.blocks,i=this.shaders&&this.shaders.block_scopes,r=Object.assign({},this.shaders&&this.shaders.uniforms);for(let e in r)null==r[e]&&_({level:"warn",once:!0},`Style '${this.name}' has invalid uniform '${e}': uniform values must be non-null`);var s=this.shaders&&this.shaders.extensions;"string"==typeof s&&(s=[s]),this.program=new j(this.gl,this.vertex_shader_src,this.fragment_shader_src,{name:this.name,defines:e,uniforms:r,blocks:n,block_scopes:i,extensions:s}),this.selection?this.selection_program=new j(this.gl,this.vertex_shader_src,"// Fragment shader for feature selection passes\n// Renders in silhouette according to selection (picking) color, or black if none defined\n\n#ifdef TANGRAM_FEATURE_SELECTION\n varying vec4 v_selection_color;\n#endif\n\nvoid main (void) {\n #ifdef TANGRAM_FEATURE_SELECTION\n gl_FragColor = v_selection_color;\n #else\n gl_FragColor = vec4(0., 0., 0., 1.);\n #endif\n}\n",{name:this.name+" (selection)",defines:t,uniforms:r,blocks:n,block_scopes:i,extensions:s}):this.selection_program=null,this.compile_setup=!0}},addShaderBlock(e,t,n=null){this.shaders.blocks=this.shaders.blocks||{},this.shaders.blocks[e]=this.shaders.blocks[e]||[],this.shaders.blocks[e].push(t),this.shaders.block_scopes=this.shaders.block_scopes||{},this.shaders.block_scopes[e]=this.shaders.block_scopes[e]||[],this.shaders.block_scopes[e].push(n)},removeShaderBlock(e){this.shaders.blocks&&(this.shaders.blocks[e]=null),this.shaders.block_scopes&&(this.shaders.block_scopes[e]=null)},replaceShaderBlock(e,t,n=null){this.removeShaderBlock(e),this.addShaderBlock(e,t,n)},buildDefineList(){var e={};if(null!=this.defines)for(var t in this.defines)e[t]=this.defines[t];if(null!=this.shaders&&null!=this.shaders.defines)for(t in this.shaders.defines)e[t]=this.shaders.defines[t];return e},hasRasters(){return["color","normal","custom"].indexOf(this.raster)>-1},setupRasters(){if(!this.hasRasters())return;"color"===this.raster?this.defines.TANGRAM_RASTER_TEXTURE_COLOR=!0:"normal"===this.raster&&(this.defines.TANGRAM_RASTER_TEXTURE_NORMAL=!0);let e=Object.keys(this.sources).filter(e=>this.sources[e]instanceof Se).length;if(this.defines.TANGRAM_NUM_RASTER_SOURCES=`${e}`,e>0){const t=Object.keys(this.sources).filter(e=>this.sources[e].mask_alpha).length;this.defines.TANGRAM_HAS_MASKED_RASTERS=t>0,this.defines.TANGRAM_ALL_MASKED_RASTERS=t===e,this.defines.TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING=!0,this.replaceShaderBlock("raster","// Uniforms defining raster textures and macros for accessing them\n\n#ifdef TANGRAM_FRAGMENT_SHADER\nuniform sampler2D u_rasters[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture samplers\nuniform vec2 u_raster_sizes[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture sizes (width/height in pixels)\nuniform vec3 u_raster_offsets[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture UV starting offset for tile\n\n// Raster sources can optionally mask by the alpha channel (render with only full or no alpha, based on a threshold),\n// which is used for handling transparency outside the raster image when rendering with opaque blending\n#if defined(TANGRAM_HAS_MASKED_RASTERS) && !defined(TANGRAM_ALL_MASKED_RASTERS) // only add uniform if we need it\nuniform bool u_raster_mask_alpha;\n#endif\n\n// Note: the raster accessors below are #defines rather than functions to\n// avoid issues with constant integer expressions for array indices\n\n// Adjusts UVs in model space to account for raster tile texture overzooming\n// (applies scale and offset adjustments)\n#define adjustRasterUV(raster_index, uv) \\\n ((uv) * u_raster_offsets[raster_index].z + u_raster_offsets[raster_index].xy)\n\n// Returns the UVs of the current model position for a raster sampler\n#define currentRasterUV(raster_index) \\\n (adjustRasterUV(raster_index, v_modelpos_base_zoom.xy))\n\n// Returns pixel location in raster tile texture at current model position\n#define currentRasterPixel(raster_index) \\\n (currentRasterUV(raster_index) * rasterPixelSize(raster_index))\n\n// Samples a raster tile texture for the current model position\n#define sampleRaster(raster_index) \\\n (texture2D(u_rasters[raster_index], currentRasterUV(raster_index)))\n\n// Samples a raster tile texture for a given pixel\n#define sampleRasterAtPixel(raster_index, pixel) \\\n (texture2D(u_rasters[raster_index], (pixel) / rasterPixelSize(raster_index)))\n\n// Returns size of raster sampler in pixels\n#define rasterPixelSize(raster_index) \\\n (u_raster_sizes[raster_index])\n\n#endif\n","Raster")}},async buildRasterTextures(e,t){if(!this.hasRasters())return t;if(0===e.rasters.length)return t;let n;try{n=await a.postMessage(`${this.main_thread_target}.loadTextures`,{coords:e.coords,source:e.source,rasters:e.rasters,min:e.min,max:e.max})}catch(e){return t}if(!n||n.length<1)return t;if(n.some(e=>!e.loaded))return null;t.uniforms.u_raster_mask_alpha=!0===this.sources[e.rasters[0]].mask_alpha;const i=t.uniforms.u_rasters=[],r=t.uniforms.u_raster_sizes=[],s=t.uniforms.u_raster_offsets=[];return n.forEach(n=>{const o=n.index;if(i[o]=n.name,t.textures.push(n.name),r[o]=[n.width,n.height],e.coords.z>n.coords.z){let t=e.coords.z-n.coords.z,i=Math.pow(2,t);s[o]=[(e.coords.x%i+i)%i/i,(i-1-e.coords.y%i)/i,1/i]}else s[o]=[0,0,1]}),t},async loadTextures(e){let t={},n={},i=[];e.rasters.map(e=>this.sources[e]).filter(e=>e).forEach((r,s)=>{r instanceof Se&&i.push(r.tileTexture(e,this).then(e=>{t[e.name]=e,n[e.name]=s}))}),await Promise.all(i),await S.createFromObject(this.gl,t);let r=await Promise.all(Object.keys(t).map(e=>S.textures[e]&&S.textures[e].load()).filter(e=>e));return r.forEach(e=>e.retain()),r.map(e=>({name:e.name,width:e.width,height:e.height,loaded:e.loaded,index:n[e.name],coords:t[e.name].coords}))},setupCustomAttributes(){if(this.shaders.attributes)for(const[e,t]of Object.entries(this.shaders.attributes))"float"===t.type&&(!1!==t.varying?(this.addShaderBlock("attributes",`\n #ifdef TANGRAM_VERTEX_SHADER\n attribute float a_${e};\n varying float v_${e};\n #define ${e} a_${e}\n #else\n varying float v_${e};\n #define ${e} v_${e}\n #endif\n `),this.addShaderBlock("setup",`#ifdef TANGRAM_VERTEX_SHADER\nv_${e} = a_${e};\n#endif`)):this.addShaderBlock("attributes",`\n #ifdef TANGRAM_VERTEX_SHADER\n attribute float a_${e};\n #define ${e} a_${e}\n #endif\n `))},addCustomAttributesToAttributeList(e){if(this.shaders.attributes)for(const[t,n]of Object.entries(this.shaders.attributes))"float"===n.type&&e.push({name:`a_${t}`,size:1,type:fe.FLOAT,normalized:!1});return e},addCustomAttributesToVertexTemplate(e,t){if(this.shaders.attributes)for(let n in this.shaders.attributes)this.vertex_template[t++]=null!=e.attributes[n]?e.attributes[n]:0},setup(){this.setUniforms(),this.material.setupProgram(j.current)},setUniforms(){var e,t=j.current;t&&t.setUniforms(null===(e=this.shaders)||void 0===e?void 0:e.uniforms,!0)},render_states:{opaque:{depth_test:!0,depth_write:!0},translucent:{depth_test:!0,depth_write:!0},add:{depth_test:!0,depth_write:!1},multiply:{depth_test:!0,depth_write:!1},inlay:{depth_test:!0,depth_write:!1},overlay:{depth_test:!1,depth_write:!1}},default_blend_orders:{opaque:Number.MIN_SAFE_INTEGER,add:1,multiply:2,inlay:3,translucent:4,overlay:5},getBlendOrderForDraw(e){return"opaque"!==this.blend&&null!=e.blend_order?e.blend_order:this.blend_order}};function Me(e,t,n,i,r,s){e[t]=e[t]||{features:0,geoms:0,styles:{},base:{}},e[t].features+=n,e[t].geoms+=i;for(let n in r)e[t].styles[n]=e[t].styles[n]||0,e[t].styles[n]+=r[n];for(let n in s)e[t].base[n]=e[t].base[n]||0,e[t].base[n]+=s[n]}let Le=Math.pow(2,16)-1,Ne=!1;class ze{constructor(){this.array=[],this.has_overflown=!1}push(e){this.has_overflown&&!Ne||e>Le&&(this.has_overflown=!0,!Ne)||this.array.push(e)}end(){if(this.array.length){let t=(e=this.array,new(this.has_overflown&&Ne?Uint32Array:Uint16Array)(e));return this.array=[],this.has_overflown=!1,t}return!1;var e}}ze.setElementIndexUint=function(e){Ne=e};let De={[fe.FLOAT]:Float32Array,[fe.BYTE]:Int8Array,[fe.UNSIGNED_BYTE]:Uint8Array,[fe.INT]:Int32Array,[fe.UNSIGNED_INT]:Uint32Array,[fe.SHORT]:Int16Array,[fe.UNSIGNED_SHORT]:Uint16Array};class Ie{constructor(e,{prealloc:t=500}={}){this.vertex_layout=e,this.vertex_elements=new ze,this.stride=this.vertex_layout.stride,Ie.array_pool.length>0?(this.vertex_buffer=Ie.array_pool.pop(),this.byte_length=this.vertex_buffer.byteLength,this.size=Math.floor(this.byte_length/this.stride),_("trace",`VertexData: reused buffer of bytes ${this.byte_length}, ${this.size} vertices`)):(this.size=t,this.byte_length=this.stride*this.size,this.vertex_buffer=new Uint8Array(this.byte_length)),this.offset=0,this.vertex_count=0,this.realloc_count=0,this.setBufferViews(),this.setAddVertexFunction()}setBufferViews(){this.views={},this.views[fe.UNSIGNED_BYTE]=this.vertex_buffer,this.vertex_layout.dynamic_attribs.forEach(e=>{if(null==this.views[e.type]){var t=De[e.type];this.views[e.type]=new t(this.vertex_buffer.buffer)}})}checkBufferSize(){if(this.offset+this.stride>this.byte_length){this.size=Math.floor(1.5*this.size),this.size-=this.size%4,this.byte_length=this.stride*this.size;var e=new Uint8Array(this.byte_length);e.set(this.vertex_buffer),Ie.array_pool.push(this.vertex_buffer),this.vertex_buffer=e,this.setBufferViews(),this.realloc_count++}}setAddVertexFunction(){this.vertexLayoutAddVertex=this.vertex_layout.getAddVertexFunction()}addVertex(e){this.checkBufferSize(),this.vertexLayoutAddVertex(e,this.views,this.offset),this.offset+=this.stride,this.vertex_count++}end(){return this.vertex_buffer=this.vertex_buffer.subarray(0,this.offset),this.element_buffer=this.vertex_elements.end(),_("trace",`VertexData: ${this.size} vertices total, realloc count ${this.realloc_count}`),this}}Ie.array_pool=[];class Fe{constructor(e){this.attribs=e,this.dynamic_attribs=this.attribs.filter(e=>null==e.static),this.static_attribs=this.attribs.filter(e=>null!=e.static),this.components=[],this.index={},this.offset={},this.stride=0;let t=0,n=0;for(let e=0;e<this.attribs.length;e++){let i=this.attribs[e];if(null==i.static){i.offset=this.stride,i.byte_size=i.size;let e=0;switch(i.type){case fe.FLOAT:case fe.INT:case fe.UNSIGNED_INT:i.byte_size*=4,e=2;break;case fe.SHORT:case fe.UNSIGNED_SHORT:i.byte_size*=2,e=1}3&i.byte_size&&(i.byte_size+=4-(3&i.byte_size)),this.stride+=i.byte_size;let r=i.offset>>e;for(let t=0;t<i.size;t++)this.components.push({type:i.type,shift:e,offset:r++,index:n++});this.index[i.name]=t,t+=i.size,this.offset[i.name]=i.offset}else i.static=Array.isArray(i.static)?i.static:[i.static],i.method=`vertexAttrib${i.static.length}fv`}}enableDynamicAttributes(e,t){for(const t in Fe.enabled_attribs)e.disableVertexAttribArray(t);Fe.enabled_attribs={},this.dynamic_attribs.forEach(n=>{const i=t.attribute(n.name).location;-1!==i&&(e.enableVertexAttribArray(i),e.vertexAttribPointer(i,n.size,n.type,n.normalized,this.stride,n.offset),Fe.enabled_attribs[i]=t)})}enableStaticAttributes(e,t){this.static_attribs.forEach(n=>{const i=t.attribute(n.name).location;-1!==i&&e[n.method]instanceof Function&&(e.enableVertexAttribArray(i),e[n.method](i,n.static),e.disableVertexAttribArray(i))})}createVertexData(){return new Ie(this)}getAddVertexFunction(){return null==this.addVertex&&this.createAddVertexFunction(),this.addVertex}createAddVertexFunction(){let e=R(JSON.stringify(this.attribs));if(null==Fe.add_vertex_funcs[e]){let t,n=["var t, o;"],i=[...this.components];i.sort((e,t)=>e.type!==t.type?e.type-t.type:e.index-t.index);for(let e=0;e<i.length;e++){let r=i[e];t!==r.type&&(n.push(`t = vs[${r.type}];`),n.push(`o = off${r.shift?" >> "+r.shift:""};`),t=r.type),n.push(`t[o + ${r.offset}] = v[${r.index}];`)}n=n.join("\n");let r=new Function("v","vs","off",n);Fe.add_vertex_funcs[e]=r}this.addVertex=Fe.add_vertex_funcs[e]}}Fe.enabled_attribs={},Fe.add_vertex_funcs={};const je=[{x:0,y:0},{x:G.tile_scale,y:-G.tile_scale}],Be=[0,0,1,1];function Ue(e,t,n){let i=je[0],r=je[1];return e[0]<=i.x+n&&t[0]<=i.x+n||e[0]>=r.x-n&&t[0]>=r.x-n||e[1]>=i.y-n&&t[1]>=i.y-n||e[1]<=r.y+n&&t[1]<=r.y+n}function Ve(e,t){t=t||0;let n=je[0],i=je[1];return e[0]<=n.x+t||e[0]>=i.x-t||e[1]>=n.y-t||e[1]<=i.y+t}var Ge,$e={exports:{}},Ze=function(){if(Ge)return $e.exports;function e(e,r,s){s=s||2;var o,a,c,h,f,p,m,_=r&&r.length,g=_?r[0]*s:e.length,y=t(e,0,g,s,!0),v=[];if(!y||y.next===y.prev)return v;if(_&&(y=function(e,i,r,s){var o,a,c,h=[];for(o=0,a=i.length;o<a;o++)(c=t(e,i[o]*s,o<a-1?i[o+1]*s:e.length,s,!1))===c.next&&(c.steiner=!0),h.push(d(c));for(h.sort(l),o=0;o<h.length;o++)u(h[o],r),r=n(r,r.next);return r}(e,r,y,s)),e.length>80*s){o=c=e[0],a=h=e[1];for(var b=s;b<g;b+=s)(f=e[b])<o&&(o=f),(p=e[b+1])<a&&(a=p),f>c&&(c=f),p>h&&(h=p);m=0!==(m=Math.max(c-o,h-a))?1/m:0}return i(y,v,s,o,a,m),v}function t(e,t,n,i,r){var s,o;if(r===T(e,t,n,i)>0)for(s=t;s<n;s+=i)o=w(s,e[s],e[s+1],o);else for(s=n-i;s>=t;s-=i)o=w(s,e[s],e[s+1],o);return o&&_(o,o.next)&&(E(o),o=o.next),o}function n(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!_(i,i.next)&&0!==m(i.prev,i,i.next))i=i.next;else{if(E(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function i(e,t,l,u,c,d,f){if(e){!f&&d&&function(e,t,n,i){var r=e;do{null===r.z&&(r.z=h(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,i,r,s,o,a,l,u=1;do{for(n=e,e=null,s=null,o=0;n;){for(o++,i=n,a=0,t=0;t<u&&(a++,i=i.nextZ);t++);for(l=u;a>0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;n=i}s.nextZ=null,u*=2}while(o>1)}(r)}(e,u,c,d);for(var p,m,_=e;e.prev!==e.next;)if(p=e.prev,m=e.next,d?s(e,u,c,d):r(e))t.push(p.i/l),t.push(e.i/l),t.push(m.i/l),E(e),e=m.next,_=m.next;else if((e=m)===_){f?1===f?i(e=o(n(e),t,l),t,l,u,c,d,2):2===f&&a(e,t,l,u,c,d):i(n(e),t,l,u,c,d,1);break}}}function r(e){var t=e.prev,n=e,i=e.next;if(m(t,n,i)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(f(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&m(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function s(e,t,n,i){var r=e.prev,s=e,o=e.next;if(m(r,s,o)>=0)return!1;for(var a=r.x<s.x?r.x<o.x?r.x:o.x:s.x<o.x?s.x:o.x,l=r.y<s.y?r.y<o.y?r.y:o.y:s.y<o.y?s.y:o.y,u=r.x>s.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,c=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,d=h(a,l,t,n,i),p=h(u,c,t,n,i),_=e.prevZ,g=e.nextZ;_&&_.z>=d&&g&&g.z<=p;){if(_!==e.prev&&_!==e.next&&f(r.x,r.y,s.x,s.y,o.x,o.y,_.x,_.y)&&m(_.prev,_,_.next)>=0)return!1;if(_=_.prevZ,g!==e.prev&&g!==e.next&&f(r.x,r.y,s.x,s.y,o.x,o.y,g.x,g.y)&&m(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;_&&_.z>=d;){if(_!==e.prev&&_!==e.next&&f(r.x,r.y,s.x,s.y,o.x,o.y,_.x,_.y)&&m(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;g&&g.z<=p;){if(g!==e.prev&&g!==e.next&&f(r.x,r.y,s.x,s.y,o.x,o.y,g.x,g.y)&&m(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function o(e,t,i){var r=e;do{var s=r.prev,o=r.next.next;!_(s,o)&&g(s,r,r.next,o)&&b(s,o)&&b(o,s)&&(t.push(s.i/i),t.push(r.i/i),t.push(o.i/i),E(r),E(r.next),r=e=o),r=r.next}while(r!==e);return n(r)}function a(e,t,r,s,o,a){var l=e;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&p(l,u)){var c=x(l,u);return l=n(l,l.next),c=n(c,c.next),i(l,t,r,s,o,a),void i(c,t,r,s,o,a)}u=u.next}l=l.next}while(l!==e)}function l(e,t){return e.x-t.x}function u(e,t){if(t=function(e,t){var n,i=t,r=e.x,s=e.y,o=-1/0;do{if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){var a=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=r&&a>o){if(o=a,a===r){if(s===i.y)return i;if(s===i.next.y)return i.next}n=i.x<i.next.x?i:i.next}}i=i.next}while(i!==t);if(!n)return null;if(r===o)return n;var l,u=n,h=n.x,d=n.y,p=1/0;i=n;do{r>=i.x&&i.x>=h&&r!==i.x&&f(s<d?r:o,s,h,d,s<d?o:r,s,i.x,i.y)&&(l=Math.abs(s-i.y)/(r-i.x),b(i,e)&&(l<p||l===p&&(i.x>n.x||i.x===n.x&&c(n,i)))&&(n=i,p=l)),i=i.next}while(i!==u);return n}(e,t),t){var i=x(t,e);n(t,t.next),n(i,i.next)}}function c(e,t){return m(e.prev,e,t.prev)<0&&m(t.next,e,e.next)<0}function h(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function d(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function f(e,t,n,i,r,s,o,a){return(r-o)*(t-a)-(e-o)*(s-a)>=0&&(e-o)*(i-a)-(n-o)*(t-a)>=0&&(n-o)*(s-a)-(r-o)*(i-a)>=0}function p(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&g(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(b(e,t)&&b(t,e)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,s=(e.y+t.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(m(e.prev,e,t.prev)||m(e,t.prev,t))||_(e,t)&&m(e.prev,e,e.next)>0&&m(t.prev,t,t.next)>0)}function m(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function _(e,t){return e.x===t.x&&e.y===t.y}function g(e,t,n,i){var r=v(m(e,t,n)),s=v(m(e,t,i)),o=v(m(n,i,e)),a=v(m(n,i,t));return r!==s&&o!==a||!(0!==r||!y(e,n,t))||!(0!==s||!y(e,i,t))||!(0!==o||!y(n,e,i))||!(0!==a||!y(n,t,i))}function y(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function v(e){return e>0?1:e<0?-1:0}function b(e,t){return m(e.prev,e,e.next)<0?m(e,t,e.next)>=0&&m(e,e.prev,t)>=0:m(e,t,e.prev)<0||m(e,e.next,t)<0}function x(e,t){var n=new A(e.i,e.x,e.y),i=new A(t.i,t.x,t.y),r=e.next,s=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function w(e,t,n,i){var r=new A(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function E(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function A(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function T(e,t,n,i){for(var r=0,s=t,o=n-i;s<n;s+=i)r+=(e[o]-e[s])*(e[s+1]+e[o+1]),o=s;return r}return Ge=1,$e.exports=e,$e.exports.default=e,e.deviation=function(e,t,n,i){var r=t&&t.length,s=r?t[0]*n:e.length,o=Math.abs(T(e,0,s,n));if(r)for(var a=0,l=t.length;a<l;a++){var u=t[a]*n,c=a<l-1?t[a+1]*n:e.length;o-=Math.abs(T(e,u,c,n))}var h=0;for(a=0;a<i.length;a+=3){var d=i[a]*n,f=i[a+1]*n,p=i[a+2]*n;h+=Math.abs((e[d]-e[p])*(e[f+1]-e[d+1])-(e[d]-e[f])*(e[p+1]-e[d+1]))}return 0===o&&0===h?0:Math.abs((h-o)/o)},e.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},i=0,r=0;r<e.length;r++){for(var s=0;s<e[r].length;s++)for(var o=0;o<t;o++)n.vertices.push(e[r][s][o]);r>0&&(i+=e[r-1].length,n.holes.push(i))}return n},$e.exports}(),qe=M(Ze);function We(e,t,n=0,i=e.length-1,r=Ke){for(;i>n;){if(i-n>600){const s=i-n+1,o=t-n+1,a=Math.log(s),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);We(e,t,Math.max(n,Math.floor(t-o*l/s+u)),Math.min(i,Math.floor(t+(s-o)*l/s+u)),r)}const s=e[t];let o=n,a=i;for(He(e,n,t),r(e[i],s)>0&&He(e,n,i);o<a;){for(He(e,o,a),o++,a--;r(e[o],s)<0;)o++;for(;r(e[a],s)>0;)a--}0===r(e[n],s)?He(e,n,a):(a++,He(e,a,i)),a<=t&&(n=a+1),t<=a&&(i=a-1)}}function He(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function Ke(e,t){return e<t?-1:e>t?1:0}const Ye=[0,0,1];function Xe(e,t,n,{texcoord_index:i,texcoord_scale:r,texcoord_normalize:s}){let o,a,l,u,c,h,d,f,p,m,_,g,y=t.vertex_elements,v=e.length,b=0;i&&(s=s||1,[o,a,l,u]=r||Be);for(let r=0;r<v;r++){const v=500;let w=e[r];w.length>v&&(w=[...w],We(w,v,1,w.length-1,(e,t)=>t.area-e.area),w=w.slice(0,v));const E=(x=qe.flatten(w),qe(x.vertices,x.holes,x.dimensions)),A=E.length,T=t.vertex_count;if(A){i&&([c,h,d,f]=G.findBoundingBox(w),p=d-c,m=f-h,_=(l-o)/p,g=(u-a)/m);for(let e=0;e<w.length;e++){let r=w[e];for(let e=0;e<r.length;e++){let l=r[e];n[0]=l[0],n[1]=l[1],i&&(n[i+0]=((l[0]-c)*_+o)*s,n[i+1]=((l[1]-h)*g+a)*s),t.addVertex(n)}}for(let e=0;e<A;e++)y.push(T+E[e]);b+=A/3}}var x;return b}var Qe='uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_order_offset;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_color;\n\n// Optional normal attribute, otherwise default to up\n#ifdef TANGRAM_NORMAL_ATTRIBUTE\n attribute vec3 a_normal;\n #define TANGRAM_NORMAL a_normal\n#else\n #define TANGRAM_NORMAL vec3(0., 0., 1.)\n#endif\n\n// Optional dynamic line extrusion\n#ifdef TANGRAM_EXTRUDE_LINES\n attribute vec2 a_extrude; // extrusion direction in xy plane\n attribute vec2 a_offset; // offset direction in xy plane\n\n // Polygon and line styles have slightly different VBO layouts, saving memory by optimizing vertex packing.\n // All lines have a width scaling factor, but only some have a height (position.z) or offset.\n // The vertex height is stored in different attributes to account for this.\n attribute vec2 a_z_and_offset_scale; // stores vertex height in x, and offset scaling factor in y\n #define TANGRAM_POSITION_Z a_z_and_offset_scale.x // vertex height is stored in separate line-specific attrib\n #define TANGRAM_OFFSET_SCALING a_z_and_offset_scale.y // zoom scaling factor for line offset\n #define TANGRAM_WIDTH_SCALING a_position.z // zoom scaling factor for line width (stored in position attrib)\n\n uniform float u_v_scale_adjust; // scales texture UVs for line dash patterns w/fractional pixel width\n#else\n #define TANGRAM_POSITION_Z a_position.z // vertex height\n#endif\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n// Optional texture UVs\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\n attribute vec2 a_texcoord;\n varying vec2 v_texcoord;\n#endif\n\n// Optional model position varying for tile coordinate zoom\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#define TANGRAM_UNPACK_SCALING(x) (x / 1024.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n // Texture UVs\n #ifdef TANGRAM_TEXTURE_COORDS\n v_texcoord = a_texcoord;\n #ifdef TANGRAM_EXTRUDE_LINES\n v_texcoord.y *= u_v_scale_adjust;\n #endif\n #endif\n\n // Pass model position to fragment shader\n #ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n v_modelpos_base_zoom = modelPositionBaseZoom();\n #endif\n\n // Position\n vec4 position = vec4(a_position.xy, TANGRAM_POSITION_Z / TANGRAM_HEIGHT_SCALE, 1.); // convert height back to meters\n\n #ifdef TANGRAM_EXTRUDE_LINES\n vec2 _extrude = a_extrude.xy;\n vec2 _offset = a_offset.xy;\n\n // Adjust line width based on zoom level, to prevent proxied lines\n // from being either too small or too big.\n // "Flattens" the zoom between 1-2 to peg it to 1 (keeps lines from\n // prematurely shrinking), then interpolate and clamp to 4 (keeps lines\n // from becoming too small when far away).\n float _dz = clamp(u_map_position.z - u_tile_origin.z, 0., 4.);\n _dz += step(1., _dz) * (1. - _dz) + mix(0., 2., clamp((_dz - 2.) / 2., 0., 1.));\n\n // Interpolate line width between zooms\n float _mdz = (_dz - 0.5) * 2.; // zoom from mid-point\n _extrude -= _extrude * TANGRAM_UNPACK_SCALING(TANGRAM_WIDTH_SCALING) * _mdz;\n\n // Interpolate line offset between zooms\n // Scales from the larger value to the smaller one\n float _dwdz = TANGRAM_UNPACK_SCALING(TANGRAM_OFFSET_SCALING);\n float _sdwdz = sign(step(0., _dwdz) - 0.5); // sign indicates "direction" of scaling\n _offset -= _offset * abs(_dwdz) * ((1.-step(0., _sdwdz)) - (_dz * -_sdwdz)); // scale "up" or "down"\n\n // Scale line width and offset to be consistent in screen space\n float _ssz = exp2(-_dz - (u_tile_origin.z - u_tile_origin.w));\n _extrude *= _ssz;\n _offset *= _ssz;\n\n // Modify line width before extrusion\n #ifdef TANGRAM_BLOCK_WIDTH\n float width = 1.;\n #pragma tangram: width\n _extrude *= width;\n #endif\n\n position.xy += _extrude + _offset;\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = wrapWorldPosition(u_model * position);\n\n // Adjust for tile and view position\n position = u_modelView * position;\n\n // Modify position before camera projection\n #pragma tangram: position\n\n // Setup varyings\n v_position = position;\n v_normal = normalize(u_normalMatrix * TANGRAM_NORMAL);\n v_color = a_color;\n\n #if defined(TANGRAM_LIGHTING_VERTEX)\n // Vertex lighting\n vec3 normal = v_normal;\n\n // Modify normal before lighting\n #pragma tangram: normal\n\n // Pass lighting intensity to fragment shader\n v_lighting = calculateLighting(position.xyz - u_eye, normal, vec4(1.));\n #endif\n\n // Camera\n cameraProjection(position);\n\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_order_offset + 1., position);\n\n gl_Position = position;\n}\n',Je="uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n#ifdef TANGRAM_EXTRUDE_LINES\n uniform bool u_has_line_texture;\n uniform sampler2D u_texture;\n uniform float u_texture_ratio;\n uniform vec4 u_dash_background_color;\n uniform float u_has_dash;\n#endif\n\n#define TANGRAM_NORMAL v_normal\n\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\n varying vec2 v_texcoord;\n#endif\n\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n vec3 normal = TANGRAM_NORMAL;\n\n // Apply raster to vertex color\n #ifdef TANGRAM_RASTER_TEXTURE_COLOR\n vec4 _raster_color = sampleRaster(0);\n\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n // Raster sources can optionally mask by the alpha channel, which will render with only full or no alpha.\n // This is used for handling transparency outside the raster image in some blend modes,\n // which either don't support alpha, or would cause transparent pixels to write to the depth buffer,\n // obscuring geometry underneath.\n #ifdef TANGRAM_HAS_MASKED_RASTERS // skip masking logic if no masked raster sources\n #ifndef TANGRAM_ALL_MASKED_RASTERS // skip source check for masking if *all* raster sources are masked\n if (u_raster_mask_alpha) {\n #else\n {\n #endif\n #if defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (_raster_color.a < TANGRAM_EPSILON) {\n discard;\n }\n #else // TANGRAM_BLEND_OPAQUE\n if (_raster_color.a < 1. - TANGRAM_EPSILON) {\n discard;\n }\n // only allow full alpha in opaque blend mode (avoids artifacts blending w/canvas tile background)\n _raster_color.a = 1.;\n #endif\n }\n #endif\n #endif\n\n color *= _raster_color; // multiplied to tint texture color\n #endif\n\n // Apply line texture\n #ifdef TANGRAM_EXTRUDE_LINES\n { // enclose in scope to avoid leakage of internal variables\n if (u_has_line_texture) {\n vec2 _line_st = vec2(v_texcoord.x, fract(v_texcoord.y / u_texture_ratio));\n vec4 _line_color = texture2D(u_texture, _line_st);\n\n // If the line has a dash pattern, the line texture indicates if the current fragment should be\n // the dash foreground or background color. If the line doesn't have a dash pattern,\n // the line texture color is used directly (but also tinted by the vertex color).\n color = mix(\n color * _line_color, // no dash: tint the line texture with the vertex color\n mix(u_dash_background_color, color, _line_color.a), // choose dash foreground or background color\n u_has_dash // 0 if no dash, 1 if has dash\n );\n\n // Use alpha discard test as a lower-quality substitute for blending\n #if defined(TANGRAM_BLEND_OPAQUE)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n }\n }\n #endif\n\n // First, get normal from raster tile (if applicable)\n #ifdef TANGRAM_RASTER_TEXTURE_NORMAL\n normal = normalize(sampleRaster(0).rgb * 2. - 1.);\n #endif\n\n // Second, alter normal with normal map texture (if applicable)\n #if defined(TANGRAM_LIGHTING_FRAGMENT) && defined(TANGRAM_MATERIAL_NORMAL_TEXTURE)\n calculateNormal(normal);\n #endif\n\n // Normal modification applied here for fragment lighting or no lighting,\n // and in vertex shader for vertex lighting\n #if !defined(TANGRAM_LIGHTING_VERTEX)\n #pragma tangram: normal\n #endif\n\n // Color modification before lighting is applied\n #pragma tangram: color\n\n #if defined(TANGRAM_LIGHTING_FRAGMENT)\n // Calculate per-fragment lighting\n color = calculateLighting(v_position.xyz - u_eye, normal, color);\n #elif defined(TANGRAM_LIGHTING_VERTEX)\n // Apply lighting intensity interpolated from vertex shader\n color *= v_lighting;\n #endif\n\n // Post-processing effects (modify color after lighting)\n #pragma tangram: filter\n\n gl_FragColor = color;\n}\n";const et=Object.create(Re);Object.assign(et,{name:"polygons",built_in:!0,vertex_shader_src:Qe,fragment_shader_src:Je,selection:!0,init(){Re.init.apply(this,arguments),this.defines.TANGRAM_NORMAL_ATTRIBUTE=!0,this.defines.TANGRAM_TEXTURE_COORDS=this.texcoords},_parseFeature(e,t,n){var i=this.feature_style;return i.color=this.parseColor(t.color,n),i.color?(i.alpha=J.evalCachedProperty(t.alpha,n),i.variant=t.variant,i.z=J.evalCachedDistanceProperty(t.z,n)||J.defaults.z,i.z*=G.height_scale,i.extrude=J.evalProperty(t.extrude,n),i.extrude&&(!0===i.extrude?(i.height=e.properties.height||J.defaults.height,i.min_height=e.properties.min_height||J.defaults.min_height):"number"==typeof i.extrude?(i.height=i.extrude,i.min_height=0):Array.isArray(i.extrude)&&(i.min_height=i.extrude[0],i.height=i.extrude[1]),i.height*=G.height_scale,i.min_height*=G.height_scale),i.tile_edges=t.tile_edges,i):null},_preprocess(e){return e.color=J.createColorPropertyCache(e.color),e.alpha=J.createPropertyCache(e.alpha),e.z=J.createPropertyCache(e.z,J.parseUnits),this.computeVariant(e),e},computeVariant(e){const t=e.interactive?1:0,n=null!=e.extrude?1:0,i=this.texcoords?1:0,r=this.getBlendOrderForDraw(e),s=[t,n,i,r].join("/");e.variant=s,null==this.variants[s]&&(this.variants[s]={key:s,blend_order:r,mesh_order:0,selection:t,normal:n,texcoords:i})},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.key]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_normal",size:3,type:fe.BYTE,normalized:!0,static:e.normal?null:[0,0,1]},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0,static:e.texcoords?null:[0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new Fe(t)}return this.vertex_layouts[e.key]},meshVariantTypeForDraw(e){return this.variants[e.variant]},makeVertexTemplate(e,t){let n=0;return this.vertex_template[n++]=0,this.vertex_template[n++]=0,this.vertex_template[n++]=e.z||0,this.vertex_template[n++]=this.scaleOrder(e.order),t.variant.normal&&(this.vertex_template[n++]=0,this.vertex_template[n++]=0,this.vertex_template[n++]=127),this.vertex_template[n++]=255*e.color[0],this.vertex_template[n++]=255*e.color[1],this.vertex_template[n++]=255*e.color[2],this.vertex_template[n++]=255*(null!=e.alpha?e.alpha:e.color[3]),t.variant.selection&&(this.vertex_template[n++]=255*e.selection_color[0],this.vertex_template[n++]=255*e.selection_color[1],this.vertex_template[n++]=255*e.selection_color[2],this.vertex_template[n++]=255*e.selection_color[3]),t.variant.texcoords&&(this.vertex_template[n++]=0,this.vertex_template[n++]=0),this.addCustomAttributesToVertexTemplate(e,n),this.vertex_template},buildPolygons(e,t,n){let i=this.getTileMesh(n.tile,this.meshVariantTypeForDraw(t)),r=i.vertex_data,s=r.vertex_layout,o=this.makeVertexTemplate(t,i),a={texcoord_index:s.index.a_texcoord,texcoord_normalize:65535,remove_tile_edges:!t.tile_edges,tile_edge_tolerance:G.tile_scale*n.tile.pad_scale*4,winding:n.winding};return t.extrude&&t.height?function(e,t,n,i,r,s,o,a,{remove_tile_edges:l,tile_edge_tolerance:u,texcoord_index:c,texcoord_scale:h,texcoord_normalize:d,winding:f}){var p=t+(i||0),m=t+n;s[2]=m;var _=Xe(e,r,s,{texcoord_index:c,texcoord_scale:h,texcoord_normalize:d}),g=r.vertex_elements,y=r.vertex_count;if(c){d=d||1;var[v,b,x,w]=h||Be,E=[[v,w],[v,b],[x,b],[x,w]]}for(var A=e.length,T=0;T<A;T++)for(var k=e[T],S=0;S<k.length;S++)for(var O=k[S],P=0;P<O.length-1;P++){if(l&&Ue(O[P],O[P+1],u))continue;let e,t;"CCW"===f?(e=P,t=P+1):(e=P+1,t=P);var C=[[O[t][0],O[t][1],m],[O[t][0],O[t][1],p],[O[e][0],O[e][1],p],[O[e][0],O[e][1],m]];let n=ye.normalize([O[t][0]-O[e][0],O[t][1]-O[e][1],0]),i=ye.cross(Ye,n);s[o+0]=i[0]*a,s[o+1]=i[1]*a,s[o+2]=i[2]*a;for(var R=0;R<C.length;R++)s[0]=C[R][0],s[1]=C[R][1],s[2]=C[R][2],c&&(s[c+0]=E[R][0]*d,s[c+1]=E[R][1]*d),r.addVertex(s);g.push(y+0),g.push(y+1),g.push(y+2),g.push(y+2),g.push(y+3),g.push(y+0),y+=4,_+=2}return _}(e,t.z,t.height,t.min_height,r,o,s.index.a_normal,127,a):Xe(e,r,o,a)}});const tt=[0,0],nt={butt:0,square:1,round:2},it={miter:0,bevel:1,round:2},rt=G.tile_scale,st=[0,0],ot=[1,0],at=[.5,0];function lt(e,t){if(!(e.length<2)){var n,i,r,s,{join_type:o,cap_type:a,closed_polygon:l,remove_tile_edges:u,tile_edge_tolerance:c,v_scale:h,miter_len_sq:d}=t,f=null!=t.texcoord_index,p=0;if(l&&o===it.miter){var m=function(e){if(Ve(e[0]))return 0;for(var t=0;t<e.length;t++)if(Ve(e[e.length-1-t]))return e.length-1-t;return 0}(e);if(0!==m){var _=function(e,t){var n=[];for(let r=0;r<e.length;r++){var i=(r+t)%e.length;0!==i&&n.push(e[i])}return n.push(n[0]),n}(e,m);return t.extra_lines=t.extra_lines||[],void t.extra_lines.push(_)}}var g=0,y=e.length-1,v=0;for(n=e[g],i=e[g+1];ye.isEqual(n,i);)if(n=i,i=e[1+ ++g],v++,g===e.length-1)return;for(;ye.isEqual(e[y],e[y-1]);)if(v++,0===--y)return;if(!(e.length<2+v))if(s=ye.normalize(ye.perp(n,i)),u&&Ue(n,i,c)){var b=ut(e,g,c);b&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(b))}else{l?function(e,t,n,i,r){if(void 0===i||Ve(e))pt(e,n,n,1,0,r,1),pt(e,n,n,0,0,r,-1);else{i===it.miter?ht(0,e,t,n,r.miter_len_sq,!0,r):dt(i,0,e,t,n,!0,r)}}(n,r=ye.normalize(ye.perp(e[y-1],n)),s,o,t):(Ve(n)||(gt(n,p,s,a,!0,t),f&&a!==nt.butt&&(p+=.5*h*t.texcoord_width)),pt(n,s,s,1,p,t,1),pt(n,s,s,0,p,t,-1)),f&&(p+=h*ye.length(ye.sub(i,n)));for(var x=g+1;x<y;x++){var w=x,E=x+1;if(n=e[w],i=e[E],!ye.isEqual(n,i)){if(u&&Ue(n,i,c)){pt(n,s,s,1,p,t,1),pt(n,s,s,0,p,t,-1),ft(1,t);var A=ut(e,w+1,c);return void(A&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(A)))}r=s,s=ye.normalize(ye.perp(n,i)),o===it.miter?ht(p,n,r,s,d,!1,t):dt(o,p,n,r,s,!1,t),f&&(p+=h*ye.length(ye.sub(i,n)))}}n=i,r=s,l?function(e,t,n,i,r,s){if(Ve(e))pt(e,t,t,1,r,s,1),pt(e,t,t,0,r,s,-1),ft(1,s);else{var o=ct(t,n);i===it.miter&&ye.lengthSq(o)>s.miter_len_sq&&(i=it.bevel),i===it.miter?(pt(e,o,t,1,r,s,1),pt(e,o,t,0,r,s,-1),ft(1,s)):(pt(e,t,t,1,r,s,1),pt(e,t,t,0,r,s,-1),ft(1,s))}}(n,r,s=ye.normalize(ye.perp(n,e[1])),o,p,t):(pt(n,r,s,1,p,t,1),pt(n,r,s,0,p,t,-1),ft(1,t),Ve(n)||gt(n,p,r,a,!1,t))}}}function ut(e,t,n){for(var i=t;e[i+1]&&Ue(e[i],e[i+1],n);)i++;return e.length-i>=2&&e.slice(i)}function ct(e,t){var n=ye.normalize(ye.add(e,t)),i=2/(1+Math.abs(ye.dot(e,n)));return ye.mult(n,i*i)}function ht(e,t,n,i,r,s,o){var a=ct(n,i);ye.lengthSq(a)>r?dt(it.bevel,e,t,n,i,s,o):(pt(t,a,a,1,e,o,1),pt(t,a,a,0,e,o,-1),s||ft(1,o))}function dt(e,t,n,i,r,s,o){var a=ct(i,r),l=r[0]*i[1]-r[1]*i[0]>0;null!=o.texcoord_index&&(st[1]=t,ot[1]=t),l?(pt(n,a,a,1,t,o,1),pt(n,i,a,0,t,o,-1),s||ft(1,o),_t(n,ye.neg(i),a,ye.neg(r),a,st,ot,st,!1,e===it.bevel,o),pt(n,a,a,1,t,o,1),pt(n,r,a,0,t,o,-1)):(pt(n,i,a,1,t,o,1),pt(n,a,a,0,t,o,-1),s||ft(1,o),_t(n,i,ye.neg(a),r,a,ot,st,ot,!1,e===it.bevel,o),pt(n,r,a,1,t,o,1),pt(n,a,a,0,t,o,-1))}function ft(e,t){for(var n=t.vertex_data.vertex_elements,i=t.vertex_data.vertex_count-2*e-2,r=0;r<e;r++)n.push(i+2*r+2),n.push(i+2*r+1),n.push(i+2*r+0),n.push(i+2*r+2),n.push(i+2*r+3),n.push(i+2*r+1),t.geom_count+=2}function pt(e,t,n,i,r,s,o){var a=s.vertex_template,l=s.vertex_data;a[0]=e[0],a[1]=e[1];let u=s.half_width*o;a[s.extrude_index+0]=t[0]*u,a[s.extrude_index+1]=t[1]*u,s.offset&&(a[s.offset_index+0]=n[0]*s.offset,a[s.offset_index+1]=n[1]*s.offset),null!=s.texcoord_index&&(a[s.texcoord_index+0]=65535*i,a[s.texcoord_index+1]=65535*r),l.addVertex(a)}var mt=[0,0];function _t(e,t,n,i,r,s,o,a,l,u,c){for(var h=t[0]*i[1]-t[1]*i[0],d=ye.dot(t,i),f=Math.atan2(h,d);f>=Math.PI;)f-=2*Math.PI;if(u)p=1;else{var p=function(e,t){e<0&&(e=-e);var n=t>10?Math.log2(t/5):1;return Math.ceil(e/Math.PI*n)}(f,c.half_width);if(p<1)return}var m=c.vertex_data.vertex_count,_=c.vertex_data.vertex_elements;pt(e,n,r,o[0],o[1],c,1),pt(e,t,r,s[0],s[1],c,1);var g=t,y=null!=c.texcoord_index;if(y)if(l)var v=ye.sub(s,o);else{mt=ye.copy(s);var b=ye.div(ye.sub(a,s),p)}var x=f/p;let w,E,A=f<0?-1:1;h>0?(w=2,E=1):(w=1,E=2);for(var T=0;T<p;T++)0===T&&f<0&&(g=ye.neg(g)),g=ye.rot(g,x),y&&(l?(v=ye.rot(v,x),mt[0]=v[0]+o[0],mt[1]=v[1]*c.texcoord_width*c.v_scale+o[1]):mt=ye.add(mt,b)),pt(e,g,r,mt[0],mt[1],c,A),_.push(m+T+w),_.push(m),_.push(m+T+E)}function gt(e,t,n,i,r,s){var o=ye.neg(n),a=null!=s.texcoord_index;switch(i){case nt.square:var l;r?(l=[n[1],-n[0]],pt(e,ye.add(n,l),n,1,t,s,1),pt(e,ye.add(o,l),n,0,t,s,1),a&&(t+=.5*s.texcoord_width*s.v_scale),pt(e,n,n,1,t,s,1),pt(e,o,n,0,t,s,1)):(l=[-n[1],n[0]],pt(e,n,n,1,t,s,1),pt(e,o,n,0,t,s,1),a&&(t+=.5*s.texcoord_width*s.v_scale),pt(e,ye.add(n,l),n,1,t,s,1),pt(e,ye.add(o,l),n,0,t,s,1)),ft(1,s);break;case nt.round:var u,c,h=st,d=ot,f=at;r?(u=n,c=o,a&&(t+=.5*s.texcoord_width*s.v_scale,h=ot,d=st,f=at)):(u=o,c=n),a&&(st[1]=t,ot[1]=t,at[1]=t),_t(e,u,tt,c,n,h,f,d,!0,!1,s);break;case nt.butt:return}}const yt=[255,255,255,255],vt=[0,0,0,0],bt=Object.create(Re);Object.assign(bt,{name:"lines",built_in:!0,vertex_shader_src:Qe,fragment_shader_src:Je,selection:!0,init(){Re.init.apply(this,arguments),this.defines.TANGRAM_EXTRUDE_LINES=!0,this.defines.TANGRAM_TEXTURE_COORDS=!0,this.outline_feature_style={},this.inline_feature_style=this.feature_style,this.dash_textures={}},calcDistance:(e,t)=>J.evalCachedDistanceProperty(e,t)||0,calcDistanceNextZoom(e,t){t.zoom++;let n=this.calcDistance(e,t);return t.zoom--,n},calcWidth(e,t,n){let i,r=this.calcDistance(e.width,n);if(!(r<0)){if(i=e.next_width?this.calcDistanceNextZoom(e.next_width,n):r/2,0===r&&0===i||i<0)return!1;if(t.width_unscaled=r,t.next_width_unscaled=i,e.next_width){i*=2;let e=.5*(r+i);t.width=e*n.units_per_meter_overzoom,t.width_scale=1-i/e}else t.width=r*n.units_per_meter_overzoom,t.width_scale=0;return e.texcoords&&(e.inline_texcoord_width?t.texcoord_width=e.inline_texcoord_width:t.texcoord_width=(t.width_unscaled||t.next_width_unscaled)*n.units_per_meter_overzoom/n.tile.overzoom2),!0}},calcOffset(e,t,n){if(e.offset_precalc)t.offset=e.offset_precalc,t.offset_scale=e.offset_scale_precalc;else if(e.offset){let i=this.calcDistance(e.offset,n);if(e.next_offset){let r=2*this.calcDistanceNextZoom(e.next_offset,n);Math.abs(i)>=Math.abs(r)?(t.offset=i*n.units_per_meter_overzoom,t.offset_scale=0!==i?1-r/i:0):(t.offset=r*n.units_per_meter_overzoom,t.offset_scale=0!==r?-1*(1-i/r):0)}else t.offset=i*n.units_per_meter_overzoom,t.offset_scale=0}else t.offset=0,t.offset_scale=0},_parseFeature(e,t,n){var i=this.feature_style;if(!1!==this.calcWidth(t,i,n)&&(this.calcOffset(t,i,n),i.color=this.parseColor(t.color,n),i.color)){if(i.alpha=J.evalCachedProperty(t.alpha,n),i.variant=t.variant,i.z=J.evalCachedDistanceProperty(t.z,n)||J.defaults.z,i.height=e.properties.height||J.defaults.height,i.extrude=J.evalProperty(t.extrude,n),i.extrude&&("number"==typeof i.extrude?i.height=i.extrude:Array.isArray(i.extrude)&&(i.height=i.extrude[1])),i.extrude&&i.height&&(i.z+=i.height),i.z*=G.height_scale,i.cap=t.cap,i.join=t.join,i.miter_limit=t.miter_limit,i.tile_edges=t.tile_edges,i.outline=i.outline||{width:{},next_width:{},preprocessed:!0},t.outline&&!1!==t.outline.visible&&t.outline.color&&t.outline.width){let e=2*this.calcDistance(t.outline.width,n),r=2*this.calcDistanceNextZoom(t.outline.next_width,n);0===e&&0===r||e<0||r<0?(i.outline.width.value=null,i.outline.next_width.value=null,i.outline.color=null,i.outline.inline_texcoord_width=null,i.outline.texcoords=!1):(i.outline.width.value=e+i.width_unscaled,i.outline.next_width.value=r+i.next_width_unscaled,i.outline.inline_texcoord_width=i.texcoord_width,i.outline.offset_precalc=i.offset,i.outline.offset_scale_precalc=i.offset_scale,i.outline.color=t.outline.color,i.outline.alpha=t.outline.alpha,i.outline.interactive=t.outline.interactive,i.outline.cap=t.outline.cap,i.outline.join=t.outline.join,i.outline.miter_limit=t.outline.miter_limit,i.outline.texcoords=t.outline.texcoords,i.outline.extrude=t.outline.extrude,i.outline.z=t.outline.z,i.outline.style=t.outline.style,i.outline.variant=t.outline.variant,t.outline.order?i.outline.order=this.parseOrder(t.outline.order,n):i.outline.order=i.order,i.outline.order>i.order&&(i.outline.order=i.order),i.outline.order-=.5)}else i.outline.width.value=null,i.outline.next_width.value=null,i.outline.color=null,i.outline.inline_texcoord_width=null;return i}},_preprocess(e){if(e.color=J.createColorPropertyCache(e.color),e.alpha=J.createPropertyCache(e.alpha),e.width=J.createPropertyCache(e.width,J.parseUnits),e.width&&e.width.type!==J.CACHE_TYPE.STATIC&&(e.next_width=J.createPropertyCache(e.width,J.parseUnits)),e.offset=e.offset&&J.createPropertyCache(e.offset,J.parseUnits),e.offset&&e.offset.type!==J.CACHE_TYPE.STATIC&&(e.next_offset=J.createPropertyCache(e.offset,J.parseUnits)),e.z=J.createPropertyCache(e.z,J.parseUnits),e.dash=void 0!==e.dash?e.dash:this.dash,e.dash_key=e.dash&&this.dashTextureKey(e.dash),e.dash_background_color=void 0!==e.dash_background_color?e.dash_background_color:this.dash_background_color,e.dash_background_color=e.dash_background_color&&J.parseColor(e.dash_background_color),e.texture_merged=e.dash_key||(void 0!==e.texture?e.texture:this.texture),e.texcoords=this.texcoords||e.texture_merged?1:0,this.computeVariant(e),e.outline){e.outline.is_outline=!0,e.outline.style=e.outline.style||this.name,e.outline.color=J.createColorPropertyCache(e.outline.color),e.outline.alpha=J.createPropertyCache(e.outline.alpha),e.outline.width=J.createPropertyCache(e.outline.width,J.parseUnits),e.outline.next_width=J.createPropertyCache(e.outline.width,J.parseUnits),e.outline.interactive=null!=e.outline.interactive?e.outline.interactive:e.interactive,e.outline.cap=e.outline.cap||e.cap,e.outline.join=e.outline.join||e.join,e.outline.miter_limit=null!=e.outline.miter_limit?e.outline.miter_limit:e.miter_limit,e.outline.offset=e.offset,e.outline.extrude=e.extrude,e.outline.z=e.z;let t=this.styles[e.outline.style];t?(e.outline.dash=void 0!==e.outline.dash?e.outline.dash:t.dash,e.outline.texture=void 0!==e.outline.texture?e.outline.texture:t.texture,null!=e.outline.dash?(e.outline.dash_key=e.outline.dash&&this.dashTextureKey(e.outline.dash),e.outline.texture_merged=e.outline.dash_key):null===e.outline.dash||null!=e.outline.texture?(e.outline.dash_key=null,e.outline.texture_merged=e.outline.texture):(e.outline.dash=e.dash,e.outline.dash_key=e.outline.dash&&this.dashTextureKey(e.outline.dash),e.outline.texture_merged=e.outline.dash_key),e.outline.dash_background_color=void 0!==e.outline.dash_background_color?e.outline.dash_background_color:t.dash_background_color,e.outline.dash_background_color=void 0!==e.outline.dash_background_color?e.outline.dash_background_color:e.dash_background_color,e.outline.dash_background_color=e.outline.dash_background_color&&J.parseColor(e.outline.dash_background_color),e.outline.texcoords=t.texcoords||e.outline.texture_merged?1:0,void 0===e.outline.blend_order&&null!=e.blend_order&&(e.outline.blend_order=e.blend_order),t.computeVariant(e.outline)):(_({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': line 'outline' specifies non-existent draw style '${e.outline.style}' (or maybe the style is defined but is missing a 'base' or has another error), skipping outlines for features matching this layer group`),e.outline=null)}return e},dashTextureKey:e=>"__dash_"+JSON.stringify(e),getDashTexture(e){let t=this.dashTextureKey(e);if(null==this.dash_textures[t]){this.dash_textures[t]=!0;const n=function(e,t={}){const n=t.dash_color||yt,i=t.background_color||vt,r=e,s=t.scale||1;r.length%2==1&&Array.prototype.push.apply(r,r);let o=!0,a=[];for(let e=0;e<r.length;e++){let t=Math.floor(r[e]*s);for(let e=0;e<t;e++)Array.prototype.push.apply(a,o?n:i);o=!o}return a.reverse(),a=new Uint8Array(a),{pixels:a,length:a.length/4}}(e,{scale:20});S.create(this.gl,t,{data:n.pixels,height:n.length,width:1,filtering:"nearest"})}},async endData(e){const t=await Re.endData.call(this,e);if(t){t.uniforms.u_has_line_texture=!1,t.uniforms.u_texture=S.default,t.uniforms.u_v_scale_adjust=G.tile_scale;let n=[];for(let i in t.meshes){let r=t.meshes[i].variant;if(r.texture){let s=t.meshes[i].uniforms=t.meshes[i].uniforms||{};if(s.u_has_line_texture=!0,s.u_texture=r.texture,s.u_texture_ratio=1,r.dash&&(s.u_v_scale_adjust=20*G.tile_scale,s.u_has_dash=null!=r.dash_background_color?1:0,s.u_dash_background_color=r.dash_background_color||[0,0,0,0]),r.dash_key&&null==this.dash_textures[r.dash_key]){this.dash_textures[r.dash_key]=!0;try{await a.postMessage(this.main_thread_target+".getDashTexture",r.dash)}catch(e){_("trace",`${this.name}: line dash texture create failed because style no longer on main thread`)}}if(null==S.textures[r.texture])n.push(S.syncTexturesToWorker([r.texture]).then(e=>{let t=e[r.texture];t&&(s.u_texture_ratio=t.height/t.width)}));else{let e=S.textures[r.texture];s.u_texture_ratio=e.height/e.width}}}await Promise.all(n)}return t},computeVariant(e){let t=e.offset?1:0;t+="/"+e.texcoords,t+="/"+(e.interactive?1:0),t+="/"+(e.extrude||e.z?1:0),t+="/"+e.is_outline,e.dash_key&&(t+=e.dash_key,e.dash_background_color&&(t+=e.dash_background_color)),e.texture_merged&&(t+=e.texture_merged);const n=this.getBlendOrderForDraw(e);t+="/"+n,t=R(t),e.variant=t,null==this.variants[t]&&(this.variants[t]={key:t,blend_order:n,mesh_order:e.is_outline?0:1,selection:e.interactive?1:0,offset:e.offset?1:0,z_or_offset:e.offset||e.extrude||e.z?1:0,texcoords:e.texcoords,texture:e.texture_merged,dash:e.dash,dash_key:e.dash_key,dash_background_color:e.dash_background_color})},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.key]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_extrude",size:2,type:fe.SHORT,normalized:!1},{name:"a_offset",size:2,type:fe.SHORT,normalized:!1,static:e.offset?null:[0,0]},{name:"a_z_and_offset_scale",size:2,type:fe.SHORT,normalized:!1,static:e.z_or_offset?null:[0,0]},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0,static:e.texcoords?null:[0,0]},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new Fe(t)}return this.vertex_layouts[e.key]},meshVariantTypeForDraw(e){return this.variants[e.variant]},makeVertexTemplate(e,t){let n=0;return this.vertex_template[n++]=0,this.vertex_template[n++]=0,this.vertex_template[n++]=1024*e.width_scale,this.vertex_template[n++]=this.scaleOrder(e.order),this.vertex_template[n++]=0,this.vertex_template[n++]=0,t.variant.offset&&(this.vertex_template[n++]=0,this.vertex_template[n++]=0),t.variant.z_or_offset&&(this.vertex_template[n++]=e.z||0,this.vertex_template[n++]=1024*e.offset_scale),t.variant.texcoords&&(this.vertex_template[n++]=0,this.vertex_template[n++]=0),this.vertex_template[n++]=255*e.color[0],this.vertex_template[n++]=255*e.color[1],this.vertex_template[n++]=255*e.color[2],this.vertex_template[n++]=255*(null!=e.alpha?e.alpha:e.color[3]),t.variant.selection&&(this.vertex_template[n++]=255*e.selection_color[0],this.vertex_template[n++]=255*e.selection_color[1],this.vertex_template[n++]=255*e.selection_color[2],this.vertex_template[n++]=255*e.selection_color[3]),this.addCustomAttributesToVertexTemplate(e,n),this.vertex_template},buildLines(e,t,n,i){if(this.feature_style=this.outline_feature_style,t.outline&&null!=t.outline.color&&null!=t.outline.width.value){var r=this.styles[t.outline.style];r&&r.addFeature(n.feature,t.outline,n)}this.feature_style=this.inline_feature_style;let s=this.getTileMesh(n.tile,this.meshVariantTypeForDraw(t)),o=s.vertex_data,a=o.vertex_layout;return function(e,t,n,i,r,s,o,a){var l,u=t.cap?nt[t.cap]:nt.butt,c=t.join?it[t.join]:it.miter;if(c===it.miter){const e=t.miter_limit||3;var h=e*e}r.a_texcoord&&(l=1/(t.texcoord_width*rt));var d={closed_polygon:s,remove_tile_edges:o,tile_edge_tolerance:a,miter_len_sq:h,join_type:c,cap_type:u,vertex_data:n,vertex_template:i,half_width:t.width/2,extrude_index:r.a_extrude,offset_index:r.a_offset,v_scale:l,texcoord_index:r.a_texcoord,texcoord_width:t.texcoord_width,offset:t.offset,geom_count:0};for(let t=0;t<e.length;t++)lt(e[t],d);if(d.extra_lines)for(let e=0;e<d.extra_lines.length;e++)lt(d.extra_lines[e],d);return d.geom_count}(e,t,o,this.makeVertexTemplate(t,s),a.index,i&&i.closed_polygon,!t.tile_edges&&i&&i.remove_tile_edges,G.tile_scale*n.tile.pad_scale*2)},buildPolygons(e,t,n){let i=0;for(let r=0;r<e.length;r++)i+=this.buildLines(e[r],t,n,{closed_polygon:!0,remove_tile_edges:!0});return i}});const xt=128/Math.PI,wt=16384/Math.PI,Et=[0,2,2,0],At=[1,1,3,3],Tt=new Array(4),kt=["left","top-left","bottom-left"],St=["right","top-right","bottom-right"],Ot=["top","top-left","top-right"],Pt=["bottom","bottom-left","bottom-right"],Ct={computeOffset(e,t,n,i=null){if(!n||"center"===n)return e;let r=[e[0],e[1]];return i=i||this.default_buffer,this.isLeftAnchor(n)?(r[0]-=t[0]/2,"left"===n&&(r[0]-=i[0])):this.isRightAnchor(n)&&(r[0]+=t[0]/2,"right"===n&&(r[0]+=i[1])),this.isTopAnchor(n)?(r[1]-=t[1]/2,"top"===n&&(r[1]-=i[2])):this.isBottomAnchor(n)&&(r[1]+=t[1]/2,"bottom"===n&&(r[1]+=i[3])),r},alignForAnchor(e){if(e&&"center"!==e){if(this.isLeftAnchor(e))return"right";if(this.isRightAnchor(e))return"left"}return"center"},isLeftAnchor:e=>kt.indexOf(e)>-1,isRightAnchor:e=>St.indexOf(e)>-1,isTopAnchor:e=>Ot.indexOf(e)>-1,isBottomAnchor:e=>Pt.indexOf(e)>-1,default_buffer:[2.5,2.5,1.5,.75],zero_buffer:[0,0,0,0]};function Rt(e,t){return!(e[2]<t[0]||e[0]>t[2]||e[3]<t[1]||e[1]>t[3])}const Mt=[[1,0],[0,1]],Lt=[],Nt=[];let zt,Dt,It,Ft;class jt{constructor(e,t,n,i,r){this.dimension=[i/2,r/2],this.angle=n,this.centroid=[e,t],this.quad=null,this.axis_0=null,this.axis_1=null,this.update()}toJSON(){return{x:this.centroid[0],y:this.centroid[1],a:this.angle,w:this.dimension[0],h:this.dimension[1]}}getExtent(){return 0===this.angle?[this.quad[0],this.quad[1],this.quad[4],this.quad[5]]:[Math.min(this.quad[0],this.quad[2],this.quad[4],this.quad[6]),Math.min(this.quad[1],this.quad[3],this.quad[5],this.quad[7]),Math.max(this.quad[0],this.quad[2],this.quad[4],this.quad[6]),Math.max(this.quad[1],this.quad[3],this.quad[5],this.quad[7])]}updateAxes(){this.axis_0=ye.normalize([this.quad[4]-this.quad[6],this.quad[5]-this.quad[7]]),this.axis_1=ye.normalize([this.quad[4]-this.quad[2],this.quad[5]-this.quad[3]])}update(){const e=this.centroid,t=this.dimension[0],n=this.dimension[1];if(0===this.angle)this.quad=[e[0]-t,e[1]-n,e[0]+t,e[1]-n,e[0]+t,e[1]+n,e[0]-t,e[1]+n],this.axis_0=Mt[0],this.axis_1=Mt[1];else{let i=Math.cos(this.angle)*t,r=Math.sin(this.angle)*t,s=-Math.sin(this.angle)*n,o=Math.cos(this.angle)*n;this.quad=[e[0]-i-s,e[1]-r-o,e[0]+i-s,e[1]+r-o,e[0]+i+s,e[1]+r+o,e[0]-i+s,e[1]-r+o],this.updateAxes()}}static projectToAxis(e,t,n){let i=e.quad;return zt=i[0]*t[0]+i[1]*t[1],Dt=i[2]*t[0]+i[3]*t[1],It=i[4]*t[0]+i[5]*t[1],Ft=i[6]*t[0]+i[7]*t[1],n[0]=Math.min(zt,Dt,It,Ft),n[1]=Math.max(zt,Dt,It,Ft),n}static axisCollide(e,t,n,i){return jt.projectToAxis(e,n,Lt),jt.projectToAxis(t,n,Nt),!(Nt[0]>Lt[1]||Nt[1]<Lt[0]||(jt.projectToAxis(e,i,Lt),jt.projectToAxis(t,i,Nt),Nt[0]>Lt[1]||Nt[1]<Lt[0]))}static intersect(e,t){return jt.axisCollide(e,t,e.axis_0,e.axis_1)&&jt.axisCollide(e,t,t.axis_0,t.axis_1)}}class Bt{constructor(e,t={}){this.id=Bt.nextLabelId(),this.type="",this.size=e,this.layout=t,this.position=null,this.angle=0,this.anchor=Array.isArray(this.layout.anchor)?this.layout.anchor[0]:this.layout.anchor,this.placed=null,this.offset=t.offset,this.unit_scale=this.layout.units_per_pixel,this.aabb=null,this.obb=null,this.align="center",this.throw_away=!1}toJSON(){return{id:this.id,type:this.type,obb:this.obb.toJSON(),position:this.position,angle:this.angle,size:this.size,offset:this.offset,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Ut(this.layout)}}update(){this.align=this.layout.align||Ct.alignForAnchor(this.anchor)}occluded(e,t=null){let n=!1,i=e.aabb,r=e.obb;return i.length>0&&function(e,t,n){for(let i=0;i<t.length&&(!Rt(e,t[i])||null==n(i));i++);}(this.aabb,i,e=>{if(!t||i[e]!==t.aabb)return 0===this.obb.angle&&0===r[e].angle||jt.intersect(this.obb,r[e])?(n=!0,!0):void 0}),n}inTileBounds(){return this.aabb[0]>=0&&this.aabb[1]>-G.tile_scale&&this.aabb[0]<G.tile_scale&&this.aabb[1]<=0||this.aabb[2]>=0&&this.aabb[3]>-G.tile_scale&&this.aabb[2]<G.tile_scale&&this.aabb[3]<=0}mayRepeatAcrossTiles(){if(this.layout.collide)return!0;const e=this.layout.repeat_distance;return 0!==e&&(Math.abs(this.position[0])<e||Math.abs(this.position[0]-G.tile_scale)<e||Math.abs(this.position[1])<e||Math.abs(-(this.position[1]-G.tile_scale))<e)}discard(e,t=null){return!!this.throw_away||this.occluded(e,t)}}function Ut(e){return{priority:e.priority,collide:e.collide,repeat_distance:e.repeat_distance,repeat_group:e.repeat_group,buffer:e.buffer,italic:e.italic}}Bt.add=function(e,t){if(e.placed=!0,e.aabb&&(t.aabb.push(e.aabb),t.obb.push(e.obb)),e.aabbs)for(let n=0;n<e.aabbs.length;n++)t.aabb.push(e.aabbs[n]),t.obb.push(e.obbs[n])},Bt.id=0,Bt.id_prefix=0,Bt.id_multiplier=0,Bt.nextLabelId=function(){return Bt.id_prefix+Bt.id++*Bt.id_multiplier},Bt.epsilon=.9999;class Vt{constructor(e,t){this.key=e,this.repeat_dist=t,this.repeat_dist_sq=this.repeat_dist*this.repeat_dist,this.positions=[]}check(e){let t=e.position;for(let e=0;e<this.positions.length;e++){let n=this.positions[e],i=t[0]-n[0],r=t[1]-n[1];if(i*i+r*r<this.repeat_dist_sq)return!0}}add(e){e&&e.position&&this.positions.push(e.position)}static clear(e){this.groups[e]={}}static check(e,t,n){if(t.repeat_distance&&t.repeat_group&&this.groups[n][t.repeat_group])return this.groups[n][t.repeat_group].check(e)}static add(e,t,n){t.repeat_distance&&t.repeat_group&&(null==this.groups[n][t.repeat_group]&&(this.groups[n][t.repeat_group]=new Vt(t.repeat_group,t.repeat_distance*t.repeat_scale)),this.groups[n][t.repeat_group].add(e))}}Vt.groups={};class Gt{constructor(e,t){this.anchor=e,this.span=t,this.cells={}}addLabel(e){e.aabb&&this.addLabelBboxes(e,e.aabb),e.aabbs&&e.aabbs.forEach(t=>this.addLabelBboxes(e,t))}addLabelBboxes(e,t){const n=[Math.max(Math.floor((t[0]-this.anchor.x)/this.span),0),Math.max(Math.floor(-(t[1]-this.anchor.y)/this.span),0),Math.max(Math.floor((t[2]-this.anchor.x)/this.span),0),Math.max(Math.floor(-(t[3]-this.anchor.y)/this.span),0)];e.cells=[];for(let t=n[1];t<=n[3];t++){this.cells[t]=this.cells[t]||{};for(let i=n[0];i<=n[2];i++)this.cells[t][i]=this.cells[t][i]||{aabb:[],obb:[]},e.cells.push(this.cells[t][i])}}}const $t={tiles:{},grid:null,initGrid(e){this.grid=null==e?null:new Gt(e.anchor,e.span)},startTile(e,{apply_repeat_groups:t=!0,return_hidden:n=!1}={}){let i=this.tiles[e]={bboxes:{aabb:[],obb:[]},objects:{},labels:{},styles:{},repeat:t,return_hidden:n};null==i.complete&&(i.complete=new Promise((e,t)=>{i.resolve=e,i.reject=t}))},resetTile(e){delete this.tiles[e]},abortTile(e){this.tiles[e]&&this.tiles[e].resolve&&this.tiles[e].resolve([]),this.resetTile(e)},addStyle(e,t){this.tiles[t].styles[e]=!0},collide(e,t,n){let i=this.tiles[n];if(!i)return _("trace","Collision.collide() called with null tile",n,this.tiles,t,e),Promise.resolve([]);let r=i.objects;for(let n=0;n<e.length;n++){let i=e[n],s=i.label.layout.priority;r[s]=r[s]||{},r[s][t]=r[s][t]||[],r[s][t].push(i)}return delete i.styles[t],0===Object.keys(i.styles).length&&this.endTile(n),i.complete.then(()=>(i.resolve=null,i.labels[t]||[]))},endTile(e){let t=this.tiles[e],n=t.labels;this.grid&&this.addLabelsToGrid(e),t.repeat&&Vt.clear(e);let i=Object.keys(t.objects).sort((e,t)=>e-t);for(let r=0;r<i.length;r++){let s=t.objects[i[r]];if(s)for(let i in s){let r=s[i];n[i]=n[i]||[];for(let s=0;s<r.length;s++){let o=r[s];this.canBePlaced(o,e,o.linked,t)?o.linked?this.canBePlaced(o.linked,e,o,t)?(o.show=!0,(o.label.breach||o.linked.label.breach)&&(o.label.breach=!0,o.linked.label.breach=!0),(o.label.may_repeat_across_tiles||o.linked.label.may_repeat_across_tiles)&&(o.label.may_repeat_across_tiles=!0,o.linked.label.may_repeat_across_tiles=!0),n[i].push(o),this.place(o,e,t),this.place(o.linked,e,t)):t.return_hidden&&(o.show=!1,n[i].push(o)):(o.show=!0,n[i].push(o),this.place(o,e,t)):t.return_hidden&&(o.show=!1,n[i].push(o))}}}delete this.tiles[e],t.resolve()},addLabelsToGrid(e){const t=this.tiles[e];for(const e in t.objects){const n=t.objects[e];if(n)for(const e in n)n[e].forEach(e=>this.grid.addLabel(e.label))}},canBePlaced(e,t,n=null,{repeat:i=!0}={}){let r=e.label,s=e.label.layout;if(null!=r.placed)return r.placed;let o=!s.collide;if(o||(o=this.grid&&r.cells?r.cells.reduce((e,t)=>(e&&r.discard(t,n&&n.label)&&(e=!1),e),!0):!r.discard(this.tiles[t].bboxes,n&&n.label)),o){if(!i||!Vt.check(r,s,t))return!0;r.placed=!1}else s.collide&&(r.placed=!1);return r.placed},place({label:e},t,{repeat:n=!0}){null==e.placed&&(n&&Vt.add(e,e.layout,t),this.grid&&e.cells?e.cells.forEach(t=>Bt.add(e,t)):Bt.add(e,this.tiles[t].bboxes))}};class Zt extends Bt{constructor(e,t,n,i=0){super(t,n),this.type="point",this.position=[e[0],e[1]],this.angle=i,this.parent=this.layout.parent,this.update(),this.start_anchor_index=1,this.degenerate=!(this.size[0]||this.size[1]||this.layout.buffer[0]||this.layout.buffer[1]),this.throw_away=!1}update(){super.update(),this.computeOffset(),this.updateBBoxes()}computeOffset(){if(this.offset=[this.layout.offset[0],this.layout.offset[1]],this.parent){let e=this.parent;this.offset=Ct.computeOffset(this.offset,e.size,e.anchor,Ct.zero_buffer),this.offset=Ct.computeOffset(this.offset,e.size,this.anchor,Ct.zero_buffer),e.offset!==J.zeroPair&&(this.offset===J.zeroPair?this.offset=e.offset:(this.offset[0]+=e.offset[0],this.offset[1]+=e.offset[1]))}this.offset=Ct.computeOffset(this.offset,this.size,this.anchor)}updateBBoxes(){let e=(this.size[0]+2*this.layout.buffer[0])*this.unit_scale*Bt.epsilon,t=(this.size[1]+2*this.layout.buffer[1])*this.unit_scale*Bt.epsilon;this.layout.italic&&(e+=5*this.unit_scale),this.obb=new jt(this.position[0]+this.offset[0]*this.unit_scale,this.position[1]-this.offset[1]*this.unit_scale,-this.angle,e,t),this.aabb=this.obb.getExtent(),this.inTileBounds&&(this.breach=!this.inTileBounds()),this.mayRepeatAcrossTiles&&(this.may_repeat_across_tiles=this.mayRepeatAcrossTiles())}discard(e,t=null){if(this.degenerate)return!1;if(super.discard(e,t)){if(Array.isArray(this.layout.anchor))for(let n=this.start_anchor_index;n<this.layout.anchor.length;n++)if(this.anchor=this.layout.anchor[n],this.update(),!super.discard(e,t))return!1;return!0}return!1}}Zt.PLACEMENT={VERTEX:0,MIDPOINT:1,SPACED:2,CENTROID:3};const qt=Zt.PLACEMENT;function Wt(e,t,n){const i=[],r=n.placement,s=Math.max(t[0],t[1])*n.placement_min_length_ratio*n.units_per_pixel;if(r===qt.SPACED){let r=function(e,t,n){let i=n.units_per_pixel,r=(n.placement_spacing||80)*i,s=function(e){let t=0;for(let n=0;n<e.length-1;n++)t+=Kt(e[n],e[n+1]);return t}(e);if(s<=t)return!1;let o=Math.max(Math.floor(s/r),1),a=[],l=[],u=.5*(s-(o-1)*r);for(let i=0;i<o;i++){let{position:i,angle:s}=Yt(e,u,t,n);null!=i&&null!=s&&(a.push(i),l.push(s)),u+=r}return{positions:a,angles:l}}(e,s,n);if(!r)return[];let o=r.positions,a=r.angles;for(let e=0;e<o.length;e++){let r=o[e],s=a[e];!0!==n.tile_edges&&Ve(r)||i.push(new Zt(r,t,n,s))}}else if(r===qt.VERTEX){let r,s;for(let o=0;o<e.length-1;o++)if(r=e[o],s=e[o+1],!0===n.tile_edges||!Ve(r)){const e=Ht(r,s,n.angle);i.push(new Zt(r,t,n,e))}const o=Ht(r,s,n.angle);i.push(new Zt(s,t,n,o))}else if(r===qt.MIDPOINT)for(let r=0;r<e.length-1;r++){let o=e[r],a=e[r+1],l=[.5*(o[0]+a[0]),.5*(o[1]+a[1])];if((!0===n.tile_edges||!Ve(l))&&(!s||Kt(o,a)>s)){const e=Ht(o,a,n.angle);i.push(new Zt(l,t,n,e))}}return i}function Ht(e,t,n=0){return"auto"===n?Math.atan2(t[0]-e[0],t[1]-e[1]):n}function Kt(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))}function Yt(e,t,n,i){let r,s,o=0;for(let a=0;a<e.length-1;a++){let l=e[a],u=e[a+1];const c=Kt(l,u);if(!(c<=n)&&(o+=c,o>t)){r=Xt(l,u,o-t),s=Ht(l,u,i.angle);break}}return{position:r,angle:s}}function Xt(e,t,n){let i=n/Kt(e,t);return[i*e[0]+(1-i)*t[0],i*e[1]+(1-i)*t[1]]}const Qt={key:e=>[e.style,e.weight,e.family,e.px_size,e.fill,e.stroke,e.stroke_width,e.underline_width,e.background_color,e.background_width,e.background_stroke_color,e.background_stroke_width,e.transform,e.text_wrap,e.max_lines,e.supersample,g.device_pixel_ratio].join("/"),defaults:{style:"normal",weight:"normal",size:"12px",px_size:12,family:"Helvetica",fill:[1,1,1,1],text_wrap:15,max_lines:5,align:"center"},compute(e,t){const n={};e.font=e.font||this.defaults,n.supersample=e.supersample_text?1.5:1,n.can_articulate=e.can_articulate,n.fill=J.evalCachedColorPropertyWithAlpha(e.font.fill,e.font.alpha,t),n.fill=g.toCSSColor(n.fill),e.font.stroke&&e.font.stroke.color&&(n.stroke=J.evalCachedColorPropertyWithAlpha(e.font.stroke.color,e.font.stroke.alpha,t),n.stroke=g.toCSSColor(n.stroke),n.stroke_width=J.evalCachedProperty(e.font.stroke.width,t)),!0!==e.font.underline||n.can_articulate||(n.underline_width=1.5*n.supersample),e.font.background&&!n.can_articulate&&(n.background_color=J.evalCachedColorPropertyWithAlpha(e.font.background.color,e.font.background.alpha,t),n.background_color=g.toCSSColor(n.background_color),n.background_color&&(n.background_width=J.evalCachedProperty(e.font.background.width,t)),n.background_stroke_color=e.font.background.stroke&&e.font.background.stroke.color&&J.evalCachedColorPropertyWithAlpha(e.font.background.stroke.color,e.font.background.stroke.alpha,t),n.background_stroke_color&&(n.background_stroke_color=g.toCSSColor(n.background_stroke_color),n.background_stroke_width=null!=e.font.background.stroke.width?J.evalCachedProperty(e.font.background.stroke.width,t):1)),n.weight=J.evalCachedProperty(e.font.weight,t)||this.defaults.weight,"number"==typeof n.weight&&(n.weight=Math.min(Math.max(n.weight,1),1e3)),e.font.family?(n.family=e.font.family,n.family!==this.defaults.family&&(n.family+=", "+this.defaults.family)):n.family=this.defaults.family,n.style=e.font.style||this.defaults.style,n.transform=e.font.transform,n.px_size=J.evalCachedProperty(e.font.px_size,t)*n.supersample,n.font_css=this.fontCSS(n);let i=e.text_wrap;return null!=i||n.can_articulate||(i=!0),!0===i&&(i=this.defaults.text_wrap),n.text_wrap=i,n.max_lines=e.max_lines||this.defaults.max_lines,n},fontCSS:({style:e,weight:t,px_size:n,family:i})=>[e,t,n+"px",i].filter(e=>e).join(" ")};var Jt,en,tn={exports:{}},nn=M((Jt||(Jt=1,en=tn,function(){function e(e,t){document.addEventListener?e.addEventListener("scroll",t,!1):e.attachEvent("scroll",t)}function t(e){this.a=document.createElement("div"),this.a.setAttribute("aria-hidden","true"),this.a.appendChild(document.createTextNode(e)),this.b=document.createElement("span"),this.c=document.createElement("span"),this.h=document.createElement("span"),this.f=document.createElement("span"),this.g=-1,this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.f.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.b.appendChild(this.h),this.c.appendChild(this.f),this.a.appendChild(this.b),this.a.appendChild(this.c)}function n(e,t){e.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;left:-999px;white-space:nowrap;font:"+t+";"}function i(e){var t=e.a.offsetWidth,n=t+100;return e.f.style.width=n+"px",e.c.scrollLeft=n,e.b.scrollLeft=e.b.scrollWidth+100,e.g!==t&&(e.g=t,!0)}function r(t,n){function r(){var e=s;i(e)&&e.a.parentNode&&n(e.g)}var s=t;e(t.b,r),e(t.c,r),i(t)}function s(e,t){var n=t||{};this.family=e,this.style=n.style||"normal",this.weight=n.weight||"normal",this.stretch=n.stretch||"normal"}var o=null,a=null,l=null,u=null;function c(){if(null===l){var e=document.createElement("div");try{e.style.font="condensed 100px sans-serif"}catch(e){}l=""!==e.style.font}return l}function h(e,t){return[e.style,e.weight,c()?e.stretch:"","100px",t].join(" ")}s.prototype.load=function(e,i){var s=this,l=e||"BESbswy",c=0,d=i||3e3,f=(new Date).getTime();return new Promise(function(e,i){var p;if(null===u&&(u=!!document.fonts),(p=u)&&(null===a&&(a=/OS X.*Version\/10\..*Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor)),p=!a),p){p=new Promise(function(e,t){!function n(){(new Date).getTime()-f>=d?t():document.fonts.load(h(s,'"'+s.family+'"'),l).then(function(t){1<=t.length?e():setTimeout(n,25)},function(){t()})}()});var m=new Promise(function(e,t){c=setTimeout(t,d)});Promise.race([m,p]).then(function(){clearTimeout(c),e(s)},function(){i(s)})}else!function(e){document.body?e():document.addEventListener?document.addEventListener("DOMContentLoaded",function t(){document.removeEventListener("DOMContentLoaded",t),e()}):document.attachEvent("onreadystatechange",function t(){"interactive"!=document.readyState&&"complete"!=document.readyState||(document.detachEvent("onreadystatechange",t),e())})}(function(){function a(){var t;(t=-1!=_&&-1!=g||-1!=_&&-1!=y||-1!=g&&-1!=y)&&((t=_!=g&&_!=y&&g!=y)||(null===o&&(t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),o=!!t&&(536>parseInt(t[1],10)||536===parseInt(t[1],10)&&11>=parseInt(t[2],10))),t=o&&(_==v&&g==v&&y==v||_==b&&g==b&&y==b||_==x&&g==x&&y==x)),t=!t),t&&(w.parentNode&&w.parentNode.removeChild(w),clearTimeout(c),e(s))}var u=new t(l),p=new t(l),m=new t(l),_=-1,g=-1,y=-1,v=-1,b=-1,x=-1,w=document.createElement("div");w.dir="ltr",n(u,h(s,"sans-serif")),n(p,h(s,"serif")),n(m,h(s,"monospace")),w.appendChild(u.a),w.appendChild(p.a),w.appendChild(m.a),document.body.appendChild(w),v=u.a.offsetWidth,b=p.a.offsetWidth,x=m.a.offsetWidth,function e(){if((new Date).getTime()-f>=d)w.parentNode&&w.parentNode.removeChild(w),i(s);else{var t=document.hidden;!0!==t&&void 0!==t||(_=u.a.offsetWidth,g=p.a.offsetWidth,y=m.a.offsetWidth,a()),c=setTimeout(e,50)}}(),r(u,function(e){_=e,a()}),n(u,h(s,'"'+s.family+'",sans-serif')),r(p,function(e){g=e,a()}),n(p,h(s,'"'+s.family+'",serif')),r(m,function(e){y=e,a()}),n(m,h(s,'"'+s.family+'",monospace'))})})},en.exports=s}()),tn.exports));const rn={fonts_loaded:Promise.resolve(),last_loaded:null,loadFonts(e){const t=JSON.stringify(e)===this.last_loaded;if(e&&!t){const t=[];for(const n in e)Array.isArray(e[n])?e[n].forEach(e=>t.push(this.loadFontFace(n,e))):t.push(this.loadFontFace(n,e[n]));this.last_loaded=JSON.stringify(e),this.fonts_loaded=Promise.all(t.filter(e=>e))}return this.fonts_loaded},async loadFontFace(e,t){if(null==t||"object"!=typeof t&&"external"!==t)return;const n={family:e};"object"==typeof t&&(Object.assign(n,t),"string"==typeof t.url&&await this.injectFontFace(n));try{n.weight="string"==typeof n.weight?n.weight.split(" ")[0]:n.weight;const t=new nn(e,n);await t.load(),_("debug",`Font face '${e}' is available`,n)}catch(t){_("warn",`Font face '${e}' is NOT available`,n,t)}},async injectFontFace({family:e,url:t,weight:n,style:i}){void 0===this.supports_native_font_loading&&(this.supports_native_font_loading=void 0!==window.FontFace);let r=t;if("blob:"===t.slice(0,5)){r=(await g.io(t,6e4,"arraybuffer")).body;let e=new Uint8Array(r);if(this.supports_native_font_loading)r=e;else{let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);r="data:font/opentype;base64,"+btoa(t)}}if(this.supports_native_font_loading){let t;"string"==typeof r?t=new FontFace(e,`url(${encodeURI(r)})`,{weight:n,style:i}):r instanceof Uint8Array&&(t=new FontFace(e,r,{weight:n,style:i})),document.fonts.add(t),_("trace","Adding FontFace to document.fonts:",t)}else{let t=`\n @font-face {\n font-family: '${e}';\n font-weight: ${n||"normal"};\n font-style: ${i||"normal"};\n src: url(${encodeURI(r)});\n }`,s=document.createElement("style");s.appendChild(document.createTextNode("")),document.head.appendChild(s),s.sheet.insertRule(t,0),_("trace","Injecting CSS font face:",t)}}},sn=new RegExp("[֑-߿יִ-﷽ﹰ-ﻼ]");function on(e){return sn.test(e)}const an="\0-/:-@[-`{-¿×÷ʹ-˿ -⯿‐-\u2029 -⯿",ln=new RegExp("["+an+"]+");function un(e){return ln.test(e)}const cn=new RegExp("^["+an+"-ۿ]+"),hn=new RegExp("["+an+"آ-إاد-زوٱ-ٷڈ-ڙۄ-ۋۏےۓۮۯ]"),dn=new RegExp("^[ؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ۭ]+"),fn="[̀-֑ͯ-ׇֽֿׁׂׅׄަ-ްऀ-ःऺ-ौॎॏ॑-ॗॢॣঁ-ঃ়া-ৌৗৢৣਁ-ਃ਼-ੌੑઁ-ઃ઼ા-ૌૢૣଁ-ଃ଼ା-ୌୖୗୢୣஂா-்ௗఀ-ఃా-ౌౕౖౢౣಁ-ಃ಼ಾ-ೌೕೖೢೣഁ-ഃാ-ൌൎൗൢൣංඃ්-ෟෲෳัิ-ฺ็-๎ັິ-ຼ່-ໍ༹༘༙༵༷༾༿ཱ-ྃ྆྇ྍ-ྼ࿆ါ-း်-ှၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏႚ-ႝ឴-៑៓ᩕ-ᩞᩡ-᩼᷀-᷿⃐-]",pn=new RegExp(`^.(?:${fn}+)?([्্੍્୍్್്྄္្᩠᩿]\\W(?:${fn}+)?)*`),mn={Mongolian:"᠀-"},_n=Object.keys(mn).map(e=>mn[e]).join(""),gn=new RegExp("["+_n+"]");function yn(e,t,n){const i=t?1:2;if(e.length<i)return[e];let r=e;if(n.segment[r])return n.stats.segment_hits++,n.segment[r];let s=[];if(cn.exec(e)){s=e.split(hn);let t=-1;for(var o=0;o<s.length-1;o++){if(o>0){let e=dn.exec(s[o]);e&&(s[o]=s[o].substring(e[0].length),s[o-1]+=e[0],t+=e[0].length)}t+=1+s[o].length,s[o]+=e.slice(t,t+1)}e=""}for(;e.length;){let t="",n=e,r=0;for(;r<i&&n.length;r++){let e=(pn.exec(n)||n)[0];t+=e,n=n.substring(e.length)}s.push(t),e=e.substring(t.length)}return t&&s.reverse(),n.stats.segment_misses++,n.segment[r]=s,s}class vn{constructor(e,t=1/0,n=1/0){this.width=0,this.height=0,this.lines=[],this.max_lines=t,this.text_wrap=n,this.context=e}createLine(e){return this.lines.length<this.max_lines&&new bn(e,this.text_wrap)}push(e){if(this.lines.length<this.max_lines){let t=this.context.measureText(e.text).width;return e.width=t,t>this.width&&(this.width=Math.ceil(t)),this.lines.push(e),this.height+=e.height,!0}return this.addEllipsis(),!1}advance(e,t){return!!this.push(e)&&this.createLine(t)}addEllipsis(){let e=this.lines[this.lines.length-1],t=Math.ceil(this.context.measureText(vn.ellipsis).width);e.append(vn.ellipsis),e.width+=t,e.width>this.width&&(this.width=e.width)}finish(e){e?this.push(e):this.addEllipsis()}static parse(e,t,n,i,r){let s;s="number"==typeof t?e.split(" "):[e];let o=new vn(r,n,t),a=o.createLine(i);for(let e=0;e<s.length;e++){let n=s[e].split("\n"),r=0===e;for(let s=0;s<n.length&&a;s++){let l=n[s];on(l)&&un(l[l.length-1])&&(l+="");let u=r?l:" "+l;if(t&&e>0&&a.exceedsTextwrap(u)){if(a=o.advance(a,i),!a)break;a.append(l),r=!0}else a.append(u);s<n.length-1&&(a=o.advance(a,i),r=!0)}e===s.length-1&&o.finish(a)}return o}}vn.ellipsis="...";class bn{constructor(e=0,t=0){this.chars=0,this.text="",this.height=Math.ceil(e),this.text_wrap=t}append(e){this.chars+=e.length,this.text+=e}exceedsTextwrap(e){return e.length+this.chars>this.text_wrap}}function xn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function wn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xn(Object(n),!0).forEach(function(t){r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}class En{constructor(){this.createCanvas(),this.vertical_text_buffer=8,this.horizontal_text_buffer=4,this.background_size=4}createCanvas(){this.canvas=document.createElement("canvas"),this.canvas.style.backgroundColor="transparent",this.context=this.canvas.getContext("2d")}resize(e,t){this.canvas.width=e,this.canvas.height=t,this.context.clearRect(0,0,e,t)}setFont({font_css:e,fill:t,stroke:n,stroke_width:i,px_size:r,supersample:s}){this.px_size=r;let o=this.context,a=g.device_pixel_ratio*s;n&&i>0&&(o.strokeStyle=n,o.lineWidth=i*a),o.fillStyle=t,o.font=e,o.miterLimit=2}async textSizes(e,t){return await rn.loadFonts(),A.add({type:"textSizes",run:this.processTextSizesTask.bind(this),texts:t,tile_id:e,cursor:{styles:Object.keys(t),texts:null,style_idx:null,text_idx:null}})}processTextSizesTask(e){let{cursor:t,texts:n}=e;for(t.style_idx=t.style_idx||0;t.style_idx<t.styles.length;){let r=t.styles[t.style_idx];null==t.text_idx&&(t.text_idx=0,t.texts=Object.keys(n[r]));let s=n[r],o=!0;for(;t.text_idx<t.texts.length;){let n=t.texts[t.text_idx],a=s[n],l=a.text_settings;if(o&&(this.setFont(l),o=!1),a.size=this.textSize(r,n,l).size,l.can_articulate){let e=!1,t=!1;if(on(n)&&(un(n)?e=!0:t=!0),a.isRTL=e,a.no_curving=t||(i=n,gn.test(i)),a.vertical_buffer=this.vertical_text_buffer,a.segment_sizes=[],!a.no_curving){let t=yn(n,e,En.cache);a.segments=t;for(let e=0;e<t.length;e++)a.segment_sizes.push(this.textSize(r,t[e],l).size)}}if(t.text_idx++,!A.shouldContinue(e))return!1}t.text_idx=null,t.style_idx++}var i;return A.finish(e,n),!0}textSize(e,t,{transform:n,text_wrap:i,max_lines:r,stroke_width:s=0,background_color:o,background_stroke_width:a=0,background_width:l,underline_width:u=0,supersample:c}){if(En.cache.text[e]=En.cache.text[e]||{},En.cache.text[e][t])return En.cache.stats.text_hits++,En.cache.text[e][t];En.cache.stats.text_misses++,En.cache.text_count++;const h=g.device_pixel_ratio*c,d=this.applyTextTransform(t,n),f=this.context,p=this.vertical_text_buffer*h,m=(s+this.horizontal_text_buffer)*h;l=null!=l?l:this.background_size;const _=o||a?(l+a)*h:0,y=(2+u+(u?s+1:0))*h,v=this.px_size+y;let{width:b,height:x,lines:w}=vn.parse(d,i,r,v,f);b+=2*_,x+=2*_;let E=[b/h,x/h],A=[b+2*m,x+2*p],T=[A[0]/h,A[1]/h];return En.cache.text[e][t]={lines:w,size:{collision_size:E,texture_size:A,logical_size:T,horizontal_buffer:m,vertical_buffer:p,dpr:h,line_height:v,background_size:_}},En.cache.text[e][t]}drawTextMultiLine(e,[t,n],i,r,s){const{dpr:o,collision_size:a,texture_size:l,line_height:u,horizontal_buffer:c,vertical_buffer:h}=i;if(r.background_color||r.background_stroke_color){const e=r.background_stroke_color,i=(r.background_stroke_width||0)*o;this.context.save(),r.background_color&&(this.context.fillStyle=r.background_color,this.context.fillRect(t+c+("curved"===s?l[0]:0)+i,n+h+i,o*a[0]-2*i,o*a[1]-2*i)),e&&i&&(this.context.strokeStyle=e,this.context.lineWidth=i,this.context.strokeRect(t+c+("curved"===s?l[0]:0)+.5*i,n+h+.5*i,o*a[0]-i,o*a[1]-i)),this.context.restore()}const d=r.underline_width||0,f=r.stroke_width||0;let p=n-(d?.5*(d+f+1)*o:0);for(let n=0;n<e.length;n++){let o=e[n];this.drawTextLine(o,[t,p],i,r,s),p+=u}this.drawTextDebug([t,n],i,s)}drawTextLine(e,[t,n],i,r,s){const{stroke:o,stroke_width:a,transform:l,align:u="center"}=r,{horizontal_buffer:c,vertical_buffer:h,texture_size:d,background_size:f,line_height:p,dpr:m}=i,_=(r.underline_width||0)*m,g=this.applyTextTransform(e.text,l);let y;"left"===u?y=t+c+f:"center"===u?y=t+d[0]/2-e.width/2:"right"===u&&(y=t+d[0]-e.width-c-f);const v=n+.75*h+p+f-.5*_,b=o&&a>0&&"curved"===s?d[0]:0;if(_){this.context.save(),this.context.strokeStyle=this.context.fillStyle,this.context.lineWidth=_;const t=v+(.5*a+2)*m+.5*this.context.lineWidth;this.context.beginPath(),this.context.moveTo(y+b,t),this.context.lineTo(y+b+e.width,t),this.context.stroke(),this.context.restore()}o&&a>0&&this.context.strokeText(g,y+b,v),this.context.fillText(g,y,v)}drawTextDebug([e,t],n,i){const{dpr:r,horizontal_buffer:s,vertical_buffer:o,texture_size:a,collision_size:l}=n;v.draw_label_collision_boxes&&(this.context.save(),this.context.strokeStyle="blue",this.context.lineWidth=2,this.context.strokeRect(e+s,t+o,r*l[0],r*l[1]),"curved"===i&&this.context.strokeRect(e+a[0]+s,t+o,r*l[0],r*l[1]),this.context.restore()),v.draw_label_texture_boxes&&(this.context.save(),this.context.strokeStyle="green",this.context.lineWidth=2,this.context.strokeRect(e+2,t+2,a[0]-4,a[1]-4),"curved"===i&&this.context.strokeRect(e+2+a[0],t+2,a[0]-4,a[1]-4),this.context.restore())}rasterize(e,t,n,i,r){return A.add({type:"rasterizeLabels",run:this.processRasterizeTask.bind(this),cancel:this.cancelRasterizeTask.bind(this),pause_factor:2,user_moving_view:!1,texts:e,textures:t,texture_prefix:i,gl:r,tile_id:n,cursor:{styles:Object.keys(e),texts:null,style_idx:0,text_idx:null,texture_idx:0,texture_resize:!0,texture_names:[]}})}processRasterizeTask(e){let t,{cursor:n,texts:i,textures:r}=e;for(;n.texture_idx<e.textures.length;){for(t=r[n.texture_idx],n.texture_resize&&(n.texture_resize=!1,this.resize(...t.texture_size));n.style_idx<n.styles.length;){let r=n.styles[n.style_idx];null==n.text_idx&&(n.text_idx=0,n.texts=Object.keys(i[r]));let s=i[r],o=!0;for(;n.text_idx<n.texts.length;){let i=n.texts[n.text_idx],a=s[i],l=a.text_settings;if(o&&(this.setFont(l),o=!1),l.can_articulate){a.texcoords=a.texcoords||{};for(let e=0;e<a.type.length;e++){let s=a.type[e];if("straight"===s){if(a.textures[e]!==n.texture_idx)continue;let o,u=a.isRTL?i.split().reverse().join():i,c=t.texcoord_cache[r][u];if(c.texcoord)o=c.texcoord;else{let e=c.texture_position,{size:n,lines:i}=this.textSize(r,u,l);this.drawTextMultiLine(i,e,n,l,s),o=S.getTexcoordsForSprite(e,n.texture_size,t.texture_size),c.texcoord=o}a.texcoords[s]={texcoord:o,texture_id:c.texture_id}}else if("curved"===s){let i=a.segments;a.texcoords.curved=a.texcoords.curved||[],a.texcoords_stroke=a.texcoords_stroke||[];for(let o=0;o<i.length;o++){if(a.textures[e][o]!==n.texture_idx)continue;let u,c,h=i[o],d=t.texcoord_cache[r][h];if(d.texcoord)u=d.texcoord,c=d.texcoord_stroke,a.texcoords_stroke.push(c);else{let e=d.texture_position,{size:n,lines:i}=this.textSize(r,h,l);this.drawTextMultiLine(i,e,n,l,s),u=S.getTexcoordsForSprite(e,n.texture_size,t.texture_size);let o=[e[0]+n.texture_size[0],e[1]];c=S.getTexcoordsForSprite(o,n.texture_size,t.texture_size),d.texcoord=u,d.texcoord_stroke=c,a.texcoords_stroke.push(c)}a.texcoords.curved.push({texcoord:u,texture_id:d.texture_id})}}}}else{let e=this.textSize(r,i,l).lines;const s=wn({},l);for(let i in a.align)a.align[i].texture_id===n.texture_idx&&(s.align=i,this.drawTextMultiLine(e,a.align[i].texture_position,a.size,s),a.align[i].texcoords=S.getTexcoordsForSprite(a.align[i].texture_position,a.size.texture_size,t.texture_size))}if(n.text_idx++,!A.shouldContinue(e))return!1}n.text_idx=null,n.style_idx++}let s=e.texture_prefix+n.texture_idx;S.create(e.gl,s,{element:this.canvas,filtering:"linear",UNPACK_PREMULTIPLY_ALPHA_WEBGL:!0}),S.retain(s),n.texture_names.push(s),n.texture_idx++,n.texture_resize=!0,n.style_idx=0}return A.finish(e,n.texture_names),!0}cancelRasterizeTask(e){_("trace",`RasterizeTask: release textures [${e.cursor.texture_names.join(", ")}]`),e.cursor.texture_names.forEach(e=>S.release(e))}setTextureTextPositions(e,t){let n={cx:0,cy:0,width:0,height:0,column_width:0,texture_id:0,texcoord_cache:{}},i=[];for(let r in e){let s=e[r];for(let e in s){let o,a=s[e];if(a.text_settings.can_articulate){a.textures=[],n.texcoord_cache[r]=n.texcoord_cache[r]||{};for(let s=0;s<a.type.length;s++){let l=a.type[s];if("straight"===l){let l=a.isRTL?e.split().reverse().join():e;if(!n.texcoord_cache[r][l]){let e=a.size.texture_size;o=this.placeText(e[0],e[1],r,n,i,t),n.texcoord_cache[r][l]={texture_id:n.texture_id,texture_position:o}}a.textures[s]=n.texture_id}else if("curved"===l){a.textures[s]=[];for(let e=0;e<a.segment_sizes.length;e++){let l=a.segments[e];if(!n.texcoord_cache[r][l]){let s=a.segment_sizes[e].texture_size,u=2*s[0];o=this.placeText(u,s[1],r,n,i,t),n.texcoord_cache[r][l]={texture_id:n.texture_id,texture_position:o}}a.textures[s].push(n.texture_id)}}}}else{let e=a.size.texture_size;for(let s in a.align)o=this.placeText(e[0],e[1],r,n,i,t),a.align[s].texture_id=n.texture_id,a.align[s].texture_position=o}}}return n.column_width>0&&n.height>0&&(i[n.texture_id]={texture_size:[n.width,n.height],texcoord_cache:n.texcoord_cache}),i}placeText(e,t,n,i,r,s){let o;return i.cy+t>s?(i.cx+=i.column_width,i.cy=0,i.column_width=e):i.column_width=Math.max(i.column_width,e),i.cx+i.column_width<=s?(o=[i.cx,i.cy],i.cy+=t,i.height=Math.max(i.height,i.cy),i.width=Math.max(i.width,i.cx+i.column_width)):(r[i.texture_id]={texture_size:[i.width,i.height],texcoord_cache:i.texcoord_cache},i.texcoord_cache={},i.texcoord_cache[n]={},i.texture_id++,i.cx=0,i.cy=t,i.column_width=e,i.width=e,i.height=t,o=[0,0]),o}applyTextTransform(e,t){return"capitalize"===t?e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1)}):"uppercase"===t?e.toUpperCase():"lowercase"===t?e.toLowerCase():e}static fontPixelSize(e){if(null==e)return;e="string"==typeof e?e:String(e);let[,t,n]=e.match(En.font_size_re)||[];return n=n||"px","em"===n?t*=16:"pt"===n?t/=.75:"%"===n&&(t/=6.25),t=J.parsePositiveNumber(t),t*=g.device_pixel_ratio,t}static pruneTextCache(){En.cache.text_count>En.cache.text_count_max&&(En.cache.text={},En.cache.text_count=0,_("debug","TextCanvas: pruning text cache")),Object.keys(En.cache.segment).length>En.cache.segment_count_max&&(En.cache.segment={},_("debug","TextCanvas: pruning segment cache"))}}function An(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}En.font_size_re=/((?:[0-9]*\.)?[0-9]+)\s*(px|pt|em|%)?/,En.cache={text:{},text_count:0,text_count_max:2e3,segment:{},segment_count_max:2e3,stats:{text_hits:0,text_misses:0,segment_hits:0,segment_misses:0}};let Tn=0;const kn={resetText(){t.is_main?this.canvas=new En:t.is_worker&&(this.texts={})},freeText(e){delete this.texts[e.id]},parseTextFeature(e,t,n,i){let r=this.parseTextSource(e,t,n);if(null==r||""===r)return;let s=Qt.compute(t,n),o=Qt.key(s);this.texts[i.id]=this.texts[i.id]||{};let a=this.texts[i.id][o]=this.texts[i.id][o]||{};if(r instanceof Object){let l=[],u=r.left+"-"+r.right;for(let c in r){let h=r[c];if(!h)continue;let d=this.computeTextLayout({},e,t,n,i,h,s,u,c);a[h]||(a[h]={text_settings:s,ref:0}),l.push({draw:t,text:h,text_settings_key:o,layout:d})}return l.length>0&&l}{let l=this.computeTextLayout({},e,t,n,i,r,s);return a[r]||(a[r]={text_settings:s,ref:0}),{draw:t,text:r,text_settings_key:o,layout:l}}},parseTextSource(e,t,n){let i,r=t.text_source||"name";if(null==r||Array.isArray(r)||"object"!=typeof r)i=this.parseTextSourceValue(r,e,n);else{i={};for(let t in r)i[t]=this.parseTextSourceValue(r[t],e,n)}return i},parseTextSourceValue(e,t,n){let i;if(Array.isArray(e)){for(let r=0;r<e.length;r++)if("string"==typeof e[r]?i=t.properties[e[r]]:"function"==typeof e[r]&&(i=e[r](n)),i)return i}else"string"==typeof e?i=t.properties[e]:e instanceof Function&&(i=e(n));return i},async prepareTextLabels(e,t){if(0===Object.keys(this.texts[e.id]||{}).length)return[];try{const n=await a.postMessage(this.main_thread_target+".calcTextSizes",e.id,this.texts[e.id]);return e.canceled?(_("trace",`Style ${this.name}: stop tile build because tile was canceled: ${e.key}, post-calcTextSizes()`),[]):(this.texts[e.id]=n||[],n?this.buildTextLabels(e,t):($t.abortTile(e.id),[]))}catch(t){return $t.abortTile(e.id),[]}},async collideAndRenderTextLabels(e,t,n){let i=await this.prepareTextLabels(e,n);if(0===i.length)return $t.collide([],t,e.id),{};if(i=await $t.collide(i,t,e.id),e.canceled)return _("trace",`stop tile build because tile was canceled: ${e.key}, post-collide()`),{};let s=this.texts[e.id];if(null==s||0===i.length)return{};this.cullTextStyles(s,i),i.forEach(e=>{let t=e.text_settings_key,n=s[t]&&s[t][e.text];n.text_settings.can_articulate?(n.type||(n.type=[]),-1===n.type.indexOf(e.label.type)&&n.type.push(e.label.type)):(n.align=n.align||{},n.align[e.label.align]={})});try{const t=await a.postMessage(this.main_thread_target+".rasterizeTexts",e.id,e.key,s);return e.canceled?(_("trace",`stop tile build because tile was canceled: ${e.key}, post-rasterizeTexts()`),{}):function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?An(Object(n),!0).forEach(function(t){r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):An(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({labels:i},t)}catch(e){return{}}},cullTextStyles(e,t){for(let n=0;n<t.length;n++){let i=t[n];e[i.text_settings_key][i.text].ref++}for(let t in e)for(let n in e[t])e[t][n].ref<1&&delete e[t][n];for(let t in e)0===Object.keys(e[t]).length&&delete e[t]},calcTextSizes(e,t){return this.canvas.textSizes(e,t)},async rasterizeTexts(e,t,n){let i=new En,r=Math.min(this.max_texture_size,2048),s=i.setTextureTextPositions(n,r),o=["labels",this.name,t,e,Tn,""].join("-");return Tn++,s=await i.rasterize(n,s,e,o,this.gl),s?{texts:n,textures:s}:{}},preprocessText(e){if(e&&e.font&&"object"==typeof e.font)return e.font.weight=J.createPropertyCache(e.font.weight),e.font.fill=J.createPropertyCache(e.font.fill||Qt.defaults.fill),e.font.alpha=J.createPropertyCache(e.font.alpha),e.font.stroke&&(e.font.stroke.color=J.createPropertyCache(e.font.stroke.color),e.font.stroke.alpha=J.createPropertyCache(e.font.stroke.alpha)),e.font.background&&(e.font.background.color=J.createPropertyCache(e.font.background.color),e.font.background.alpha=J.createPropertyCache(e.font.background.alpha),e.font.background.width=J.createPropertyCache(e.font.background.width,J.parsePositiveNumber),e.font.background.stroke&&(e.font.background.stroke.color=J.createPropertyCache(e.font.background.stroke.color),e.font.background.stroke.alpha=J.createPropertyCache(e.font.background.stroke.alpha))),e.font.px_size=J.createPropertyCache(e.font.size||Qt.defaults.size,En.fontPixelSize,En.fontPixelSize),e.font.stroke&&null!=e.font.stroke.width&&(e.font.stroke.width=J.createPropertyCache(e.font.stroke.width,J.parsePositiveNumber)),e.font.background&&e.font.background.stroke&&null!=e.font.background.stroke.width&&(e.font.background.stroke.width=J.createPropertyCache(e.font.background.stroke.width,J.parsePositiveNumber)),e.offset=J.createPropertyCache(e.offset,e=>Array.isArray(e)&&e.map(J.parseNumber)),e.buffer=J.createPropertyCache(e.buffer,e=>(Array.isArray(e)?e:[e,e]).map(J.parsePositiveNumber)),e.repeat_distance=J.createPropertyCache(e.repeat_distance,J.parsePositiveNumber),e},computeTextLayout(e,t,n,i,r,s,o,a,l){let u=e||{};return u=this.computeLayout(u,t,n,i,r),null==n.repeat_distance&&(u.repeat_distance="point"===i.geometry?0:G.tile_size,u.repeat_distance&&(u.repeat_distance*=u.units_per_pixel,u.repeat_scale=1,"function"==typeof n.repeat_group?u.repeat_group=n.repeat_group(i):u.repeat_group=n.repeat_group)),u.repeat_distance&&(a&&(u.repeat_group+="/"+a),u.repeat_group+="/"+s),u.subdiv=r.overzoom2,u.align=n.align,u.italic="normal"!==o.style,"right"===l?u.orientation=1:"left"===l&&(u.orientation=-1),u}};var Sn,On,Pn,Cn,Rn,Mn,Ln,Nn,zn,Dn,In,Fn,jn,Bn,Un,Vn,Gn=M(On?Sn:(On=1,Sn=function(e,t){var n=t[0],i=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],f=t[11],p=t[12],m=t[13],_=t[14],g=t[15],y=n*a-i*o,v=n*l-r*o,b=n*u-s*o,x=i*l-r*a,w=i*u-s*a,E=r*u-s*l,A=c*m-h*p,T=c*_-d*p,k=c*g-f*p,S=h*_-d*m,O=h*g-f*m,P=d*g-f*_,C=y*P-v*O+b*S+x*k-w*T+E*A;return C?(C=1/C,e[0]=(a*P-l*O+u*S)*C,e[1]=(l*k-o*P-u*T)*C,e[2]=(o*O-a*k+u*A)*C,e[3]=(r*O-i*P-s*S)*C,e[4]=(n*P-r*k+s*T)*C,e[5]=(i*k-n*O-s*A)*C,e[6]=(m*E-_*w+g*x)*C,e[7]=(_*b-p*E-g*v)*C,e[8]=(p*w-m*b+g*y)*C,e):null})),$n=M(Cn?Pn:(Cn=1,Pn=function(e,t){var n=t[0],i=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],u=t[7],c=t[8],h=c*o-a*u,d=-c*s+a*l,f=u*s-o*l,p=n*h+i*d+r*f;return p?(p=1/p,e[0]=h*p,e[1]=(-c*i+r*u)*p,e[2]=(a*i-r*o)*p,e[3]=d*p,e[4]=(c*n-r*l)*p,e[5]=(-a*n+r*s)*p,e[6]=f*p,e[7]=(-u*n+i*l)*p,e[8]=(o*n-i*s)*p,e):null})),Zn=M(Mn?Rn:(Mn=1,Rn=function(e,t,n){var i=t[0],r=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],f=t[10],p=t[11],m=t[12],_=t[13],g=t[14],y=t[15],v=n[0],b=n[1],x=n[2],w=n[3];return e[0]=v*i+b*a+x*h+w*m,e[1]=v*r+b*l+x*d+w*_,e[2]=v*s+b*u+x*f+w*g,e[3]=v*o+b*c+x*p+w*y,v=n[4],b=n[5],x=n[6],w=n[7],e[4]=v*i+b*a+x*h+w*m,e[5]=v*r+b*l+x*d+w*_,e[6]=v*s+b*u+x*f+w*g,e[7]=v*o+b*c+x*p+w*y,v=n[8],b=n[9],x=n[10],w=n[11],e[8]=v*i+b*a+x*h+w*m,e[9]=v*r+b*l+x*d+w*_,e[10]=v*s+b*u+x*f+w*g,e[11]=v*o+b*c+x*p+w*y,v=n[12],b=n[13],x=n[14],w=n[15],e[12]=v*i+b*a+x*h+w*m,e[13]=v*r+b*l+x*d+w*_,e[14]=v*s+b*u+x*f+w*g,e[15]=v*o+b*c+x*p+w*y,e})),qn=M(Nn?Ln:(Nn=1,Ln=function(e,t,n){var i,r,s,o,a,l,u,c,h,d,f,p,m=n[0],_=n[1],g=n[2];return t===e?(e[12]=t[0]*m+t[4]*_+t[8]*g+t[12],e[13]=t[1]*m+t[5]*_+t[9]*g+t[13],e[14]=t[2]*m+t[6]*_+t[10]*g+t[14],e[15]=t[3]*m+t[7]*_+t[11]*g+t[15]):(i=t[0],r=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],f=t[10],p=t[11],e[0]=i,e[1]=r,e[2]=s,e[3]=o,e[4]=a,e[5]=l,e[6]=u,e[7]=c,e[8]=h,e[9]=d,e[10]=f,e[11]=p,e[12]=i*m+a*_+h*g+t[12],e[13]=r*m+l*_+d*g+t[13],e[14]=s*m+u*_+f*g+t[14],e[15]=o*m+c*_+p*g+t[15]),e})),Wn=M(Dn?zn:(Dn=1,zn=function(e,t,n){var i=n[0],r=n[1],s=n[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*s,e[9]=t[9]*s,e[10]=t[10]*s,e[11]=t[11]*s,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e})),Hn=M(Fn?In:(Fn=1,In=function(e,t,n,i,r){var s=1/Math.tan(t/2),o=1/(i-r);return e[0]=s/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=(r+i)*o,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*r*i*o,e[15]=0,e}));function Kn(){return Bn?jn:(Bn=1,jn=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e})}var Yn,Xn,Qn=function(){if(Vn)return Un;Vn=1;var e=Kn();return Un=function(t,n,i,r){var s,o,a,l,u,c,h,d,f,p,m=n[0],_=n[1],g=n[2],y=r[0],v=r[1],b=r[2],x=i[0],w=i[1],E=i[2];return Math.abs(m-x)<1e-6&&Math.abs(_-w)<1e-6&&Math.abs(g-E)<1e-6?e(t):(h=m-x,d=_-w,f=g-E,s=v*(f*=p=1/Math.sqrt(h*h+d*d+f*f))-b*(d*=p),o=b*(h*=p)-y*f,a=y*d-v*h,(p=Math.sqrt(s*s+o*o+a*a))?(s*=p=1/p,o*=p,a*=p):(s=0,o=0,a=0),l=d*a-f*o,u=f*s-h*a,c=h*o-d*s,(p=Math.sqrt(l*l+u*u+c*c))?(l*=p=1/p,u*=p,c*=p):(l=0,u=0,c=0),t[0]=s,t[1]=l,t[2]=h,t[3]=0,t[4]=o,t[5]=u,t[6]=d,t[7]=0,t[8]=a,t[9]=c,t[10]=f,t[11]=0,t[12]=-(s*m+o*_+a*g),t[13]=-(l*m+u*_+c*g),t[14]=-(h*m+d*_+f*g),t[15]=1,t)}}(),Jn=M(Qn),ei=M(Kn()),ti=M(Xn?Yn:(Xn=1,Yn=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}));const ni={fromValues(e,t,n){var i=new Float64Array(3);return i[0]=e,i[1]=t,i[2]=n,i}},ii={normalFromMat4:Gn,invert:$n},ri={multiply:Zn,translate:qn,scale:Wn,perspective:Hn,lookAt:Jn,identity:ei,copy:ti};class si{constructor(e,t,n={}){this.view=t,this.position=n.position,this.zoom=n.zoom}static create(e,t,n){switch(n.type){case"isometric":return new ai(e,t,n);case"flat":return new li(e,t,n);default:return new oi(e,t,n)}}update(){}setupProgram(){}updateView(){if(this.position||this.zoom){var e={};this.position&&(e={lng:this.position[0],lat:this.position[1],zoom:this.position[2]}),this.zoom&&(e.zoom=this.zoom),this.view.setView(e)}}setupMatrices(e,t){ri.multiply(e.model_view32,this.view_matrix,e.model),t.uniform("Matrix4fv","u_modelView",e.model_view32),ii.normalFromMat4(e.normal32,e.model_view32),ii.invert(e.inverse_normal32,e.normal32),t.uniform("Matrix3fv","u_normalMatrix",e.normal32),t.uniform("Matrix3fv","u_inverseNormalMatrix",e.inverse_normal32)}}class oi extends si{constructor(e,t,n={}){super(e,t,n),this.type="perspective",this.focal_length=n.focal_length,this.fov=n.fov,this.focal_length||this.fov||(this.focal_length=[[16,2],[17,2.5],[18,3],[19,4],[20,6]]),this.vanishing_point=n.vanishing_point||[0,0],this.vanishing_point=this.vanishing_point.map(parseFloat),this.vanishing_point_skew=[],this.position_meters=null,this.view_matrix=new Float64Array(16),this.projection_matrix=new Float32Array(16),j.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n }")}constrainCamera({view_height:e,height:t,focal_length:n,fov:i}){return t?(n=2*t/e,i=2*Math.atan(1/n)):(n?i=2*Math.atan(1/n):i&&(i=i*Math.PI/180,n=1/Math.tan(i/2)),t=e/2*n),{view_height:e,height:t,focal_length:n,fov:i}}updateMatrices(){var e=this.view.size.css.height*this.view.meters_per_pixel,{height:t,fov:n}=this.constrainCamera({view_height:e,focal_length:g.interpolate(this.view.zoom,this.focal_length),fov:g.interpolate(this.view.zoom,this.fov)}),i=[this.view.center.meters.x,this.view.center.meters.y,t];this.position_meters=i,ri.lookAt(this.view_matrix,ni.fromValues(i[0],i[1],0),ni.fromValues(i[0],i[1],-1),ni.fromValues(0,1,0)),ri.perspective(this.projection_matrix,n,this.view.aspect,1,2*t),this.vanishing_point_skew[0]=this.vanishing_point[0]/this.view.size.css.width,this.vanishing_point_skew[1]=this.vanishing_point[1]/this.view.size.css.height,this.projection_matrix[8]=2*-this.vanishing_point_skew[0],this.projection_matrix[9]=2*-this.vanishing_point_skew[1],ri.translate(this.projection_matrix,this.projection_matrix,ni.fromValues(e/2*this.view.aspect*(2*-this.vanishing_point_skew[0]),e/2*(2*-this.vanishing_point_skew[1]),0)),ri.translate(this.projection_matrix,this.projection_matrix,ni.fromValues(0,0,-t))}update(){super.update(),this.updateMatrices()}setupProgram(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3f","u_eye",[0,0,this.position_meters[2]]),e.uniform("2fv","u_vanishing_point",this.vanishing_point_skew)}}class ai extends si{constructor(e,t,n={}){super(e,t,n),this.type="isometric",this.axis=n.axis||{x:0,y:1},2===this.axis.length&&(this.axis={x:this.axis[0],y:this.axis[1]}),this.position_meters=null,this.viewport_height=null,this.view_matrix=new Float64Array(16),this.projection_matrix=new Float32Array(16),j.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n // position.xy += position.z * u_isometric_axis;\n\n // Reverse z for depth buffer so up is negative,\n // and scale down values so objects higher than one screen height will not get clipped\n // pull forward slightly to avoid going past far clipping plane\n position.z = -position.z / 100. + 1. - 0.001;\n }")}update(){super.update(),this.viewport_height=this.view.size.css.height*this.view.meters_per_pixel;var e=[this.view.center.meters.x,this.view.center.meters.y,this.viewport_height];this.position_meters=e,ri.identity(this.view_matrix),ri.translate(this.view_matrix,this.view_matrix,ni.fromValues(-e[0],-e[1],0)),ri.identity(this.projection_matrix),this.projection_matrix[8]=this.axis.x/this.view.aspect,this.projection_matrix[9]=this.axis.y,ri.scale(this.projection_matrix,this.projection_matrix,ni.fromValues(2/this.view.size.meters.x,2/this.view.size.meters.y,2/this.view.size.meters.y))}setupProgram(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3fv","u_eye",[0,0,this.viewport_height]),e.uniform("2fv","u_vanishing_point",[0,0])}}class li extends ai{constructor(e,t,n={}){super(e,t,n),this.type="flat"}update(){this.axis.x=0,this.axis.y=0,super.update()}}const ui=Zt.PLACEMENT,ci=Object.create(Re),hi="__shader_point";Object.assign(ci,kn),Object.assign(ci,{name:"points",built_in:!0,vertex_shader_src:"uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_order_offset;\nuniform bool u_tile_fade_in;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\nuniform bool u_view_panning;\nuniform float u_view_pan_snap_timer;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_shape;\nattribute vec4 a_color;\nattribute vec2 a_texcoord;\nattribute vec2 a_offset;\n\nuniform float u_point_type;\n\n#ifdef TANGRAM_CURVED_LABEL\n attribute vec4 a_offsets;\n attribute vec4 a_pre_angles;\n attribute vec4 a_angles;\n#endif\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\nvarying float v_alpha_factor;\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n attribute float a_outline_edge;\n attribute vec4 a_outline_color;\n\n varying float v_outline_edge;\n varying vec4 v_outline_color;\n varying float v_aa_offset;\n#endif\n\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\n varying float v_label_hidden;\n#endif\n\n#define TANGRAM_PI 3.14159265359\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvec2 rotate2D(vec2 _st, float _angle) {\n return mat2(cos(_angle),-sin(_angle),\n sin(_angle),cos(_angle)) * _st;\n}\n\n#ifdef TANGRAM_CURVED_LABEL\n // Assumes stops are [0, 0.33, 0.66, 0.99];\n float mix4linear(vec4 v, float x) {\n x = clamp(x, 0., 1.);\n return mix(mix(v[0], v[1], 3. * x),\n mix(v[1],\n mix(v[2], v[3], 3. * (max(x, .66) - .66)),\n 3. * (clamp(x, .33, .66) - .33)),\n step(0.33, x)\n );\n }\n#endif\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n // discard hidden labels by collapsing into degenerate triangle\n #ifndef TANGRAM_SHOW_HIDDEN_LABELS\n if (a_shape.w == 0.) {\n gl_Position = vec4(0., 0., 0., 1.);\n return;\n }\n #else\n // highlight hidden label in fragment shader for debugging\n if (a_shape.w == 0.) {\n v_label_hidden = 1.; // label debug testing\n }\n else {\n v_label_hidden = 0.;\n }\n #endif\n\n v_alpha_factor = 1.0;\n v_color = a_color;\n v_texcoord = a_texcoord; // UV from vertex attribute\n\n #ifdef TANGRAM_HAS_SHADER_POINTS\n v_outline_color = a_outline_color;\n v_outline_edge = a_outline_edge;\n\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // use point dimensions for UVs instead (ignore attribute), add antialiasing info for fragment shader\n float _size = abs(a_shape.x / 128.); // radius in pixels\n v_texcoord = sign(a_shape.xy) * (_size + 1.) / _size;\n _size += 2.;\n v_aa_offset = 2. / _size;\n }\n #endif\n\n // Position\n vec4 position = u_modelView * vec4(a_position.xyz, 1.);\n\n // Apply positioning and scaling in screen space\n vec2 _shape = a_shape.xy / 256.; // values have an 8-bit fraction\n vec2 _offset = vec2(a_offset.x, -a_offset.y); // flip y to make it point down\n float _theta = a_shape.z / 4096.;\n\n #ifdef TANGRAM_CURVED_LABEL\n //TODO: potential bug? null is passed in for non-curved labels, otherwise the first offset will be 0\n if (a_offsets[0] != 0.){\n vec4 _angles_scaled = (TANGRAM_PI / 16384.) * a_angles;\n vec4 _pre_angles_scaled = (TANGRAM_PI / 128.) * a_pre_angles;\n vec4 _offsets_scaled = (1. / 64.) * a_offsets;\n\n float _zoom = clamp(u_map_position.z - u_tile_origin.z, 0., 1.); //fract(u_map_position.z);\n float _pre_angle = mix4linear(_pre_angles_scaled, _zoom);\n float _angle = mix4linear(_angles_scaled, _zoom);\n float _offset_curve = mix4linear(_offsets_scaled, _zoom);\n\n _shape = rotate2D(_shape, _pre_angle); // rotate in place\n _shape.x += _offset_curve; // offset for curved label segment\n _shape = rotate2D(_shape, _angle); // rotate relative to curved label anchor\n _shape += rotate2D(_offset, _theta); // offset if specified in the scene file\n }\n else {\n _shape = rotate2D(_shape + _offset, _theta);\n }\n #else\n _shape = rotate2D(_shape + _offset, _theta);\n #endif\n\n // Fade in (if requested) based on time mesh has been visible.\n // Value passed to fragment shader in the v_alpha_factor varying\n #ifdef TANGRAM_FADE_IN_RATE\n if (u_tile_fade_in) {\n v_alpha_factor *= clamp(u_visible_time * TANGRAM_FADE_IN_RATE, 0., 1.);\n }\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = u_model * position;\n v_world_position.xy += _shape * u_meters_per_pixel;\n v_world_position = wrapWorldPosition(v_world_position);\n\n // Modify position before camera projection\n #pragma tangram: position\n\n cameraProjection(position);\n\n #ifdef TANGRAM_LAYER_ORDER\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_order_offset + 1., position);\n #endif\n\n // Apply pixel offset in screen-space\n // Multiply by 2 is because screen is 2 units wide Normalized Device Coords (and u_resolution device pixels wide)\n // Device pixel ratio adjustment is because shape is in logical pixels\n position.xy += _shape * position.w * 2. * u_device_pixel_ratio / u_resolution;\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // enlarge by 1px to catch missed MSAA fragments\n position.xy += sign(_shape) * position.w * u_device_pixel_ratio / u_resolution;\n }\n #endif\n\n // Snap to pixel grid\n // Only applied to fully upright sprites/labels (not shader-drawn points), while panning is not active\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (!u_view_panning && (abs(_theta) < TANGRAM_EPSILON) && u_point_type != TANGRAM_POINT_TYPE_SHADER) {\n #else\n if (!u_view_panning && (abs(_theta) < TANGRAM_EPSILON)) {\n #endif\n vec2 _position_fract = fract((((position.xy / position.w) + 1.) * .5) * u_resolution);\n vec2 _position_snap = position.xy + ((step(0.5, _position_fract) - _position_fract) * position.w * 2. / u_resolution);\n\n // Animate the snapping to smooth the transition and make it less noticeable\n #ifdef TANGRAM_VIEW_PAN_SNAP_RATE\n position.xy = mix(position.xy, _position_snap, clamp(u_view_pan_snap_timer * TANGRAM_VIEW_PAN_SNAP_RATE, 0., 1.));\n #else\n position.xy = _position_snap;\n #endif\n }\n\n gl_Position = position;\n}\n",fragment_shader_src:"uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nuniform sampler2D u_texture;\nuniform float u_point_type;\nuniform bool u_apply_color_blocks;\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\nvarying float v_alpha_factor;\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n varying vec4 v_outline_color;\n varying float v_outline_edge;\n varying float v_aa_offset;\n#endif\n\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\n varying float v_label_hidden;\n#endif\n\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n //l is the distance from the center to the fragment, R is the radius of the drawn point\n float _tangram_antialias(float l, float R){\n float low = R - v_aa_offset;\n float high = R + v_aa_offset;\n return 1. - smoothstep(low, high, l);\n }\n#endif\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n\n #ifdef TANGRAM_HAS_SHADER_POINTS\n // Only apply shader blocks to point, not to attached text (N.B.: for compatibility with ES)\n if (u_point_type == TANGRAM_POINT_TYPE_TEXTURE) { // sprite texture\n color *= texture2D(u_texture, v_texcoord);\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_LABEL) { // label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // Mask of outermost circle, either outline or point boundary\n float _d = length(v_texcoord); // distance to this fragment from the point center\n float _outer_alpha = _tangram_antialias(_d, 1.);\n float _fill_alpha = _tangram_antialias(_d, 1. - (v_outline_edge * 0.5)) * color.a;\n float _stroke_alpha = (_outer_alpha - _tangram_antialias(_d, 1. - v_outline_edge)) * v_outline_color.a;\n\n // Apply alpha compositing with stroke 'over' fill.\n #ifdef TANGRAM_BLEND_ADD\n color.a = _stroke_alpha + _fill_alpha;\n color.rgb = color.rgb * _fill_alpha + v_outline_color.rgb * _stroke_alpha;\n #else // TANGRAM_BLEND_OVERLAY (and fallback for not implemented blending modes)\n color.a = _stroke_alpha + _fill_alpha * (1. - _stroke_alpha);\n color.rgb = mix(color.rgb * _fill_alpha, v_outline_color.rgb, _stroke_alpha) / max(color.a, 0.001); // avoid divide by zero\n #endif\n }\n #else\n // If shader points not supported, assume label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n #endif\n\n // Shader blocks for color/filter are only applied for sprites, shader points, and standalone text,\n // NOT for text attached to a point (N.B.: for compatibility with ES)\n if (u_apply_color_blocks) {\n #pragma tangram: color\n #pragma tangram: filter\n }\n\n color.a *= v_alpha_factor;\n\n // highlight hidden label in fragment shader for debugging\n #ifdef TANGRAM_SHOW_HIDDEN_LABELS\n if (v_label_hidden > 0.) {\n color.a *= 0.5;\n color.rgb = vec3(1., 0., 0.);\n }\n #endif\n\n // Use alpha test as a lower-quality substitute\n // For opaque and translucent: avoid transparent pixels writing to depth buffer, obscuring geometry underneath\n // For multiply: avoid transparent pixels multiplying geometry underneath to zero/full black\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n\n // Make points more visible in wireframe debug mode\n #ifdef TANGRAM_WIREFRAME\n color = vec4(vec3(0.5), 1.); // use gray outline for textured points\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) {\n color = vec4(v_color.rgb, 1.); // use original vertex color outline for shader points\n }\n #endif\n #endif\n\n gl_FragColor = color;\n}\n",selection:!0,collision:!0,blend:"overlay",init(e={}){Re.init.call(this,e),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=!0,this.defines.TANGRAM_POINT_TYPE_TEXTURE=1,this.defines.TANGRAM_POINT_TYPE_LABEL=2,this.defines.TANGRAM_POINT_TYPE_SHADER=3,this.collision_group_points=this.name+"-points",this.collision_group_text=this.name+"-text",this.stencil_proxy_tiles=!1,this.reset()},setupDefines(){"overlay"!==this.blend&&(this.defines.TANGRAM_LAYER_ORDER=!0),!0===v.suppress_label_fade_in?(this.fade_in_time=0,this.defines.TANGRAM_FADE_IN_RATE=null):(this.fade_in_time=.15,this.defines.TANGRAM_FADE_IN_RATE=1/this.fade_in_time),!0!==v.suppress_label_snap_animation&&(this.defines.TANGRAM_VIEW_PAN_SNAP_RATE=2),!0===v.show_hidden_labels&&(this.defines.TANGRAM_SHOW_HIDDEN_LABELS=!0),!0===v.wireframe&&(this.defines.TANGRAM_WIREFRAME=!0)},reset(){this.queues={},this.resetText(),this.texture_missing_sprites={}},addFeature(e,t,n){let i=n.tile;if(i.generation!==this.generation)return;let r,s={};if(s.color=this.parseColor(t.color,n),s.texture=t.texture,s.label_texture=null,s.blend_order=t.blend_order,!s.color&&!s.texture)return;if(s.alpha=J.evalCachedProperty(t.alpha,n),this.hasSprites(s)){if(r=this.parseSprite(s,t,n),!r)return void _({level:"debug",once:!0},`Layer group '${t.layers.join(", ")}' uses a texture '${s.texture}', but doesn't specify which sprite to draw. Features that match this layer group won't be drawn without specifying the sprite with the 'sprite' or 'sprite_default' properties. The merged draw parameters for this layer group are:`,t).then(n=>{n&&_("debug",`Example feature for layer group '${t.layers.join(", ")}'`,e)});s.texcoords=r.texcoords}else if(t.sprite)return void _({level:"warn",once:!0},`Layer group '${t.layers.join(", ")}' specifies sprite '${t.sprite}', but the texture '${t.texture}' doesn't define any sprites. Features that match this layer group won't be drawn. The merged draw parameters for this layer group are:`,t);if(this.calcSize(t,s,r,n),t.outline&&(s.outline_width=J.evalCachedProperty(t.outline.width,n)||J.defaults.outline.width,s.outline_color=this.parseColor(t.outline.color,n)),s.outline_edge_pct=0,s.outline_width&&s.outline_color){let e=s.outline_width;s.size[0]+=e,s.size[1]+=e,s.outline_edge_pct=e/Math.min(s.size[0],s.size[1])*2,s.outline_alpha=J.evalCachedProperty(t.outline.alpha,n)}s.size[0]=Math.min(s.size[0],256),s.size[1]=Math.min(s.size[1],256),s.placement=t.placement,s.placement_min_length_ratio=J.evalCachedProperty(t.placement_min_length_ratio,n),s.placement===ui.SPACED&&t.placement_spacing&&(s.placement_spacing=J.evalCachedProperty(t.placement_spacing,n)),s.angle=J.evalProperty(t.angle,n)||0,s.z=J.evalCachedDistanceProperty(t.z,n)||J.defaults.z,s.tile_edges=t.tile_edges,this.computeLayout(s,e,t,n,i);let o=t.text&&!1!==t.text.visible&&this.parseTextFeature(e,t.text,n,i);Array.isArray(o)&&(o=null,_({level:"warn",once:!0},`Layer group '${t.layers.join(", ")}': cannot use boundary labels (e.g. 'text_source: { left: ..., right: ... }') for 'text' labels attached to 'points'; provided 'text_source' value was ${JSON.stringify(t.text.text_source)}`)),o&&(o.layout.parent=s,o.layout.priority=t.text.priority?Math.max(o.layout.priority,s.priority+.5):s.priority+.5,$t.addStyle(this.collision_group_text,i.id)),this.queueFeature({feature:e,draw:t,context:n,style:s,text_feature:o},i),$t.addStyle(this.collision_group_points,i.id)},calcSize(e,t,n,i){if(t.size=e.size,t.size){if(t.size=J.evalCachedPointSizeProperty(e.size,n,S.textures[t.texture],i),null==t.size)return void _({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': 'size' (${JSON.stringify(e.size.value)}) couldn't be interpreted, features that match this layer group won't be drawn`);"number"==typeof t.size&&(t.size=[t.size,t.size])}else t.size=n&&n.css_size||[16,16]},hasSprites:e=>e.texture&&S.textures[e.texture]&&S.textures[e.texture].sprites,getSpriteInfo(e,t){let n=S.textures[e.texture].sprites[t]&&S.getSpriteInfo(e.texture,t);return t&&!n?(this.texture_missing_sprites[e.texture]=this.texture_missing_sprites[e.texture]||{},this.texture_missing_sprites[e.texture][t]||(_("debug",`Style: in style '${this.name}', could not find sprite '${t}' for texture '${e.texture}'`),this.texture_missing_sprites[e.texture][t]=!0)):n&&(n.sprite=t),n},parseSprite(e,t,n){let i=J.evalProperty(t.sprite,n);return this.getSpriteInfo(e,i)||this.getSpriteInfo(e,t.sprite_default)},queueFeature(e,t){this.tile_data[t.id]&&this.queues[t.id]||this.startData(t),this.queues[t.id]=this.queues[t.id]||[],this.queues[t.id].push(e)},async endData(e){if(e.canceled)return _("trace",`Style ${this.name}: stop tile build because tile was canceled: ${e.key}`),null;let t=this.queues[e.id];delete this.queues[e.id];let n=[],i=[];t.forEach(e=>{let t=e.style,r=e.feature,s=r.geometry,o=this.buildLabels(t.size,s,t);for(let s=0;s<o.length;s++){let a=o[s],l={feature:r,draw:e.draw,context:e.context,style:t,label:a};if(i.push(l),e.text_feature){let t={feature:r,draw:e.text_feature.draw,context:e.context,text:e.text_feature.text,text_settings_key:e.text_feature.text_settings_key,layout:e.text_feature.layout,point_label:a,linked:l};n.push(t),e.draw.text.optional||(l.linked=t)}}});const[,{labels:r,texts:s,textures:o}]=await Promise.all([$t.collide(i,this.collision_group_points,e.id).then(e=>{e.forEach(e=>{this.feature_style=e.style,this.feature_style.label=e.label,this.feature_style.linked=e.linked,Re.addFeature.call(this,e.feature,e.draw,e.context)})}),this.collideAndRenderTextLabels(e,this.collision_group_text,n)]);r&&s&&r.forEach(e=>{let t=e.text_settings_key,n=s[t]&&s[t][e.text],i=this.feature_style;i.label=e.label,i.linked=e.linked,i.size=n.size.logical_size,i.texcoords=n.align[e.label.align].texcoords,i.label_texture=o[n.align[e.label.align].texture_id],i.blend_order=e.draw.blend_order,Re.addFeature.call(this,e.feature,e.draw,e.context)}),this.freeText(e);const a=await Re.endData.call(this,e);return a&&o&&o.length&&(a.textures=a.textures||[],a.textures.push(...o)),a},_preprocess(e){e.color=J.createColorPropertyCache(e.color),e.alpha=J.createPropertyCache(e.alpha),e.texture=void 0!==e.texture?e.texture:this.texture,e.blend_order=this.getBlendOrderForDraw(e),e.outline&&(e.outline.color=J.createColorPropertyCache(e.outline.color),e.outline.alpha=J.createPropertyCache(e.outline.alpha),e.outline.width=J.createPropertyCache(e.outline.width,J.parsePositiveNumber)),e.z=J.createPropertyCache(e.z,J.parseUnits);try{e.size=J.createPointSizePropertyCache(e.size,e.texture)}catch(t){return _({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': ${t} (${JSON.stringify(e.size)}), features that match this layer group won't be drawn.`),null}if(e.offset=J.createPropertyCache(e.offset,e=>Array.isArray(e)&&e.map(J.parseNumber)),e.buffer=J.createPropertyCache(e.buffer,e=>(Array.isArray(e)?e:[e,e]).map(J.parsePositiveNumber)),e.repeat_distance=J.createPropertyCache(e.repeat_distance,J.parseNumber),e.placement=ui[e.placement&&e.placement.toUpperCase()],null==e.placement&&(e.placement=ui.VERTEX),e.placement_spacing=null!=e.placement_spacing?e.placement_spacing:80,e.placement_spacing=J.createPropertyCache(e.placement_spacing,J.parsePositiveNumber),e.placement_min_length_ratio=null!=e.placement_min_length_ratio?e.placement_min_length_ratio:1,e.placement_min_length_ratio=J.createPropertyCache(e.placement_min_length_ratio,J.parsePositiveNumber),"number"==typeof e.angle)e.angle=e.angle*Math.PI/180;else if("function"==typeof e.angle){const t=e.angle;e.angle=e=>t(e)*Math.PI/180}else e.angle=e.angle||0;return e.text=this.preprocessText(e.text),e.text&&(e.text.key=e.key,e.text.group=e.group,e.text.layers=e.layers,e.text.order=e.order,e.text.blend_order=e.blend_order,e.text.repeat_group=null!=e.text.repeat_group?e.text.repeat_group:e.repeat_group,e.text.anchor=e.text.anchor||this.default_anchor,e.text.optional="boolean"==typeof e.text.optional&&e.text.optional,e.text.interactive=e.text.interactive||e.interactive),e},default_anchor:["bottom","top","right","left"],computeLayout(e,t,n,i,r){let s=e||{};s.id=t,s.units_per_pixel=r.units_per_pixel||1,s.collide=!1!==n.collide,s.anchor=n.anchor,s.offset=J.evalCachedProperty(n.offset,i)||J.zeroPair,s.buffer=J.evalCachedProperty(n.buffer,i)||J.zeroPair,s.repeat_distance=J.evalCachedProperty(n.repeat_distance,i),s.repeat_distance&&(s.repeat_distance*=s.units_per_pixel,s.repeat_scale=1,"function"==typeof n.repeat_group?s.repeat_group=n.repeat_group(i):s.repeat_group=n.repeat_group||i.layer);let o=n.priority;return null!=o?"function"==typeof o&&(o=o(i)):o=-1>>>0,s.priority=o,s},buildTextLabels(e,t){let n=[];for(let i=0;i<t.length;i++){let r=t[i],s=this.texts[e.id][r.text_settings_key][r.text].size.collision_size;r.label=new Zt(r.point_label.position,s,r.layout),n.push(r)}return n},buildLabels(e,t,n){let i=[];if("Point"===t.type)i.push(new Zt(t.coordinates,e,n,n.angle));else if("MultiPoint"===t.type){let r=t.coordinates;for(let t=0;t<r.length;++t){let s=r[t];i.push(new Zt(s,e,n,n.angle))}}else if("LineString"===t.type){let r=Wt(t.coordinates,e,n);for(let e=0;e<r.length;++e)i.push(r[e])}else if("MultiLineString"===t.type){let r=t.coordinates;for(let t=0;t<r.length;t++){let s=Wt(r[t],e,n);for(let e=0;e<s.length;++e)i.push(s[e])}}else if("Polygon"===t.type)if(n.placement===ui.CENTROID){let r=G.centroid(t.coordinates);r&&i.push(new Zt(r,e,n,n.angle))}else{let r=t.coordinates;for(let t=0;t<r.length;t++){let s=Wt(r[t],e,n);for(let e=0;e<s.length;++e)i.push(s[e])}}else if("MultiPolygon"===t.type)if(n.placement===ui.CENTROID){let r=G.multiCentroid(t.coordinates);r&&i.push(new Zt(r,e,n,n.angle))}else{let r=t.coordinates;for(let t=0;t<r.length;t++){let s=r[t];for(let t=0;t<s.length;t++){let r=Wt(s[t],e,n);for(let e=0;e<r.length;++e)i.push(r[e])}}}return i},makeVertexTemplate(e,t,n=!0){let i=0;this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=e.z||0,this.vertex_template[i++]=this.scaleOrder(e.order),this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=e.label.layout.collide?0:1,t.variant.shader_point||(this.vertex_template[i++]=0,this.vertex_template[i++]=0),this.vertex_template[i++]=0,this.vertex_template[i++]=0;const r=e.color||J.defaults.color;if(this.vertex_template[i++]=255*r[0],this.vertex_template[i++]=255*r[1],this.vertex_template[i++]=255*r[2],this.vertex_template[i++]=255*(null!=e.alpha?e.alpha:r[3]),t.variant.selection&&(this.vertex_template[i++]=255*e.selection_color[0],this.vertex_template[i++]=255*e.selection_color[1],this.vertex_template[i++]=255*e.selection_color[2],this.vertex_template[i++]=255*e.selection_color[3]),t.variant.shader_point){const t=e.outline_color||J.defaults.outline.color;this.vertex_template[i++]=255*t[0],this.vertex_template[i++]=255*t[1],this.vertex_template[i++]=255*t[2],this.vertex_template[i++]=255*(null!=e.outline_alpha?e.outline_alpha:t[3]),this.vertex_template[i++]=e.outline_edge_pct||J.defaults.outline.width}return n&&this.addCustomAttributesToVertexTemplate(e,i),this.vertex_template},buildQuad:(e,t,n,i,r,s,o,a,l,u,c)=>t[0]<=0||t[1]<=0?0:function(e,t,n,i,r,s,o,a,l,u,c,h){const d=128*r[0],f=128*r[1];Tt[0]=-d,Tt[1]=-f,Tt[2]=d,Tt[3]=f;const p=c||Be,m=t.vertex_elements;let _=t.vertex_count;for(let r=0;r<4;r++)n[i.a_position+0]=e[0],n[i.a_position+1]=e[1],n[i.a_shape+0]=Tt[Et[r]],n[i.a_shape+1]=Tt[At[r]],n[i.a_shape+2]=l,n[i.a_offset+0]=s[0],n[i.a_offset+1]=s[1],i.a_texcoord&&(n[i.a_texcoord+0]=65535*p[Et[r]],n[i.a_texcoord+1]=65535*p[At[r]]),h&&(n[i.a_pre_angles+0]=xt*a[0],n[i.a_pre_angles+1]=xt*a[1],n[i.a_pre_angles+2]=xt*a[2],n[i.a_pre_angles+3]=xt*a[3],n[i.a_angles+0]=wt*u[0],n[i.a_angles+1]=wt*u[1],n[i.a_angles+2]=wt*u[2],n[i.a_angles+3]=wt*u[3],n[i.a_offsets+0]=64*o[0],n[i.a_offsets+1]=64*o[1],n[i.a_offsets+2]=64*o[2],n[i.a_offsets+3]=64*o[3]),t.addVertex(n);return m.push(_+0),m.push(_+1),m.push(_+2),m.push(_+2),m.push(_+3),m.push(_+0),2}(e,u,c,u.vertex_layout.index,t,s,o,r,4096*n,i,a,l),build(e,t){let n=e.label;return"curved"===n.type?this.buildCurvedLabel(n,e,t):this.buildStraightLabel(n,e,t)},buildStraightLabel(e,t,n){let i,r,s=this.getTileMesh(n.tile,this.meshVariantTypeForDraw(t)),o=this.makeVertexTemplate(t,s);"point"!==e.type?(i=t.size[e.type],r=t.texcoords[e.type].texcoord):(i=t.size,r=t.texcoords),s.uniforms=s.uniforms||{},t.label_texture?(s.uniforms.u_texture=t.label_texture,s.uniforms.u_point_type=2,s.uniforms.u_apply_color_blocks=!1):t.texture?(s.uniforms.u_texture=t.texture,s.uniforms.u_point_type=1,s.uniforms.u_apply_color_blocks=!0):(s.uniforms.u_texture=S.default,s.uniforms.u_point_type=3,s.uniforms.u_apply_color_blocks=!0);let a=e.offset,l=this.buildQuad(e.position,i,e.angle,null,null,a,null,r,!1,s.vertex_data,o);const u=t.linked&&t.linked.label.id;return this.trackLabel(e,u,s,l,n),l},buildCurvedLabel(e,t,n){let i,r,s=0;for(let o=0;o<e.num_segments;o++){let a=t.size[e.type][o],l=t.texcoords_stroke[o];t.label_texture=t.label_textures[o],i=this.getTileMesh(n.tile,this.meshVariantTypeForDraw(t)),r=this.makeVertexTemplate(t,i),i.uniforms=i.uniforms||{},i.uniforms.u_texture=t.label_texture,i.uniforms.u_point_type=2,i.uniforms.u_apply_color_blocks=!1;let u=e.offset||[0,0],c=e.position,h=e.angles[o],d=e.offsets[o],f=e.pre_angles[o],p=this.buildQuad(c,a,e.angle,h,f,u,d,l,!0,i.vertex_data,r);s+=p;const m=t.linked&&t.linked.label.id;this.trackLabel(e,m,i,p,n)}for(let o=0;o<e.num_segments;o++){let a=t.size[e.type][o],l=t.texcoords[e.type][o].texcoord;t.label_texture=t.label_textures[o],i=this.getTileMesh(n.tile,this.meshVariantTypeForDraw(t)),r=this.makeVertexTemplate(t,i),i.uniforms=i.uniforms||{},i.uniforms.u_texture=t.label_texture,i.uniforms.u_point_type=2,i.uniforms.u_apply_color_blocks=!1;let u=e.offset||[0,0],c=e.position,h=e.angles[o],d=e.offsets[o],f=e.pre_angles[o],p=this.buildQuad(c,a,e.angle,h,f,u,d,l,!0,i.vertex_data,r);s+=p;const m=t.linked&&t.linked.label.id;this.trackLabel(e,m,i,p,n)}return s},trackLabel(e,t,n,i){if(e.layout.collide||e.may_repeat_across_tiles){n.labels=n.labels||{},n.labels[e.id]=n.labels[e.id]||{container:{label:e.toJSON(),linked:t},ranges:[]};const r=2*i,s=n.vertex_data.offset-n.vertex_data.stride*r;n.labels[e.id].ranges.push([s,r])}},buildLines(e,t,n){return this.build(t,n)},buildPoints(e,t,n){return this.build(t,n)},buildPolygons(e,t,n){return this.build(t,n)},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.shader_point]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_shape",size:4,type:fe.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0,static:e.shader_point?[0,0]:null},{name:"a_offset",size:2,type:fe.SHORT,normalized:!1},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_outline_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.shader_point?null:[0,0,0,0]},{name:"a_outline_edge",size:1,type:fe.FLOAT,normalized:!1,static:e.shader_point?null:0}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.shader_point]=new Fe(t)}return this.vertex_layouts[e.shader_point]},meshVariantTypeForDraw(e){const t=e.label_texture||e.texture||hi,n=t+"/"+e.blend_order;return null==this.variants[n]&&(this.variants[n]={key:n,selection:1,shader_point:t===hi,blend_order:e.blend_order,mesh_order:e.label_texture?1:0}),this.variants[n]},makeMesh(e,t,n={}){return n=Object.assign({},n,{fade_in_time:this.fade_in_time}),Re.makeMesh.call(this,e,t,n)}});const di=[0,.33,.66,.99];let fi=function(e,t,n,i){const r=[{type:"straight",tolerance:i.no_curving?1.8:1.5},{type:"curved"},{type:"straight",tolerance:2.3}];for(let s=0;s<r.length;s++){let o,a=r[s];if("straight"===a.type?o=new mi(t,n,i,a.tolerance):"curved"===a.type&&!i.no_curving&&n.length>2&&(o=new _i(e,n,i)),o&&!o.throw_away)return o}return!1};class pi{constructor(e){this.id=Bt.nextLabelId(),this.layout=e,this.position=[],this.angle=0,this.offset=e.offset.slice(),this.unit_scale=this.layout.units_per_pixel,this.obbs=[],this.aabbs=[],this.type="",this.throw_away=!1}toJSON(){return{id:this.id,type:this.type,position:this.position,size:this.size,offset:this.offset,angle:this.angle,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Ut(this.layout)}}static splitLineByOrientation(e){let t=[e[0]],n=0,i=0,r=0,s=t,o=!1;for(let a=1;a<e.length;a++){let l=e[a],u=e[a-1],c=ye.length(ye.sub(l,u));l[0]>u[0]?1===r?(t.push(l),n+=c,n>i&&(s=t,i=n,o=!1)):(t=[u,l],n=c,n>i&&(s=t,i=n,o=!1),r=1):l[0]<u[0]?-1===r?(t.unshift(l),n+=c,n>i&&(s=t,i=n,o=!0)):(t=[l,u],n=c,n>i&&(s=t,i=n,o=!0),r=-1):(-1===r?t.unshift(l):(t.push(l),r=1),n+=c,n>i&&(s=t,i=n,o=-1===r))}return[s,o]}discard(e,t=null){if(this.throw_away)return!0;for(let n=0;n<this.obbs.length;n++){let i={aabb:this.aabbs[n],obb:this.obbs[n]};if(Bt.prototype.occluded.call(i,e,t))return!0}return!1}inTileBounds(){for(let e=0;e<this.aabbs.length;e++){let t={aabb:this.aabbs[e]};if(!Bt.prototype.inTileBounds.call(t))return!1}return!0}static createOBB(e,t,n,i,r,s,o){let a=e[0],l=e[1];return!s||0===s[0]&&0===s[1]||(a+=(s=ye.rot(s,r))[0]*o,l-=s[1]*o),new jt(a,l,-i,t,n)}}class mi extends pi{constructor(e,t,n,i){super(n),this.type="straight",this.size=e,this.throw_away=!this.fit(e,t,n,i)}fit(e,t,n,i){let r,s=this.unit_scale;[t,r]=pi.splitLineByOrientation(t),"number"==typeof n.orientation&&(this.offset[1]+=1.2*(e[1]-n.vertical_buffer),r&&(this.offset[1]*=-1),-1===n.orientation&&(this.offset[1]*=-1));let o=vi(t),a=e[0]*s;for(let r=0;r<t.length-1;r++){let s,l=t[r],u=0,c=0,h=r+1;for(;h<t.length;){let d=t[h-1],f=t[h],p=yi(d,f);if(h!==r+1&&(u+=bi(p,s)),Math.abs(u)>.1)break;if(c+=o[h-1],gi(c,a)<i){let t=ye.mult(ye.add(l,f),.5);return this.angle=-p,Math.abs(this.angle-Math.PI/2)<.01&&(this.angle=-Math.PI/2,"number"==typeof n.orientation&&(this.offset[1]*=-1)),this.position=t,this.updateBBoxes(this.position,e,this.angle,this.angle,this.offset),!0}s=p,h++}}return!1}updateBBoxes(e,t,n,i,r){let s=this.unit_scale;this.obbs=[],this.aabbs=[];let o=(t[0]+2*this.layout.buffer[0])*s*Bt.epsilon,a=(t[1]+2*this.layout.buffer[1])*s*Bt.epsilon,l=pi.createOBB(e,o,a,n,i,r,s),u=l.getExtent();this.obbs.push(l),this.aabbs.push(u),this.inTileBounds&&(this.breach=!this.inTileBounds()),this.mayRepeatAcrossTiles&&(this.may_repeat_across_tiles=this.mayRepeatAcrossTiles())}}class _i extends pi{constructor(e,t,n){super(n),this.type="curved",this.angles=[],this.pre_angles=[],this.offsets=[],this.num_segments=e.length,this.sizes=e,this.throw_away=!this.fit(this.sizes,t,n)}toJSON(){return{id:this.id,type:this.type,obbs:this.obbs.map(e=>e.toJSON()),position:this.position,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Ut(this.layout)}}fit(e,t,n){let i,r=this.unit_scale,s=Math.max(...e.map(e=>e[1])),o=s*r;[t,i]=pi.splitLineByOrientation(t),"number"==typeof n.orientation&&(this.offset[1]+=1.2*(s-n.vertical_buffer),i&&(this.offset[1]*=-1),-1===n.orientation&&(this.offset[1]*=-1));let a=vi(t),l=e.map(e=>e[0]*r),u=a.reduce((e,t)=>e+t,0),c=l.reduce((e,t)=>e+t,0);if(c>u)return!1;let h=t.length-1;if(h-0<2)return!1;let d=_i.curvaturePlacement(t,u,a,c,0,h),f=t[d];if(-1===d||h-d<2)return!1;this.position=f;for(var p=0;p<l.length;p++){this.offsets[p]=[],this.angles[p]=[],this.pre_angles[p]=[];for(var m=0;m<di.length;m++){let e=di[m],[n,i]=_i.scaleLine(e,t);f=n[d];let{positions:s,offsets:a,angles:u,pre_angles:c}=_i.placeAtIndex(d,n,i,l),h=a.map(e=>Math.sqrt(e[0]*e[0]+e[1]*e[1])/r);if(0===e){this.angle=1/u.length*u.reduce((e,t)=>e+t);for(let e=0;e<s.length;e++){let t=s[e],n=c[e],i=l[e],a=n+u[e],h=this.angle,d=pi.createOBB(t,i,o,a,h,this.offset,r),f=d.getExtent();this.obbs.push(d),this.aabbs.push(f)}}this.offsets[p].push(h[p]),this.angles[p].push(u[p]),this.pre_angles[p].push(c[p])}}return!0}static curvaturePlacement(e,t,n,i,r,s){r=r||0,s=s||e.length-1;var o=[];for(let t=r+1;t<s;t++){var a=e[t-1],l=e[t],u=e[t+1],c=ye.perp(l,a),h=ye.perp(u,l),d=ye.angleBetween(c,h);d>1&&(d=1/0),o.push(d)}o.push(1/0);var f=[],p=[],m=r,_=0;for(let e=0;e<r;e++)_+=n[e];for(;_+i<t;){for(var g=_+i,y=_,v=m,b=0;v<s&&y+n[v]<g&&(b+=o[v])!==1/0;)y+=n[v],v++;if(0===b)return m;var x=b/(v-m);f.push(b),p.push(x),_+=n[m],m++}if(0===f.length)return-1;var w=Math.min.apply(null,f),E=p[f.indexOf(w)];return w<1.3&&E<.4?f.indexOf(w):-1}static scaleLine(e,t){var n=[t[0]],i=[];return t.forEach((r,s)=>{if(s!==t.length-1){var o=ye.sub(t[s+1],t[s]),a=ye.mult(o,1+e);n.push(ye.add(n[s],a)),i.push(ye.length(a))}}),[n,i]}static placeAtIndex(e,t,n,i){let r=t[e],[s,o]=_i.getIndicesAndOffsets(e,n,i),a=_i.getPositionsFromIndicesAndOffsets(t,s,o),[l,u,c]=_i.getAnglesFromIndicesAndOffsets(r,s,t,a);return{positions:a,offsets:l,angles:u,pre_angles:c}}static getIndicesAndOffsets(e,t,n){let i=n.length,r=[],s=[],o=0,a=0,l=0;for(;o<i;){let u=n[o];for(;o<i&&a+.5*u<=l+t[e];){let t=a-l+.5*u;s.push(t),r.push(e),a+=u,o++,u=n[o]}l+=t[e],e++}return[r,s]}static getPositionsFromIndicesAndOffsets(e,t,n){let i=[];for(let r=0;r<t.length;r++){let s=t[r],o=n[r],a=yi(e[s],e[s+1]),l=ye.rot([o,0],a),u=ye.add(e[s],l);i.push(u)}return i}static getAnglesFromIndicesAndOffsets(e,t,n,i){let r=[],s=[],o=[];for(let a=0;a<i.length;a++){let l=i[a],u=t[a],c=ye.sub(l,e),h=-ye.angle(c),d=-yi(n[u],n[u+1])-h;if(a>0){let e=r[a-1],t=s[a-1];Math.abs(h-e)>Math.PI&&(h+=h>e?-2*Math.PI:2*Math.PI),Math.abs(t-d)>Math.PI&&(d+=d>t?-2*Math.PI:2*Math.PI)}r.push(h),s.push(d),o.push(c)}return[o,r,s]}}function gi(e,t){return t/e}function yi(e,t){let n=ye.sub(t,e);return ye.angle(n)}function vi(e){let t=[];for(let n=0;n<e.length-1;n++){let i=e[n],r=e[n+1],s=Math.hypot(i[0]-r[0],i[1]-r[1]);t.push(s)}return t}function bi(e,t){let n,i;for(e>t?(n=t,i=e):(n=e,i=t);i-n>Math.PI;)n+=2*Math.PI;return Math.abs(i-n)}let xi=Object.create(ci);Object.assign(xi,{name:"text",super:ci,built_in:!0,init(e={}){Re.init.call(this,e),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=!1,this.defines.TANGRAM_CURVED_LABEL=!0,this.reset()},makeVertexTemplate(e,t){this.super.makeVertexTemplate.call(this,e,t,!1);let n=t.vertex_data.vertex_layout.index.a_pre_angles;for(let e=0;e<12;e++)this.vertex_template[n++]=0;return this.addCustomAttributesToVertexTemplate(e,n),this.vertex_template},reset(){this.queues={},this.resetText()},addFeature(e,t,n){let i=n.tile;if(i.generation!==this.generation)return;let r=e.geometry.type;t.can_articulate="LineString"===r||"MultiLineString"===r,t.supersample_text="LineString"===r||"MultiLineString"===r;let s=this.parseTextFeature(e,t,n,i);s&&(s instanceof Array?s.forEach(t=>{t.feature=e,t.context=n,t.layout.vertex=!1,this.queueFeature(t,i)}):(s.feature=e,s.context=n,s.layout.vertex=!1,this.queueFeature(s,i)),$t.addStyle(this.name,i.id))},async endData(e){let t=this.queues[e.id];delete this.queues[e.id];const{labels:n,texts:i,textures:r}=await this.collideAndRenderTextLabels(e,this.name,t);n&&i&&(this.texts[e.id]=i,n.forEach(t=>{let n=t.text_settings_key,i=this.texts[e.id][n]&&this.texts[e.id][n][t.text],s=this.feature_style;s.label=t.label,i.text_settings.can_articulate?(s.size={},s.texcoords={},"straight"===t.label.type?(s.size.straight=i.size.logical_size,s.texcoords.straight=i.texcoords.straight,s.label_texture=r[i.texcoords.straight.texture_id]):(s.size.curved=i.segment_sizes.map(function(e){return e.logical_size}),s.texcoords_stroke=i.texcoords_stroke,s.texcoords.curved=i.texcoords.curved,s.label_textures=i.texcoords.curved.map(e=>r[e.texture_id]))):(s.size=i.size.logical_size,s.texcoords=i.align[t.label.align].texcoords,s.label_texture=r[i.align[t.label.align].texture_id]),s.blend_order=t.draw.blend_order,Re.addFeature.call(this,t.feature,t.draw,t.context)})),this.freeText(e);const s=await Re.endData.call(this,e);if(s){r&&r.length&&s.textures.push(...r);for(let e in s.meshes)s.meshes[e].uniforms.u_apply_color_blocks=!0}return s},_preprocess(e){return e.blend_order=this.getBlendOrderForDraw(e),this.preprocessText(e)},buildTextLabels(e,t){let n=[];for(let r=0;r<t.length;r++){let s,o=t[r],a=this.texts[e.id][o.text_settings_key][o.text];if(o.layout.vertical_buffer=a.vertical_buffer,a.text_settings.can_articulate){var i=a.segment_sizes.map(e=>e.collision_size);o.layout.no_curving=a.no_curving,s=this.buildLabels(i,o.feature.geometry,o.layout,a.size.collision_size)}else s=this.buildLabels(a.size.collision_size,o.feature.geometry,o.layout);for(let e=0;e<s.length;e++){let t=Object.create(o);t.label=s[e],n.push(t)}}return n},buildLabels(e,t,n,i){let r=[];if("LineString"===t.type)Array.prototype.push.apply(r,this.buildLineLabels(t.coordinates,e,n,i));else if("MultiLineString"===t.type){let s=t.coordinates;for(let t=0;t<s.length;++t)Array.prototype.push.apply(r,this.buildLineLabels(s[t],e,n,i))}else if("Point"===t.type)r.push(new Zt(t.coordinates,e,n));else if("MultiPoint"===t.type){let i=t.coordinates;for(let t=0;t<i.length;++t)r.push(new Zt(i[t],e,n))}else if("Polygon"===t.type){let i=G.centroid(t.coordinates);i&&r.push(new Zt(i,e,n))}else if("MultiPolygon"===t.type){let i=G.multiCentroid(t.coordinates);i&&r.push(new Zt(i,e,n))}return r},buildLineLabels(e,t,n,i){let r=[],s=Math.min(n.subdiv,e.length-1);if(s>1){let o=(e.length-1)/s;for(let a=0;a<s;a++){let s=Math.floor(a*o),l=Math.floor((a+1)*o)+1,u=e.slice(s,l),c=fi(t,i,u,n);c&&r.push(c)}}if(r.length<s){let s=fi(t,i,e,n);s&&r.push(s)}return r},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.shader_point]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_shape",size:4,type:fe.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0},{name:"a_offset",size:2,type:fe.SHORT,normalized:!1},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_pre_angles",size:4,type:fe.BYTE,normalized:!1},{name:"a_angles",size:4,type:fe.SHORT,normalized:!1},{name:"a_offsets",size:4,type:fe.UNSIGNED_SHORT,normalized:!1}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.shader_point]=new Fe(t)}return this.vertex_layouts[e.shader_point]}}),xi.texture_id=0;let wi=Object.create(et);function Ei(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function Ai(e){return null!=e}function Ti(e){return"("+e+")"}function ki(e){return"string"==typeof e?'"'+e+'"':e}function Si(e){return"$"===e[0]?"context['"+e.substring(1)+"']":e.indexOf(".")>-1?-1===e.indexOf("\\.")?`context.feature.properties${e.split(".").map(e=>"['"+e+"']").join("")}`:`context.feature.properties${e.replace(/\\\./g,"__TANGRAM_DELIMITER__").split(".").map(e=>e.replace(/__TANGRAM_DELIMITER__/g,".")).map(e=>"['"+e+"']").join("")}`:"context.feature.properties['"+e+"']"}function Oi(e,t){return Ti(ki(t)+" === "+Si(e))}function Pi(e,t){return Ti(`${"["+t.map(ki).join(",")+"]"}.indexOf(${Si(e)}) > -1`)}function Ci(e,t){return Ti(e.filter(Ai).map(function(e){return Ti(e.join(" && "))}).join(" "+t+" "))}function Ri(e,t,n){return t&&t.length>0?Ci(t.map(function(e){return Fi(e,n)}),"||"):"true"}function Mi(e,t,n){return t&&t.length>0?Ci(t.map(function(e){return Fi(e,n)}),"&&"):"true"}function Li(e,t,n){return"!"+Ti(Fi(t,n).join(" && "))}function Ni(e,t,n){return"!"+Ti(Ri(0,t,n))}function zi(e,t){return Ti(Si(e)+(t?" != ":" == ")+"null")}function Di(e,t,n){var i=[],r=n&&"function"==typeof n.rangeTransform&&n.rangeTransform;if(t.max){var s=r?r(t.max):t.max;i.push(Si(e)+" < "+s)}if(t.min){var o=r?o=r(t.min):t.min;i.push(Si(e)+" >= "+o)}return Ti(i.join(" && "))}function Ii(e,t){let n=[];if(t.includes_any){const i="["+(Array.isArray(t.includes_any)?t.includes_any:[t.includes_any]).map(ki).join(",")+"]";n.push(`${Si(e)} != null && ${i}.some(function(v) { return ${Si(e)}.indexOf(v) > -1 })`)}if(t.includes_all){const i="["+(Array.isArray(t.includes_all)?t.includes_all:[t.includes_all]).map(ki).join(",")+"]";n.push(`${Si(e)} != null && ${i}.every(function(v) { return ${Si(e)}.indexOf(v) > -1 })`)}return Ti(n.join(" && "))}function Fi(e,t){var n=[];if("function"==typeof e)return[Ti(e.toString()+"(context)")];if(Array.isArray(e))return[Ri(0,e,t)];if(null==e)return["true"];for(var i=Object.keys(e),r=0;r<i.length;r++){var s=i[r],o=e[s],a=typeof o;if("string"===a||"number"===a)n.push(Oi(s,o));else if("boolean"===a)n.push(zi(s,o));else if("not"===s)n.push(Li(0,o,t));else if("any"===s)n.push(Ri(0,o,t));else if("all"===s)n.push(Mi(0,o,t));else if("none"===s)n.push(Ni(0,o,t));else if(Array.isArray(o))n.push(Pi(s,o));else if("object"===a&&null!=o)o.max||o.min?n.push(Di(s,o,t)):(o.includes_any||o.includes_all)&&n.push(Ii(s,o));else{if(null!=o)throw new Error("Unknown Query syntax: "+o);n.push(" true ")}}return 0===i.length?["true"]:n}function ji(e,t){return null==e?function(){return!0}:new Function("context","return "+Ti(Fi(e,t).join(" && "))+";")}Object.assign(wi,{name:"raster",super:et,built_in:!0,init(){this.raster=this.raster||"color",this.super.init.apply(this,arguments),this.selection=!1},_preprocess(e){return e.color=e.color||J.defaults.color,this.super._preprocess.apply(this,arguments)}});const Bi=["filter","draw","visible","enabled","data","exclusive","priority"];let Ui={};function Vi(e,t){let n,i=0;for(let t=0;t<e.length;t++)e[t].length>i&&(i=e[t].length);if(0===i)return null;let r={visible:!0};for(let s=0;s<i;s++)n=[],e.forEach(e=>{e[s]&&e[s][t]&&-1===n.indexOf(e[s][t])&&n.push(e[s][t])}),0!==n.length&&V(r,...n);return!1===r.visible?null:r}const Gi=["any","all","not","none"];class $i{constructor({layer:e,name:t,parent:n,draw:i,visible:r,enabled:s,filter:o,exclusive:a,priority:l,styles:u}){if(this.id=$i.id++,this.config_data=e.data,this.parent=n,this.name=t,this.full_name=this.parent?this.parent.full_name+":"+this.name:this.name,this.draw=i,this.filter=o,this.exclusive=!0===a,this.priority=null!=l?l:Number.MAX_SAFE_INTEGER,this.styles=u,this.is_built=!1,s=void 0===s?r:s,this.enabled=!1!==s,this.draw)for(let e in this.draw)if(this.draw[e]=null==this.draw[e]?{}:this.draw[e],"object"!=typeof this.draw[e]){let t=`Draw group '${e}' for layer ${this.full_name} is invalid, must be an object, `;t+=`but was set to \`${e}: ${this.draw[e]}\` instead`,_("warn",t),delete this.draw[e]}}build(){_("trace",`Building layer '${this.full_name}'`),this.buildFilter(),this.buildDraw(),this.is_built=!0}buildDraw(){this.draw=H(this.draw,J.wrapFunction),this.calculatedDraw=function(e){let t=[];if(e.parent){let n=e.parent.calculatedDraw||[];t.push(...n)}return t.push(e.draw),t}(this)}buildFilter(){this.filter_original=this.filter,this.filter=H(this.filter,J.wrapFunction);let e=typeof this.filter;if(null!=this.filter&&"object"!==e&&"function"!==e){let e=`Filter for layer ${this.full_name} is invalid, filter value must be an object or function, `;return e+=`but was set to \`filter: ${this.filter}\` instead`,void _("warn",e)}try{this.buildZooms(),this.buildPropMatches(),null!=this.filter&&("function"==typeof this.filter||Object.keys(this.filter).length>0)?this.filter=ji(this.filter,Wi):this.filter=null}catch(e){let t=`Filter for layer ${this.full_name} is invalid, \`filter: ${JSON.stringify(this.filter)}\` `;t+=`failed with error '${e.message}', stack trace: ${e.stack}`,_("warn",t)}}buildZooms(){let e=this.filter&&this.filter.$zoom,t=typeof e;if(null!=e){if(this.zooms={},"number"===t)this.zooms[e]=!0;else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.zooms[e[t]]=!0;else if("object"===t&&(null!=e.min||null!=e.max)){let t=e.min||0,n=e.max||G.max_style_zoom;for(let e=t;e<n;e++)this.zooms[e]=!0}delete this.filter.$zoom}}buildPropMatches(){this.filter&&!Array.isArray(this.filter)&&"function"!=typeof this.filter&&Object.keys(this.filter).forEach(e=>{if(-1===Gi.indexOf(e)){let t=this.filter[e],n=typeof t,i=Array.isArray(t);if(!i&&"string"!==n&&"number"!==n)return;"$"===e[0]?(this.context_prop_matches=this.context_prop_matches||[],this.context_prop_matches.push([e.substring(1),i?t:[t]]),delete this.filter[e]):-1===e.indexOf(".")&&(this.feature_prop_matches=this.feature_prop_matches||[],this.feature_prop_matches.push([e,i?t:[t]]),delete this.filter[e])}})}doPropMatches(e){if(this.feature_prop_matches)for(let t=0;t<this.feature_prop_matches.length;t++){let n=this.feature_prop_matches[t],i=e.feature.properties[n[0]];if(null==i||-1===n[1].indexOf(i))return!1}if(this.context_prop_matches)for(let t=0;t<this.context_prop_matches.length;t++){let n=this.context_prop_matches[t],i=e[n[0]];if(null==i||-1===n[1].indexOf(i))return!1}return!0}doesMatch(e){if(!this.enabled)return!1;if(this.is_built||this.build(),null!=this.zooms&&!this.zooms[e.zoom])return!1;if(!this.doPropMatches(e))return!1;let t;if(this.filter instanceof Function)try{t=this.filter(e)}catch(t){let n=`Filter for this ${this.full_name}: \`filter: ${this.filter_original}\` `;n+=`failed with error '${t.message}', stack trace: ${t.stack}`,_("error",n,e.feature)}else t=null==this.filter;return!!t&&(this.children_to_parse&&(function(e,t,n){for(let i in t){let r=t[i];if("object"!=typeof r||Array.isArray(r)){let t=`Layer value must be an object: cannot create layer '${i}: ${JSON.stringify(r)}'`;t+=`, under parent layer '${e.full_name}'.`,n[e.name]&&(t+=` The parent name '${e.name}' is also the name of a style, did you mean to create a 'draw' group`,e.parent&&(t+=` under '${e.parent.name}'`),t+=" instead?"),_("warn",t)}else Ki(i,r,e,n)}e.layers.sort((e,t)=>{if(e.exclusive<t.exclusive)return 1;if(e.exclusive>t.exclusive)return-1;const n=e.exclusive?1:-1;return e.priority>t.priority?n:e.priority<t.priority?-n:e.full_name<t.full_name?n:e.full_name>t.full_name?-n:void 0})}(this,this.children_to_parse,this.styles),delete this.children_to_parse),!0)}}$i.id=0;class Zi extends $i{constructor(e){super(e),this.is_leaf=!0}}class qi extends $i{constructor(e){super(e),this.is_tree=!0,this.layers=e.layers||[]}addLayer(e){this.layers.push(e)}buildDrawGroups(e){let t=[],n=[];if(Yi(e,[this],t,n),t.length>0){let e=function(e){if(e.length>1){for(var t=e[0],n=1;n<e.length;n++)t+="/"+e[n];return t}return e[0]}(n);if(void 0===Ui[e]){let n=t.map(e=>e&&!1!==e.visible&&e.calculatedDraw),i={};for(let e=0;e<n.length;e++){let t=n[e];if(t)for(let e=0;e<t.length;e++){let n=t[e];for(let e in n)i[e]=!0}}for(let r in i)Ui[e]=Ui[e]||{},Ui[e][r]=Vi(n,r),Ui[e][r]?(Ui[e][r].key=e+"/"+r,Ui[e][r].layers=t.map(e=>e&&e.full_name),Ui[e][r].group=r):delete Ui[e][r];Ui[e]&&0===Object.keys(Ui[e]).length&&(Ui[e]=null)}return Ui[e]}}}const Wi={rangeTransform:e=>"string"==typeof e&&"px2"===e.trim().slice(-3)?`${parseFloat(e)} * context.meters_per_pixel_sq`:e};function Hi(e){return Bi.indexOf(e)>-1}function Ki(e,t,n,i){let r={name:e,layer:t=null==t?{}:t,parent:n,styles:i},[s,o]=function(e){let t={},n={};for(let i in e)Hi(i)?t[i]=e[i]:n[i]=e[i];return[t,n]}(t),a=(l=o,0===Object.keys(l).length);var l;let u;u=a&&null!=n?Zi:qi;let c=new u(Object.assign(r,s));return c.enabled&&(n&&n.addLayer(c),c.children_to_parse=a?null:o),c}function Yi(e,t,n,i){let r=!1,s=!1;if(0!==t.length){for(let o=0;o<t.length;o++){let a=t[o];if(a.is_leaf){if(a.doesMatch(e)&&(r=!0,n.push(a),i.push(a.id),a.exclusive))break}else if(a.is_tree&&a.doesMatch(e)&&(r=!0,s=Yi(e,a.layers,n,i),s||(n.push(a),i.push(a.id)),a.exclusive))break}return r}}function Xi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function Qi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xi(Object(n),!0).forEach(function(t){r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let Ji=0,er=0;class tr{constructor({coords:e,style_z:t,source:n,workers:i,view:r}){this.id=Ji++,this.view=r,this.source=n,this.generation=null,this.valid=!0,this.visible=!1,this.proxy_for=null,this.proxied_as=null,this.proxy_level=0,this.proxy_order_offset=0,this.fade_in=!0,this.loading=!1,this.loaded=!1,this.built=!1,this.labeled=!1,this.error=null,this.debug={},this.style_z=t,this.coords=ke.normalizedCoord(e,this.source),this.key=ke.key(this.coords,this.source,this.style_z),this.overzoom=Math.max(this.style_z-this.coords.z,0),this.overzoom2=Math.pow(2,this.overzoom),this.min=G.metersForTile(this.coords),this.max=G.metersForTile({x:this.coords.x+1,y:this.coords.y+1,z:this.coords.z}),this.span={x:this.max.x-this.min.x,y:-(this.max.y-this.min.y)},this.bounds={sw:{x:this.min.x,y:this.max.y},ne:{x:this.max.x,y:this.min.y}},this.meters_per_pixel=G.metersPerPixel(this.style_z),this.meters_per_pixel_sq=this.meters_per_pixel*this.meters_per_pixel,this.units_per_pixel=G.units_per_pixel/this.overzoom2,this.units_per_meter_overzoom=G.unitsPerMeter(this.coords.z)*this.overzoom2,this.preserve_tiles_within_zoom=this.source.preserve_tiles_within_zoom,this.meshes={},this.new_mesh_styles=[],this.pending_label_meshes=null,this.setWorker(i)}freeResources(){for(let e in this.meshes)this.meshes[e].forEach(e=>e.destroy());if(this.meshes={},this.pending_label_meshes)for(let e in this.pending_label_meshes)this.pending_label_meshes[e].forEach(e=>e.destroy());this.pending_label_meshes=null}destroy(){A.removeForTile(this.id),this.workerMessage("self.removeTile",this.key),this.freeResources(),this.worker=null,this.valid=!1}buildAsMessage(){return{id:this.id,key:this.key,source:this.source.name,coords:this.coords,min:this.min,max:this.max,units_per_pixel:this.units_per_pixel,meters_per_pixel:this.meters_per_pixel,meters_per_pixel_sq:this.meters_per_pixel_sq,units_per_meter_overzoom:this.units_per_meter_overzoom,style_z:this.style_z,overzoom:this.overzoom,overzoom2:this.overzoom2,generation:this.generation,debug:this.debug}}setWorker(e){this.source.tiled?this.worker_id=Math.abs(this.coords.x+this.coords.y+this.coords.z)%e.length:this.worker_id=this.source.id%e.length,this.worker=e[this.worker_id]}workerMessage(...e){return a.postMessage(this.worker,...e)}build(e,{fade_in:t=!0}={}){return this.generation=e,this.fade_in=t,this.loaded||(this.loading=!0,this.built=!1,this.labeled=!1),this.workerMessage("self.buildTile",{tile:this.buildAsMessage()}).catch(e=>{throw e})}static cancel(e){e&&(e.canceled=!0,e.source_data&&e.source_data.request_id&&(g.cancelRequest(e.source_data.request_id),e.source_data.request_id=null),tr.abortBuild(e))}static buildGeometry(e,{scene_id:t,layers:n,styles:i,global:r}){let s=e.source_data;e.debug.building=+new Date,e.debug.feature_count=0,e.debug.layers=null,$t.startTile(e.id,{apply_repeat_groups:!0});for(let t in n){let o=n[t];if(!o||!o.config_data){_("warn",`Layer ${t} was defined without a geometry data source and will not be rendered.`);continue}if(o.config_data.source!==e.source)continue;let a=tr.getDataForSource(s,o.config_data,t);for(let n=0;n<a.length;n++){let s=a[n],l=s.geom;if(l)for(let n=0;n<l.features.length;n++){let a=l.features[n];if(null==a.geometry)continue;let u=J.getFeatureParseContext(a,e,r);u.winding=e.default_winding,u.source=e.source,u.layer=s.layer;let c=o.buildDrawGroups(u,!0);if(c){for(let e in c){let n=c[e],r=n.style||e,s=i[r];s?(n=s.preprocess(n),null!=n&&!1!==n.visible&&(u.layers=n.layers,s.addFeature(a,n,u))):_("warn",`Style '${r}' not found, skipping layer '${t}':`,n,a)}e.debug.feature_count++}}}}e.debug.building=+new Date-e.debug.building;let o=this.stylesForTile(e,i).map(e=>i[e]);tr.buildStyleGroups(e,o,t,e=>e.collision?"collision":"non-collision")}static stylesForTile(e,t){let n=[];for(let i in t)t[i].hasDataForTile(e)&&n.push(i);return n}static buildStyleGroups(e,t,n,i){const r=t.reduce((e,t)=>{const n=i(t);return e[n]=e[n]||[],e[n].push(t),e},{});if(0===Object.keys(r).length)return a.postMessage(`TileManager_${n}.buildTileStylesCompleted`,a.withTransferables({tile:tr.slice(e),progress:{start:!0,done:!0}})),void $t.resetTile(e.id);const s={};for(const t in r)tr.buildStyleGroup({group_name:t,groups:r,tile:e,progress:s,scene_id:n})}static async buildStyleGroup({group_name:e,groups:t,tile:n,progress:i,scene_id:r}){const s=t[e],o={};try{await Promise.all(s.map(async function(e){const t=await e.endData(n);t&&(o[e.name]=t)})),_("trace",`Finished style group '${e}' for tile ${n.key}`),t[e]=null,Object.keys(t).every(e=>null==t[e])&&(i.done=!0),a.postMessage(`TileManager_${r}.buildTileStylesCompleted`,a.withTransferables({tile:Qi(Qi({},tr.slice(n)),{},{mesh_data:o}),progress:i})),i.done&&$t.resetTile(n.id)}catch(t){_("error",`Error for style group '${e}' for tile ${n.key}`,t&&t.stack||t)}}static getDataForSource(e,t,n){var i=[];if(null!=t&&null!=e&&null!=e.layers)if(!0===t.all_layers){null!=t.layer&&_({level:"warn",once:!0},`Layer ${n} includes both 'all_layers: true' and an explicit 'layer' keyword in its 'data' block. 'all_layers: true' takes precedence, 'layer' will be ignored.`);for(const t in e.layers)i.push({layer:t,geom:e.layers[t]})}else!t.layer&&e.layers._default?i.push({geom:e.layers._default}):!t.layer&&n?i.push({layer:n,geom:e.layers[n]}):"string"==typeof t.layer?i.push({layer:t.layer,geom:e.layers[t.layer]}):Array.isArray(t.layer)&&t.layer.forEach(t=>{i.push({layer:t,geom:e.layers[t]})});return i}buildMeshes(e,t){if(this.error)return;this.build_id=er++,t.start&&(this.debug.geometry_count=0,this.debug.buffer_size=0);let n={},i=this.mesh_data;if(i)for(let t in i){for(let r in i[t].meshes){let s=i[t].meshes[r];if(s.vertex_data){if(!e[t]){_("warn",`Could not create mesh because style '${t}' not found, for tile ${this.key}, aborting tile`);break}let r=Object.assign({},i[t]);r.uniforms=Object.assign({},r.uniforms,s.uniforms),r.variant=s.variant,s.labels&&(r.retain=!0);let o=e[t].makeMesh(s.vertex_data,s.vertex_elements,r);o.variant=r.variant,o.labels=s.labels,n[t]=n[t]||[],n[t].push(o),null==o.variant.mesh_order&&(o.variant.mesh_order=n[t].length-1),this.debug.buffer_size+=o.buffer_size,this.debug.geometry_count+=o.geometry_count}}n[t]&&n[t].sort((e,t)=>{let n=e.variant.mesh_order,i=t.variant.mesh_order;return null==n?1:null==i||n<i?-1:1})}delete this.mesh_data;for(let t in n)e[t].collision?(this.pending_label_meshes=this.pending_label_meshes||{},this.pending_label_meshes[t]=n[t]):(this.meshes[t]&&this.meshes[t].forEach(e=>e.destroy()),this.meshes[t]=n[t],this.new_mesh_styles.push(t));if(t.done){for(let e in this.meshes)-1!==this.new_mesh_styles.indexOf(e)||this.pending_label_meshes&&null!=this.pending_label_meshes[e]||(this.meshes[e].forEach(e=>e.destroy()),delete this.meshes[e]);this.new_mesh_styles=[],this.debug.geometry_ratio=(this.debug.geometry_count/this.debug.feature_count).toFixed(1)}this.printDebug(t)}pendingLabelStyleCount(){return this.pending_label_meshes?Object.keys(this.pending_label_meshes).length:0}swapPendingLabels(){if(this.labeled=!0,this.pending_label_meshes){for(let e in this.pending_label_meshes)this.meshes[e]&&this.meshes[e].forEach(e=>e.destroy()),this.meshes[e]=this.pending_label_meshes[e];this.pending_label_meshes=null}}static abortBuild(e){if(A.removeForTile(e.id),$t.abortTile(e.id),e.mesh_data)for(let t in e.mesh_data){let n=e.mesh_data[t].textures;n&&n.forEach(t=>{let n=S.textures[t];n&&(_("trace",`releasing texture ${t} for tile ${e.key}`),n.release())})}}setProxyFor(e){e?(this.visible=!0,this.proxy_for=this.proxy_for||[],this.proxy_for.push(e),this.proxy_order_offset=1,e.proxied_as=e.style_z>this.style_z?"child":"parent",this.proxy_level=Math.abs(e.style_z-this.style_z)):(this.proxy_for=null,this.proxy_order_offset=0,this.proxy_level=0)}isProxy(){return null!=this.proxy_for}shouldProxyForStyle(e){return!this.proxy_for||this.proxy_for.some(t=>null==t.meshes[e])}setupProgram({model:e,model32:t},n){n.uniform("4fv","u_tile_origin",[this.min.x,this.min.y,this.style_z,this.coords.z]),n.uniform("1f","u_tile_proxy_order_offset",this.proxy_order_offset),ri.identity(e),ri.translate(e,e,ni.fromValues(this.min.x,this.min.y,0)),ri.scale(e,e,ni.fromValues(this.span.x/G.tile_scale,this.span.y/G.tile_scale,1)),ri.copy(t,e),n.uniform("Matrix4fv","u_model",t),n.uniform("1i","u_tile_fade_in",this.fade_in&&"child"!==this.proxied_as)}static slice(e,t){let n=["id","key","loading","loaded","generation","error","debug"];Array.isArray(t)&&n.push(...t);var i={};for(let t=0;t<n.length;t++){const r=n[t];i[r]=e[r]}return i}merge(e){return this.loading=e.loading,this.loaded=e.loaded,this.generation=e.generation,this.error=e.error,this.mesh_data=e.mesh_data,this.debug=V(this.debug,e.debug),this}printDebug(e){const t=["layers"];let n={};for(let e in this.debug)-1===t.indexOf(e)&&(n[e]=this.debug[e]);_("debug",`Tile ${e.done?"(done)":""}: debug for ${this.key}: [ ${JSON.stringify(n)} ]`)}}function nr(e,t){for(let n in e){let i=e[n];Me(t,n,i.features,i.geoms,i.styles,i.base),i.layers&&(t[n].layers=t[n].layers||{},nr(i.layers,t[n].layers))}}tr.coord_children={};var ir,rr,sr,or={};var ar,lr,ur,cr,hr,dr,fr,pr,mr,_r=function(){if(sr)return rr;sr=1,rr=t;var e=(ir||(ir=1,or.read=function(e,t,n,i,r){var s,o,a=8*r-i-1,l=(1<<a)-1,u=l>>1,c=-7,h=n?r-1:0,d=n?-1:1,f=e[t+h];for(h+=d,s=f&(1<<-c)-1,f>>=-c,c+=a;c>0;s=256*s+e[t+h],h+=d,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=i;c>0;o=256*o+e[t+h],h+=d,c-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,i),s-=u}return(f?-1:1)*o*Math.pow(2,s-i)},or.write=function(e,t,n,i,r,s){var o,a,l,u=8*s-r-1,c=(1<<u)-1,h=c>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:s-1,p=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(o++,l/=2),o+h>=c?(a=0,o=c):o+h>=1?(a=(t*l-1)*Math.pow(2,r),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,r),o=0));r>=8;e[n+f]=255&a,f+=p,a/=256,r-=8);for(o=o<<r|a,u+=r;u>0;e[n+f]=255&o,f+=p,o/=256,u-=8);e[n+f-p]|=128*m}),or);function t(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var n=4294967296,i=1/n;function r(e){return e.type===t.Bytes?e.readVarint()+e.pos:e.pos+1}function s(e,t,n){return n?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function o(e,t,n){var i=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.ceil(Math.log(t)/(7*Math.LN2));n.realloc(i);for(var r=n.pos-1;r>=e;r--)n.buf[r+i]=n.buf[r]}function a(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function l(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function u(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function c(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function h(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function d(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function f(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function p(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function m(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function _(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function g(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function y(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var i=this.readVarint(),r=i>>3,s=this.pos;this.type=7&i,e(r,t,this),this.pos===s&&this.skip(i)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=_(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=y(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=_(this.buf,this.pos)+_(this.buf,this.pos+4)*n;return this.pos+=8,e},readSFixed64:function(){var e=_(this.buf,this.pos)+y(this.buf,this.pos+4)*n;return this.pos+=8,e},readFloat:function(){var t=e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(e){var t,n,i=this.buf;return t=127&(n=i[this.pos++]),n<128?t:(t|=(127&(n=i[this.pos++]))<<7,n<128?t:(t|=(127&(n=i[this.pos++]))<<14,n<128?t:(t|=(127&(n=i[this.pos++]))<<21,n<128?t:function(e,t,n){var i,r,o=n.buf;if(i=(112&(r=o[n.pos++]))>>4,r<128)return s(e,i,t);if(i|=(127&(r=o[n.pos++]))<<3,r<128)return s(e,i,t);if(i|=(127&(r=o[n.pos++]))<<10,r<128)return s(e,i,t);if(i|=(127&(r=o[n.pos++]))<<17,r<128)return s(e,i,t);if(i|=(127&(r=o[n.pos++]))<<24,r<128)return s(e,i,t);if(i|=(1&(r=o[n.pos++]))<<31,r<128)return s(e,i,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(n=i[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=function(e,t,n){for(var i="",r=t;r<n;){var s,o,a,l=e[r],u=null,c=l>239?4:l>223?3:l>191?2:1;if(r+c>n)break;1===c?l<128&&(u=l):2===c?128==(192&(s=e[r+1]))&&(u=(31&l)<<6|63&s)<=127&&(u=null):3===c?(s=e[r+1],o=e[r+2],128==(192&s)&&128==(192&o)&&((u=(15&l)<<12|(63&s)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(s=e[r+1],o=e[r+2],a=e[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&((u=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,i+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),i+=String.fromCharCode(u),r+=c}return i}(this.buf,this.pos,e);return this.pos=e,t},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){var n=r(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){var t=r(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){var t=r(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){var t=r(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){var t=r(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){var t=r(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){var t=r(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){var t=r(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){var t=r(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var n=7&e;if(n===t.Varint)for(;this.buf[this.pos++]>127;);else if(n===t.Bytes)this.pos=this.readVarint()+this.pos;else if(n===t.Fixed32)this.pos+=4;else{if(n!==t.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),g(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),g(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),g(this.buf,-1&e,this.pos),g(this.buf,Math.floor(e*i),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),g(this.buf,-1&e,this.pos),g(this.buf,Math.floor(e*i),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var n,i;if(e>=0?(n=e%4294967296|0,i=e/4294967296|0):(i=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,i=i+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,n){n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos]=127&e}(n,0,t),function(e,t){var n=(7&e)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(i,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,n){for(var i,r,s=0;s<t.length;s++){if((i=t.charCodeAt(s))>55295&&i<57344){if(!r){i>56319||s+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):r=i;continue}if(i<56320){e[n++]=239,e[n++]=191,e[n++]=189,r=i;continue}i=r-55296<<10|i-56320|65536,r=null}else r&&(e[n++]=239,e[n++]=191,e[n++]=189,r=null);i<128?e[n++]=i:(i<2048?e[n++]=i>>6|192:(i<65536?e[n++]=i>>12|224:(e[n++]=i>>18|240,e[n++]=i>>12&63|128),e[n++]=i>>6&63|128),e[n++]=63&i|128)}return n}(this.buf,e,this.pos);var n=this.pos-t;n>=128&&o(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(t){this.realloc(4),e.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),e.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var i=this.pos-n;i>=128&&o(n,i,this),this.pos=n-1,this.writeVarint(i),this.pos+=i},writeMessage:function(e,n,i){this.writeTag(e,t.Bytes),this.writeRawMessage(n,i)},writePackedVarint:function(e,t){this.writeMessage(e,a,t)},writePackedSVarint:function(e,t){this.writeMessage(e,l,t)},writePackedBoolean:function(e,t){this.writeMessage(e,h,t)},writePackedFloat:function(e,t){this.writeMessage(e,u,t)},writePackedDouble:function(e,t){this.writeMessage(e,c,t)},writePackedFixed32:function(e,t){this.writeMessage(e,d,t)},writePackedSFixed32:function(e,t){this.writeMessage(e,f,t)},writePackedFixed64:function(e,t){this.writeMessage(e,p,t)},writePackedSFixed64:function(e,t){this.writeMessage(e,m,t)},writeBytesField:function(e,n){this.writeTag(e,t.Bytes),this.writeBytes(n)},writeFixed32Field:function(e,n){this.writeTag(e,t.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(e,n){this.writeTag(e,t.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(e,n){this.writeTag(e,t.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(e,n){this.writeTag(e,t.Fixed64),this.writeSFixed64(n)},writeVarintField:function(e,n){this.writeTag(e,t.Varint),this.writeVarint(n)},writeSVarintField:function(e,n){this.writeTag(e,t.Varint),this.writeSVarint(n)},writeStringField:function(e,n){this.writeTag(e,t.Bytes),this.writeString(n)},writeFloatField:function(e,n){this.writeTag(e,t.Fixed32),this.writeFloat(n)},writeDoubleField:function(e,n){this.writeTag(e,t.Fixed64),this.writeDouble(n)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}},rr}(),gr=M(_r),yr={};function vr(){if(cr)return ur;cr=1;var e=function(){if(lr)return ar;function e(e,t){this.x=e,this.y=t}return lr=1,ar=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,n=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=n,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),n=Math.sin(e),i=t*this.x-n*this.y,r=n*this.x+t*this.y;return this.x=i,this.y=r,this},_rotateAround:function(e,t){var n=Math.cos(e),i=Math.sin(e),r=t.x+n*(this.x-t.x)-i*(this.y-t.y),s=t.y+i*(this.x-t.x)+n*(this.y-t.y);return this.x=r,this.y=s,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(t){return t instanceof e?t:Array.isArray(t)?new e(t[0],t[1]):t},ar}();function t(e,t,i,r,s){this.properties={},this.extent=i,this.type=0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=s,e.readFields(n,this,t)}function n(e,t,n){1==e?t.id=n.readVarint():2==e?function(e,t){for(var n=e.readVarint()+e.pos;e.pos<n;){var i=t._keys[e.readVarint()],r=t._values[e.readVarint()];t.properties[i]=r}}(n,t):3==e?t.type=n.readVarint():4==e&&(t._geometry=n.pos)}function i(e){for(var t,n,i=0,r=0,s=e.length,o=s-1;r<s;o=r++)t=e[r],i+=((n=e[o]).x-t.x)*(t.y+n.y);return i}return ur=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var n,i=t.readVarint()+t.pos,r=1,s=0,o=0,a=0,l=[];t.pos<i;){if(!s){var u=t.readVarint();r=7&u,s=u>>3}if(s--,1===r||2===r)o+=t.readSVarint(),a+=t.readSVarint(),1===r&&(n&&l.push(n),n=[]),n.push(new e(o,a));else{if(7!==r)throw new Error("unknown command "+r);n&&n.push(n[0].clone())}}return n&&l.push(n),l},t.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,n=1,i=0,r=0,s=0,o=1/0,a=-1/0,l=1/0,u=-1/0;e.pos<t;){if(!i){var c=e.readVarint();n=7&c,i=c>>3}if(i--,1===n||2===n)(r+=e.readSVarint())<o&&(o=r),r>a&&(a=r),(s+=e.readSVarint())<l&&(l=s),s>u&&(u=s);else if(7!==n)throw new Error("unknown command "+n)}return[o,l,a,u]},t.prototype.toGeoJSON=function(e,n,r){var s,o,a=this.extent*Math.pow(2,r),l=this.extent*e,u=this.extent*n,c=this.loadGeometry(),h=t.types[this.type];function d(e){for(var t=0;t<e.length;t++){var n=e[t],i=180-360*(n.y+u)/a;e[t]=[360*(n.x+l)/a-180,360/Math.PI*Math.atan(Math.exp(i*Math.PI/180))-90]}}switch(this.type){case 1:var f=[];for(s=0;s<c.length;s++)f[s]=c[s][0];d(c=f);break;case 2:for(s=0;s<c.length;s++)d(c[s]);break;case 3:for(c=function(e){var t=e.length;if(t<=1)return[e];for(var n,r,s=[],o=0;o<t;o++){var a=i(e[o]);0!==a&&(void 0===r&&(r=a<0),r===a<0?(n&&s.push(n),n=[e[o]]):n.push(e[o]))}return n&&s.push(n),s}(c),s=0;s<c.length;s++)for(o=0;o<c[s].length;o++)d(c[s][o])}1===c.length?c=c[0]:h="Multi"+h;var p={type:"Feature",geometry:{type:h,coordinates:c},properties:this.properties};return"id"in this&&(p.id=this.id),p},ur}function br(){if(dr)return hr;dr=1;var e=vr();function t(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(n,this,t),this.length=this._features.length}function n(e,t,n){15===e?t.version=n.readVarint():1===e?t.name=n.readString():5===e?t.extent=n.readVarint():2===e?t._features.push(n.pos):3===e?t._keys.push(n.readString()):4===e&&t._values.push(function(e){for(var t=null,n=e.readVarint()+e.pos;e.pos<n;){var i=e.readVarint()>>3;t=1===i?e.readString():2===i?e.readFloat():3===i?e.readDouble():4===i?e.readVarint64():5===i?e.readVarint():6===i?e.readSVarint():7===i?e.readBoolean():null}return t}(n))}return hr=t,t.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var n=this._pbf.readVarint()+this._pbf.pos;return new e(this._pbf,n,this.extent,this._keys,this._values)},hr}var xr=(mr||(mr=1,yr.VectorTile=function(){if(pr)return fr;pr=1;var e=br();function t(t,n,i){if(3===t){var r=new e(i,i.readVarint()+i.pos);r.length&&(n[r.name]=r)}}return fr=function(e,n){this.layers=e.readFields(t,{},n)},fr}(),yr.VectorTileFeature=vr(),yr.VectorTileLayer=br()),yr);const wr=["{","["];class Er extends Te{constructor(e,t){super(e,t),this.response_type="arraybuffer",!0===e.parse_json?this.parse_json_type=1:Array.isArray(e.parse_json)?(this.parse_json_type=2,this.parse_json_prop_list=e.parse_json):(null!=e.parse_json&&_({level:"warn",once:!0},`Data source '${this.name}': 'parse_json' parameter should be 'true', or an array of property names (was '${JSON.stringify(e.parse_json)}')`),this.parse_json_type=0)}parseSourceData(e,t,n){var i=new Uint8Array(n),r=new gr(i);if(t.data=new xr.VectorTile(r),t.layers=this.toGeoJSON(t.data),"function"==typeof this.transform){const n={min:Object.assign({},e.min),max:Object.assign({},e.max),coords:Object.assign({},e.coords)};t.layers=this.transform(t.layers,this.extra_data,n)}delete t.data}toGeoJSON(e){var t={};for(var n in e.layers){for(var i=e.layers[n],r=G.tile_scale/i.extent,s={type:"FeatureCollection",features:[]},o=0;o<i.length;o++){var a=i.feature(o),l={type:"Feature",geometry:{},id:a.id,properties:a.properties};this.parseJSONProperties(l);for(var u=l.geometry,c=a.loadGeometry(),h=0;h<c.length;h++)for(var d=c[h],f=0;f<d.length;f++)d[f]=[d[f].x*r,d[f].y*r];u.coordinates=c,"Point"===xr.VectorTileFeature.types[a.type]?1===c.length?(u.type="Point",u.coordinates=u.coordinates[0][0]):(u.type="MultiPoint",u.coordinates=u.coordinates[0]):"LineString"===xr.VectorTileFeature.types[a.type]?1===c.length?(u.type="LineString",u.coordinates=u.coordinates[0]):u.type="MultiLineString":"Polygon"===xr.VectorTileFeature.types[a.type]&&(u=Ar(u)),s.features.push(l)}t[n]=s}return t}parseJSONProperties(e){if(0!==this.parse_json_type){const t=e.properties;if(2===this.parse_json_type)this.parse_json_prop_list.forEach(e=>{try{t[e]=JSON.parse(t[e])}catch(e){}});else for(const n in t)if(wr.indexOf(t[n][0])>-1)try{t[n]=JSON.parse(t[n])}catch(e){}}}}function Ar(e){let t,n=[],i=[];for(let r=0;r<e.coordinates.length;r++){let s=e.coordinates[r],o=G.ringWinding(s);null!=o&&(t=t||o,o===t&&i.length>0&&(n.push(i),i=[]),i.push(s))}return i.length>0&&n.push(i),1===n.length?(e.type="Polygon",e.coordinates=n[0]):n.length>1?(e.type="MultiPolygon",e.coordinates=n):e=null,e}function Tr(e,t,n,i){for(var r,s=i,o=n-t>>1,a=n-t,l=e[t],u=e[t+1],c=e[n],h=e[n+1],d=t+3;d<n;d+=3){var f=kr(e[d],e[d+1],l,u,c,h);if(f>s)r=d,s=f;else if(f===s){var p=Math.abs(d-o);p<a&&(r=d,a=p)}}s>i&&(r-t>3&&Tr(e,t,r,i),e[r+2]=s,n-r>3&&Tr(e,r,n,i))}function kr(e,t,n,i,r,s){var o=r-n,a=s-i;if(0!==o||0!==a){var l=((e-n)*o+(t-i)*a)/(o*o+a*a);l>1?(n=r,i=s):l>0&&(n+=o*l,i+=a*l)}return(o=e-n)*o+(a=t-i)*a}function Sr(e,t,n,i){var r={id:void 0===e?null:e,type:t,geometry:n,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,n=e.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)Or(e,t);else if("Polygon"===n||"MultiLineString"===n)for(var i=0;i<t.length;i++)Or(e,t[i]);else if("MultiPolygon"===n)for(i=0;i<t.length;i++)for(var r=0;r<t[i].length;r++)Or(e,t[i][r])}(r),r}function Or(e,t){for(var n=0;n<t.length;n+=3)e.minX=Math.min(e.minX,t[n]),e.minY=Math.min(e.minY,t[n+1]),e.maxX=Math.max(e.maxX,t[n]),e.maxY=Math.max(e.maxY,t[n+1])}function Pr(e,t,n,i){if(t.geometry){var r=t.geometry.coordinates,s=t.geometry.type,o=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2),a=[],l=t.id;if(n.promoteId?l=t.properties[n.promoteId]:n.generateId&&(l=i||0),"Point"===s)Cr(r,a);else if("MultiPoint"===s)for(var u=0;u<r.length;u++)Cr(r[u],a);else if("LineString"===s)Rr(r,a,o,!1);else if("MultiLineString"===s){if(n.lineMetrics){for(u=0;u<r.length;u++)a=[],Rr(r[u],a,o,!1),e.push(Sr(l,"LineString",a,t.properties));return}Mr(r,a,o,!1)}else if("Polygon"===s)Mr(r,a,o,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<t.geometry.geometries.length;u++)Pr(e,{id:l,geometry:t.geometry.geometries[u],properties:t.properties},n,i);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<r.length;u++){var c=[];Mr(r[u],c,o,!0),a.push(c)}}e.push(Sr(l,s,a,t.properties))}}function Cr(e,t){t.push(Lr(e[0])),t.push(Nr(e[1])),t.push(0)}function Rr(e,t,n,i){for(var r,s,o=0,a=0;a<e.length;a++){var l=Lr(e[a][0]),u=Nr(e[a][1]);t.push(l),t.push(u),t.push(0),a>0&&(o+=i?(r*u-l*s)/2:Math.sqrt(Math.pow(l-r,2)+Math.pow(u-s,2))),r=l,s=u}var c=t.length-3;t[2]=1,Tr(t,0,c,n),t[c+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function Mr(e,t,n,i){for(var r=0;r<e.length;r++){var s=[];Rr(e[r],s,n,i),t.push(s)}}function Lr(e){return e/360+.5}function Nr(e){var t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function zr(e,t,n,i,r,s,o,a){if(i/=t,s>=(n/=t)&&o<i)return e;if(o<n||s>=i)return null;for(var l=[],u=0;u<e.length;u++){var c=e[u],h=c.geometry,d=c.type,f=0===r?c.minX:c.minY,p=0===r?c.maxX:c.maxY;if(f>=n&&p<i)l.push(c);else if(!(p<n||f>=i)){var m=[];if("Point"===d||"MultiPoint"===d)Dr(h,m,n,i,r);else if("LineString"===d)Ir(h,m,n,i,r,!1,a.lineMetrics);else if("MultiLineString"===d)jr(h,m,n,i,r,!1);else if("Polygon"===d)jr(h,m,n,i,r,!0);else if("MultiPolygon"===d)for(var _=0;_<h.length;_++){var g=[];jr(h[_],g,n,i,r,!0),g.length&&m.push(g)}if(m.length){if(a.lineMetrics&&"LineString"===d){for(_=0;_<m.length;_++)l.push(Sr(c.id,d,m[_],c.tags));continue}"LineString"!==d&&"MultiLineString"!==d||(1===m.length?(d="LineString",m=m[0]):d="MultiLineString"),"Point"!==d&&"MultiPoint"!==d||(d=3===m.length?"Point":"MultiPoint"),l.push(Sr(c.id,d,m,c.tags))}}}return l.length?l:null}function Dr(e,t,n,i,r){for(var s=0;s<e.length;s+=3){var o=e[s+r];o>=n&&o<=i&&(t.push(e[s]),t.push(e[s+1]),t.push(e[s+2]))}}function Ir(e,t,n,i,r,s,o){for(var a,l,u=Fr(e),c=0===r?Ur:Vr,h=e.start,d=0;d<e.length-3;d+=3){var f=e[d],p=e[d+1],m=e[d+2],_=e[d+3],g=e[d+4],y=0===r?f:p,v=0===r?_:g,b=!1;o&&(a=Math.sqrt(Math.pow(f-_,2)+Math.pow(p-g,2))),y<n?v>n&&(l=c(u,f,p,_,g,n),o&&(u.start=h+a*l)):y>i?v<i&&(l=c(u,f,p,_,g,i),o&&(u.start=h+a*l)):Br(u,f,p,m),v<n&&y>=n&&(l=c(u,f,p,_,g,n),b=!0),v>i&&y<=i&&(l=c(u,f,p,_,g,i),b=!0),!s&&b&&(o&&(u.end=h+a*l),t.push(u),u=Fr(e)),o&&(h+=a)}var x=e.length-3;f=e[x],p=e[x+1],m=e[x+2],(y=0===r?f:p)>=n&&y<=i&&Br(u,f,p,m),x=u.length-3,s&&x>=3&&(u[x]!==u[0]||u[x+1]!==u[1])&&Br(u,u[0],u[1],u[2]),u.length&&t.push(u)}function Fr(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function jr(e,t,n,i,r,s){for(var o=0;o<e.length;o++)Ir(e[o],t,n,i,r,s,!1)}function Br(e,t,n,i){e.push(t),e.push(n),e.push(i)}function Ur(e,t,n,i,r,s){var o=(s-t)/(i-t);return e.push(s),e.push(n+(r-n)*o),e.push(1),o}function Vr(e,t,n,i,r,s){var o=(s-n)/(r-n);return e.push(t+(i-t)*o),e.push(s),e.push(1),o}function Gr(e,t){for(var n=[],i=0;i<e.length;i++){var r,s=e[i],o=s.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)r=$r(s.geometry,t);else if("MultiLineString"===o||"Polygon"===o){r=[];for(var a=0;a<s.geometry.length;a++)r.push($r(s.geometry[a],t))}else if("MultiPolygon"===o)for(r=[],a=0;a<s.geometry.length;a++){for(var l=[],u=0;u<s.geometry[a].length;u++)l.push($r(s.geometry[a][u],t));r.push(l)}n.push(Sr(s.id,o,r,s.tags))}return n}function $r(e,t){var n=[];n.size=e.size,void 0!==e.start&&(n.start=e.start,n.end=e.end);for(var i=0;i<e.length;i+=3)n.push(e[i]+t,e[i+1],e[i+2]);return n}function Zr(e,t){if(e.transformed)return e;var n,i,r,s=1<<e.z,o=e.x,a=e.y;for(n=0;n<e.features.length;n++){var l=e.features[n],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(i=0;i<u.length;i+=2)l.geometry.push(qr(u[i],u[i+1],t,s,o,a));else for(i=0;i<u.length;i++){var h=[];for(r=0;r<u[i].length;r+=2)h.push(qr(u[i][r],u[i][r+1],t,s,o,a));l.geometry.push(h)}}return e.transformed=!0,e}function qr(e,t,n,i,r,s){return[Math.round(n*(e*i-r)),Math.round(n*(t*i-s))]}function Wr(e,t,n,i,r){for(var s=t===r.maxZoom?0:r.tolerance/((1<<t)*r.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:n,y:i,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<e.length;a++){o.numFeatures++,Hr(o,e[a],s,r);var l=e[a].minX,u=e[a].minY,c=e[a].maxX,h=e[a].maxY;l<o.minX&&(o.minX=l),u<o.minY&&(o.minY=u),c>o.maxX&&(o.maxX=c),h>o.maxY&&(o.maxY=h)}return o}function Hr(e,t,n,i){var r=t.geometry,s=t.type,o=[];if("Point"===s||"MultiPoint"===s)for(var a=0;a<r.length;a+=3)o.push(r[a]),o.push(r[a+1]),e.numPoints++,e.numSimplified++;else if("LineString"===s)Kr(o,r,e,n,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(a=0;a<r.length;a++)Kr(o,r[a],e,n,"Polygon"===s,0===a);else if("MultiPolygon"===s)for(var l=0;l<r.length;l++){var u=r[l];for(a=0;a<u.length;a++)Kr(o,u[a],e,n,!0,0===a)}if(o.length){var c=t.tags||null;if("LineString"===s&&i.lineMetrics){for(var h in c={},t.tags)c[h]=t.tags[h];c.mapbox_clip_start=r.start/r.size,c.mapbox_clip_end=r.end/r.size}var d={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:c};null!==t.id&&(d.id=t.id),e.features.push(d)}}function Kr(e,t,n,i,r,s){var o=i*i;if(i>0&&t.size<(r?o:i))n.numPoints+=t.length/3;else{for(var a=[],l=0;l<t.length;l+=3)(0===i||t[l+2]>o)&&(n.numSimplified++,a.push(t[l]),a.push(t[l+1])),n.numPoints++;r&&function(e,t){for(var n=0,i=0,r=e.length,s=r-2;i<r;s=i,i+=2)n+=(e[i]-e[s])*(e[i+1]+e[s+1]);if(n>0===t)for(i=0,r=e.length;i<r/2;i+=2){var o=e[i],a=e[i+1];e[i]=e[r-2-i],e[i+1]=e[r-1-i],e[r-2-i]=o,e[r-1-i]=a}}(a,s),e.push(a)}}function Yr(e,t){return new Xr(e,t)}function Xr(e,t){var n=(t=this.options=function(e,t){for(var n in t)e[n]=t[n];return e}(Object.create(this.options),t)).debug;if(n&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var i=function(e,t){var n=[];if("FeatureCollection"===e.type)for(var i=0;i<e.features.length;i++)Pr(n,e.features[i],t,i);else"Feature"===e.type?Pr(n,e,t):Pr(n,{geometry:e},t);return n}(e,t);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=function(e,t){var n=t.buffer/t.extent,i=e,r=zr(e,1,-1-n,n,0,-1,2,t),s=zr(e,1,1-n,2+n,0,-1,2,t);return(r||s)&&(i=zr(e,1,-n,1+n,0,-1,2,t)||[],r&&(i=Gr(r,1).concat(i)),s&&(i=i.concat(Gr(s,-1)))),i}(i,t),i.length&&this.splitTile(i,0,0,0),n&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Qr(e,t,n){return 32*((1<<e)*n+t)+e}we.register("MVT",()=>Er),Xr.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Xr.prototype.splitTile=function(e,t,n,i,r,s,o){for(var a=[e,t,n,i],l=this.options,u=l.debug;a.length;){i=a.pop(),n=a.pop(),t=a.pop(),e=a.pop();var c=1<<t,h=Qr(t,n,i),d=this.tiles[h];if(!d&&(u>1&&console.time("creation"),d=this.tiles[h]=Wr(e,t,n,i,l),this.tileCoords.push({z:t,x:n,y:i}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,n,i,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));var f="z"+t;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(d.source=e,r){if(t===l.maxZoom||t===r)continue;var p=1<<r-t;if(n!==Math.floor(s/p)||i!==Math.floor(o/p))continue}else if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue;if(d.source=null,0!==e.length){u>1&&console.time("clipping");var m,_,g,y,v,b,x=.5*l.buffer/l.extent,w=.5-x,E=.5+x,A=1+x;m=_=g=y=null,v=zr(e,c,n-x,n+E,0,d.minX,d.maxX,l),b=zr(e,c,n+w,n+A,0,d.minX,d.maxX,l),e=null,v&&(m=zr(v,c,i-x,i+E,1,d.minY,d.maxY,l),_=zr(v,c,i+w,i+A,1,d.minY,d.maxY,l),v=null),b&&(g=zr(b,c,i-x,i+E,1,d.minY,d.maxY,l),y=zr(b,c,i+w,i+A,1,d.minY,d.maxY,l),b=null),u>1&&console.timeEnd("clipping"),a.push(m||[],t+1,2*n,2*i),a.push(_||[],t+1,2*n,2*i+1),a.push(g||[],t+1,2*n+1,2*i),a.push(y||[],t+1,2*n+1,2*i+1)}}},Xr.prototype.getTile=function(e,t,n){var i=this.options,r=i.extent,s=i.debug;if(e<0||e>24)return null;var o=1<<e,a=Qr(e,t=(t%o+o)%o,n);if(this.tiles[a])return Zr(this.tiles[a],r);s>1&&console.log("drilling down to z%d-%d-%d",e,t,n);for(var l,u=e,c=t,h=n;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[Qr(u,c,h)];return l&&l.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,c,h),s>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,e,t,n),s>1&&console.timeEnd("drilling down"),this.tiles[a]?Zr(this.tiles[a],r):null):null};class Jr extends Ae{constructor(e,t){super(e,t),this.load_data=null,this.tile_indexes={},this.setTileSize(512),this.pad_scale=0}_load(e){return this.load_data||(this.load_data=super._load({source_data:{layers:{}}}).then(e=>{e.source_data.error&&_("warn",`data source load error(s) for source '${this.name}', URL '${this.url}': ${e.source_data.error}`);let t=e.source_data.layers;for(let e in t)this.tile_indexes[e]=Yr(t[e],{maxZoom:this.max_zoom,tolerance:1.5,extent:G.tile_scale,buffer:1e-4});return this.loaded=!0,e})),this.load_data.then(()=>{for(let t in this.tile_indexes)e.source_data.layers[t]=this.getTileFeatures(e,t);return e})}getTileFeatures(e,t){let n,i=G.wrapTile(e.coords,{x:!0}),r=this.tile_indexes[t].getTile(i.z,i.x,i.y);if(r&&r.features){n={type:"FeatureCollection",features:[]};for(let e=0;e<r.features.length;e++){const t=r.features[e];let i={type:"Feature",geometry:{},id:t.id,properties:t.tags};if(1===t.type)i.geometry.coordinates=t.geometry.map(e=>[e[0],e[1]]),i.geometry.type="MultiPoint";else{if(2!==t.type&&3!==t.type)continue;if(i.geometry.coordinates=t.geometry.map(e=>e.map(e=>[e[0],e[1]])),2===t.type)i.geometry.type="MultiLineString";else if(i.geometry=Ar(i.geometry),null==i.geometry)continue}n.features.push(i)}}return n}formatURL(){return this.url}parseSourceData(e,t,n){let i="string"==typeof n?JSON.parse(n):n,r=this.getLayers(i);t.layers=this.preprocessLayers(r,e)}preprocessLayers(e,t){for(let t in e){let n=e[t];n.features=this.preprocessFeatures(n.features)}if("function"==typeof this.transform){const n={min:Object.assign({},t.min),max:Object.assign({},t.max),coords:Object.assign({},t.coords)};1===Object.keys(e).length&&e._default?e._default=this.transform(e._default,this.extra_data,n):e=this.transform(e,this.extra_data,n)}return e}preprocessFeatures(e){if(e=e.filter(e=>null!=e.geometry),this.config.generate_label_centroids){let t=[],n={label_placement:!0};e.forEach(e=>{let i,r;if("Polygon"===e.geometry.type)i=e.geometry.coordinates,r=ts(i,e.id,e.properties,n),t.push(r);else if("MultiPolygon"===e.geometry.type){i=e.geometry.coordinates;let s=-1/0,o=0;for(let e=0;e<i.length;e++){let t=G.polygonArea(i[e]);t>s&&(s=t,o=e)}r=ts(i[o],e.id,e.properties,n),t.push(r)}}),t=t.filter(e=>e),Array.prototype.push.apply(e,t)}return e}getLayers(e){return"Feature"===e.type?{_default:{type:"FeatureCollection",features:[e]}}:"FeatureCollection"===e.type?{_default:e}:e}}class es extends Te{constructor(e,t){super(e,t)}parseSourceData(e,t,n){let i="string"==typeof n?JSON.parse(n):n;this.prepareGeoJSON(i,e,t)}prepareGeoJSON(e,t,n){if("function"==typeof this.transform){const n={min:Object.assign({},t.min),max:Object.assign({},t.max),coords:Object.assign({},t.coords)};e=this.transform(e,this.extra_data,n)}n.layers=Jr.prototype.getLayers(e);let i={coords:t.coords,min:G.metersForTile(G.wrapTile(t.coords,{x:!0}))};we.projectData(n),we.scaleData(n,i)}}function ts(e,t,n,i){let r=G.centroid(e);if(!r)return;let s={};return Object.assign(s,n,i),{type:"Feature",id:t,properties:s,geometry:{type:"Point",coordinates:r}}}function ns(e){return e}function is(e,t){var n=t.id,i=t.bbox,r=null==t.properties?{}:t.properties,s=function(e,t){var n=function(e){if(null==(t=e.transform))return ns;var t,n,i,r=t.scale[0],s=t.scale[1],o=t.translate[0],a=t.translate[1];return function(e,t){return t||(n=i=0),e[0]=(n+=e[0])*r+o,e[1]=(i+=e[1])*s+a,e}}(e),i=e.arcs;function r(e,t){t.length&&t.pop();for(var r=i[e<0?~e:e],s=0,o=r.length;s<o;++s)t.push(n(r[s].slice(),s));e<0&&function(e,t){for(var n,i=e.length,r=i-t;r<--i;)n=e[r],e[r++]=e[i],e[i]=n}(t,o)}function s(e){return n(e.slice())}function o(e){for(var t=[],n=0,i=e.length;n<i;++n)r(e[n],t);return t.length<2&&t.push(t[0].slice()),t}function a(e){for(var t=o(e);t.length<4;)t.push(t[0].slice());return t}function l(e){return e.map(a)}return function e(t){var n,i=t.type;switch(i){case"GeometryCollection":return{type:i,geometries:t.geometries.map(e)};case"Point":n=s(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(s);break;case"LineString":n=o(t.arcs);break;case"MultiLineString":n=t.arcs.map(o);break;case"Polygon":n=l(t.arcs);break;case"MultiPolygon":n=t.arcs.map(l);break;default:return null}return{type:i,coordinates:n}}(t)}(e,t);return null==n&&null==i?{type:"Feature",properties:r,geometry:s}:null==i?{type:"Feature",id:n,properties:r,geometry:s}:{type:"Feature",id:n,bbox:i,properties:r,geometry:s}}we.register("GeoJSON",e=>es.urlHasTilePattern(e.url)?es:Jr);class rs extends Jr{parseSourceData(e,t,n){let i="string"==typeof n?JSON.parse(n):n;i=this.toGeoJSON(i);let r=this.getLayers(i);super.preprocessLayers(r,e),t.layers=r}toGeoJSON(e){if(e.objects&&1===Object.keys(e.objects).length){let t=Object.keys(e.objects)[0];e=ss(e,e.objects[t])}else{let t={};for(let n in e.objects)t[n]=ss(e,e.objects[n]);e=t}return e}}function ss(e,t){let n=function(e,t){return"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return is(e,t)})}:is(e,t)}(e,t);return"Feature"===n.type&&(n={type:"FeatureCollection",features:[n]}),n}class os extends es{constructor(e,t){super(e,t)}parseSourceData(e,t,n){let i="string"==typeof n?JSON.parse(n):n;i=rs.prototype.toGeoJSON(i),this.prepareGeoJSON(i,e,t)}}we.register("TopoJSON",e=>os.urlHasTilePattern(e.url)?os:rs),e.Collision=$t,e.DataSource=we,e.FeatureSelection=he,e.FilterOptions=Wi,e.FontManager=rn,e.GLSL=O,e.Geo=G,e.Label=Bt,e.LabelLineStraight=mi,e.LabelPoint=Zt,e.Light=ve,e.Material=_e,e.OBB=jt,e.ShaderProgram=j,e.Style=Re,e.StyleManager=class{constructor(){this.styles={},this.base_styles={},this.active_styles=[],this.active_blend_orders=[],this.register(Object.create(et)),this.register(Object.create(bt)),this.register(Object.create(ci)),this.register(Object.create(xi)),this.register(Object.create(wi))}init(){j.removeBlock("global"),j.removeBlock("setup"),j.addBlock("global","#ifdef TANGRAM_VERTEX_SHADER\n\n// Apply layer ordering to avoid z-fighting\nvoid applyLayerOrder (float layer, inout vec4 position) {\n position.z -= layer * TANGRAM_LAYER_DELTA * position.w;\n}\n\n// Vertex position in model space: [0, 1] range over the local tile\n// Note positions can be outside that range due to unclipped geometry, geometry higher than a unit cube, etc.\nvec4 modelPosition() {\n return\n vec4(\n a_position.xyz / TANGRAM_TILE_SCALE // scale coords to ~0-1 range\n * exp2(u_tile_origin.z - u_tile_origin.w), // adjust for tile overzooming\n 1.)\n + vec4(0., 1., 0., 0.);\n // NB: additional offset to account for unusual Tangram JS y coords,\n // should be refactored to remove\n}\n\n// Position in model space as above, but according to tile coordinate (as opposed to style) zoom\n// e.g. unadjusted for tile overzooming\nvec4 modelPositionBaseZoom() {\n return\n vec4(\n a_position.xyz / TANGRAM_TILE_SCALE, // scale coords to ~0-1 range\n 1.)\n + vec4(0., 1., 0., 0.); // see note on offset above\n}\n\n#endif\n\n// Vertex position in world coordinates, useful for 3d procedural textures, etc.\nvec4 worldPosition() {\n return v_world_position;\n}\n\n// Optionally wrap world coordinates (allows more precision at higher zooms)\n// e.g. at wrap 1000, the world space will wrap every 1000 meters\n#ifdef TANGRAM_VERTEX_SHADER\n\nvec4 wrapWorldPosition(vec4 world_position) {\n #if defined(TANGRAM_WORLD_POSITION_WRAP)\n vec2 anchor = u_tile_origin.xy - mod(u_tile_origin.xy, TANGRAM_WORLD_POSITION_WRAP);\n world_position.xy -= anchor;\n #endif\n return world_position;\n}\n\n#endif\n\n// Normal in world space\n#if defined(TANGRAM_VERTEX_SHADER)\n\nvec3 worldNormal() {\n return TANGRAM_NORMAL;\n}\n\n#elif defined(TANGRAM_FRAGMENT_SHADER)\n\nvec3 worldNormal() {\n return u_inverseNormalMatrix * TANGRAM_NORMAL;\n}\n\n#endif\n"),j.addBlock("global","// Vertex attribute + varying for feature selection\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\n attribute vec4 a_selection_color;\n varying vec4 v_selection_color;\n#endif\n"),j.replaceBlock("setup","// Selection pass-specific rendering\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\n if (a_selection_color.rgb == vec3(0.)) {\n // Discard by forcing invalid triangle if we're in the feature\n // selection pass but have no selection info\n // TODO: in some cases we may actually want non-selectable features to occlude selectable ones?\n gl_Position = vec4(0., 0., 0., 1.);\n return;\n }\n v_selection_color = a_selection_color;\n#endif\n"),j.defines.TANGRAM_EPSILON=1e-5,j.defines.TANGRAM_LAYER_DELTA=1/16384,j.defines.TANGRAM_TILE_SCALE=`vec3(${G.tile_scale}., ${G.tile_scale}., u_meters_per_pixel * ${G.tile_size}.)`,j.defines.TANGRAM_HEIGHT_SCALE=G.height_scale,j.defines.TANGRAM_ALPHA_TEST=.5}destroy(e){Object.keys(this.styles).forEach(t=>{let n=this.styles[t];n.gl===e&&(_("trace",`StyleManager.destroy: destroying render style ${n.name}`),n.base&&this.remove(n.name),n.destroy())})}register(e){this.styles[e.name]=e,this.base_styles[e.name]=e}remove(e){delete this.styles[e]}getActiveStyles(){return this.active_styles}updateActiveStyles(e){return this.active_styles=Object.keys(e.reduce((e,t)=>(Object.keys(t.meshes).forEach(t=>e[t]=!0),e),{})),this.active_styles}getActiveBlendOrders(){return this.active_blend_orders}updateActiveBlendOrders(e){const t=[];e.forEach(e=>{Object.entries(e.meshes).forEach(([e,n])=>{n.forEach(n=>{const i=n.variant.blend_order;let r=t.findIndex(e=>e.blend_order===i);r=r>-1?r:t.push({blend_order:i,styles:[]})-1,-1===t[r].styles.indexOf(e)&&t[r].styles.push(e)})})}),this.active_blend_orders=t.sort((e,t)=>e.blend_order-t.blend_order)}mix(e,t){if(e.mixed)return e;e.mixed={};let n=[];e.mix&&(Array.isArray(e.mix)?n.push(...e.mix):n.push(e.mix),n=n.map(e=>t[e]).filter(t=>t&&t!==e),n.forEach(t=>e.mixed[t.name]=!0)),n.push(e),e.animated=n.some(e=>e&&e.animated),e.texcoords=n.some(e=>e&&e.texcoords),e.base=n.map(e=>e.base).filter(e=>e).pop(),e.lighting=n.map(e=>e.lighting).filter(e=>null!=e).pop(),e.texture=n.map(e=>e.texture).filter(e=>e).pop(),e.raster=n.map(e=>e.raster).filter(e=>null!=e).pop(),e.dash=n.map(e=>e.dash).filter(e=>null!=e).pop(),e.dash_background_color=n.map(e=>e.dash_background_color).filter(e=>null!=e).pop(),n.some(e=>Object.prototype.hasOwnProperty.call(e,"blend")&&e.blend)&&(e.blend=n.map(e=>Object.prototype.hasOwnProperty.call(e,"blend")&&e.blend).filter(e=>e).pop()),e.blend_order=n.map(e=>e.blend_order).filter(e=>null!=e).pop(),e.defines=Object.assign({},...n.map(e=>e.defines).filter(e=>e)),e.material=Object.assign({},...n.map(e=>e.material).filter(e=>e));let i=n.map(e=>e.draw).filter(e=>e);return i.length>0&&(e.draw=V({},...i)),this.mixShaders(e,t,n),e}mixShaders(e,t,n){let i={},r=n.map(e=>e.shaders).filter(e=>e);if(i.defines=Object.assign({},...r.map(e=>e.defines).filter(e=>e)),i.attributes=Object.assign({},...r.map(e=>e.attributes).filter(e=>e)),i.uniforms={},i._uniforms=e.shaders&&e.shaders.uniforms||{},i._uniform_scopes={},n.filter(e=>e.shaders&&e.shaders.uniforms).forEach(e=>{for(let n in e.shaders.uniforms)i._uniform_scopes[n]=e.name,Object.defineProperty(i.uniforms,n,{enumerable:!0,configurable:!0,get:function(){return void 0!==i._uniforms[n]?i._uniforms[n]:t[i._uniform_scopes[n]].shaders.uniforms!==i.uniforms?t[i._uniform_scopes[n]].shaders.uniforms[n]:void 0},set:function(e){i._uniforms[n]=e}})}),i.extensions=Object.keys(r.map(e=>e.extensions).filter(e=>e).reduce((e,t)=>("string"==typeof t?e[t]=!0:t.forEach(t=>e[t]=!0),e),{})||{}),e.shaders&&e.shaders.blocks){e.shaders.block_scopes=e.shaders.block_scopes||{};for(let t in e.shaders.blocks){let n=e.shaders.blocks[t];e.shaders.block_scopes[t]=e.shaders.block_scopes[t]||[],Array.isArray(n)?e.shaders.block_scopes[t].push(...n.map(()=>e.name)):e.shaders.block_scopes[t].push(e.name)}}let s={};return r.forEach(e=>{if(!e.blocks)return;i.blocks=i.blocks||{},i.block_scopes=i.block_scopes||{};let t={};for(let n in e.blocks){let r=e.blocks[n],o=e.block_scopes[n];i.blocks[n]=i.blocks[n]||[],i.block_scopes[n]=i.block_scopes[n]||[],r=Array.isArray(r)?r:[r],o=Array.isArray(o)?o:[o];for(let e=0;e<r.length;e++)s[o[e]]||(t[o[e]]=!0,i.blocks[n].push(r[e]),i.block_scopes[n].push(o[e]))}Object.assign(s,t)}),Object.assign(e.mixed,s),e.shaders=i,e}create(e,t,n={}){let i=V({},t);return i.name=e,i=this.mix(i,n),i.base&&this.base_styles[i.base]?this.styles[e]=i=Object.assign(Object.create(this.base_styles[i.base]),i):i.base=null,i}build(e){const t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ei(Object(n),!0).forEach(function(t){r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ei(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},e);this.styles&&Object.values(this.styles).forEach(e=>a.removeTarget(e.main_thread_target));const n=["opaque","add","multiply","overlay","inlay","translucent"],i=["polygons","lines","points","text","raster"];for(const e of n)for(const n of i){const i=e+"_"+n;null==t[i]&&(t[i]={base:n,blend:e})}let s=Object.keys(t).sort((e,n)=>this.inheritanceDepth(e,t)-this.inheritanceDepth(n,t));for(let e in this.styles)this.base_styles[e]?this.styles[e].reset():delete this.styles[e];let o={};return s.forEach(e=>{o[e]=this.create(e,t[e],o)}),this.styles}initStyles(e={}){for(let t in this.styles)this.styles[t].init(e)}inheritanceDepth(e,t){let n=0;for(;;){let i=t[e];if(!i)break;if(!i.mix)break;if(n++,Array.isArray(i.mix)){n+=Math.max(...i.mix.map(n=>{if(e!==n)return this.inheritanceDepth(n,t)}));break}if(e===i.mix)break;e=i.mix}return n}},e.StyleParser=J,e.Task=A,e.TextCanvas=En,e.Texture=S,e.Thread=t,e.Tile=tr,e.TileID=ke,e.Utils=g,e.Vector=ye,e.VertexArrayObject=U,e.VertexData=Ie,e.VertexElements=ze,e.View=class{constructor(e,t){T(this),this.scene=e,this.createMatrices(),this.zoom=null,this.center=null,this.bounds=null,this.meters_per_pixel=null,this.panning=!1,this.panning_stop_at=0,this.pan_snap_timer=0,this.zoom_direction=0,this.user_input_at=0,this.user_input_timeout=50,this.user_input_active=!1,this.size={css:{},device:{},meters:{}},this.aspect=null,this.buffer=0,this.continuous_zoom="boolean"!=typeof t.continuousZoom||t.continuousZoom,this.wrap=!1!==t.wrapView,this.preserve_tiles_within_zoom=1,this.reset()}reset(){this.createCamera()}createCamera(){let e=this.getActiveCamera();e&&(this.camera=si.create(e,this,this.scene.config.cameras[e]),this.camera.updateView())}getActiveCamera(){if(this.scene.config&&this.scene.config.cameras){for(let e in this.scene.config.cameras)if(this.scene.config.cameras[e].active)return e;let e=Object.keys(this.scene.config.cameras);return e.length&&e[0]}}setActiveCamera(e){let t=this.getActiveCamera();return t===e?e:(this.scene.config.cameras[e]&&(this.scene.config.cameras[e].active=!0,t&&this.scene.config.cameras[t]&&delete this.scene.config.cameras[t].active),this.scene.updateConfig({rebuild:!1,normalize:!1}),this.getActiveCamera())}update(){null!=this.camera&&this.ready()&&this.camera.update(),this.pan_snap_timer=(+new Date-this.panning_stop_at)/1e3,this.user_input_active=+new Date-this.user_input_at<this.user_input_timeout}setViewportSize(e,t){this.size.css={width:e,height:t},this.size.device={width:Math.round(this.size.css.width*g.device_pixel_ratio),height:Math.round(this.size.css.height*g.device_pixel_ratio)},this.aspect=this.size.css.width/this.size.css.height,this.updateBounds()}setView({lng:e,lat:t,zoom:n}={}){var i=!1;return"number"==typeof e&&"number"==typeof t&&(this.center&&e===this.center.lng&&t===this.center.lat||(i=!0,this.center={lng:e,lat:t})),"number"==typeof n&&n!==this.zoom&&(i=!0,this.setZoom(n)),i&&this.updateBounds(),i}setZoom(e){let t=this.tile_zoom,n=this.baseZoom(e);this.continuous_zoom||(e=n),n!==t&&(this.zoom_direction=n>t?1:-1),this.zoom=e,this.tile_zoom=n,this.updateBounds(),this.scene.requestRedraw()}baseZoom(e){return Math.floor(e)}setPanning(e){this.panning=e,this.panning||(this.panning_stop_at=+new Date)}markUserInput(){this.user_input_at=+new Date}ready(){return"number"==typeof this.size.css.width&&"number"==typeof this.size.css.height&&null!=this.center&&"number"==typeof this.zoom}updateBounds(){if(!this.ready())return;this.meters_per_pixel=G.metersPerPixel(this.zoom),this.size.meters={x:this.size.css.width*this.meters_per_pixel,y:this.size.css.height*this.meters_per_pixel};const e=G.latLngToMeters([this.center.lng,this.center.lat]);this.center.meters={x:e[0],y:e[1]},this.center.tile=G.tileForMeters([this.center.meters.x,this.center.meters.y],this.tile_zoom),this.bounds={sw:{x:this.center.meters.x-this.size.meters.x/2,y:this.center.meters.y-this.size.meters.y/2},ne:{x:this.center.meters.x+this.size.meters.x/2,y:this.center.meters.y+this.size.meters.y/2}},this.scene.tile_manager.updateTilesForView(),this.trigger("move"),this.scene.requestRedraw()}findVisibleTileCoordinates(){if(!this.bounds)return[];let e=this.tile_zoom,t=G.tileForMeters([this.bounds.sw.x,this.bounds.sw.y],e),n=G.tileForMeters([this.bounds.ne.x,this.bounds.ne.y],e),i=[t.x-this.buffer,n.x+this.buffer,n.y-this.buffer,t.y+this.buffer];if(!1===this.wrap){let t=(1<<e)-1;i=i.map(e=>Math.min(Math.max(0,e),t))}let r=[];for(let t=i[0];t<=i[1];t++)for(let n=i[2];n<=i[3];n++)r.push(ke.coord({x:t,y:n,z:e}));return r}pruneTilesForView(){this.ready()&&this.scene.tile_manager.removeTiles(e=>{if(e.visible||e.isProxy())return!1;if(e.loading&&e.style_z!==this.tile_zoom)return!0;if(Math.abs(e.style_z-this.tile_zoom)>(null!=e.preserve_tiles_within_zoom?e.preserve_tiles_within_zoom:this.preserve_tiles_within_zoom))return!0;const t=this.meters_per_pixel*G.tile_size,n=ke.coordAtZoom(G.tileForMeters([this.center.meters.x-this.size.meters.x/2-t,this.center.meters.y+this.size.meters.y/2+t],this.tile_zoom),e.coords.z),i=ke.coordAtZoom(G.tileForMeters([this.center.meters.x+this.size.meters.x/2+t,this.center.meters.y-this.size.meters.y/2-t],this.tile_zoom),e.coords.z);return(e.coords.x<n.x||e.coords.x>i.x||e.coords.y<n.y||e.coords.y>i.y)&&(_("trace",`View: remove tile ${e.key} (as ${e.coords.key}) for being too far out of visible area (${n.key}, ${i.key})`),!0)})}createMatrices(){this.matrices={},this.matrices.model=new Float64Array(16),this.matrices.model32=new Float32Array(16),this.matrices.model_view=new Float64Array(16),this.matrices.model_view32=new Float32Array(16),this.matrices.normal=new Float64Array(9),this.matrices.normal32=new Float32Array(9),this.matrices.inverse_normal32=new Float32Array(9)}setupTile(e,t){e.setupProgram(this.matrices,t),this.camera.setupMatrices(this.matrices,t)}setupProgram(e){e.uniform("2fv","u_resolution",[this.size.device.width,this.size.device.height]),e.uniform("3fv","u_map_position",[this.center.meters.x,this.center.meters.y,this.zoom]),e.uniform("1f","u_meters_per_pixel",this.meters_per_pixel),e.uniform("1f","u_device_pixel_ratio",g.device_pixel_ratio),e.uniform("1f","u_view_pan_snap_timer",this.pan_snap_timer),e.uniform("1i","u_view_panning",this.panning),this.camera.setupProgram(e)}isAnimating(){return this.pan_snap_timer<=.5}},e.WorkerBroker=a,e._defineProperty=r,e.addBaseURL=function(e,t){if(!e||!x(e))return e;var n,i="/"!==e[0];if(t?(n=document.createElement("a")).href=t:n=window.location,i)e=b(n.href)+e;else{let t=n.origin;t||(t=n.protocol+"//"+n.host),e=t+e}return e},e.buildFilter=ji,e.cache=W,e.clearFunctionStringCache=function(){W.functions={},W.num_functions=0,W.num_cached=0},e.compileFunctionStrings=H,e.createObjectURL=function(e){return void 0===w&&(w=window.URL&&window.URL.createObjectURL||window.webkitURL&&window.webkitURL.createObjectURL,"function"!=typeof w&&(w=null,_("warn","window.URL.createObjectURL (or vendor prefix) not found, unable to create local blob URLs"))),w?w(e):e},e.debugSettings=v,e.debugSumLayerStats=function(e){let t={},n={};return e.filter(e=>e.debug.layers).forEach(e=>{Object.keys(e.debug.layers.list).forEach(n=>{let i=e.debug.layers.list[n];Me(t,n,i.features,i.geoms,i.styles,i.base)}),nr(e.debug.layers.tree,n)}),{list:t,tree:n}},e.extensionForURL=function(e){let t=(e=e.split("/").pop()).lastIndexOf(".");if(t>-1)return e.substring(t+1)},e.flattenRelativeURL=function(e){let t=(e||"").split("/");for(let e=1;e<t.length;e++)"."===t[e]?(t.splice(e,1),e--):".."===t[e]&&(e+=0,t.splice(e-1,2),e--);return t.join("/")},e.getAugmentedNamespace=function(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})}),n},e.getDefaultExportFromCjs=M,e.isLocalURL=function(e){if("string"==typeof e)return e.search(/^(data|blob):/)>-1},e.isRelativeURL=x,e.isReserved=Hi,e.layerCache=function(){return Ui},e.log=_,e.mergeDebugSettings=function(e){Object.assign(y,e)},e.mergeObjects=V,e.parseLayers=function(e,t){Ui={};let n={};for(let i in e){let r=e[i];r&&(n[i]=Ki(i,r,null,t))}return n},e.pathForURL=b,e.sliceObject=k,e.subscribeMixin=T,e.version=o}),rx(0,function(e){const t=Object.assign(self,{FeatureSelection:e.FeatureSelection,sources:{},styles:{},layers:{},tiles:{},init(t,n,i,r,s,o,a){return this.scene_id=t,this._worker_id=n,this.num_workers=i,e.log.setLevel(r),e.Utils.device_pixel_ratio=s,e.VertexElements.setElementIndexUint(o),e.FeatureSelection.setPrefix(this._worker_id),this.style_manager=new e.StyleManager,this.importExternalScripts(a),e.Label.id_prefix=n,e.Label.id_multiplier=i,n},importExternalScripts(t){if(0===t.length)return;e.log("debug","loading custom data source scripts in worker:",t);let n=Object.getOwnPropertyNames(window);importScripts(...t),Object.getOwnPropertyNames(window).forEach(e=>{-1===n.indexOf(e)&&(this[e]=window[e])})},updateConfig({config:t,generation:n,introspection:i},r){return t=JSON.parse(t),e.mergeDebugSettings(r),this.generation=n,this.introspection=i,this.global=e.compileFunctionStrings(t.global),this.createDataSources(t),t.styles=e.compileFunctionStrings(t.styles,e.StyleParser.wrapFunction),this.styles=this.style_manager.build(t.styles),this.style_manager.initStyles({generation:this.generation,styles:this.styles,sources:this.sources,introspection:this.introspection}),this.layers=e.parseLayers(t.layers,this.style_manager.styles),this.syncing_textures=this.syncTextures(t.textures),this.configuring=this.syncing_textures.then(()=>{e.log("debug","updated config")}),this.configuring},createDataSources(t){this.last_config_sources=this.config_sources||{},this.config_sources=e.mergeObjects({},t.sources);let n=this.sources,i=[];this.sources={};for(let r in t.sources){if(JSON.stringify(this.last_config_sources[r])===JSON.stringify(t.sources[r])){this.sources[r]=n[r];continue}let s;t.sources[r]=e.compileFunctionStrings(t.sources[r]);try{s=e.DataSource.create(Object.assign({},t.sources[r],{name:r}),this.sources)}catch(e){continue}s&&(this.sources[r]=s,i.push(r))}i.forEach(e=>{for(let t in this.tiles)this.tiles[t].source===e&&delete this.tiles[t]})},awaitConfiguration(){return this.configuring},buildTile({tile:t}){if(null==this.getTile(t.key)||!0!==this.getTile(t.key).loading)return t=this.tiles[t.key]=Object.assign(this.getTile(t.key)||{},t),this.awaitConfiguration().then(()=>{if(!0!==t.loaded)t.loading=!0,t.loaded=!1,t.error=null,this.loadTileSourceData(t).then(()=>{this.getTile(t.key)?(t.source_data.error&&e.log("warn",`tile load error(s) for ${t.key}: ${t.source_data.error}`),t.loading=!1,t.loaded=!0,e.Tile.buildGeometry(t,this)):e.log("trace",`stop tile build after data source load because tile was removed: ${t.key}`)}).catch(n=>{t.loading=!1,t.loaded=!1,t.error=n.stack,e.log("error",`tile load error for ${t.key}: ${t.error}`),e.WorkerBroker.postMessage(`TileManager_${this.scene_id}.buildTileError`,e.Tile.slice(t))});else{e.log("trace",`used worker cache for tile ${t.key}`);try{e.Tile.buildGeometry(t,this)}catch(n){t.error=n.toString(),e.WorkerBroker.postMessage(`TileManager_${this.scene_id}.buildTileError`,e.Tile.slice(t))}}})},loadTileSourceData(e){const t=this.sources[e.source];if(t){for(const n in this.tiles){const i=this.tiles[n];if(i.source===e.source&&i.coords.key===e.coords.key&&i.loaded)return Promise.resolve(t.copyTileData(i,e))}return t.load(e)}return e.source_data={},Promise.resolve(e)},getTile(e){return this.tiles[e]},removeTile(t){var n=this.tiles[t];null!=n&&(!0===n.loading&&(e.log("trace",`cancel tile load for ${t}`),n.loading=!1,e.Tile.cancel(n)),e.FeatureSelection.clearTile(t),delete this.tiles[t],e.log("trace",`remove tile from cache for ${t}`))},queryFeatures({filter:t,visible:n,geometry:i,tile_keys:r}){let s=[],o=r.map(e=>this.tiles[e]).filter(e=>e&&e.loaded);return null!=t&&(t=["{","["].indexOf(t[0])>-1?JSON.parse(t):t,t=e.compileFunctionStrings(t,e.StyleParser.wrapFunction)),t=e.buildFilter(t,e.FilterOptions),o.forEach(r=>{for(let o in r.source_data.layers){let a=r.source_data.layers[o];if(null==a)return;a.features.forEach(a=>{const l=a.generation===this.generation;if(!0===n&&!l||!1===n&&l)return;let u=e.StyleParser.getFeatureParseContext(a,r,this.global);if(u.source=r.source,u.layer=o,u.id=a.id,!t(u))return;let c={type:a.type,id:a.id,properties:Object.assign({},a.properties,{$source:u.source,$layer:u.layer,$geometry:u.geometry,$visible:l})};!0===i&&(c.geometry=e.Geo.copyGeometry(a.geometry),e.Geo.tileSpaceToLatlng(c.geometry,r.coords.z,r.min)),s.push(c)})}}),s},getFeatureSelection({id:t,key:n}={}){var i=e.FeatureSelection.map[n];return{id:t,feature:i&&i.feature}},resetFeatureSelection(t=null){e.FeatureSelection.reset(t)},getFeatureSelectionMapSize:()=>e.FeatureSelection.getMapSize(),syncTextures(t){let n=[];return t&&n.push(...Object.keys(t)),e.log("trace","sync textures to worker:",n),n.length>0?e.Texture.syncTexturesToWorker(n):Promise.resolve()},updateDevicePixelRatio(t){e.Utils.device_pixel_ratio=t},clearFunctionStringCache(){e.clearFunctionStringCache()},profile(e){console.profile(`worker ${this._worker_id}: ${e}`)},profileEnd(e){console.profileEnd(`worker ${this._worker_id}: ${e}`)},debug:{debugSettings:e.debugSettings,layerCache:e.layerCache,functionStringCache:e.cache}});e.WorkerBroker.addTarget("self",t)}),rx(0,function(e){var t,n=t={};let i=0;function r(e,t){var n;const i=t[t.length-1];return null===(n=o(e,t))||void 0===n?void 0:n[i]}function s(e,t,n){const i=t[t.length-1],r=o(e,t);r&&(r[i]=n)}function o(e,t){if(0===t.length)return;let n=e;for(let e=0;e<t.length-1;e++)if(n=n[t[e]],null==n)return;return n}t.getContext=function(e,n){var r=!1;null==e&&((e=document.createElement("canvas")).style.position="absolute",e.style.top=0,e.style.left=0,e.style.zIndex=-1,document.body.appendChild(e),r=!0),e.addEventListener("webglcontextlost",()=>{}),e.addEventListener("webglcontextrestored",()=>{});var s=e.getContext("webgl",n)||e.getContext("experimental-webgl",n);if(!s)throw new Error("Couldn't create WebGL context.");return s._tangram_id=i++,r?(t.resize(s,window.innerWidth,window.innerHeight,n.device_pixel_ratio),window.addEventListener("resize",function(){t.resize(s,window.innerWidth,window.innerHeight,n.device_pixel_ratio)})):t.resize(s,parseFloat(e.style.width),parseFloat(e.style.height),n.device_pixel_ratio),s},t.resize=function(e,t,n,i){i=i||window.devicePixelRatio||1,e.canvas.style.width=t+"px",e.canvas.style.height=n+"px",e.canvas.width=Math.round(t*i),e.canvas.height=Math.round(n*i),e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,e.canvas.width,e.canvas.height)};const a="global.",l="__global_prop";function u(e){return(null==e?void 0:e.slice(0,7))===a}function c(e,t){var n;const i=Array.isArray(t)?t:[t],r=o(e,i),s=i[i.length-1];return void 0!==(null==r||null===(n=r[l])||void 0===n?void 0:n[s])}function h(e,t=null,n={}){t=t?t+".":a;for(const i in e){const r=t+i,s=e[i];n[r]=s,"object"!=typeof s||Array.isArray(s)||h(s,r,n)}return n}function d(t,n,i,r){var s;let o;if(null!=i&&null!==(s=i[l])&&void 0!==s&&s[r]?o=i[l][r]:"string"==typeof n&&n.slice(0,7)===a&&(o=n),o){null==i[l]&&Object.defineProperty(i,l,{value:{}}),i[l][r]=o;let n,s=t[o];for(;"string"==typeof s&&s.slice(0,7)===a;){if(n=n||[o],n.indexOf(s)>-1){e.log({level:"warn",once:!0},"Global properties: cyclical reference detected",n),s=null;break}n.push(s),s=t[s]}Object.defineProperty(i,r,{enumerable:!0,get:function(){return s},set:function(e){delete i[l][r],delete i[r],i[r]=e}})}else if(Array.isArray(n))for(let e=0;e<n.length;e++)d(t,n[e],n,e);else if("object"==typeof n)for(const e in n)d(t,n[e],n,e);return n}var f="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},p=[],m=[],_="undefined"!=typeof Uint8Array?Uint8Array:Array,g=!1;function y(){g=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)p[t]=e[t],m[e.charCodeAt(t)]=t;m["-".charCodeAt(0)]=62,m["_".charCodeAt(0)]=63}function v(e,t,n){for(var i,r,s=[],o=t;o<n;o+=3)i=(e[o]<<16)+(e[o+1]<<8)+e[o+2],s.push(p[(r=i)>>18&63]+p[r>>12&63]+p[r>>6&63]+p[63&r]);return s.join("")}function b(e){var t;g||y();for(var n=e.length,i=n%3,r="",s=[],o=16383,a=0,l=n-i;a<l;a+=o)s.push(v(e,a,a+o>l?l:a+o));return 1===i?(t=e[n-1],r+=p[t>>2],r+=p[t<<4&63],r+="=="):2===i&&(t=(e[n-2]<<8)+e[n-1],r+=p[t>>10],r+=p[t>>4&63],r+=p[t<<2&63],r+="="),s.push(r),s.join("")}function x(e,t,n,i,r){var s,o,a=8*r-i-1,l=(1<<a)-1,u=l>>1,c=-7,h=n?r-1:0,d=n?-1:1,f=e[t+h];for(h+=d,s=f&(1<<-c)-1,f>>=-c,c+=a;c>0;s=256*s+e[t+h],h+=d,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=i;c>0;o=256*o+e[t+h],h+=d,c-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,i),s-=u}return(f?-1:1)*o*Math.pow(2,s-i)}function w(e,t,n,i,r,s){var o,a,l,u=8*s-r-1,c=(1<<u)-1,h=c>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:s-1,p=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(o++,l/=2),o+h>=c?(a=0,o=c):o+h>=1?(a=(t*l-1)*Math.pow(2,r),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,r),o=0));r>=8;e[n+f]=255&a,f+=p,a/=256,r-=8);for(o=o<<r|a,u+=r;u>0;e[n+f]=255&o,f+=p,o/=256,u-=8);e[n+f-p]|=128*m}var E={}.toString,A=Array.isArray||function(e){return"[object Array]"==E.call(e)};O.TYPED_ARRAY_SUPPORT=void 0===f.TYPED_ARRAY_SUPPORT||f.TYPED_ARRAY_SUPPORT;var T=k();function k(){return O.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function S(e,t){if(k()<t)throw new RangeError("Invalid typed array length");return O.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=O.prototype:(null===e&&(e=new O(t)),e.length=t),e}function O(e,t,n){if(!(O.TYPED_ARRAY_SUPPORT||this instanceof O))return new O(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return R(this,e)}return P(this,e,t,n)}function P(e,t,n,i){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,i){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(i||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===i?new Uint8Array(t):void 0===i?new Uint8Array(t,n):new Uint8Array(t,n,i),O.TYPED_ARRAY_SUPPORT?(e=t).__proto__=O.prototype:e=M(e,t),e}(e,t,n,i):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!O.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var i=0|z(t,n),r=(e=S(e,i)).write(t,n);return r!==i&&(e=e.slice(0,r)),e}(e,t,n):function(e,t){if(N(t)){var n=0|L(t.length);return 0===(e=S(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(i=t.length)!=i?S(e,0):M(e,t);if("Buffer"===t.type&&A(t.data))return M(e,t.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function C(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function R(e,t){if(C(t),e=S(e,t<0?0:0|L(t)),!O.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function M(e,t){var n=t.length<0?0:0|L(t.length);e=S(e,n);for(var i=0;i<n;i+=1)e[i]=255&t[i];return e}function L(e){if(e>=k())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+k().toString(16)+" bytes");return 0|e}function N(e){return!(null==e||!e._isBuffer)}function z(e,t){if(N(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return le(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return ue(e).length;default:if(i)return le(e).length;t=(""+t).toLowerCase(),i=!0}}function D(e,t,n){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return X(this,t,n);case"utf8":case"utf-8":return W(this,t,n);case"ascii":return K(this,t,n);case"latin1":case"binary":return Y(this,t,n);case"base64":return q(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function I(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function F(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=O.from(t,i)),N(t))return 0===t.length?-1:j(e,t,n,i,r);if("number"==typeof t)return t&=255,O.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):j(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function j(e,t,n,i,r){var s,o=1,a=e.length,l=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,n/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(r){var c=-1;for(s=n;s<a;s++)if(u(e,s)===u(t,-1===c?0:s-c)){if(-1===c&&(c=s),s-c+1===l)return c*o}else-1!==c&&(s-=s-c),c=-1}else for(n+l>a&&(n=a-l),s=n;s>=0;s--){for(var h=!0,d=0;d<l;d++)if(u(e,s+d)!==u(t,d)){h=!1;break}if(h)return s}return-1}function B(e,t,n,i){n=Number(n)||0;var r=e.length-n;i?(i=Number(i))>r&&(i=r):i=r;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var o=0;o<i;++o){var a=parseInt(t.substr(2*o,2),16);if(isNaN(a))return o;e[n+o]=a}return o}function U(e,t,n,i){return ce(le(t,e.length-n),e,n,i)}function V(e,t,n,i){return ce(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,i)}function G(e,t,n,i){return V(e,t,n,i)}function $(e,t,n,i){return ce(ue(t),e,n,i)}function Z(e,t,n,i){return ce(function(e,t){for(var n,i,r,s=[],o=0;o<e.length&&!((t-=2)<0);++o)i=(n=e.charCodeAt(o))>>8,r=n%256,s.push(r),s.push(i);return s}(t,e.length-n),e,n,i)}function q(e,t,n){return 0===t&&n===e.length?b(e):b(e.slice(t,n))}function W(e,t,n){n=Math.min(e.length,n);for(var i=[],r=t;r<n;){var s,o,a,l,u=e[r],c=null,h=u>239?4:u>223?3:u>191?2:1;if(r+h<=n)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(s=e[r+1]))&&(l=(31&u)<<6|63&s)>127&&(c=l);break;case 3:s=e[r+1],o=e[r+2],128==(192&s)&&128==(192&o)&&(l=(15&u)<<12|(63&s)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:s=e[r+1],o=e[r+2],a=e[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&u)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|1023&c),i.push(c),r+=h}return function(e){var t=e.length;if(t<=H)return String.fromCharCode.apply(String,e);for(var n="",i=0;i<t;)n+=String.fromCharCode.apply(String,e.slice(i,i+=H));return n}(i)}O.poolSize=8192,O._augment=function(e){return e.__proto__=O.prototype,e},O.from=function(e,t,n){return P(null,e,t,n)},O.TYPED_ARRAY_SUPPORT&&(O.prototype.__proto__=Uint8Array.prototype,O.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&O[Symbol.species]),O.alloc=function(e,t,n){return function(e,t,n,i){return C(t),t<=0?S(e,t):void 0!==n?"string"==typeof i?S(e,t).fill(n,i):S(e,t).fill(n):S(e,t)}(null,e,t,n)},O.allocUnsafe=function(e){return R(null,e)},O.allocUnsafeSlow=function(e){return R(null,e)},O.isBuffer=he,O.compare=function(e,t){if(!N(e)||!N(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,i=t.length,r=0,s=Math.min(n,i);r<s;++r)if(e[r]!==t[r]){n=e[r],i=t[r];break}return n<i?-1:i<n?1:0},O.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},O.concat=function(e,t){if(!A(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return O.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var i=O.allocUnsafe(t),r=0;for(n=0;n<e.length;++n){var s=e[n];if(!N(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,r),r+=s.length}return i},O.byteLength=z,O.prototype._isBuffer=!0,O.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)I(this,t,t+1);return this},O.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)I(this,t,t+3),I(this,t+1,t+2);return this},O.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)I(this,t,t+7),I(this,t+1,t+6),I(this,t+2,t+5),I(this,t+3,t+4);return this},O.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?W(this,0,e):D.apply(this,arguments)},O.prototype.equals=function(e){if(!N(e))throw new TypeError("Argument must be a Buffer");return this===e||0===O.compare(this,e)},O.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},O.prototype.compare=function(e,t,n,i,r){if(!N(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),t<0||n>e.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&t>=n)return 0;if(i>=r)return-1;if(t>=n)return 1;if(this===e)return 0;for(var s=(r>>>=0)-(i>>>=0),o=(n>>>=0)-(t>>>=0),a=Math.min(s,o),l=this.slice(i,r),u=e.slice(t,n),c=0;c<a;++c)if(l[c]!==u[c]){s=l[c],o=u[c];break}return s<o?-1:o<s?1:0},O.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},O.prototype.indexOf=function(e,t,n){return F(this,e,t,n,!0)},O.prototype.lastIndexOf=function(e,t,n){return F(this,e,t,n,!1)},O.prototype.write=function(e,t,n,i){if(void 0===t)i="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)i=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var r=this.length-t;if((void 0===n||n>r)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return B(this,e,t,n);case"utf8":case"utf-8":return U(this,e,t,n);case"ascii":return V(this,e,t,n);case"latin1":case"binary":return G(this,e,t,n);case"base64":return $(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Z(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},O.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var H=4096;function K(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(127&e[r]);return i}function Y(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(e[r]);return i}function X(e,t,n){var i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);for(var r="",s=t;s<n;++s)r+=ae(e[s]);return r}function Q(e,t,n){for(var i=e.slice(t,n),r="",s=0;s<i.length;s+=2)r+=String.fromCharCode(i[s]+256*i[s+1]);return r}function J(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function ee(e,t,n,i,r,s){if(!N(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<s)throw new RangeError('"value" argument is out of bounds');if(n+i>e.length)throw new RangeError("Index out of range")}function te(e,t,n,i){t<0&&(t=65535+t+1);for(var r=0,s=Math.min(e.length-n,2);r<s;++r)e[n+r]=(t&255<<8*(i?r:1-r))>>>8*(i?r:1-r)}function ne(e,t,n,i){t<0&&(t=4294967295+t+1);for(var r=0,s=Math.min(e.length-n,4);r<s;++r)e[n+r]=t>>>8*(i?r:3-r)&255}function ie(e,t,n,i,r,s){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function re(e,t,n,i,r){return r||ie(e,0,n,4),w(e,t,n,i,23,4),n+4}function se(e,t,n,i,r){return r||ie(e,0,n,8),w(e,t,n,i,52,8),n+8}O.prototype.slice=function(e,t){var n,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e),O.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=O.prototype;else{var r=t-e;n=new O(r,void 0);for(var s=0;s<r;++s)n[s]=this[s+e]}return n},O.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||J(e,t,this.length);for(var i=this[e],r=1,s=0;++s<t&&(r*=256);)i+=this[e+s]*r;return i},O.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||J(e,t,this.length);for(var i=this[e+--t],r=1;t>0&&(r*=256);)i+=this[e+--t]*r;return i},O.prototype.readUInt8=function(e,t){return t||J(e,1,this.length),this[e]},O.prototype.readUInt16LE=function(e,t){return t||J(e,2,this.length),this[e]|this[e+1]<<8},O.prototype.readUInt16BE=function(e,t){return t||J(e,2,this.length),this[e]<<8|this[e+1]},O.prototype.readUInt32LE=function(e,t){return t||J(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},O.prototype.readUInt32BE=function(e,t){return t||J(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},O.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||J(e,t,this.length);for(var i=this[e],r=1,s=0;++s<t&&(r*=256);)i+=this[e+s]*r;return i>=(r*=128)&&(i-=Math.pow(2,8*t)),i},O.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||J(e,t,this.length);for(var i=t,r=1,s=this[e+--i];i>0&&(r*=256);)s+=this[e+--i]*r;return s>=(r*=128)&&(s-=Math.pow(2,8*t)),s},O.prototype.readInt8=function(e,t){return t||J(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},O.prototype.readInt16LE=function(e,t){t||J(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},O.prototype.readInt16BE=function(e,t){t||J(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},O.prototype.readInt32LE=function(e,t){return t||J(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},O.prototype.readInt32BE=function(e,t){return t||J(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},O.prototype.readFloatLE=function(e,t){return t||J(e,4,this.length),x(this,e,!0,23,4)},O.prototype.readFloatBE=function(e,t){return t||J(e,4,this.length),x(this,e,!1,23,4)},O.prototype.readDoubleLE=function(e,t){return t||J(e,8,this.length),x(this,e,!0,52,8)},O.prototype.readDoubleBE=function(e,t){return t||J(e,8,this.length),x(this,e,!1,52,8)},O.prototype.writeUIntLE=function(e,t,n,i){e=+e,t|=0,n|=0,i||ee(this,e,t,n,Math.pow(2,8*n)-1,0);var r=1,s=0;for(this[t]=255&e;++s<n&&(r*=256);)this[t+s]=e/r&255;return t+n},O.prototype.writeUIntBE=function(e,t,n,i){e=+e,t|=0,n|=0,i||ee(this,e,t,n,Math.pow(2,8*n)-1,0);var r=n-1,s=1;for(this[t+r]=255&e;--r>=0&&(s*=256);)this[t+r]=e/s&255;return t+n},O.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,1,255,0),O.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},O.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,2,65535,0),O.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):te(this,e,t,!0),t+2},O.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,2,65535,0),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):te(this,e,t,!1),t+2},O.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,4,4294967295,0),O.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):ne(this,e,t,!0),t+4},O.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,4,4294967295,0),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):ne(this,e,t,!1),t+4},O.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t|=0,!i){var r=Math.pow(2,8*n-1);ee(this,e,t,n,r-1,-r)}var s=0,o=1,a=0;for(this[t]=255&e;++s<n&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+n},O.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t|=0,!i){var r=Math.pow(2,8*n-1);ee(this,e,t,n,r-1,-r)}var s=n-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+n},O.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,1,127,-128),O.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},O.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,2,32767,-32768),O.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):te(this,e,t,!0),t+2},O.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,2,32767,-32768),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):te(this,e,t,!1),t+2},O.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,4,2147483647,-2147483648),O.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):ne(this,e,t,!0),t+4},O.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):ne(this,e,t,!1),t+4},O.prototype.writeFloatLE=function(e,t,n){return re(this,e,t,!0,n)},O.prototype.writeFloatBE=function(e,t,n){return re(this,e,t,!1,n)},O.prototype.writeDoubleLE=function(e,t,n){return se(this,e,t,!0,n)},O.prototype.writeDoubleBE=function(e,t,n){return se(this,e,t,!1,n)},O.prototype.copy=function(e,t,n,i){if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);var r,s=i-n;if(this===e&&n<t&&t<i)for(r=s-1;r>=0;--r)e[r+t]=this[r+n];else if(s<1e3||!O.TYPED_ARRAY_SUPPORT)for(r=0;r<s;++r)e[r+t]=this[r+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+s),t);return s},O.prototype.fill=function(e,t,n,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),1===e.length){var r=e.charCodeAt(0);r<256&&(e=r)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!O.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var s;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;s<n;++s)this[s]=e;else{var o=N(e)?e:le(new O(e,i).toString()),a=o.length;for(s=0;s<n-t;++s)this[s+t]=o[s%a]}return this};var oe=/[^+\/0-9A-Za-z-_]/g;function ae(e){return e<16?"0"+e.toString(16):e.toString(16)}function le(e,t){var n;t=t||1/0;for(var i=e.length,r=null,s=[],o=0;o<i;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&s.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function ue(e){return function(e){var t,n,i,r,s,o;g||y();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s="="===e[a-2]?2:"="===e[a-1]?1:0,o=new _(3*a/4-s),i=s>0?a-4:a;var l=0;for(t=0,n=0;t<i;t+=4,n+=3)r=m[e.charCodeAt(t)]<<18|m[e.charCodeAt(t+1)]<<12|m[e.charCodeAt(t+2)]<<6|m[e.charCodeAt(t+3)],o[l++]=r>>16&255,o[l++]=r>>8&255,o[l++]=255&r;return 2===s?(r=m[e.charCodeAt(t)]<<2|m[e.charCodeAt(t+1)]>>4,o[l++]=255&r):1===s&&(r=m[e.charCodeAt(t)]<<10|m[e.charCodeAt(t+1)]<<4|m[e.charCodeAt(t+2)]>>2,o[l++]=r>>8&255,o[l++]=255&r),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(oe,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ce(e,t,n,i){for(var r=0;r<i&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}function he(e){return null!=e&&(!!e._isBuffer||de(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&de(e.slice(0,0))}(e))}function de(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var fe=Object.freeze({__proto__:null,Buffer:O,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),O.alloc(+e)},isBuffer:he,kMaxLength:T});function pe(){throw new Error("setTimeout has not been defined")}function me(){throw new Error("clearTimeout has not been defined")}var _e=pe,ge=me;function ye(e){if(_e===setTimeout)return setTimeout(e,0);if((_e===pe||!_e)&&setTimeout)return _e=setTimeout,setTimeout(e,0);try{return _e(e,0)}catch(t){try{return _e.call(null,e,0)}catch(t){return _e.call(this,e,0)}}}"function"==typeof f.setTimeout&&(_e=setTimeout),"function"==typeof f.clearTimeout&&(ge=clearTimeout);var ve,be=[],xe=!1,we=-1;function Ee(){xe&&ve&&(xe=!1,ve.length?be=ve.concat(be):we=-1,be.length&&Ae())}function Ae(){if(!xe){var e=ye(Ee);xe=!0;for(var t=be.length;t;){for(ve=be,be=[];++we<t;)ve&&ve[we].run();we=-1,t=be.length}ve=null,xe=!1,function(e){if(ge===clearTimeout)return clearTimeout(e);if((ge===me||!ge)&&clearTimeout)return ge=clearTimeout,clearTimeout(e);try{return ge(e)}catch(t){try{return ge.call(null,e)}catch(t){return ge.call(this,e)}}}(e)}}function Te(e,t){this.fun=e,this.array=t}Te.prototype.run=function(){this.fun.apply(null,this.array)};var ke=f.performance||{};function Se(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}ke.now||ke.mozNow||ke.msNow||ke.oNow||ke.webkitNow;var Oe,Pe,Ce,Re,Me,Le,Ne,ze,De,Ie,Fe,je,Be,Ue,Ve,Ge,$e,Ze,qe,We,He,Ke,Ye,Xe,Qe,Je,et,tt,nt,it,rt,st,ot,at,lt={exports:{}},ut=(Oe||(Oe=1,lt.exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(!a&&Se)return Se(o);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[o]={exports:{}};t[o][0].call(u.exports,function(e){return r(t[o][1][e]||e)},u,u.exports,e,t,n,i)}return n[o].exports}for(var s=Se,o=0;o<i.length;o++)r(i[o]);return r}({1:[function(e,t,n){var i=e("./utils"),r=e("./support"),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.encode=function(e){for(var t,n,r,o,a,l,u,c=[],h=0,d=e.length,f=d,p="string"!==i.getTypeOf(e);h<e.length;)f=d-h,r=p?(t=e[h++],n=h<d?e[h++]:0,h<d?e[h++]:0):(t=e.charCodeAt(h++),n=h<d?e.charCodeAt(h++):0,h<d?e.charCodeAt(h++):0),o=t>>2,a=(3&t)<<4|n>>4,l=1<f?(15&n)<<2|r>>6:64,u=2<f?63&r:64,c.push(s.charAt(o)+s.charAt(a)+s.charAt(l)+s.charAt(u));return c.join("")},n.decode=function(e){var t,n,i,o,a,l,u=0,c=0,h="data:";if(e.substr(0,5)===h)throw new Error("Invalid base64 input, it looks like a data url.");var d,f=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===s.charAt(64)&&f--,e.charAt(e.length-2)===s.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");for(d=r.uint8array?new Uint8Array(0|f):new Array(0|f);u<e.length;)t=s.indexOf(e.charAt(u++))<<2|(o=s.indexOf(e.charAt(u++)))>>4,n=(15&o)<<4|(a=s.indexOf(e.charAt(u++)))>>2,i=(3&a)<<6|(l=s.indexOf(e.charAt(u++))),d[c++]=t,64!==a&&(d[c++]=n),64!==l&&(d[c++]=i);return d}},{"./support":30,"./utils":32}],2:[function(e,t,n){var i=e("./external"),r=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,n,i,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=i,this.compressedContent=r}a.prototype={getContentWorker:function(){var e=new r(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new r(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,n){return e.pipe(new s).pipe(new o("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){var i=e("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},n.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){var i=e("./utils"),r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==i.getTypeOf(e)?function(e,t,n){var i=r,s=0+n;e^=-1;for(var o=0;o<s;o++)e=e>>>8^i[255&(e^t[o])];return~e}(0|t,e,e.length):function(e,t,n){var i=r,s=0+n;e^=-1;for(var o=0;o<s;o++)e=e>>>8^i[255&(e^t.charCodeAt(o))];return~e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){var i;i="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:i}},{lie:37}],7:[function(e,t,n){var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,r=e("pako"),s=e("./utils"),o=e("./stream/GenericWorker"),a=i?"uint8array":"array";function l(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic="\b\0",s.inherits(l,o),l.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(a,e.data),!1)},l.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new r[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new l("Deflate",e)},n.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){function i(e,t){var n,i="";for(n=0;n<t;n++)i+=String.fromCharCode(255&e),e>>>=8;return i}function r(e,t,n,r,o,c){var h,d,f=e.file,p=e.compression,m=c!==a.utf8encode,_=s.transformTo("string",c(f.name)),g=s.transformTo("string",a.utf8encode(f.name)),y=f.comment,v=s.transformTo("string",c(y)),b=s.transformTo("string",a.utf8encode(y)),x=g.length!==f.name.length,w=b.length!==y.length,E="",A="",T="",k=f.dir,S=f.date,O={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(O.crc32=e.crc32,O.compressedSize=e.compressedSize,O.uncompressedSize=e.uncompressedSize);var P=0;t&&(P|=8),m||!x&&!w||(P|=2048);var C=0,R=0;k&&(C|=16),"UNIX"===o?(R=798,C|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(f.unixPermissions,k)):(R=20,C|=function(e){return 63&(e||0)}(f.dosPermissions)),h=S.getUTCHours(),h<<=6,h|=S.getUTCMinutes(),h<<=5,h|=S.getUTCSeconds()/2,d=S.getUTCFullYear()-1980,d<<=4,d|=S.getUTCMonth()+1,d<<=5,d|=S.getUTCDate(),x&&(A=i(1,1)+i(l(_),4)+g,E+="up"+i(A.length,2)+A),w&&(T=i(1,1)+i(l(v),4)+b,E+="uc"+i(T.length,2)+T);var M="";return M+="\n\0",M+=i(P,2),M+=p.magic,M+=i(h,2),M+=i(d,2),M+=i(O.crc32,4),M+=i(O.compressedSize,4),M+=i(O.uncompressedSize,4),M+=i(_.length,2),M+=i(E.length,2),{fileRecord:u.LOCAL_FILE_HEADER+M+_+E,dirRecord:u.CENTRAL_FILE_HEADER+i(R,2)+M+i(v.length,2)+"\0\0\0\0"+i(C,4)+i(r,4)+_+E+v}}var s=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),l=e("../crc32"),u=e("../signature");function c(e,t,n,i){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=i,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(c,o),c.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-i-1))/n:100}}))},c.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=r(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=r(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return u.DATA_DESCRIPTOR+i(e.crc32,4)+i(e.compressedSize,4)+i(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var n=this.bytesWritten-e,r=function(e,t,n,r,o){var a=s.transformTo("string",o(r));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(e,2)+i(e,2)+i(t,4)+i(n,4)+i(a.length,2)+a}(this.dirRecords.length,n,e,this.zipComment,this.encodeFileName);this.push({data:r,meta:{percent:100}})},c.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},c.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},c.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},c.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var n=0;n<t.length;n++)try{t[n].error(e)}catch(e){}return!0},c.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=c},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,n){var i=e("../compressions"),r=e("./ZipFileWorker");n.generateWorker=function(e,t,n){var s=new r(t.streamFiles,n,t.platform,t.encodeFileName),o=0;try{e.forEach(function(e,n){o++;var r=function(e,t){var n=e||t,r=i[n];if(!r)throw new Error(n+" is not a valid compression method !");return r}(n.options.compression,t.compression),a=n.options.compressionOptions||t.compressionOptions||{},l=n.dir,u=n.date;n._compressWorker(r,a).withStreamInfo("file",{name:e,dir:l,date:u,comment:n.comment||"",unixPermissions:n.unixPermissions,dosPermissions:n.dosPermissions}).pipe(s)}),s.entriesCount=o}catch(e){s.error(e)}return s}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,n){function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new i;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(i.prototype=e("./object")).loadAsync=e("./load"),i.support=e("./support"),i.defaults=e("./defaults"),i.version="3.10.1",i.loadAsync=function(e,t){return(new i).loadAsync(e,t)},i.external=e("./external"),t.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,n){var i=e("./utils"),r=e("./external"),s=e("./utf8"),o=e("./zipEntries"),a=e("./stream/Crc32Probe"),l=e("./nodejsUtils");function u(e){return new r.Promise(function(t,n){var i=e.decompressed.getContentWorker().pipe(new a);i.on("error",function(e){n(e)}).on("end",function(){i.streamInfo.crc32!==e.decompressed.crc32?n(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}t.exports=function(e,t){var n=this;return t=i.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:s.utf8decode}),l.isNode&&l.isStream(e)?r.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(e){var n=new o(t);return n.load(e),n}).then(function(e){var n=[r.Promise.resolve(e)],i=e.files;if(t.checkCRC32)for(var s=0;s<i.length;s++)n.push(u(i[s]));return r.Promise.all(n)}).then(function(e){for(var r=e.shift(),s=r.files,o=0;o<s.length;o++){var a=s[o],l=a.fileNameStr,u=i.resolve(a.fileNameStr);n.file(u,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders}),a.dir||(n.file(u).unsafeOriginalName=l)}return r.zipComment.length&&(n.comment=r.zipComment),n})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,n){var i=e("../utils"),r=e("../stream/GenericWorker");function s(e,t){r.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}i.inherits(s,r),s.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},s.prototype.pause=function(){return!!r.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=s},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,n){var i=e("readable-stream").Readable;function r(e,t,n){i.call(this,t),this._helper=e;var r=this;e.on("data",function(e,t){r.push(e)||r._helper.pause(),n&&n(t)}).on("error",function(e){r.emit("error",e)}).on("end",function(){r.push(null)})}e("../utils").inherits(r,i),r.prototype._read=function(){this._helper.resume()},t.exports=r},{"../utils":32,"readable-stream":16}],14:[function(e,t,n){t.exports={isNode:void 0!==O,newBufferFrom:function(e,t){if(O.from&&O.from!==Uint8Array.from)return O.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new O(e,t)},allocBuffer:function(e){if(O.alloc)return O.alloc(e);var t=new O(e);return t.fill(0),t},isBuffer:function(e){return he(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,n){function i(e,t,n){var i,r=s.getTypeOf(t),a=s.extend(n||{},l);a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(e=m(e)),a.createFolders&&(i=p(e))&&_.call(this,i,!0);var h="string"===r&&!1===a.binary&&!1===a.base64;n&&void 0!==n.binary||(a.binary=!h),(t instanceof u&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",r="string");var g;g=t instanceof u||t instanceof o?t:d.isNode&&d.isStream(t)?new f(e,t):s.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var y=new c(e,g,a);this.files[e]=y}var r=e("./utf8"),s=e("./utils"),o=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),l=e("./defaults"),u=e("./compressedObject"),c=e("./zipObject"),h=e("./generate"),d=e("./nodejsUtils"),f=e("./nodejs/NodejsStreamInputAdapter"),p=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},m=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},_=function(e,t){return t=void 0!==t?t:l.createFolders,e=m(e),this.files[e]||i.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function g(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var y={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,n,i;for(t in this.files)i=this.files[t],(n=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(n,i)},filter:function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(i)}),t},file:function(e,t,n){if(1!==arguments.length)return e=this.root+e,i.call(this,e,t,n),this;if(g(e)){var r=e;return this.filter(function(e,t){return!t.dir&&r.test(e)})}var s=this.files[this.root+e];return s&&!s.dir?s:null},folder:function(e){if(!e)return this;if(g(e))return this.filter(function(t,n){return n.dir&&e.test(t)});var t=this.root+e,n=_.call(this,t),i=this.clone();return i.root=n.name,i},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var n=this.filter(function(t,n){return n.name.slice(0,e.length)===e}),i=0;i<n.length;i++)delete this.files[n[i].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,n={};try{if((n=s.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:r.utf8encode})).type=n.type.toLowerCase(),n.compression=n.compression.toUpperCase(),"binarystring"===n.type&&(n.type="string"),!n.type)throw new Error("No output type specified.");s.checkSupport(n.type),"darwin"!==n.platform&&"freebsd"!==n.platform&&"linux"!==n.platform&&"sunos"!==n.platform||(n.platform="UNIX"),"win32"===n.platform&&(n.platform="DOS");var i=n.comment||this.comment||"";t=h.generateWorker(this,n,i)}catch(e){(t=new o("error")).error(e)}return new a(t,n.type||"string",n.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=y},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,n){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,n){var i=e("./DataReader");function r(e){i.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(r,i),r.prototype.byteAt=function(e){return this.data[this.zero+e]},r.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),n=e.charCodeAt(1),i=e.charCodeAt(2),r=e.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===t&&this.data[s+1]===n&&this.data[s+2]===i&&this.data[s+3]===r)return s-this.zero;return-1},r.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1),i=e.charCodeAt(2),r=e.charCodeAt(3),s=this.readData(4);return t===s[0]&&n===s[1]&&i===s[2]&&r===s[3]},r.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./DataReader":18}],18:[function(e,t,n){var i=e("../utils");function r(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}r.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,n=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return i.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=r},{"../utils":32}],19:[function(e,t,n){var i=e("./Uint8ArrayReader");function r(e){i.call(this,e)}e("../utils").inherits(r,i),r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){var i=e("./DataReader");function r(e){i.call(this,e)}e("../utils").inherits(r,i),r.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},r.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},r.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){var i=e("./ArrayReader");function r(e){i.call(this,e)}e("../utils").inherits(r,i),r.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){var i=e("../utils"),r=e("../support"),s=e("./ArrayReader"),o=e("./StringReader"),a=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(e){var t=i.getTypeOf(e);return i.checkSupport(t),"string"!==t||r.uint8array?"nodebuffer"===t?new a(e):r.uint8array?new l(i.transformTo("uint8array",e)):new s(i.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,n){var i=e("./GenericWorker"),r=e("../utils");function s(e){i.call(this,"ConvertWorker to "+e),this.destType=e}r.inherits(s,i),s.prototype.processChunk=function(e){this.push({data:r.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){var i=e("./GenericWorker"),r=e("../crc32");function s(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,i),s.prototype.processChunk=function(e){this.streamInfo.crc32=r(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){var i=e("../utils"),r=e("./GenericWorker");function s(e){r.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}i.inherits(s,r),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}r.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){var i=e("../utils"),r=e("./GenericWorker");function s(e){r.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=i.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}i.inherits(s,r),s.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){function i(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n<this._listeners[e].length;n++)this._listeners[e][n].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=i},{}],29:[function(e,t,n){var i=e("../utils"),r=e("./ConvertWorker"),s=e("./GenericWorker"),o=e("../base64"),a=e("../support"),l=e("../external"),u=null;if(a.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function c(e,t,n){var o=t;switch(t){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=t,this._mimeType=n,i.checkSupport(o),this._worker=e.pipe(new r(o)),e.lock()}catch(e){this._worker=new s("error"),this._worker.error(e)}}c.prototype={accumulate:function(e){return function(e,t){return new l.Promise(function(n,r){var s=[],a=e._internalType,l=e._outputType,u=e._mimeType;e.on("data",function(e,n){s.push(e),t&&t(n)}).on("error",function(e){s=[],r(e)}).on("end",function(){try{var e=function(e,t,n){switch(e){case"blob":return i.newBlob(i.transformTo("arraybuffer",t),n);case"base64":return o.encode(t);default:return i.transformTo(e,t)}}(l,function(e,t){var n,i=0,r=null,s=0;for(n=0;n<t.length;n++)s+=t[n].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(r=new Uint8Array(s),n=0;n<t.length;n++)r.set(t[n],i),i+=t[n].length;return r;case"nodebuffer":return O.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(a,s),u);n(e)}catch(e){r(e)}s=[]}).resume()})}(this,e)},on:function(e,t){var n=this;return"data"===e?this._worker.on(e,function(e){t.call(n,e.data,e.meta)}):this._worker.on(e,function(){i.delay(t,arguments,n)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(i.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new u(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=c},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,n){if(n.base64=!0,n.array=!0,n.string=!0,n.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,n.nodebuffer=void 0!==O,n.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)n.blob=!1;else{var i=new ArrayBuffer(0);try{n.blob=0===new Blob([i],{type:"application/zip"}).size}catch(e){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);r.append(i),n.blob=0===r.getBlob("application/zip").size}catch(e){n.blob=!1}}}try{n.nodestream=!!e("readable-stream").Readable}catch(e){n.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,n){for(var i=e("./utils"),r=e("./support"),s=e("./nodejsUtils"),o=e("./stream/GenericWorker"),a=new Array(256),l=0;l<256;l++)a[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function u(){o.call(this,"utf-8 decode"),this.leftOver=null}function c(){o.call(this,"utf-8 encode")}a[254]=a[254]=1,n.utf8encode=function(e){return r.nodebuffer?s.newBufferFrom(e,"utf-8"):function(e){var t,n,i,s,o,a=e.length,l=0;for(s=0;s<a;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(i-56320),s++),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=r.uint8array?new Uint8Array(l):new Array(l),s=o=0;o<l;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(i-56320),s++),n<128?t[o++]=n:(n<2048?t[o++]=192|n>>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(e)},n.utf8decode=function(e){return r.nodebuffer?i.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,n,r,s,o=e.length,l=new Array(2*o);for(t=n=0;t<o;)if((r=e[t++])<128)l[n++]=r;else if(4<(s=a[r]))l[n++]=65533,t+=s-1;else{for(r&=2===s?31:3===s?15:7;1<s&&t<o;)r=r<<6|63&e[t++],s--;1<s?l[n++]=65533:r<65536?l[n++]=r:(r-=65536,l[n++]=55296|r>>10&1023,l[n++]=56320|1023&r)}return l.length!==n&&(l.subarray?l=l.subarray(0,n):l.length=n),i.applyFromCharCode(l)}(e=i.transformTo(r.uint8array?"uint8array":"array",e))},i.inherits(u,o),u.prototype.processChunk=function(e){var t=i.transformTo(r.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var s=t;(t=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),t.set(s,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+a[e[n]]>t?n:t}(t),l=t;o!==t.length&&(r.uint8array?(l=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(l=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:n.utf8decode(l),meta:e.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=u,i.inherits(c,o),c.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){var i=e("./support"),r=e("./base64"),s=e("./nodejsUtils"),o=e("./external");function a(e){return e}function l(e,t){for(var n=0;n<e.length;++n)t[n]=255&e.charCodeAt(n);return t}e("setimmediate"),n.newBlob=function(e,t){n.checkSupport("blob");try{return new Blob([e],{type:t})}catch(n){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return i.append(e),i.getBlob(t)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var u={stringifyByChunk:function(e,t,n){var i=[],r=0,s=e.length;if(s<=n)return String.fromCharCode.apply(null,e);for(;r<s;)"array"===t||"nodebuffer"===t?i.push(String.fromCharCode.apply(null,e.slice(r,Math.min(r+n,s)))):i.push(String.fromCharCode.apply(null,e.subarray(r,Math.min(r+n,s)))),r+=n;return i.join("")},stringifyByChar:function(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&1===String.fromCharCode.apply(null,s.allocBuffer(1)).length}catch(e){return!1}}()}};function c(e){var t=65536,i=n.getTypeOf(e),r=!0;if("uint8array"===i?r=u.applyCanBeUsed.uint8array:"nodebuffer"===i&&(r=u.applyCanBeUsed.nodebuffer),r)for(;1<t;)try{return u.stringifyByChunk(e,i,t)}catch(e){t=Math.floor(t/2)}return u.stringifyByChar(e)}function h(e,t){for(var n=0;n<e.length;n++)t[n]=e[n];return t}n.applyFromCharCode=c;var d={};d.string={string:a,array:function(e){return l(e,new Array(e.length))},arraybuffer:function(e){return d.string.uint8array(e).buffer},uint8array:function(e){return l(e,new Uint8Array(e.length))},nodebuffer:function(e){return l(e,s.allocBuffer(e.length))}},d.array={string:c,array:a,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(e)}},d.arraybuffer={string:function(e){return c(new Uint8Array(e))},array:function(e){return h(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:a,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(new Uint8Array(e))}},d.uint8array={string:c,array:function(e){return h(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:a,nodebuffer:function(e){return s.newBufferFrom(e)}},d.nodebuffer={string:c,array:function(e){return h(e,new Array(e.length))},arraybuffer:function(e){return d.nodebuffer.uint8array(e).buffer},uint8array:function(e){return h(e,new Uint8Array(e.length))},nodebuffer:a},n.transformTo=function(e,t){if(t=t||"",!e)return t;n.checkSupport(e);var i=n.getTypeOf(t);return d[i][e](t)},n.resolve=function(e){for(var t=e.split("/"),n=[],i=0;i<t.length;i++){var r=t[i];"."===r||""===r&&0!==i&&i!==t.length-1||(".."===r?n.pop():n.push(r))}return n.join("/")},n.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":i.nodebuffer&&s.isBuffer(e)?"nodebuffer":i.uint8array&&e instanceof Uint8Array?"uint8array":i.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},n.checkSupport=function(e){if(!i[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},n.MAX_VALUE_16BITS=65535,n.MAX_VALUE_32BITS=-1,n.pretty=function(e){var t,n,i="";for(n=0;n<(e||"").length;n++)i+="\\x"+((t=e.charCodeAt(n))<16?"0":"")+t.toString(16).toUpperCase();return i},n.delay=function(e,t,n){setImmediate(function(){e.apply(n||null,t||[])})},n.inherits=function(e,t){function n(){}n.prototype=t.prototype,e.prototype=new n},n.extend=function(){var e,t,n={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===n[t]&&(n[t]=arguments[e][t]);return n},n.prepareContent=function(e,t,s,a,u){return o.Promise.resolve(t).then(function(e){return i.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new o.Promise(function(t,n){var i=new FileReader;i.onload=function(e){t(e.target.result)},i.onerror=function(e){n(e.target.error)},i.readAsArrayBuffer(e)}):e}).then(function(t){var c=n.getTypeOf(t);return c?("arraybuffer"===c?t=n.transformTo("uint8array",t):"string"===c&&(u?t=r.decode(t):s&&!0!==a&&(t=function(e){return l(e,i.uint8array?new Uint8Array(e.length):new Array(e.length))}(t))),t):o.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,n){var i=e("./reader/readerFor"),r=e("./utils"),s=e("./signature"),o=e("./zipEntry"),a=e("./support");function l(e){this.files=[],this.loadOptions=e}l.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+r.pretty(t)+", expected "+r.pretty(e)+")")}},isSignature:function(e,t){var n=this.reader.index;this.reader.setIndex(e);var i=this.reader.readString(4)===t;return this.reader.setIndex(n),i},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=a.uint8array?"uint8array":"array",n=r.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(n)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,n,i=this.zip64EndOfCentralSize-44;0<i;)e=this.reader.readInt(2),t=this.reader.readInt(4),n=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:n}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===r.MAX_VALUE_16BITS||this.diskWithCentralDirStart===r.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===r.MAX_VALUE_16BITS||this.centralDirRecords===r.MAX_VALUE_16BITS||this.centralDirSize===r.MAX_VALUE_32BITS||this.centralDirOffset===r.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var n=this.centralDirOffset+this.centralDirSize;this.zip64&&(n+=20,n+=12+this.zip64EndOfCentralSize);var i=t-n;if(0<i)this.isSignature(t,s.CENTRAL_FILE_HEADER)||(this.reader.zero=i);else if(i<0)throw new Error("Corrupted zip: missing "+Math.abs(i)+" bytes.")},prepareReader:function(e){this.reader=i(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=l},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,n){var i=e("./reader/readerFor"),r=e("./utils"),s=e("./compressedObject"),o=e("./crc32"),a=e("./utf8"),l=e("./compressions"),u=e("./support");function c(e,t){this.options=e,this.loadOptions=t}c.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,n;if(e.skip(22),this.fileNameLength=e.readInt(2),n=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(n),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in l)if(Object.prototype.hasOwnProperty.call(l,t)&&l[t].magic===e)return l[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+r.pretty(this.compressionMethod)+" unknown (inner file : "+r.transformTo("string",this.fileName)+")");this.decompressed=new s(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=i(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,i,r=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<r;)t=e.readInt(2),n=e.readInt(2),i=e.readData(n),this.extraFields[t]={id:t,length:n,value:i};e.setIndex(r)},handleUTF8:function(){var e=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var n=r.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(n)}var i=this.findExtraFieldUnicodeComment();if(null!==i)this.fileCommentStr=i;else{var s=r.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(s)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=i(e.value);return 1!==t.readInt(1)||o(this.fileName)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=i(e.value);return 1!==t.readInt(1)||o(this.fileComment)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null}},t.exports=c},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,n){function i(e,t,n){this.name=e,this.dir=n.dir,this.date=n.date,this.comment=n.comment,this.unixPermissions=n.unixPermissions,this.dosPermissions=n.dosPermissions,this._data=t,this._dataBinary=n.binary,this.options={compression:n.compression,compressionOptions:n.compressionOptions}}var r=e("./stream/StreamHelper"),s=e("./stream/DataWorker"),o=e("./utf8"),a=e("./compressedObject"),l=e("./stream/GenericWorker");i.prototype={internalStream:function(e){var t=null,n="string";try{if(!e)throw new Error("No output type specified.");var i="string"===(n=e.toLowerCase())||"text"===n;"binarystring"!==n&&"text"!==n||(n="string"),t=this._decompressWorker();var s=!this._dataBinary;s&&!i&&(t=t.pipe(new o.Utf8EncodeWorker)),!s&&i&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new l("error")).error(e)}return new r(t,n,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof a&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var n=this._decompressWorker();return this._dataBinary||(n=n.pipe(new o.Utf8EncodeWorker)),a.createWorkerFrom(n,e,t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof l?this._data:new s(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],c=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},h=0;h<u.length;h++)i.prototype[u[h]]=c;t.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,n){(function(e){var n,i,r=e.MutationObserver||e.WebKitMutationObserver;if(r){var s=0,o=new r(c),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),n=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){c(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(c,0)};else{var l=new e.MessageChannel;l.port1.onmessage=c,n=function(){l.port2.postMessage(0)}}var u=[];function c(){var e,t;i=!0;for(var n=u.length;n;){for(t=u,u=[],e=-1;++e<n;)t[e]();n=u.length}i=!1}t.exports=function(e){1!==u.push(e)||i||n()}}).call(this,void 0!==f?f:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,n){var i=e("immediate");function r(){}var s={},o=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==r&&f(this,e)}function c(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function h(e,t,n){i(function(){var i;try{i=t(n)}catch(i){return s.reject(e,i)}i===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,i)})}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function f(e,t){var n=!1;function i(t){n||(n=!0,s.reject(e,t))}function r(t){n||(n=!0,s.resolve(e,t))}var o=p(function(){t(r,i)});"error"===o.status&&i(o.value)}function p(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}(t.exports=u).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){throw n})})},u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var n=new this.constructor(r);return this.state!==l?h(n,this.state===a?e:t,this.outcome):this.queue.push(new c(n,e,t)),n},c.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},c.prototype.otherCallFulfilled=function(e){h(this.promise,this.onFulfilled,e)},c.prototype.callRejected=function(e){s.reject(this.promise,e)},c.prototype.otherCallRejected=function(e){h(this.promise,this.onRejected,e)},s.resolve=function(e,t){var n=p(d,t);if("error"===n.status)return s.reject(e,n.value);var i=n.value;if(i)f(e,i);else{e.state=a,e.outcome=t;for(var r=-1,o=e.queue.length;++r<o;)e.queue[r].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var n=-1,i=e.queue.length;++n<i;)e.queue[n].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:s.resolve(new this(r),e)},u.reject=function(e){var t=new this(r);return s.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=new Array(n),a=0,l=-1,u=new this(r);++l<n;)c(e[l],l);return u;function c(e,r){t.resolve(e).then(function(e){o[r]=e,++a!==n||i||(i=!0,s.resolve(u,o))},function(e){i||(i=!0,s.reject(u,e))})}},u.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,n=!1;if(!t)return this.resolve([]);for(var i,o=-1,a=new this(r);++o<t;)i=e[o],this.resolve(i).then(function(e){n||(n=!0,s.resolve(a,e))},function(e){n||(n=!0,s.reject(a,e))});return a}},{immediate:36}],38:[function(e,t,n){var i={};(0,e("./lib/utils/common").assign)(i,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,n){var i=e("./zlib/deflate"),r=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/messages"),a=e("./zlib/zstream"),l=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=r.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var n=i.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==n)throw new Error(o[n]);if(t.header&&i.deflateSetHeader(this.strm,t.header),t.dictionary){var c;if(c="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(n=i.deflateSetDictionary(this.strm,c)))throw new Error(o[n]);this._dict_set=!0}}function c(e,t){var n=new u(t);if(n.push(e,!0),n.err)throw n.msg||o[n.err];return n.result}u.prototype.push=function(e,t){var n,o,a=this.strm,u=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=s.string2buf(e):"[object ArrayBuffer]"===l.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new r.Buf8(u),a.next_out=0,a.avail_out=u),1!==(n=i.deflate(a,o))&&0!==n)return this.onEnd(n),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(r.shrinkBuf(a.output,a.next_out))):this.onData(r.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==n);return 4===o?(n=i.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,0===n):2!==o||(this.onEnd(0),!(a.avail_out=0))},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Deflate=u,n.deflate=c,n.deflateRaw=function(e,t){return(t=t||{}).raw=!0,c(e,t)},n.gzip=function(e,t){return(t=t||{}).gzip=!0,c(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,n){var i=e("./zlib/inflate"),r=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),l=e("./zlib/zstream"),u=e("./zlib/gzheader"),c=Object.prototype.toString;function h(e){if(!(this instanceof h))return new h(e);this.options=r.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=i.inflateInit2(this.strm,t.windowBits);if(n!==o.Z_OK)throw new Error(a[n]);this.header=new u,i.inflateGetHeader(this.strm,this.header)}function d(e,t){var n=new h(t);if(n.push(e,!0),n.err)throw n.msg||a[n.err];return n.result}h.prototype.push=function(e,t){var n,a,l,u,h,d,f=this.strm,p=this.options.chunkSize,m=this.options.dictionary,_=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?f.input=s.binstring2buf(e):"[object ArrayBuffer]"===c.call(e)?f.input=new Uint8Array(e):f.input=e,f.next_in=0,f.avail_in=f.input.length;do{if(0===f.avail_out&&(f.output=new r.Buf8(p),f.next_out=0,f.avail_out=p),(n=i.inflate(f,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&m&&(d="string"==typeof m?s.string2buf(m):"[object ArrayBuffer]"===c.call(m)?new Uint8Array(m):m,n=i.inflateSetDictionary(this.strm,d)),n===o.Z_BUF_ERROR&&!0===_&&(n=o.Z_OK,_=!1),n!==o.Z_STREAM_END&&n!==o.Z_OK)return this.onEnd(n),!(this.ended=!0);f.next_out&&(0!==f.avail_out&&n!==o.Z_STREAM_END&&(0!==f.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(l=s.utf8border(f.output,f.next_out),u=f.next_out-l,h=s.buf2string(f.output,l),f.next_out=u,f.avail_out=p-u,u&&r.arraySet(f.output,f.output,l,u,0),this.onData(h)):this.onData(r.shrinkBuf(f.output,f.next_out)))),0===f.avail_in&&0===f.avail_out&&(_=!0)}while((0<f.avail_in||0===f.avail_out)&&n!==o.Z_STREAM_END);return n===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(n=i.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(f.avail_out=0))},h.prototype.onData=function(e){this.chunks.push(e)},h.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Inflate=h,n.inflate=d,n.inflateRaw=function(e,t){return(t=t||{}).raw=!0,d(e,t)},n.ungzip=d},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,n){var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;n.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])}}return e},n.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,n,i,r){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+i),r);else for(var s=0;s<i;s++)e[r+s]=t[n+s]},flattenChunks:function(e){var t,n,i,r,s,o;for(t=i=0,n=e.length;t<n;t++)i+=e[t].length;for(o=new Uint8Array(i),t=r=0,n=e.length;t<n;t++)s=e[t],o.set(s,r),r+=s.length;return o}},s={arraySet:function(e,t,n,i,r){for(var s=0;s<i;s++)e[r+s]=t[n+s]},flattenChunks:function(e){return[].concat.apply([],e)}};n.setTyped=function(e){e?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,r)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,s))},n.setTyped(i)},{}],42:[function(e,t,n){var i=e("./common"),r=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){r=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new i.Buf8(256),a=0;a<256;a++)o[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function l(e,t){if(t<65537&&(e.subarray&&s||!e.subarray&&r))return String.fromCharCode.apply(null,i.shrinkBuf(e,t));for(var n="",o=0;o<t;o++)n+=String.fromCharCode(e[o]);return n}o[254]=o[254]=1,n.string2buf=function(e){var t,n,r,s,o,a=e.length,l=0;for(s=0;s<a;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(r-56320),s++),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=new i.Buf8(l),s=o=0;o<l;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(r-56320),s++),n<128?t[o++]=n:(n<2048?t[o++]=192|n>>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return l(e,e.length)},n.binstring2buf=function(e){for(var t=new i.Buf8(e.length),n=0,r=t.length;n<r;n++)t[n]=e.charCodeAt(n);return t},n.buf2string=function(e,t){var n,i,r,s,a=t||e.length,u=new Array(2*a);for(n=i=0;n<a;)if((r=e[n++])<128)u[i++]=r;else if(4<(s=o[r]))u[i++]=65533,n+=s-1;else{for(r&=2===s?31:3===s?15:7;1<s&&n<a;)r=r<<6|63&e[n++],s--;1<s?u[i++]=65533:r<65536?u[i++]=r:(r-=65536,u[i++]=55296|r>>10&1023,u[i++]=56320|1023&r)}return l(u,i)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+o[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){t.exports=function(e,t,n,i){for(var r=65535&e,s=e>>>16&65535,o=0;0!==n;){for(n-=o=2e3<n?2e3:n;s=s+(r=r+t[i++]|0)|0,--o;);r%=65521,s%=65521}return r|s<<16}},{}],44:[function(e,t,n){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,n){var i=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,r){var s=i,o=r+n;e^=-1;for(var a=r;a<o;a++)e=e>>>8^s[255&(e^t[a])];return~e}},{}],46:[function(e,t,n){var i,r=e("../utils/common"),s=e("./trees"),o=e("./adler32"),a=e("./crc32"),l=e("./messages"),u=-2,c=258,h=262,d=113;function f(e,t){return e.msg=l[t],t}function p(e){return(e<<1)-(4<e?9:0)}function m(e){for(var t=e.length;0<=--t;)e[t]=0}function _(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(r.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function g(e,t){s._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,_(e.strm)}function y(e,t){e.pending_buf[e.pending++]=t}function v(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function b(e,t){var n,i,r=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-h?e.strstart-(e.w_size-h):0,u=e.window,d=e.w_mask,f=e.prev,p=e.strstart+c,m=u[s+o-1],_=u[s+o];e.prev_length>=e.good_match&&(r>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(n=t)+o]===_&&u[n+o-1]===m&&u[n]===u[s]&&u[++n]===u[s+1]){s+=2,n++;do{}while(u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&s<p);if(i=c-(p-s),s=p-c,o<i){if(e.match_start=t,a<=(o=i))break;m=u[s+o-1],_=u[s+o]}}}while((t=f[t&d])>l&&0!=--r);return o<=e.lookahead?o:e.lookahead}function x(e){var t,n,i,s,l,u,c,d,f,p,m=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-h)){for(r.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=n=e.hash_size;i=e.head[--t],e.head[t]=m<=i?i-m:0,--n;);for(t=n=m;i=e.prev[--t],e.prev[t]=m<=i?i-m:0,--n;);s+=m}if(0===e.strm.avail_in)break;if(u=e.strm,c=e.window,d=e.strstart+e.lookahead,p=void 0,(f=s)<(p=u.avail_in)&&(p=f),n=0===p?0:(u.avail_in-=p,r.arraySet(c,u.input,u.next_in,p,d),1===u.state.wrap?u.adler=o(u.adler,c,p,d):2===u.state.wrap&&(u.adler=a(u.adler,c,p,d)),u.next_in+=p,u.total_in+=p,p),e.lookahead+=n,e.lookahead+e.insert>=3)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+3-1])&e.hash_mask,e.prev[l&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=l,l++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<h&&0!==e.strm.avail_in)}function w(e,t){for(var n,i;;){if(e.lookahead<h){if(x(e),e.lookahead<h&&0===t)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-h&&(e.match_length=b(e,n)),e.match_length>=3)if(i=s._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else i=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}function E(e,t){for(var n,i,r;;){if(e.lookahead<h){if(x(e),e.lookahead<h&&0===t)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-h&&(e.match_length=b(e,n),e.match_length<=5&&(1===e.strategy||3===e.match_length&&4096<e.strstart-e.match_start)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){for(r=e.strstart+e.lookahead-3,i=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=r&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(g(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((i=s._tr_tally(e,0,e.window[e.strstart-1]))&&g(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=s._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}function A(e,t,n,i,r){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=i,this.func=r}function T(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r.Buf16(1146),this.dyn_dtree=new r.Buf16(122),this.bl_tree=new r.Buf16(78),m(this.dyn_ltree),m(this.dyn_dtree),m(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r.Buf16(16),this.heap=new r.Buf16(573),m(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r.Buf16(573),m(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function k(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:d,e.adler=2===t.wrap?0:1,t.last_flush=0,s._tr_init(t),0):f(e,u)}function S(e){var t=k(e);return 0===t&&function(e){e.window_size=2*e.w_size,m(e.head),e.max_lazy_match=i[e.level].max_lazy,e.good_match=i[e.level].good_length,e.nice_match=i[e.level].nice_length,e.max_chain_length=i[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0}(e.state),t}function O(e,t,n,i,s,o){if(!e)return u;var a=1;if(-1===t&&(t=6),i<0?(a=0,i=-i):15<i&&(a=2,i-=16),s<1||9<s||8!==n||i<8||15<i||t<0||9<t||o<0||4<o)return f(e,u);8===i&&(i=9);var l=new T;return(e.state=l).strm=e,l.wrap=a,l.gzhead=null,l.w_bits=i,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=s+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+3-1)/3),l.window=new r.Buf8(2*l.w_size),l.head=new r.Buf16(l.hash_size),l.prev=new r.Buf16(l.w_size),l.lit_bufsize=1<<s+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new r.Buf8(l.pending_buf_size),l.d_buf=1*l.lit_bufsize,l.l_buf=3*l.lit_bufsize,l.level=t,l.strategy=o,l.method=n,S(e)}i=[new A(0,0,0,0,function(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(x(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+n;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,g(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-h&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(g(e,!1),e.strm.avail_out),1)}),new A(4,4,8,4,w),new A(4,5,16,8,w),new A(4,6,32,32,w),new A(4,4,16,16,E),new A(8,16,32,32,E),new A(8,16,128,128,E),new A(8,32,128,256,E),new A(32,128,258,1024,E),new A(32,258,258,4096,E)],n.deflateInit=function(e,t){return O(e,t,8,15,8,0)},n.deflateInit2=O,n.deflateReset=S,n.deflateResetKeep=k,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?u:(e.state.gzhead=t,0):u},n.deflate=function(e,t){var n,r,o,l;if(!e||!e.state||5<t||t<0)return e?f(e,u):u;if(r=e.state,!e.output||!e.input&&0!==e.avail_in||666===r.status&&4!==t)return f(e,0===e.avail_out?-5:u);if(r.strm=e,n=r.last_flush,r.last_flush=t,42===r.status)if(2===r.wrap)e.adler=0,y(r,31),y(r,139),y(r,8),r.gzhead?(y(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),y(r,255&r.gzhead.time),y(r,r.gzhead.time>>8&255),y(r,r.gzhead.time>>16&255),y(r,r.gzhead.time>>24&255),y(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),y(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(y(r,255&r.gzhead.extra.length),y(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=a(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(y(r,0),y(r,0),y(r,0),y(r,0),y(r,0),y(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),y(r,3),r.status=d);else{var h=8+(r.w_bits-8<<4)<<8;h|=(2<=r.strategy||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(h|=32),h+=31-h%31,r.status=d,v(r,h),0!==r.strstart&&(v(r,e.adler>>>16),v(r,65535&e.adler)),e.adler=1}if(69===r.status)if(r.gzhead.extra){for(o=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),_(e),o=r.pending,r.pending!==r.pending_buf_size));)y(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){o=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),_(e),o=r.pending,r.pending===r.pending_buf_size)){l=1;break}l=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,y(r,l)}while(0!==l);r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),0===l&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){o=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),_(e),o=r.pending,r.pending===r.pending_buf_size)){l=1;break}l=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,y(r,l)}while(0!==l);r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),0===l&&(r.status=103)}else r.status=103;if(103===r.status&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&_(e),r.pending+2<=r.pending_buf_size&&(y(r,255&e.adler),y(r,e.adler>>8&255),e.adler=0,r.status=d)):r.status=d),0!==r.pending){if(_(e),0===e.avail_out)return r.last_flush=-1,0}else if(0===e.avail_in&&p(t)<=p(n)&&4!==t)return f(e,-5);if(666===r.status&&0!==e.avail_in)return f(e,-5);if(0!==e.avail_in||0!==r.lookahead||0!==t&&666!==r.status){var b=2===r.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(x(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}(r,t):3===r.strategy?function(e,t){for(var n,i,r,o,a=e.window;;){if(e.lookahead<=c){if(x(e),e.lookahead<=c&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&0<e.strstart&&(i=a[r=e.strstart-1])===a[++r]&&i===a[++r]&&i===a[++r]){o=e.strstart+c;do{}while(i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&r<o);e.match_length=c-(o-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=s._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}(r,t):i[r.level].func(r,t);if(3!==b&&4!==b||(r.status=666),1===b||3===b)return 0===e.avail_out&&(r.last_flush=-1),0;if(2===b&&(1===t?s._tr_align(r):5!==t&&(s._tr_stored_block(r,0,0,!1),3===t&&(m(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),_(e),0===e.avail_out))return r.last_flush=-1,0}return 4!==t?0:r.wrap<=0?1:(2===r.wrap?(y(r,255&e.adler),y(r,e.adler>>8&255),y(r,e.adler>>16&255),y(r,e.adler>>24&255),y(r,255&e.total_in),y(r,e.total_in>>8&255),y(r,e.total_in>>16&255),y(r,e.total_in>>24&255)):(v(r,e.adler>>>16),v(r,65535&e.adler)),_(e),0<r.wrap&&(r.wrap=-r.wrap),0!==r.pending?0:1)},n.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&t!==d&&666!==t?f(e,u):(e.state=null,t===d?f(e,-3):0):u},n.deflateSetDictionary=function(e,t){var n,i,s,a,l,c,h,d,f=t.length;if(!e||!e.state)return u;if(2===(a=(n=e.state).wrap)||1===a&&42!==n.status||n.lookahead)return u;for(1===a&&(e.adler=o(e.adler,t,f,0)),n.wrap=0,f>=n.w_size&&(0===a&&(m(n.head),n.strstart=0,n.block_start=0,n.insert=0),d=new r.Buf8(n.w_size),r.arraySet(d,t,f-n.w_size,n.w_size,0),t=d,f=n.w_size),l=e.avail_in,c=e.next_in,h=e.input,e.avail_in=f,e.next_in=0,e.input=t,x(n);n.lookahead>=3;){for(i=n.strstart,s=n.lookahead-2;n.ins_h=(n.ins_h<<n.hash_shift^n.window[i+3-1])&n.hash_mask,n.prev[i&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=i,i++,--s;);n.strstart=i,n.lookahead=2,x(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,e.next_in=c,e.input=h,e.avail_in=l,n.wrap=a,0},n.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,n){t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,n){t.exports=function(e,t){var n,i,r,s,o,a,l,u,c,h,d,f,p,m,_,g,y,v,b,x,w,E,A,T,k;n=e.state,i=e.next_in,T=e.input,r=i+(e.avail_in-5),s=e.next_out,k=e.output,o=s-(t-e.avail_out),a=s+(e.avail_out-257),l=n.dmax,u=n.wsize,c=n.whave,h=n.wnext,d=n.window,f=n.hold,p=n.bits,m=n.lencode,_=n.distcode,g=(1<<n.lenbits)-1,y=(1<<n.distbits)-1;e:do{p<15&&(f+=T[i++]<<p,p+=8,f+=T[i++]<<p,p+=8),v=m[f&g];t:for(;;){if(f>>>=b=v>>>24,p-=b,0==(b=v>>>16&255))k[s++]=65535&v;else{if(!(16&b)){if(!(64&b)){v=m[(65535&v)+(f&(1<<b)-1)];continue t}if(32&b){n.mode=12;break e}e.msg="invalid literal/length code",n.mode=30;break e}x=65535&v,(b&=15)&&(p<b&&(f+=T[i++]<<p,p+=8),x+=f&(1<<b)-1,f>>>=b,p-=b),p<15&&(f+=T[i++]<<p,p+=8,f+=T[i++]<<p,p+=8),v=_[f&y];n:for(;;){if(f>>>=b=v>>>24,p-=b,!(16&(b=v>>>16&255))){if(!(64&b)){v=_[(65535&v)+(f&(1<<b)-1)];continue n}e.msg="invalid distance code",n.mode=30;break e}if(w=65535&v,p<(b&=15)&&(f+=T[i++]<<p,(p+=8)<b&&(f+=T[i++]<<p,p+=8)),l<(w+=f&(1<<b)-1)){e.msg="invalid distance too far back",n.mode=30;break e}if(f>>>=b,p-=b,(b=s-o)<w){if(c<(b=w-b)&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(A=d,(E=0)===h){if(E+=u-b,b<x){for(x-=b;k[s++]=d[E++],--b;);E=s-w,A=k}}else if(h<b){if(E+=u+h-b,(b-=h)<x){for(x-=b;k[s++]=d[E++],--b;);if(E=0,h<x){for(x-=b=h;k[s++]=d[E++],--b;);E=s-w,A=k}}}else if(E+=h-b,b<x){for(x-=b;k[s++]=d[E++],--b;);E=s-w,A=k}for(;2<x;)k[s++]=A[E++],k[s++]=A[E++],k[s++]=A[E++],x-=3;x&&(k[s++]=A[E++],1<x&&(k[s++]=A[E++]))}else{for(E=s-w;k[s++]=k[E++],k[s++]=k[E++],k[s++]=k[E++],2<(x-=3););x&&(k[s++]=k[E++],1<x&&(k[s++]=k[E++]))}break}}break}}while(i<r&&s<a);i-=x=p>>3,f&=(1<<(p-=x<<3))-1,e.next_in=i,e.next_out=s,e.avail_in=i<r?r-i+5:5-(i-r),e.avail_out=s<a?a-s+257:257-(s-a),n.hold=f,n.bits=p}},{}],49:[function(e,t,n){var i=e("../utils/common"),r=e("./adler32"),s=e("./crc32"),o=e("./inffast"),a=e("./inftrees"),l=-2;function u(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function c(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function h(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new i.Buf32(852),t.distcode=t.distdyn=new i.Buf32(592),t.sane=1,t.back=-1,0):l}function d(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,h(e)):l}function f(e,t){var n,i;return e&&e.state?(i=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?l:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,d(e))):l}function p(e,t){var n,i;return e?(i=new c,(e.state=i).window=null,0!==(n=f(e,t))&&(e.state=null),n):l}var m,_,g=!0;function y(e){if(g){var t;for(m=new i.Buf32(512),_=new i.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(1,e.lens,0,288,m,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(2,e.lens,0,32,_,0,e.work,{bits:5}),g=!1}e.lencode=m,e.lenbits=9,e.distcode=_,e.distbits=5}function v(e,t,n,r){var s,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new i.Buf8(o.wsize)),r>=o.wsize?(i.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(r<(s=o.wsize-o.wnext)&&(s=r),i.arraySet(o.window,t,n-r,s,o.wnext),(r-=s)?(i.arraySet(o.window,t,n-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0}n.inflateReset=d,n.inflateReset2=f,n.inflateResetKeep=h,n.inflateInit=function(e){return p(e,15)},n.inflateInit2=p,n.inflate=function(e,t){var n,c,h,d,f,p,m,_,g,b,x,w,E,A,T,k,S,O,P,C,R,M,L,N,z=0,D=new i.Buf8(4),I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return l;12===(n=e.state).mode&&(n.mode=13),f=e.next_out,h=e.output,m=e.avail_out,d=e.next_in,c=e.input,p=e.avail_in,_=n.hold,g=n.bits,b=p,x=m,M=0;e:for(;;)switch(n.mode){case 1:if(0===n.wrap){n.mode=13;break}for(;g<16;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(2&n.wrap&&35615===_){D[n.check=0]=255&_,D[1]=_>>>8&255,n.check=s(n.check,D,2,0),g=_=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&_)<<8)+(_>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&_)){e.msg="unknown compression method",n.mode=30;break}if(g-=4,R=8+(15&(_>>>=4)),0===n.wbits)n.wbits=R;else if(R>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<<R,e.adler=n.check=1,n.mode=512&_?10:12,g=_=0;break;case 2:for(;g<16;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(n.flags=_,8!=(255&n.flags)){e.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=_>>8&1),512&n.flags&&(D[0]=255&_,D[1]=_>>>8&255,n.check=s(n.check,D,2,0)),g=_=0,n.mode=3;case 3:for(;g<32;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}n.head&&(n.head.time=_),512&n.flags&&(D[0]=255&_,D[1]=_>>>8&255,D[2]=_>>>16&255,D[3]=_>>>24&255,n.check=s(n.check,D,4,0)),g=_=0,n.mode=4;case 4:for(;g<16;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}n.head&&(n.head.xflags=255&_,n.head.os=_>>8),512&n.flags&&(D[0]=255&_,D[1]=_>>>8&255,n.check=s(n.check,D,2,0)),g=_=0,n.mode=5;case 5:if(1024&n.flags){for(;g<16;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}n.length=_,n.head&&(n.head.extra_len=_),512&n.flags&&(D[0]=255&_,D[1]=_>>>8&255,n.check=s(n.check,D,2,0)),g=_=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(p<(w=n.length)&&(w=p),w&&(n.head&&(R=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),i.arraySet(n.head.extra,c,d,w,R)),512&n.flags&&(n.check=s(n.check,c,w,d)),p-=w,d+=w,n.length-=w),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===p)break e;for(w=0;R=c[d+w++],n.head&&R&&n.length<65536&&(n.head.name+=String.fromCharCode(R)),R&&w<p;);if(512&n.flags&&(n.check=s(n.check,c,w,d)),p-=w,d+=w,R)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===p)break e;for(w=0;R=c[d+w++],n.head&&R&&n.length<65536&&(n.head.comment+=String.fromCharCode(R)),R&&w<p;);if(512&n.flags&&(n.check=s(n.check,c,w,d)),p-=w,d+=w,R)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;g<16;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(_!==(65535&n.check)){e.msg="header crc mismatch",n.mode=30;break}g=_=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;g<32;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}e.adler=n.check=u(_),g=_=0,n.mode=11;case 11:if(0===n.havedict)return e.next_out=f,e.avail_out=m,e.next_in=d,e.avail_in=p,n.hold=_,n.bits=g,2;e.adler=n.check=1,n.mode=12;case 12:if(5===t||6===t)break e;case 13:if(n.last){_>>>=7&g,g-=7&g,n.mode=27;break}for(;g<3;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}switch(n.last=1&_,g-=1,3&(_>>>=1)){case 0:n.mode=14;break;case 1:if(y(n),n.mode=20,6!==t)break;_>>>=2,g-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}_>>>=2,g-=2;break;case 14:for(_>>>=7&g,g-=7&g;g<32;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if((65535&_)!=(_>>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&_,g=_=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(w=n.length){if(p<w&&(w=p),m<w&&(w=m),0===w)break e;i.arraySet(h,c,d,w,f),p-=w,d+=w,m-=w,f+=w,n.length-=w;break}n.mode=12;break;case 17:for(;g<14;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(n.nlen=257+(31&_),_>>>=5,g-=5,n.ndist=1+(31&_),_>>>=5,g-=5,n.ncode=4+(15&_),_>>>=4,g-=4,286<n.nlen||30<n.ndist){e.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;g<3;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}n.lens[I[n.have++]]=7&_,_>>>=3,g-=3}for(;n.have<19;)n.lens[I[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,L={bits:n.lenbits},M=a(0,n.lens,0,19,n.lencode,0,n.work,L),n.lenbits=L.bits,M){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;k=(z=n.lencode[_&(1<<n.lenbits)-1])>>>16&255,S=65535&z,!((T=z>>>24)<=g);){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(S<16)_>>>=T,g-=T,n.lens[n.have++]=S;else{if(16===S){for(N=T+2;g<N;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(_>>>=T,g-=T,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}R=n.lens[n.have-1],w=3+(3&_),_>>>=2,g-=2}else if(17===S){for(N=T+3;g<N;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}g-=T,R=0,w=3+(7&(_>>>=T)),_>>>=3,g-=3}else{for(N=T+7;g<N;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}g-=T,R=0,w=11+(127&(_>>>=T)),_>>>=7,g-=7}if(n.have+w>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;w--;)n.lens[n.have++]=R}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,L={bits:n.lenbits},M=a(1,n.lens,0,n.nlen,n.lencode,0,n.work,L),n.lenbits=L.bits,M){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,L={bits:n.distbits},M=a(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,L),n.distbits=L.bits,M){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=p&&258<=m){e.next_out=f,e.avail_out=m,e.next_in=d,e.avail_in=p,n.hold=_,n.bits=g,o(e,x),f=e.next_out,h=e.output,m=e.avail_out,d=e.next_in,c=e.input,p=e.avail_in,_=n.hold,g=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;k=(z=n.lencode[_&(1<<n.lenbits)-1])>>>16&255,S=65535&z,!((T=z>>>24)<=g);){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(k&&!(240&k)){for(O=T,P=k,C=S;k=(z=n.lencode[C+((_&(1<<O+P)-1)>>O)])>>>16&255,S=65535&z,!(O+(T=z>>>24)<=g);){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}_>>>=O,g-=O,n.back+=O}if(_>>>=T,g-=T,n.back+=T,n.length=S,0===k){n.mode=26;break}if(32&k){n.back=-1,n.mode=12;break}if(64&k){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&k,n.mode=22;case 22:if(n.extra){for(N=n.extra;g<N;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}n.length+=_&(1<<n.extra)-1,_>>>=n.extra,g-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;k=(z=n.distcode[_&(1<<n.distbits)-1])>>>16&255,S=65535&z,!((T=z>>>24)<=g);){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(!(240&k)){for(O=T,P=k,C=S;k=(z=n.distcode[C+((_&(1<<O+P)-1)>>O)])>>>16&255,S=65535&z,!(O+(T=z>>>24)<=g);){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}_>>>=O,g-=O,n.back+=O}if(_>>>=T,g-=T,n.back+=T,64&k){e.msg="invalid distance code",n.mode=30;break}n.offset=S,n.extra=15&k,n.mode=24;case 24:if(n.extra){for(N=n.extra;g<N;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}n.offset+=_&(1<<n.extra)-1,_>>>=n.extra,g-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===m)break e;if(w=x-m,n.offset>w){if((w=n.offset-w)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}E=w>n.wnext?(w-=n.wnext,n.wsize-w):n.wnext-w,w>n.length&&(w=n.length),A=n.window}else A=h,E=f-n.offset,w=n.length;for(m<w&&(w=m),m-=w,n.length-=w;h[f++]=A[E++],--w;);0===n.length&&(n.mode=21);break;case 26:if(0===m)break e;h[f++]=n.length,m--,n.mode=21;break;case 27:if(n.wrap){for(;g<32;){if(0===p)break e;p--,_|=c[d++]<<g,g+=8}if(x-=m,e.total_out+=x,n.total+=x,x&&(e.adler=n.check=n.flags?s(n.check,h,x,f-x):r(n.check,h,x,f-x)),x=m,(n.flags?_:u(_))!==n.check){e.msg="incorrect data check",n.mode=30;break}g=_=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;g<32;){if(0===p)break e;p--,_+=c[d++]<<g,g+=8}if(_!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=30;break}g=_=0}n.mode=29;case 29:M=1;break e;case 30:M=-3;break e;case 31:return-4;default:return l}return e.next_out=f,e.avail_out=m,e.next_in=d,e.avail_in=p,n.hold=_,n.bits=g,(n.wsize||x!==e.avail_out&&n.mode<30&&(n.mode<27||4!==t))&&v(e,e.output,e.next_out,x-e.avail_out)?(n.mode=31,-4):(b-=e.avail_in,x-=e.avail_out,e.total_in+=b,e.total_out+=x,n.total+=x,n.wrap&&x&&(e.adler=n.check=n.flags?s(n.check,h,x,e.next_out-x):r(n.check,h,x,e.next_out-x)),e.data_type=n.bits+(n.last?64:0)+(12===n.mode?128:0)+(20===n.mode||15===n.mode?256:0),(0==b&&0===x||4===t)&&0===M&&(M=-5),M)},n.inflateEnd=function(e){if(!e||!e.state)return l;var t=e.state;return t.window&&(t.window=null),e.state=null,0},n.inflateGetHeader=function(e,t){var n;return e&&e.state&&2&(n=e.state).wrap?((n.head=t).done=!1,0):l},n.inflateSetDictionary=function(e,t){var n,i=t.length;return e&&e.state?0!==(n=e.state).wrap&&11!==n.mode?l:11===n.mode&&r(1,t,i,0)!==n.check?-3:v(e,t,i,i)?(n.mode=31,-4):(n.havedict=1,0):l},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,n){var i=e("../utils/common"),r=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],s=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,n,l,u,c,h,d){var f,p,m,_,g,y,v,b,x,w=d.bits,E=0,A=0,T=0,k=0,S=0,O=0,P=0,C=0,R=0,M=0,L=null,N=0,z=new i.Buf16(16),D=new i.Buf16(16),I=null,F=0;for(E=0;E<=15;E++)z[E]=0;for(A=0;A<l;A++)z[t[n+A]]++;for(S=w,k=15;1<=k&&0===z[k];k--);if(k<S&&(S=k),0===k)return u[c++]=20971520,u[c++]=20971520,d.bits=1,0;for(T=1;T<k&&0===z[T];T++);for(S<T&&(S=T),E=C=1;E<=15;E++)if(C<<=1,(C-=z[E])<0)return-1;if(0<C&&(0===e||1!==k))return-1;for(D[1]=0,E=1;E<15;E++)D[E+1]=D[E]+z[E];for(A=0;A<l;A++)0!==t[n+A]&&(h[D[t[n+A]]++]=A);if(y=0===e?(L=I=h,19):1===e?(L=r,N-=257,I=s,F-=257,256):(L=o,I=a,-1),E=T,g=c,P=A=M=0,m=-1,_=(R=1<<(O=S))-1,1===e&&852<R||2===e&&592<R)return 1;for(;;){for(v=E-P,x=h[A]<y?(b=0,h[A]):h[A]>y?(b=I[F+h[A]],L[N+h[A]]):(b=96,0),f=1<<E-P,T=p=1<<O;u[g+(M>>P)+(p-=f)]=v<<24|b<<16|x,0!==p;);for(f=1<<E-1;M&f;)f>>=1;if(0!==f?(M&=f-1,M+=f):M=0,A++,0==--z[E]){if(E===k)break;E=t[n+h[A]]}if(S<E&&(M&_)!==m){for(0===P&&(P=S),g+=T,C=1<<(O=E-P);O+P<k&&!((C-=z[O+P])<=0);)O++,C<<=1;if(R+=1<<O,1===e&&852<R||2===e&&592<R)return 1;u[m=M&_]=S<<24|O<<16|g-c}}return 0!==M&&(u[g+M]=E-P<<24|64<<16),d.bits=S,0}},{"../utils/common":41}],51:[function(e,t,n){t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,n){var i=e("../utils/common");function r(e){for(var t=e.length;0<=--t;)e[t]=0}var s=256,o=286,a=30,l=15,u=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],c=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],h=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],d=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],f=new Array(576);r(f);var p=new Array(60);r(p);var m=new Array(512);r(m);var _=new Array(256);r(_);var g=new Array(29);r(g);var y,v,b,x=new Array(a);function w(e,t,n,i,r){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=i,this.max_length=r,this.has_stree=e&&e.length}function E(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function A(e){return e<256?m[e]:m[256+(e>>>7)]}function T(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function k(e,t,n){e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,T(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function S(e,t,n){k(e,n[2*t],n[2*t+1])}function O(e,t){for(var n=0;n|=1&e,e>>>=1,n<<=1,0<--t;);return n>>>1}function P(e,t,n){var i,r,s=new Array(16),o=0;for(i=1;i<=l;i++)s[i]=o=o+n[i-1]<<1;for(r=0;r<=t;r++){var a=e[2*r+1];0!==a&&(e[2*r]=O(s[a]++,a))}}function C(e){var t;for(t=0;t<o;t++)e.dyn_ltree[2*t]=0;for(t=0;t<a;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function R(e){8<e.bi_valid?T(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function M(e,t,n,i){var r=2*t,s=2*n;return e[r]<e[s]||e[r]===e[s]&&i[t]<=i[n]}function L(e,t,n){for(var i=e.heap[n],r=n<<1;r<=e.heap_len&&(r<e.heap_len&&M(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!M(t,i,e.heap[r],e.depth));)e.heap[n]=e.heap[r],n=r,r<<=1;e.heap[n]=i}function N(e,t,n){var i,r,o,a,l=0;if(0!==e.last_lit)for(;i=e.pending_buf[e.d_buf+2*l]<<8|e.pending_buf[e.d_buf+2*l+1],r=e.pending_buf[e.l_buf+l],l++,0===i?S(e,r,t):(S(e,(o=_[r])+s+1,t),0!==(a=u[o])&&k(e,r-=g[o],a),S(e,o=A(--i),n),0!==(a=c[o])&&k(e,i-=x[o],a)),l<e.last_lit;);S(e,256,t)}function z(e,t){var n,i,r,s=t.dyn_tree,o=t.stat_desc.static_tree,a=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=573,n=0;n<u;n++)0!==s[2*n]?(e.heap[++e.heap_len]=c=n,e.depth[n]=0):s[2*n+1]=0;for(;e.heap_len<2;)s[2*(r=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[r]=0,e.opt_len--,a&&(e.static_len-=o[2*r+1]);for(t.max_code=c,n=e.heap_len>>1;1<=n;n--)L(e,s,n);for(r=u;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],L(e,s,1),i=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=i,s[2*r]=s[2*n]+s[2*i],e.depth[r]=(e.depth[n]>=e.depth[i]?e.depth[n]:e.depth[i])+1,s[2*n+1]=s[2*i+1]=r,e.heap[1]=r++,L(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,i,r,s,o,a,u=t.dyn_tree,c=t.max_code,h=t.stat_desc.static_tree,d=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,m=t.stat_desc.max_length,_=0;for(s=0;s<=l;s++)e.bl_count[s]=0;for(u[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<573;n++)m<(s=u[2*u[2*(i=e.heap[n])+1]+1]+1)&&(s=m,_++),u[2*i+1]=s,c<i||(e.bl_count[s]++,o=0,p<=i&&(o=f[i-p]),a=u[2*i],e.opt_len+=a*(s+o),d&&(e.static_len+=a*(h[2*i+1]+o)));if(0!==_){do{for(s=m-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[m]--,_-=2}while(0<_);for(s=m;0!==s;s--)for(i=e.bl_count[s];0!==i;)c<(r=e.heap[--n])||(u[2*r+1]!==s&&(e.opt_len+=(s-u[2*r+1])*u[2*r],u[2*r+1]=s),i--)}}(e,t),P(s,c,e.bl_count)}function D(e,t,n){var i,r,s=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),t[2*(n+1)+1]=65535,i=0;i<=n;i++)r=o,o=t[2*(i+1)+1],++a<l&&r===o||(a<u?e.bl_tree[2*r]+=a:0!==r?(r!==s&&e.bl_tree[2*r]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=r,u=(a=0)===o?(l=138,3):r===o?(l=6,3):(l=7,4))}function I(e,t,n){var i,r,s=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),i=0;i<=n;i++)if(r=o,o=t[2*(i+1)+1],!(++a<l&&r===o)){if(a<u)for(;S(e,r,e.bl_tree),0!=--a;);else 0!==r?(r!==s&&(S(e,r,e.bl_tree),a--),S(e,16,e.bl_tree),k(e,a-3,2)):a<=10?(S(e,17,e.bl_tree),k(e,a-3,3)):(S(e,18,e.bl_tree),k(e,a-11,7));s=r,u=(a=0)===o?(l=138,3):r===o?(l=6,3):(l=7,4)}}r(x);var F=!1;function j(e,t,n,r){k(e,0+(r?1:0),3),function(e,t,n){R(e),T(e,n),T(e,~n),i.arraySet(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}(e,t,n)}n._tr_init=function(e){F||(function(){var e,t,n,i,r,s=new Array(16);for(i=n=0;i<28;i++)for(g[i]=n,e=0;e<1<<u[i];e++)_[n++]=i;for(_[n-1]=i,i=r=0;i<16;i++)for(x[i]=r,e=0;e<1<<c[i];e++)m[r++]=i;for(r>>=7;i<a;i++)for(x[i]=r<<7,e=0;e<1<<c[i]-7;e++)m[256+r++]=i;for(t=0;t<=l;t++)s[t]=0;for(e=0;e<=143;)f[2*e+1]=8,e++,s[8]++;for(;e<=255;)f[2*e+1]=9,e++,s[9]++;for(;e<=279;)f[2*e+1]=7,e++,s[7]++;for(;e<=287;)f[2*e+1]=8,e++,s[8]++;for(P(f,287,s),e=0;e<a;e++)p[2*e+1]=5,p[2*e]=O(e,5);y=new w(f,u,257,o,l),v=new w(p,c,0,a,l),b=new w(new Array(0),h,0,19,7)}(),F=!0),e.l_desc=new E(e.dyn_ltree,y),e.d_desc=new E(e.dyn_dtree,v),e.bl_desc=new E(e.bl_tree,b),e.bi_buf=0,e.bi_valid=0,C(e)},n._tr_stored_block=j,n._tr_flush_block=function(e,t,n,i){var r,o,a=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<s;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),z(e,e.l_desc),z(e,e.d_desc),a=function(e){var t;for(D(e,e.dyn_ltree,e.l_desc.max_code),D(e,e.dyn_dtree,e.d_desc.max_code),z(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*d[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),r=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=r&&(r=o)):r=o=n+5,n+4<=r&&-1!==t?j(e,t,n,i):4===e.strategy||o===r?(k(e,2+(i?1:0),3),N(e,f,p)):(k(e,4+(i?1:0),3),function(e,t,n,i){var r;for(k(e,t-257,5),k(e,n-1,5),k(e,i-4,4),r=0;r<i;r++)k(e,e.bl_tree[2*d[r]+1],3);I(e,e.dyn_ltree,t-1),I(e,e.dyn_dtree,n-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),N(e,e.dyn_ltree,e.dyn_dtree)),C(e),i&&R(e)},n._tr_tally=function(e,t,n){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(_[n]+s+1)]++,e.dyn_dtree[2*A(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){k(e,2,3),S(e,256,f),function(e){16===e.bi_valid?(T(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,n){(function(e){!function(e){if(!e.setImmediate){var t,n,i,r,s=1,o={},a=!1,l=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,t="[object process]"==={}.toString.call(e.process)?function(e){!function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];be.push(new Te(e,t)),1!==be.length||xe||ye(Ae)}(function(){h(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?(r="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",d,!1):e.attachEvent("onmessage",d),function(t){e.postMessage(r+t,"*")}):e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){h(e.data)},function(e){i.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(n=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){h(e),t.onreadystatechange=null,n.removeChild(t),t=null},n.appendChild(t)}):function(e){setTimeout(h,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var n=new Array(arguments.length-1),i=0;i<n.length;i++)n[i]=arguments[i+1];var r={callback:e,args:n};return o[s]=r,t(s),s++},u.clearImmediate=c}function c(e){delete o[e]}function h(e){if(a)setTimeout(h,0,e);else{var t=o[e];if(t){a=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(void 0,n)}}(t)}finally{c(e),a=!1}}}}function d(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(r)&&h(+t.data.slice(r.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,void 0!==f?f:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)),lt.exports),ct=e.getDefaultExportFromCjs(ut),ht={},dt={},ft={};function pt(){if(Pe)return ft;function e(e){return null==e}return Pe=1,ft.isNothing=e,ft.isObject=function(e){return"object"==typeof e&&null!==e},ft.toArray=function(t){return Array.isArray(t)?t:e(t)?[]:[t]},ft.repeat=function(e,t){var n,i="";for(n=0;n<t;n+=1)i+=e;return i},ft.isNegativeZero=function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},ft.extend=function(e,t){var n,i,r,s;if(t)for(n=0,i=(s=Object.keys(t)).length;n<i;n+=1)e[r=s[n]]=t[r];return e},ft}function mt(){if(Re)return Ce;function e(e,t){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||"",this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():"")}return Re=1,e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t},Ce=e}function _t(){if(ze)return Ne;ze=1;var e=mt(),t=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],n=["scalar","sequence","mapping"];return Ne=function(i,r){if(r=r||{},Object.keys(r).forEach(function(n){if(-1===t.indexOf(n))throw new e('Unknown option "'+n+'" is met in definition of "'+i+'" YAML type.')}),this.tag=i,this.kind=r.kind||null,this.resolve=r.resolve||function(){return!0},this.construct=r.construct||function(e){return e},this.instanceOf=r.instanceOf||null,this.predicate=r.predicate||null,this.represent=r.represent||null,this.defaultStyle=r.defaultStyle||null,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach(function(n){e[n].forEach(function(e){t[String(e)]=n})}),t}(r.styleAliases||null),-1===n.indexOf(this.kind))throw new e('Unknown kind "'+this.kind+'" is specified for "'+i+'" YAML type.')},Ne}function gt(){if(Ie)return De;Ie=1;var e=pt(),t=mt(),n=_t();function i(e,t,n){var r=[];return e.include.forEach(function(e){n=i(e,t,n)}),e[t].forEach(function(e){n.forEach(function(t,n){t.tag===e.tag&&r.push(n)}),n.push(e)}),n.filter(function(e,t){return-1===r.indexOf(t)})}function r(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new t("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=i(this,"implicit",[]),this.compiledExplicit=i(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,n={};function i(e){n[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(i);return n}(this.compiledImplicit,this.compiledExplicit)}return r.DEFAULT=null,r.create=function(){var i,s;switch(arguments.length){case 1:i=r.DEFAULT,s=arguments[0];break;case 2:i=arguments[0],s=arguments[1];break;default:throw new t("Wrong number of arguments for Schema.create function")}if(i=e.toArray(i),s=e.toArray(s),!i.every(function(e){return e instanceof r}))throw new t("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!s.every(function(e){return e instanceof n}))throw new t("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new r({include:i,explicit:s})},De=r}function yt(){if(je)return Fe;je=1;var e=_t();return Fe=new e("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})}function vt(){if(Ue)return Be;Ue=1;var e=_t();return Be=new e("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})}function bt(){if(Ge)return Ve;Ge=1;var e=_t();return Ve=new e("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})}function xt(){if(Ze)return $e;Ze=1;var e=gt();return $e=new e({explicit:[yt(),vt(),bt()]})}function wt(){if(We)return qe;We=1;var e=_t();return qe=new e("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})}function Et(){if(Ke)return He;Ke=1;var e=_t();return He=new e("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})}function At(){if(Xe)return Ye;Xe=1;var e=pt(),t=_t();function n(e){return 48<=e&&e<=55}function i(e){return 48<=e&&e<=57}return Ye=new t("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r,s=e.length,o=0,a=!1;if(!s)return!1;if("-"!==(t=e[o])&&"+"!==t||(t=e[++o]),"0"===t){if(o+1===s)return!0;if("b"===(t=e[++o])){for(o++;o<s;o++)if("_"!==(t=e[o])){if("0"!==t&&"1"!==t)return!1;a=!0}return a}if("x"===t){for(o++;o<s;o++)if("_"!==(t=e[o])){if(!(48<=(r=e.charCodeAt(o))&&r<=57||65<=r&&r<=70||97<=r&&r<=102))return!1;a=!0}return a}for(;o<s;o++)if("_"!==(t=e[o])){if(!n(e.charCodeAt(o)))return!1;a=!0}return a}for(;o<s;o++)if("_"!==(t=e[o])){if(":"===t)break;if(!i(e.charCodeAt(o)))return!1;a=!0}return!!a&&(":"!==t||/^(:[0-5]?[0-9])+$/.test(e.slice(o)))},construct:function(e){var t,n,i=e,r=1,s=[];return-1!==i.indexOf("_")&&(i=i.replace(/_/g,"")),"-"!==(t=i[0])&&"+"!==t||("-"===t&&(r=-1),t=(i=i.slice(1))[0]),"0"===i?0:"0"===t?"b"===i[1]?r*parseInt(i.slice(2),2):"x"===i[1]?r*parseInt(i,16):r*parseInt(i,8):-1!==i.indexOf(":")?(i.split(":").forEach(function(e){s.unshift(parseInt(e,10))}),i=0,n=1,s.forEach(function(e){i+=e*n,n*=60}),r*i):r*parseInt(i,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&t%1==0&&!e.isNegativeZero(t)},represent:{binary:function(e){return"0b"+e.toString(2)},octal:function(e){return"0"+e.toString(8)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return"0x"+e.toString(16).toUpperCase()}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Ye}function Tt(){if(Je)return Qe;Je=1;var e=pt(),t=_t(),n=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?|\\.[0-9_]+(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),i=/^[-+]?[0-9]+e/;return Qe=new t("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!!n.test(e)},construct:function(e){var t,n,i,r;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,r=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach(function(e){r.unshift(parseFloat(e,10))}),t=0,i=1,r.forEach(function(e){t+=e*i,i*=60}),n*t):n*parseFloat(t,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||e.isNegativeZero(t))},represent:function(t,n){var r;if(isNaN(t))switch(n){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(n){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(n){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(e.isNegativeZero(t))return"-0.0";return r=t.toString(10),i.test(r)?r.replace("e",".e"):r},defaultStyle:"lowercase"})}function kt(){if(tt)return et;tt=1;var e=gt();return et=new e({include:[xt()],implicit:[wt(),Et(),At(),Tt()]})}function St(){if(it)return nt;it=1;var e=gt();return nt=new e({include:[kt()]})}function Ot(){if(st)return rt;st=1;var e=_t(),t=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?)?$");return rt=new e("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&null!==t.exec(e)},construct:function(e){var n,i,r,s,o,a,l,u,c=0,h=null;if(null===(n=t.exec(e)))throw new Error("Date resolve error");if(i=+n[1],r=+n[2]-1,s=+n[3],!n[4])return new Date(Date.UTC(i,r,s));if(o=+n[4],a=+n[5],l=+n[6],n[7]){for(c=n[7].slice(0,3);c.length<3;)c+="0";c=+c}return n[9]&&(h=6e4*(60*+n[10]+ +(n[11]||0)),"-"===n[9]&&(h=-h)),u=new Date(Date.UTC(i,r,s,o,a,l,c)),h&&u.setTime(u.getTime()-h),u},instanceOf:Date,represent:function(e){return e.toISOString()}})}function Pt(){if(at)return ot;at=1;var e=_t();return ot=new e("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})}var Ct,Rt,Mt,Lt,Nt,zt,Dt,It,Ft,jt,Bt,Ut,Vt,Gt,$t,Zt,qt,Wt,Ht,Kt,Yt,Xt,Qt=e.getAugmentedNamespace(fe);function Jt(){if(Rt)return Ct;Rt=1;var e=Qt.Buffer,t=_t(),n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";return Ct=new t("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,i,r=0,s=e.length,o=n;for(i=0;i<s;i++)if(!((t=o.indexOf(e.charAt(i)))>64)){if(t<0)return!1;r+=6}return r%8==0},construct:function(t){var i,r,s=t.replace(/[\r\n=]/g,""),o=s.length,a=n,l=0,u=[];for(i=0;i<o;i++)i%4==0&&i&&(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|a.indexOf(s.charAt(i));return 0==(r=o%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===r?(u.push(l>>10&255),u.push(l>>2&255)):12===r&&u.push(l>>4&255),e?new e(u):u},predicate:function(t){return e&&e.isBuffer(t)},represent:function(e){var t,i,r="",s=0,o=e.length,a=n;for(t=0;t<o;t++)t%3==0&&t&&(r+=a[s>>18&63],r+=a[s>>12&63],r+=a[s>>6&63],r+=a[63&s]),s=(s<<8)+e[t];return 0==(i=o%3)?(r+=a[s>>18&63],r+=a[s>>12&63],r+=a[s>>6&63],r+=a[63&s]):2===i?(r+=a[s>>10&63],r+=a[s>>4&63],r+=a[s<<2&63],r+=a[64]):1===i&&(r+=a[s>>2&63],r+=a[s<<4&63],r+=a[64],r+=a[64]),r}}),Ct}function en(){if(Lt)return Mt;Lt=1;var e=_t(),t=Object.prototype.hasOwnProperty,n=Object.prototype.toString;return Mt=new e("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var i,r,s,o,a,l=[],u=e;for(i=0,r=u.length;i<r;i+=1){if(s=u[i],a=!1,"[object Object]"!==n.call(s))return!1;for(o in s)if(t.call(s,o)){if(a)return!1;a=!0}if(!a)return!1;if(-1!==l.indexOf(o))return!1;l.push(o)}return!0},construct:function(e){return null!==e?e:[]}}),Mt}function tn(){if(zt)return Nt;zt=1;var e=_t(),t=Object.prototype.toString;return Nt=new e("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var n,i,r,s,o,a=e;for(o=new Array(a.length),n=0,i=a.length;n<i;n+=1){if(r=a[n],"[object Object]"!==t.call(r))return!1;if(1!==(s=Object.keys(r)).length)return!1;o[n]=[s[0],r[s[0]]]}return!0},construct:function(e){if(null===e)return[];var t,n,i,r,s,o=e;for(s=new Array(o.length),t=0,n=o.length;t<n;t+=1)i=o[t],r=Object.keys(i),s[t]=[r[0],i[r[0]]];return s}}),Nt}function nn(){if(It)return Dt;It=1;var e=_t(),t=Object.prototype.hasOwnProperty;return Dt=new e("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var n,i=e;for(n in i)if(t.call(i,n)&&null!==i[n])return!1;return!0},construct:function(e){return null!==e?e:{}}})}function rn(){if(jt)return Ft;jt=1;var e=gt();return Ft=new e({include:[St()],implicit:[Ot(),Pt()],explicit:[Jt(),en(),tn(),nn()]})}function sn(){if(Ut)return Bt;Ut=1;var e=_t();return Bt=new e("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:function(){return!0},construct:function(){},predicate:function(e){return void 0===e},represent:function(){return""}})}function on(){if(Gt)return Vt;Gt=1;var e=_t();return Vt=new e("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:function(e){if(null===e)return!1;if(0===e.length)return!1;var t=e,n=/\/([gim]*)$/.exec(e),i="";if("/"===t[0]){if(n&&(i=n[1]),i.length>3)return!1;if("/"!==t[t.length-i.length-1])return!1}return!0},construct:function(e){var t=e,n=/\/([gim]*)$/.exec(e),i="";return"/"===t[0]&&(n&&(i=n[1]),t=t.slice(1,t.length-i.length-1)),new RegExp(t,i)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})}function an(){if(Zt)return $t;var e;Zt=1;try{e=Se("esprima")}catch(t){"undefined"!=typeof window&&(e=window.esprima)}var t=_t();return $t=new t("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(t){if(null===t)return!1;try{var n="("+t+")",i=e.parse(n,{range:!0});return"Program"===i.type&&1===i.body.length&&"ExpressionStatement"===i.body[0].type&&"FunctionExpression"===i.body[0].expression.type}catch(e){return!1}},construct:function(t){var n,i="("+t+")",r=e.parse(i,{range:!0}),s=[];if("Program"!==r.type||1!==r.body.length||"ExpressionStatement"!==r.body[0].type||"FunctionExpression"!==r.body[0].expression.type)throw new Error("Failed to resolve function");return r.body[0].expression.params.forEach(function(e){s.push(e.name)}),n=r.body[0].expression.body.range,new Function(s,i.slice(n[0]+1,n[1]-1))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})}function ln(){if(Wt)return qt;Wt=1;var e=gt();return qt=e.DEFAULT=new e({include:[rn()],explicit:[sn(),on(),an()]})}var un=function(){if(Xt)return Yt;Xt=1;var e=function(){if(Kt)return ht;Kt=1;var e=function(){if(Ht)return dt;Ht=1;var e=pt(),t=mt(),n=function(){if(Le)return Me;Le=1;var e=pt();function t(e,t,n,i,r){this.name=e,this.buffer=t,this.position=n,this.line=i,this.column=r}return t.prototype.getSnippet=function(t,n){var i,r,s,o,a;if(!this.buffer)return null;for(t=t||4,n=n||75,i="",r=this.position;r>0&&-1==="\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(r-1));)if(r-=1,this.position-r>n/2-1){i=" ... ",r+=5;break}for(s="",o=this.position;o<this.buffer.length&&-1==="\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(o));)if((o+=1)-this.position>n/2-1){s=" ... ",o-=5;break}return a=this.buffer.slice(r,o),e.repeat(" ",t)+i+a+s+"\n"+e.repeat(" ",t+this.position-r+i.length)+"^"},t.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(n+=":\n"+t),n},Me=t}(),i=rn(),r=ln(),s=Object.prototype.hasOwnProperty,o=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,a=/[\x85\u2028\u2029]/,l=/[,\[\]\{\}]/,u=/^(?:!|!!|![a-z\-]+!)$/i,c=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function h(e){return 10===e||13===e}function d(e){return 9===e||32===e}function f(e){return 9===e||32===e||10===e||13===e}function p(e){return 44===e||91===e||93===e||123===e||125===e}function m(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function _(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"
":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function g(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var y=new Array(256),v=new Array(256),b=0;b<256;b++)y[b]=_(b)?1:0,v[b]=_(b);function x(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||r,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function w(e,i){return new t(i,new n(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function E(e,t){throw w(e,t)}function A(e,t){e.onWarning&&e.onWarning.call(null,w(e,t))}var T={YAML:function(e,t,n){var i,r,s;null!==e.version&&E(e,"duplication of %YAML directive"),1!==n.length&&E(e,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&E(e,"ill-formed argument of the YAML directive"),r=parseInt(i[1],10),s=parseInt(i[2],10),1!==r&&E(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=s<2,1!==s&&2!==s&&A(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,r;2!==n.length&&E(e,"TAG directive accepts exactly two arguments"),i=n[0],r=n[1],u.test(i)||E(e,"ill-formed tag handle (first argument) of the TAG directive"),s.call(e.tagMap,i)&&E(e,'there is a previously declared suffix for "'+i+'" tag handle'),c.test(r)||E(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[i]=r}};function k(e,t,n,i){var r,s,a,l;if(t<n){if(l=e.input.slice(t,n),i)for(r=0,s=l.length;r<s;r+=1)9===(a=l.charCodeAt(r))||32<=a&&a<=1114111||E(e,"expected valid JSON character");else o.test(l)&&E(e,"the stream contains non-printable characters");e.result+=l}}function S(t,n,i,r){var o,a,l,u;for(e.isObject(i)||E(t,"cannot merge mappings; the provided source object is unacceptable"),l=0,u=(o=Object.keys(i)).length;l<u;l+=1)a=o[l],s.call(n,a)||(n[a]=i[a],r[a]=!0)}function O(e,t,n,i,r,o){var a,l;if(r=String(r),null===t&&(t={}),"tag:yaml.org,2002:merge"===i)if(Array.isArray(o))for(a=0,l=o.length;a<l;a+=1)S(e,t,o[a],n);else S(e,t,o,n);else e.json||s.call(n,r)||!s.call(t,r)||E(e,"duplicated mapping key"),t[r]=o,delete n[r];return t}function P(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):E(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function C(e,t,n){for(var i=0,r=e.input.charCodeAt(e.position);0!==r;){for(;d(r);)r=e.input.charCodeAt(++e.position);if(t&&35===r)do{r=e.input.charCodeAt(++e.position)}while(10!==r&&13!==r&&0!==r);if(!h(r))break;for(P(e),r=e.input.charCodeAt(e.position),i++,e.lineIndent=0;32===r;)e.lineIndent++,r=e.input.charCodeAt(++e.position)}return-1!==n&&0!==i&&e.lineIndent<n&&A(e,"deficient indentation"),i}function R(e){var t,n=e.position;return!(45!==(t=e.input.charCodeAt(n))&&46!==t||t!==e.input.charCodeAt(n+1)||t!==e.input.charCodeAt(n+2)||(n+=3,0!==(t=e.input.charCodeAt(n))&&!f(t)))}function M(t,n){1===n?t.result+=" ":n>1&&(t.result+=e.repeat("\n",n-1))}function L(e,t){var n,i,r=e.tag,s=e.anchor,o=[],a=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),i=e.input.charCodeAt(e.position);0!==i&&45===i&&f(e.input.charCodeAt(e.position+1));)if(a=!0,e.position++,C(e,!0,-1)&&e.lineIndent<=t)o.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,D(e,t,3,!1,!0),o.push(e.result),C(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)E(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!a&&(e.tag=r,e.anchor=s,e.kind="sequence",e.result=o,!0)}function N(e){var t,n,i,r,o=!1,a=!1;if(33!==(r=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&E(e,"duplication of a tag property"),60===(r=e.input.charCodeAt(++e.position))?(o=!0,r=e.input.charCodeAt(++e.position)):33===r?(a=!0,n="!!",r=e.input.charCodeAt(++e.position)):n="!",t=e.position,o){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&62!==r);e.position<e.length?(i=e.input.slice(t,e.position),r=e.input.charCodeAt(++e.position)):E(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==r&&!f(r);)33===r&&(a?E(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),u.test(n)||E(e,"named tag handle cannot contain such characters"),a=!0,t=e.position+1)),r=e.input.charCodeAt(++e.position);i=e.input.slice(t,e.position),l.test(i)&&E(e,"tag suffix cannot contain flow indicator characters")}return i&&!c.test(i)&&E(e,"tag name cannot contain such characters: "+i),o?e.tag=i:s.call(e.tagMap,n)?e.tag=e.tagMap[n]+i:"!"===n?e.tag="!"+i:"!!"===n?e.tag="tag:yaml.org,2002:"+i:E(e,'undeclared tag handle "'+n+'"'),!0}function z(e){var t,n;if(38!==(n=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&E(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!f(n)&&!p(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&E(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function D(t,n,i,r,o){var a,l,u,c,_,b,x,w,A=1,T=!1,S=!1;if(null!==t.listener&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,a=l=u=4===i||3===i,r&&C(t,!0,-1)&&(T=!0,t.lineIndent>n?A=1:t.lineIndent===n?A=0:t.lineIndent<n&&(A=-1)),1===A)for(;N(t)||z(t);)C(t,!0,-1)?(T=!0,u=a,t.lineIndent>n?A=1:t.lineIndent===n?A=0:t.lineIndent<n&&(A=-1)):u=!1;if(u&&(u=T||o),1!==A&&4!==i||(x=1===i||2===i?n:n+1,w=t.position-t.lineStart,1===A?u&&(L(t,w)||function(e,t,n){var i,r,s,o,a=e.tag,l=e.anchor,u={},c={},h=null,p=null,m=null,_=!1,g=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=u),o=e.input.charCodeAt(e.position);0!==o;){if(i=e.input.charCodeAt(e.position+1),s=e.line,63!==o&&58!==o||!f(i)){if(!D(e,n,2,!1,!0))break;if(e.line===s){for(o=e.input.charCodeAt(e.position);d(o);)o=e.input.charCodeAt(++e.position);if(58===o)f(o=e.input.charCodeAt(++e.position))||E(e,"a whitespace character is expected after the key-value separator within a block mapping"),_&&(O(e,u,c,h,p,null),h=p=m=null),g=!0,_=!1,r=!1,h=e.tag,p=e.result;else{if(!g)return e.tag=a,e.anchor=l,!0;E(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!g)return e.tag=a,e.anchor=l,!0;E(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===o?(_&&(O(e,u,c,h,p,null),h=p=m=null),g=!0,_=!0,r=!0):_?(_=!1,r=!0):E(e,"incomplete explicit mapping pair; a key node is missed"),e.position+=1,o=i;if((e.line===s||e.lineIndent>t)&&(D(e,t,4,!0,r)&&(_?p=e.result:m=e.result),_||(O(e,u,c,h,p,m),h=p=m=null),C(e,!0,-1),o=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==o)E(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return _&&O(e,u,c,h,p,null),g&&(e.tag=a,e.anchor=l,e.kind="mapping",e.result=u),g}(t,w,x))||function(e,t){var n,i,r,s,o,a,l,u,c,h,d=!0,p=e.tag,m=e.anchor,_={};if(91===(h=e.input.charCodeAt(e.position)))r=93,a=!1,i=[];else{if(123!==h)return!1;r=125,a=!0,i={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=i),h=e.input.charCodeAt(++e.position);0!==h;){if(C(e,!0,t),(h=e.input.charCodeAt(e.position))===r)return e.position++,e.tag=p,e.anchor=m,e.kind=a?"mapping":"sequence",e.result=i,!0;d||E(e,"missed comma between flow collection entries"),c=null,s=o=!1,63===h&&f(e.input.charCodeAt(e.position+1))&&(s=o=!0,e.position++,C(e,!0,t)),n=e.line,D(e,t,1,!1,!0),u=e.tag,l=e.result,C(e,!0,t),h=e.input.charCodeAt(e.position),!o&&e.line!==n||58!==h||(s=!0,h=e.input.charCodeAt(++e.position),C(e,!0,t),D(e,t,1,!1,!0),c=e.result),a?O(e,i,_,u,l,c):s?i.push(O(e,null,_,u,l,c)):i.push(l),C(e,!0,t),44===(h=e.input.charCodeAt(e.position))?(d=!0,h=e.input.charCodeAt(++e.position)):d=!1}E(e,"unexpected end of the stream within a flow collection")}(t,x)?S=!0:(l&&function(t,n){var i,r,s,o,a,l=1,u=!1,c=n,f=0,p=!1;if(124===(o=t.input.charCodeAt(t.position)))r=!1;else{if(62!==o)return!1;r=!0}for(t.kind="scalar",t.result="";0!==o;)if(43===(o=t.input.charCodeAt(++t.position))||45===o)1===l?l=43===o?3:2:E(t,"repeat of a chomping mode identifier");else{if(!((s=48<=(a=o)&&a<=57?a-48:-1)>=0))break;0===s?E(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?E(t,"repeat of an indentation width identifier"):(c=n+s-1,u=!0)}if(d(o)){do{o=t.input.charCodeAt(++t.position)}while(d(o));if(35===o)do{o=t.input.charCodeAt(++t.position)}while(!h(o)&&0!==o)}for(;0!==o;){for(P(t),t.lineIndent=0,o=t.input.charCodeAt(t.position);(!u||t.lineIndent<c)&&32===o;)t.lineIndent++,o=t.input.charCodeAt(++t.position);if(!u&&t.lineIndent>c&&(c=t.lineIndent),h(o))f++;else{if(t.lineIndent<c){3===l?t.result+=e.repeat("\n",f):1===l&&u&&(t.result+="\n");break}for(r?d(o)?(p=!0,t.result+=e.repeat("\n",f+1)):p?(p=!1,t.result+=e.repeat("\n",f+1)):0===f?u&&(t.result+=" "):t.result+=e.repeat("\n",f):t.result+=u?e.repeat("\n",f+1):e.repeat("\n",f),u=!0,f=0,i=t.position;!h(o)&&0!==o;)o=t.input.charCodeAt(++t.position);k(t,i,t.position,!1)}}return!0}(t,x)||function(e,t){var n,i,r;if(39!==(n=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,i=r=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(k(e,i,e.position,!0),39!==(n=e.input.charCodeAt(++e.position)))return!0;i=r=e.position,e.position++}else h(n)?(k(e,i,r,!0),M(e,C(e,!1,t)),i=r=e.position):e.position===e.lineStart&&R(e)?E(e,"unexpected end of the document within a single quoted scalar"):(e.position++,r=e.position);E(e,"unexpected end of the stream within a single quoted scalar")}(t,x)||function(e,t){var n,i,r,s,o,a,l;if(34!==(a=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;0!==(a=e.input.charCodeAt(e.position));){if(34===a)return k(e,n,e.position,!0),e.position++,!0;if(92===a){if(k(e,n,e.position,!0),h(a=e.input.charCodeAt(++e.position)))C(e,!1,t);else if(a<256&&y[a])e.result+=v[a],e.position++;else if((o=120===(l=a)?2:117===l?4:85===l?8:0)>0){for(r=o,s=0;r>0;r--)(o=m(a=e.input.charCodeAt(++e.position)))>=0?s=(s<<4)+o:E(e,"expected hexadecimal character");e.result+=g(s),e.position++}else E(e,"unknown escape sequence");n=i=e.position}else h(a)?(k(e,n,i,!0),M(e,C(e,!1,t)),n=i=e.position):e.position===e.lineStart&&R(e)?E(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}E(e,"unexpected end of the stream within a double quoted scalar")}(t,x)?S=!0:function(e){var t,n,i;if(42!==(i=e.input.charCodeAt(e.position)))return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!f(i)&&!p(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&E(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(n)||E(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],C(e,!0,-1),!0}(t)?(S=!0,null===t.tag&&null===t.anchor||E(t,"alias node should not have any properties")):function(e,t,n){var i,r,s,o,a,l,u,c,m=e.kind,_=e.result;if(f(c=e.input.charCodeAt(e.position))||p(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(f(i=e.input.charCodeAt(e.position+1))||n&&p(i)))return!1;for(e.kind="scalar",e.result="",r=s=e.position,o=!1;0!==c;){if(58===c){if(f(i=e.input.charCodeAt(e.position+1))||n&&p(i))break}else if(35===c){if(f(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&R(e)||n&&p(c))break;if(h(c)){if(a=e.line,l=e.lineStart,u=e.lineIndent,C(e,!1,-1),e.lineIndent>=t){o=!0,c=e.input.charCodeAt(e.position);continue}e.position=s,e.line=a,e.lineStart=l,e.lineIndent=u;break}}o&&(k(e,r,s,!1),M(e,e.line-a),r=s=e.position,o=!1),d(c)||(s=e.position+1),c=e.input.charCodeAt(++e.position)}return k(e,r,s,!1),!!e.result||(e.kind=m,e.result=_,!1)}(t,x,1===i)&&(S=!0,null===t.tag&&(t.tag="?")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===A&&(S=u&&L(t,w))),null!==t.tag&&"!"!==t.tag)if("?"===t.tag){for(c=0,_=t.implicitTypes.length;c<_;c+=1)if((b=t.implicitTypes[c]).resolve(t.result)){t.result=b.construct(t.result),t.tag=b.tag,null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);break}}else s.call(t.typeMap,t.tag)?(b=t.typeMap[t.tag],null!==t.result&&b.kind!==t.kind&&E(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+b.kind+'", not "'+t.kind+'"'),b.resolve(t.result)?(t.result=b.construct(t.result),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):E(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")):E(t,"unknown tag !<"+t.tag+">");return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||S}function I(e){var t,n,i,r,o=e.position,l=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(r=e.input.charCodeAt(e.position))&&(C(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==r));){for(l=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!f(r);)r=e.input.charCodeAt(++e.position);for(i=[],(n=e.input.slice(t,e.position)).length<1&&E(e,"directive name must not be less than one character in length");0!==r;){for(;d(r);)r=e.input.charCodeAt(++e.position);if(35===r){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&!h(r));break}if(h(r))break;for(t=e.position;0!==r&&!f(r);)r=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}0!==r&&P(e),s.call(T,n)?T[n](e,n,i):A(e,'unknown document directive "'+n+'"')}C(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,C(e,!0,-1)):l&&E(e,"directives end mark is expected"),D(e,e.lineIndent-1,4,!1,!0),C(e,!0,-1),e.checkLineBreaks&&a.test(e.input.slice(o,e.position))&&A(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&R(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,C(e,!0,-1)):e.position<e.length-1&&E(e,"end of the stream or a document separator is expected")}function F(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new x(e,t);for(n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)I(n);return n.documents}function j(e,t,n){var i,r,s=F(e,n);for(i=0,r=s.length;i<r;i+=1)t(s[i])}function B(e,n){var i=F(e,n);if(0!==i.length){if(1===i.length)return i[0];throw new t("expected a single document in the stream, but found more")}}return dt.loadAll=j,dt.load=B,dt.safeLoadAll=function(t,n,r){j(t,n,e.extend({schema:i},r))},dt.safeLoad=function(t,n){return B(t,e.extend({schema:i},n))},dt}();function t(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}return ht.Type=_t(),ht.Schema=gt(),ht.FAILSAFE_SCHEMA=xt(),ht.JSON_SCHEMA=kt(),ht.CORE_SCHEMA=St(),ht.DEFAULT_SAFE_SCHEMA=rn(),ht.DEFAULT_FULL_SCHEMA=ln(),ht.load=e.load,ht.loadAll=e.loadAll,ht.safeLoad=e.safeLoad,ht.safeLoadAll=e.safeLoadAll,ht.YAMLException=mt(),ht.MINIMAL_SCHEMA=xt(),ht.SAFE_SCHEMA=rn(),ht.DEFAULT_SCHEMA=ln(),ht.scan=t("scan"),ht.parse=t("parse"),ht.compose=t("compose"),ht.addConstructor=t("addConstructor"),ht}();return Yt=e}(),cn=e.getDefaultExportFromCjs(un);class hn{constructor(t,n,i=null){this.url=t,!n||e.isRelativeURL(n)&&!e.isRelativeURL(this.url)?this.path=e.pathForURL(this.url):this.path=n,this.path_for_parent=n||this.path,this.parent=i,this.container=null,this.parent&&(this.parent.container?this.container=this.parent.container:this.parent.isContainer()&&(this.container=this.parent))}load(){return fn(this.url)}resourceFor(e){return{url:this.urlFor(e),path:this.pathFor(e),type:this.typeFor(e)}}urlFor(t){return u(t)?t:e.isRelativeURL(t)&&this.container?this.parent.urlFor(this.path_for_parent+t):e.addBaseURL(t,this.path)}pathFor(t){return e.pathForURL(t)}typeFor(t){return e.extensionForURL(t)}isContainer(){return!1}}class dn extends hn{constructor(e,t,n){super(e,t,n),this.zip=null,this.files={},this.root=null,this.path=""}isContainer(){return!0}async load(){if(this.zip=new ct,"string"==typeof this.url){const{body:t}=await e.Utils.io(this.url,6e4,"arraybuffer");return await this.zip.loadAsync(t),await this.parseZipFiles(),this.loadRoot()}return this}urlFor(t){return u(t)?t:e.isRelativeURL(t)?this.urlForZipFile(e.flattenRelativeURL(t)):super.urlFor(t)}typeFor(t){return e.isRelativeURL(t)?this.typeForZipFile(t):super.typeFor(t)}loadRoot(){return this.findRoot(),fn(this.urlForZipFile(this.root))}findRoot(){const t=Object.keys(this.files).filter(e=>0===this.files[e].depth).filter(t=>"yaml"===e.extensionForURL(t));if(1===t.length&&(this.root=t[0]),!this.root){let e=`Could not find root scene for bundle '${this.url}': `;throw e+="The zip archive's root level must contain a single scene file with the '.yaml' extension. ",t.length>0?e+=`Found multiple YAML files at the root level: ${t.map(e=>"'"+e+"'").join(", ")}.`:e+="Found NO YAML files at the root level.",Error(e)}}async parseZipFiles(){let t=[],n=[];this.zip.forEach((e,i)=>{i.dir||(t.push(e),n.push(i.async("arraybuffer")))});const i=await Promise.all(n);for(let n=0;n<i.length;n++){let r=t[n],s=r.split("/").length-1;this.files[r]={data:i[n],type:e.extensionForURL(r),depth:s}}}urlForZipFile(t){if(this.files[t])return this.files[t].url||(this.files[t].url=e.createObjectURL(new Blob([this.files[t].data]))),this.files[t].url}typeForZipFile(e){return this.files[e]&&this.files[e].type}}function fn(t){return new Promise((n,i)=>{"string"==typeof t?e.Utils.io(t).then(({body:e})=>{try{n(function(e){return cn.safeLoad(e,{json:!0})}(e))}catch(e){i(e)}},i):(t=Object.assign({},t),n(t))})}const pn={async loadScene(t,{path:n,type:i}={}){const r=[],s={},o=await this.loadSceneRecursive({url:t,path:n,type:i},null,s,r),{config:a,bundle:l}=this.finalize(o);if(!a)throw r[0];return r.length>0&&r.forEach(t=>{const n=`Failed to import scene: ${t.url}`;e.log("error",n,t),this.trigger("error",{type:"scene_import",message:n,error:t,url:t.url})}),{config:a,bundle:l,texture_nodes:s}},async loadSceneRecursive({url:t,path:n,type:i},r,s={},o=[]){if(!t)return{};const a=function(t,n,i,r=null){return null!=r&&"zip"===r||"string"==typeof t&&!e.isLocalURL(t)&&"zip"===e.extensionForURL(t)?new dn(t,n,i):new hn(t,n,i)}(t,n,r,i);try{let t=await a.load();if(null==t.import)return this.normalize(t,a,s),{config:t,bundle:a};Array.isArray(t.import)||(t.import=[t.import]);const n=[];t.import.forEach(t=>{"object"==typeof t&&(t=e.createObjectURL(new Blob([JSON.stringify(t)]))),n.push(a.resourceFor(t))}),delete t.import;const i=n.map(e=>this.loadSceneRecursive(e,a,s,o)),r=(await Promise.all(i)).map(e=>this.normalize(e.config,e.bundle,s)).map(e=>e.config);return this.normalize(t,a,s),t=e.mergeObjects(...r,t),{config:t,bundle:a,texture_nodes:s}}catch(e){return e.url=t,o.push(e),{}}},normalize(e,t,n={}){return this.normalizeDataSources(e,t),this.normalizeFonts(e,t),this.normalizeTextures(e,t),this.collectTextures(e,t,n),{config:e,bundle:t,texture_nodes:n}},normalizeDataSources(e,t){e.sources=e.sources||{};for(const n in e.sources)this.normalizeDataSource(e.sources[n],t);return e},normalizeDataSource(e,t){if(e.url=t.urlFor(e.url),Array.isArray(e.composite)&&e.composite.forEach(e=>e.url=t.urlFor(e.url)),e.scripts){Array.isArray(e.scripts)&&(e.scripts=e.scripts.reduce((e,t)=>(e[t]=t,e),{}));for(const n in e.scripts)e.scripts[n]=t.urlFor(e.scripts[n])}return e},normalizeFonts(e,t){e.fonts=e.fonts||{};const n=Object.values(e.fonts).filter(e=>"external"!==e);for(const e of n)(Array.isArray(e)?e:[e]).forEach(e=>e.url=t.urlFor(e.url));return e},normalizeTextures(e,t){if(e.textures=e.textures||{},e.textures)for(const n in e.textures){const i=e.textures[n];i.url&&(i.url=t.urlFor(i.url))}},collectTextures(t,n,i){if(t.styles)for(const e in t.styles){const r=t.styles[e],s=r.texture;if("string"==typeof s&&!t.textures[s]){const t=["styles",e,"texture"];this.addTextureNode(t,n,i)}r.material&&["emission","ambient","diffuse","specular","normal"].forEach(s=>{const o=null!=r.material[s]&&r.material[s].texture;if("string"==typeof o&&!t.textures[o]){const t=["styles",e,"material",s,"texture"];this.addTextureNode(t,n,i)}})}if(t.styles)for(const r in t.styles){const s=t.styles[r];s.shaders&&s.shaders.uniforms&&e.GLSL.parseUniforms(s.shaders.uniforms).forEach(({type:e,value:s,path:o})=>{if("sampler2D"===e&&"string"==typeof s&&!t.textures[s]){const e=["styles",r,"shaders","uniforms",...o];this.addTextureNode(e,n,i)}})}if(t.layers){const r=[t.layers],s=[["layers"]];for(;r.length>0;){const o=r.pop(),a=s.pop();if("object"==typeof o&&!Array.isArray(o))for(const l in o)if("draw"===l){const e=o[l];for(const r in e){if(e[r].texture){const s=e[r].texture;if("string"==typeof s&&!t.textures[s]){const e=[...a,l,"draw",r,"texture"];this.addTextureNode(e,n,i)}}if(e[r].outline&&e[r].outline.texture){const s=e[r].outline.texture;if("string"==typeof s&&!t.textures[s]){const e=[...a,l,"draw",r,"outline","texture"];this.addTextureNode(e,n,i)}}}}else{if(e.isReserved(l))continue;r.push(o[l]),s.push([...a,l])}}}},addTextureNode(e,t,n){n[JSON.stringify(e)]={path:e,bundle:t}},hoistTextureNodes(e,t,n={}){for(const{path:i,bundle:o}of Object.values(n)){const n=r(e,i);if("string"==typeof n&&null==e.textures[n])if(c(e,i)){const i=t.urlFor(n);e.textures[n]={url:i}}else{const t=o.urlFor(n);e.textures[t]={url:t},s(e,i,t)}}},applyGlobalProperties:e=>e.global&&0!==Object.keys(e.global).length?d(h(e.global),e):e,finalize:({config:e,bundle:t})=>e?(e.global=e.global||{},e.scene=e.scene||{},e.cameras=e.cameras||{},e.lights=e.lights||{},e.styles=e.styles||{},e.layers=e.layers||{},e.camera&&(e.cameras.default=e.camera),0===Object.keys(e.cameras).length&&(e.cameras.default={}),(0===Object.keys(e.lights).length||Object.keys(e.lights).every(t=>!1===e.lights[t].visible))&&(e.lights.default_light={type:"directional"}),{config:e,bundle:t}):{}};e.subscribeMixin(pn);class mn{constructor(){this.tiles={},this.max_proxy_descendant_depth=6,this.max_proxy_ancestor_depth=7,this.children_cache={}}addTile(t){for(this.tiles[t.key]=this.tiles[t.key]||{descendants:0},this.tiles[t.key].tile=t;t.style_z>=0;){if(!(t=e.TileID.parent(t)))return;this.tiles[t.key]||(this.tiles[t.key]={descendants:0}),this.tiles[t.key].descendants++}}removeTile(t){for(this.tiles[t.key]&&(delete this.tiles[t.key].tile,0===this.tiles[t.key].descendants&&delete this.tiles[t.key]);t.style_z>=0;){if(!(t=e.TileID.parent(t)))return;this.tiles[t.key]&&this.tiles[t.key].descendants>0&&(this.tiles[t.key].descendants--,0!==this.tiles[t.key].descendants||this.tiles[t.key].tile||delete this.tiles[t.key])}}getAncestor(t){let n=0;for(;n<this.max_proxy_ancestor_depth;){if(!(t=e.TileID.parent(t)))return;if(this.tiles[t.key]&&this.tiles[t.key].tile&&this.tiles[t.key].tile.loaded)return this.tiles[t.key].tile;n++}}getDescendants(t,n=0){let i=[];if(n<this.max_proxy_descendant_depth){let r=e.TileID.children(t,this.children_cache);if(!r)return;r.forEach(e=>{this.tiles[e.key]&&(this.tiles[e.key].tile&&this.tiles[e.key].tile.loaded?i.push(this.tiles[e.key].tile):this.tiles[e.key].descendants>0&&i.push(...this.getDescendants(e,n+1)))})}return i}}let _n={},gn={};function yn(t,n=null){if(this.obb)return e.Label.prototype.occluded.call(this,t,n);if(this.obbs)for(let i=0;i<this.obbs.length;i++){let r={aabb:this.aabbs[i],obb:this.obbs[i]};if(e.Label.prototype.occluded.call(r,t,n))return!0}return!1}class vn{constructor({scene:t}){this.scene=t,this.tiles={},this.pyramid=new mn,this.visible_coords={},this.queued_coords=[],this.building_tiles=null,this.renderable_tiles=[],this.collision={tile_keys:null,mesh_set:null,zoom:null,zoom_steps:3},this.main_thread_target=["TileManager",this.scene.id].join("_"),e.WorkerBroker.addTarget(this.main_thread_target,this)}destroy(){this.forEachTile(e=>e.destroy()),this.tiles={},this.pyramid=null,this.visible_coords={},this.queued_coords=[],this.scene=null,e.WorkerBroker.removeTarget(this.main_thread_target)}get view(){return this.scene.view}get style_manager(){return this.scene.style_manager}keepTile(e){this.tiles[e.key]=e,this.pyramid.addTile(e)}hasTile(e){return void 0!==this.tiles[e]}forgetTile(e){if(this.hasTile(e)){let t=this.tiles[e];this.pyramid.removeTile(t)}delete this.tiles[e],this.tileBuildStop(e)}removeTile(t){e.log("trace",`tile unload for ${t}`);var n=this.tiles[t];null!=n&&n.destroy(),this.forgetTile(n.key),this.scene.requestRedraw()}forEachTile(e){for(let t in this.tiles)e(this.tiles[t])}removeTiles(e){let t=[];for(let n in this.tiles)e(this.tiles[n])&&t.push(n);for(let e=0;e<t.length;e++){let n=t[e];this.removeTile(n)}}updateTilesForView(){this.visible_coords={};let e=this.view.findVisibleTileCoordinates();for(let t=0;t<e.length;t++){const n=e[t];this.queueCoordinate(n),this.visible_coords[n.key]=n}this.updateTileStates()}updateTileStates(){return this.forEachTile(e=>{this.updateVisibility(e)}),this.loadQueuedCoordinates(),this.updateProxyTiles(),this.view.pruneTilesForView(),this.updateRenderableTiles(),this.style_manager.updateActiveStyles(this.renderable_tiles),this.style_manager.updateActiveBlendOrders(this.renderable_tiles),this.updateLabels()}updateLabels(){var t=this;if(this.scene.building&&!this.scene.building.initial)return Promise.resolve({});const n=this.renderable_tiles.filter(e=>e.valid).filter(e=>e.built);return 0===n.length?Promise.resolve({}):(n.sort((e,t)=>e.build_id<t.build_id?-1:e.build_id>t.build_id?1:0),this.collision.zoom===bn(this.view.zoom,this.collision.zoom_steps)&&this.collision.tile_keys===JSON.stringify(n.map(e=>e.key))&&this.collision.mesh_set===xn(n)?Promise.resolve({}):(this.collision.task||(this.collision.zoom=bn(this.view.zoom,this.collision.zoom_steps),this.collision.tile_keys=JSON.stringify(n.map(e=>e.key)),this.collision.mesh_set=xn(n),this.collision.task={type:"tileManagerUpdateLabels",run:async function(i){const r=await async function(t,n,i=!1){gn=_n,_n={};let r=function(t,n){let i={};t.forEach(t=>{const r=e.Geo.unitsPerMeter(t.coords.z),s=Math.pow(2,n-t.style_z),o=r*s,a=e.Geo.metersPerPixel(n),l=Object.assign({},t.meshes,t.pending_label_meshes);for(let n in l)l[n].forEach(n=>{if(n.labels)for(let s in n.labels){if(t.isProxy()&&!gn[s])continue;const l=n.labels[s].container.label,u=n.labels[s].container.linked,c=n.labels[s].ranges;let h={};if(h.discard=yn.bind(h),h.build_id=t.build_id,Object.assign(h,l),h.layout=Object.assign({},l.layout),h.layout.repeat_scale=.75,h.layout.repeat_distance=h.layout.repeat_distance||0,h.layout.repeat_distance/=o,h.position=[h.position[0]/r+t.min.x,h.position[1]/r+t.min.y],h.unit_scale=a,"point"===h.type)e.LabelPoint.prototype.updateBBoxes.call(h);else if("straight"===h.type)e.LabelLineStraight.prototype.updateBBoxes.call(h,h.position,h.size,h.angle,h.angle,h.offset);else if(l.obbs){const n=l.obbs.map(n=>{let{x:i,y:s,a:a,w:l,h:u}=n;return i=i/r+t.min.x,s=s/r+t.min.y,l/=o,u/=o,new e.OBB(i,s,a,l,u)});h.obbs=n,h.aabbs=n.map(e=>e.getExtent())}i[s]={label:h,linked:u,ranges:c,mesh:n}}})});for(let e in i){const t=i[e];t.linked&&(t.linked=i[t.linked])}return i=Object.keys(i).map(e=>i[e]),i}(t,n);e.Collision.startTile("main",{apply_repeat_groups:!0,return_hidden:!0}),e.Collision.addStyle("main","main");const s=Math.max(0,...Object.values(t).map(e=>Object.values(e.meshes)).flat().map(e=>Math.max(0,...e.map(e=>e.labels?Object.keys(e.labels).length:0)))),o=Math.floor(s/e.Geo.tile_size);o>0?e.Collision.initGrid({anchor:{x:Math.min(...t.map(e=>e.min.x)),y:Math.min(...t.map(e=>e.min.y))},span:t[0].span.x/o}):e.Collision.initGrid();const a=await e.Collision.collide(r,"main","main");let l=[];return a.forEach(e=>{let t=0;!0!==e.show||i&&e.label.breach&&!gn[e.label.id]||(t=1),t&&(_n[e.label.id]=!0);let n=!0;e.ranges.forEach(i=>{if(!n)return;let r=e.mesh;if(!r.valid)return;let s=r.vertex_layout.offset.a_shape,o=r.vertex_layout.stride;for(let e=0;e<i[1];e++){if(r.vertex_data[i[0]+e*o+s+6]===t)return void(n=!1);r.vertex_data[i[0]+e*o+s+6]=t}-1===l.indexOf(r)&&l.push(r)})}),l.forEach(e=>e.upload()),t.forEach(e=>e.swapPendingLabels()),{labels:a,containers:r}}(n,t.collision.zoom,t.isLoadingVisibleTiles());t.scene.requestRedraw(),t.collision.task=null,e.Task.finish(i,r),t.updateTileStates()},immediate:!0},e.Task.add(this.collision.task)),this.collision.task.promise))}updateProxyTiles(){if(0===this.view.zoom_direction)return;this.forEachTile(e=>e.setProxyFor(null));let e=!1;this.forEachTile(t=>{if(t.visible&&!t.labeled){const n=this.pyramid.getAncestor(t);if(n)n.setProxyFor(t),e=!0;else{const n=this.pyramid.getDescendants(t);for(let i=0;i<n.length;i++)n[i].setProxyFor(t),e=!0}}}),e||(this.view.zoom_direction=0)}updateVisibility(t){if(t.visible=!1,t.style_z===this.view.tile_zoom)if(this.visible_coords[t.coords.key])t.visible=!0;else for(let n in this.visible_coords)if(e.TileID.isDescendant(t.coords,this.visible_coords[n])){t.visible=!0;break}}pruneToVisibleTiles(){this.removeTiles(e=>!e.visible)}getRenderableTiles(){return this.renderable_tiles}updateRenderableTiles(){this.renderable_tiles=[];for(let e in this.tiles){let t=this.tiles[e];t.visible&&t.loaded&&this.renderable_tiles.push(t)}return this.renderable_tiles}isLoadingVisibleTiles(){return Object.keys(this.tiles).some(e=>this.tiles[e].visible&&!this.tiles[e].built)}allVisibleTilesLabeled(){return this.renderable_tiles.every(e=>e.labeled)}queueCoordinate(e){this.queued_coords[this.queued_coords.length]=e}loadQueuedCoordinates(){0!==this.queued_coords.length&&(this.queued_coords.sort((t,n)=>{let i=this.view.center.meters,r=e.Geo.metersPerTile(t.z)/2,s=e.Geo.metersForTile(t);s.x+=r,s.y-=r;let o=e.Geo.metersForTile(n);o.x+=r,o.y-=r;let a=Math.abs(i.x-s.x)+Math.abs(i.y-s.y),l=Math.abs(i.x-o.x)+Math.abs(i.y-o.y);return t.center_dist=a,n.center_dist=l,l>a?-1:l===a?0:1}),this.queued_coords.forEach(e=>this.loadCoordinate(e)),this.queued_coords=[])}loadCoordinate(t){if(t.z===this.view.center.tile.z)for(let n in this.scene.sources){let i=this.scene.sources[n];if(!i.builds_geometry_tiles||!i.includesTile(t,this.view.tile_zoom))continue;let r=e.TileID.normalizedKey(t,i,this.view.tile_zoom);if(r&&!this.hasTile(r)){e.log("trace",`load tile ${r}, distance from view center: ${t.center_dist}`);let n=new e.Tile({source:i,coords:t,workers:this.scene.workers,style_z:this.view.baseZoom(t.z),view:this.view});this.keepTile(n),this.buildTile(n)}}}buildTile(e,t){this.tileBuildStart(e.key),this.updateVisibility(e),e.build(this.scene.generation,t)}buildTileStylesCompleted({tile:t,progress:n}){if(null==this.tiles[t.key])e.log("trace",`discarded tile ${t.key} in TileManager.buildTileStylesCompleted because previously removed`),e.Tile.abortBuild(t),this.updateTileStates();else if(t.generation!==this.scene.generation)e.log("trace",`discarded tile ${t.key} in TileManager.buildTileStylesCompleted because built with scene config gen ${t.generation}, current ${this.scene.generation}`),e.Tile.abortBuild(t),this.updateTileStates();else{if(this.tiles[t.key]){if(t.id<this.tiles[t.key].id)return e.log("trace",`discarded tile ${t.key} for id ${t.id} in TileManager.buildTileStylesCompleted because built for discarded tile id`),void e.Tile.abortBuild(t);t=this.tiles[t.key].merge(t)}n.done&&(t.built=!0),t.buildMeshes(this.scene.styles,n),this.updateTileStates(),this.scene.requestRedraw()}n.done&&this.tileBuildStop(t.key)}buildTileError(t){e.log("error",`Error building tile ${t.key}:`,t.error),this.forgetTile(t.key),e.Tile.abortBuild(t)}tileBuildStart(t){this.building_tiles=this.building_tiles||{},this.building_tiles[t]=!0,e.log("trace",`tileBuildStart for ${t}: ${Object.keys(this.building_tiles).length}`)}tileBuildStop(t){this.building_tiles&&(e.log("trace",`tileBuildStop for ${t}: ${Object.keys(this.building_tiles).length}`),delete this.building_tiles[t],this.checkBuildQueue())}checkBuildQueue(){this.building_tiles&&0!==Object.keys(this.building_tiles).length||(this.building_tiles=null,this.scene.tileManagerBuildDone())}getDebugProp(e,t){var n=[];for(var i in this.tiles)null==this.tiles[i].debug[e]||"function"==typeof t&&!0!==t(this.tiles[i])||n.push(this.tiles[i].debug[e]);return n}getDebugSum(e,t){var n=0;for(var i in this.tiles)null==this.tiles[i].debug[e]||"function"==typeof t&&!0!==t(this.tiles[i])||(n+=this.tiles[i].debug[e]);return n}getDebugAverage(e,t){return this.getDebugSum(e,t)/Object.keys(this.tiles).length}}function bn(e,t,n=2){return(Math.floor(e*t)/t).toFixed(n)}function xn(e){return JSON.stringify(Object.entries(e).map(([,e])=>Object.entries(e.meshes).map(([,e])=>e.map(e=>e.created_at))))}class wn{constructor(e,t){t(e),this.value=e,this.setup=t}set(e){JSON.stringify(this.value)!==JSON.stringify(e)&&(this.setup(e),this.value=e)}}class En{constructor(e){this.defaults={},this.defaults.culling=!0,this.defaults.culling_face=e.BACK,this.defaults.blending=!1,this.defaults.blending_src=e.ONE_MINUS_SRC_ALPHA,this.defaults.blending_dst=e.ONE_MINUS_SRC_ALPHA,this.defaults.blending_src_alpha=e.ONE,this.defaults.blending_dst_alpha=e.ONE_MINUS_SRC_ALPHA,this.defaults.depth_write=!0,this.defaults.depth_test=!0,e.depthFunc(e.LESS),this.culling=new wn({cull:this.defaults.culling,face:this.defaults.culling_face},t=>{t.cull?(e.enable(e.CULL_FACE),e.cullFace(t.face)):e.disable(e.CULL_FACE)}),this.blending=new wn({blend:this.defaults.blending,src:this.defaults.blending_src,dst:this.defaults.blending_dst,src_alpha:this.defaults.blending_src_alpha,dst_alpha:this.defaults.blending_dst_alpha},t=>{t.blend?(e.enable(e.BLEND),t.src_alpha&&t.dst_alpha?e.blendFuncSeparate(t.src,t.dst,t.src_alpha,t.dst_alpha):e.blendFunc(t.src,t.dst)):e.disable(e.BLEND)}),this.depth_write=new wn({depth_write:this.defaults.depth_write},t=>{e.depthMask(t.depth_write)}),this.depth_test=new wn({depth_test:this.defaults.depth_test},t=>{t.depth_test?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST)})}}class An{constructor(){this.canvas=null,this.gl=null,this.screenshot_canvas=null,this.screenshot_context=null,this.queue_screenshot=null,this.video_capture=null}setCanvas(e,t){this.canvas=e,this.gl=t}screenshot({background:e}={}){return null!=this.queue_screenshot||(this.queue_screenshot={background:e},this.queue_screenshot.promise=new Promise((e,t)=>{this.queue_screenshot.resolve=e,this.queue_screenshot.reject=t})),this.queue_screenshot.promise}completeScreenshot(){if(null!=this.queue_screenshot){let t=this.canvas.width,n=this.canvas.height,i=new Uint8Array(t*n*4);this.gl.readPixels(0,0,t,n,this.gl.RGBA,this.gl.UNSIGNED_BYTE,i);let r=this.queue_screenshot.background;r=r&&"transparent"!==r?e.StyleParser.parseColor(r).slice(0,3).map(e=>255*e):null;let s=new Uint8ClampedArray(t*n*4);for(let e=0;e<n;e++)for(let o=0;o<t;o++){let a=4*((n-e-1)*t+o),l=4*(e*t+o),u=i[a+3];s[l+0]=255*i[a+0]/u,s[l+1]=255*i[a+1]/u,s[l+2]=255*i[a+2]/u,s[l+3]=u,r&&(u/=255,s[l+0]=s[l+0]*u+r[0]*(1-u),s[l+1]=s[l+1]*u+r[1]*(1-u),s[l+2]=s[l+2]*u+r[2]*(1-u),s[l+3]=255)}this.screenshot_canvas=this.screenshot_canvas||document.createElement("canvas");let o=this.screenshot_canvas;o.width=t,o.height=n,this.screenshot_context=this.screenshot_context||o.getContext("2d");let a=this.screenshot_context,l=new ImageData(s,t,n);a.putImageData(l,0,0);const u=o.toDataURL("image/png"),c=atob(u.slice(22)),h=new Uint8Array(c.length);for(let e=0;e<c.length;++e)h[e]=c.charCodeAt(e);const d=new Blob([h],{type:"image/png"});this.queue_screenshot.resolve({url:u,blob:d,type:"png"}),this.queue_screenshot=null}}startVideoCapture(){if("function"!=typeof window.MediaRecorder||!this.canvas||"function"!=typeof this.canvas.captureStream)return e.log("warn","Video capture (Canvas.captureStream and/or MediaRecorder APIs) not supported by browser"),!1;if(this.video_capture)return e.log("warn","Video capture already in progress, call Scene.stopVideoCapture() first"),!1;try{let t=this.video_capture={};t.chunks=[],t.stream=this.canvas.captureStream(),t.options={mimeType:"video/webm"},t.media_recorder=new MediaRecorder(t.stream,t.options),t.media_recorder.ondataavailable=n=>{if(n.data.size>0&&t.chunks.push(n.data),t.resolve){let n=new Blob(t.chunks,{type:t.options.mimeType}),i=e.createObjectURL(n);t.stream&&(t.stream.getTracks()||[]).forEach(e=>{e.stop(),t.stream.removeTrack(e)}),t.stream=null,t.media_recorder=null,this.video_capture=null,t.resolve({url:i,blob:n,type:"webm"})}},t.media_recorder.start()}catch(t){return this.video_capture=null,e.log("error","Scene video capture failed",t),!1}return!0}stopVideoCapture(){return this.video_capture?(this.video_capture.promise=new Promise((e,t)=>{this.video_capture.resolve=e,this.video_capture.reject=t}),this.video_capture.media_recorder.stop(),this.video_capture.promise):(e.log("warn","No scene video capture in progress, call Scene.startVideoCapture() first"),Promise.resolve({}))}}function Tn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function kn(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?Tn(Object(i),!0).forEach(function(n){e._defineProperty(t,n,i[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Tn(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}class Sn{constructor(t,n){var i;n=n||{},e.subscribeMixin(this),this.id=Sn.id++,this.initialized=!1,this.initializing=null,this.sources={},this.view=new e.View(this,n),this.tile_manager=new vn({scene:this}),this.num_workers=n.numWorkers||2,!0===n.disableVertexArrayObjects&&(e.VertexArrayObject.disabled=!0),e.Utils.use_high_density_display=void 0===n.highDensityDisplay||n.highDensityDisplay,e.Utils.updateDevicePixelRatio(),this.config=null,this.config_source=t,this.config_bundle=null,this.last_valid_config_source=null,this.styles=null,this.style_manager=new e.StyleManager,this.building=null,this.dirty=!0,n.preUpdate&&this.subscribe({pre_update:n.preUpdate}),n.postUpdate&&this.subscribe({post_update:n.postUpdate}),this.render_loop=!n.disableRenderLoop,this.render_loop_active=!1,this.render_loop_stop=!1,this.render_count=0,this.last_render_count=0,this.render_count_changed=!1,this.frame=0,this.last_main_render=-1,this.last_selection_render=-1,this.media_capture=new An,this.selection=null,this.selection_feature_count=0,this.fetching_selection_map=null,this.prev_textures=null,this.introspection=!0===n.introspection,this.times={},this.resetTime(),this.container=n.container,this.canvas=null,this.contextOptions=n.webGLContextOptions,this.lights=null,this.background=null,this.createListeners(),this.updating=0,this.generation=Sn.generation,this.last_complete_generation=Sn.generation,(i=this).debug={profile(t){console.profile(`main thread: ${t}`),e.WorkerBroker.postMessage(i.workers,"self.profile",t)},profileEnd(t){console.profileEnd(`main thread: ${t}`),e.WorkerBroker.postMessage(i.workers,"self.profileEnd",t)},timeRebuild(t=1,n={}){let r=[],s=()=>{let o=+new Date;i.rebuild(n).then(()=>{if(r.push(+new Date-o),r.length<t)s();else{let n=~~(r.reduce((e,t)=>e+t)/r.length);e.log("info",`Profiled rebuild ${t} times: ${n} avg (${Math.min(...r)} min, ${Math.max(...r)} max)`)}})};s()},geometryCountByStyle(){let e={};return i.tile_manager.getRenderableTiles().forEach(t=>{for(let n in t.meshes)e[n]=e[n]||0,t.meshes[n].forEach(t=>{e[n]+=t.geometry_count})}),e},geometryCountByBaseStyle(){let e=i.debug.geometryCountByStyle(),t={};for(let n in e){let r=i.styles[n].baseStyle();t[r]=t[r]||0,t[r]+=e[n]}return t},geometryCountTotal(){const e=i.debug.geometryCountByStyle();return Object.keys(e).reduce((t,n)=>e[n]+t,0)},geometrySizeByStyle(){let e={};return i.tile_manager.getRenderableTiles().forEach(t=>{for(let n in t.meshes)e[n]=e[n]||0,t.meshes[n].forEach(t=>{e[n]+=t.buffer_size})}),e},geometrySizeByBaseStyle(){let e=i.debug.geometrySizeByStyle(),t={};for(let n in e){let r=i.styles[n].baseStyle();t[r]=t[r]||0,t[r]+=e[n]}return t},geometrySizeTotal(){const e=i.debug.geometrySizeByStyle();return Object.keys(e).reduce((t,n)=>e[n]+t,0)},textureSizeTotal:()=>Object.values(e.Texture.textures).map(e=>e.byteSize()).reduce((e,t)=>e+t),layerStats:()=>e.debugSettings.layer_stats?e.debugSumLayerStats(i.tile_manager.getRenderableTiles()):(e.log("warn","Enable the 'layer_stats' debug setting to collect layer stats"),{}),renderableTilesCount:()=>i.tile_manager.getRenderableTiles().length},this.log_level=n.logLevel||"warn",e.log.setLevel(this.log_level),e.log.reset()}static create(e,t={}){return new Sn(e,t)}load(t=null,n={}){var i=this;return this.initializing||(e.log.reset(),this.updating++,this.initialized=!1,this.view_complete=!1,this.times.frame=null,this.times.build=null,(n="string"==typeof n?{base_path:n}:n).blocking=void 0===n.blocking||n.blocking,!1!==this.render_loop&&this.setupRenderLoop(),this.createCanvas(),this.prev_textures=this.config&&Object.keys(this.config.textures),this.initializing=this.loadScene(t,n).then(async function({texture_nodes:t}){await i.createWorkers(),i.destroyFeatureSelection(),e.WorkerBroker.postMessage(i.workers,"self.clearFunctionStringCache");const r="object"==typeof i.config_source||i.hasSubscribersFor("load"),s=i.updateConfig({texture_nodes:t,serialize_funcs:r,normalize:!1,loading:!0,fade_in:!0});!0===n.blocking&&await s,i.freePreviousTextures(),i.updating--,i.initializing=null,i.initialized=!0,i.last_valid_config_source=i.config_source,i.last_valid_options={base_path:n.base_path,file_type:n.file_type},i.requestRedraw()}).catch(t=>{let n,i;if(this.initializing=null,this.updating=0,"YAMLException"===t.name?(n="yaml",i="Error parsing scene YAML"):i="Error initializing scene",this.trigger("error",{type:n,message:i,error:t,url:this.config_source}),i=`Scene.load() failed to load ${JSON.stringify(this.config_source)}: ${t.message}`,this.last_valid_config_source)return e.log("warn",i,t),e.log("info","Scene.load() reverting to last valid configuration"),this.load(this.last_valid_config_source,this.last_valid_base_path);throw e.log("error",i,t),t})),this.initializing}destroy(){if(this.initialized=!1,this.render_loop_stop=!0,this.destroyListeners(),this.destroyFeatureSelection(),this.canvas&&this.canvas.parentNode&&(this.canvas.parentNode.removeChild(this.canvas),this.canvas=null),this.container=null,this.gl){e.Texture.destroy(this.gl),this.style_manager.destroy(this.gl),this.styles={},e.ShaderProgram.reset();let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.gl=null}this.sources={},this.destroyWorkers(),this.tile_manager.destroy(),this.tile_manager=null,e.log.reset()}createCanvas(){if(!this.canvas){this.container=this.container||document.body,this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.top=0,this.canvas.style.left=0,this.container.style.backgroundColor="transparent",this.container.appendChild(this.canvas);try{this.gl=n.getContext(this.canvas,Object.assign({alpha:!0,premultipliedAlpha:!0,stencil:!0,device_pixel_ratio:e.Utils.device_pixel_ratio,powerPreference:"high-performance"},this.contextOptions))}catch(e){throw new Error("Couldn't create WebGL context. Your browser may not support WebGL, or it's turned off? Visit http://webglreport.com/ for more info.")}this.resizeMap(this.container.clientWidth,this.container.clientHeight),e.VertexArrayObject.init(this.gl),this.render_states=new En(this.gl),this.media_capture.setCanvas(this.canvas,this.gl)}}updateExternalScripts(){let e=[...this.external_scripts||[]],t=[];if(this.config.scene.scripts)for(let e in this.config.scene.scripts)-1===t.indexOf(this.config.scene.scripts[e])&&t.push(this.config.scene.scripts[e]);for(let e in this.config.sources){let n=this.config.sources[e];if(n.scripts)for(let e in n.scripts)-1===t.indexOf(n.scripts[e])&&t.push(n.scripts[e])}return this.external_scripts=t,!(this.external_scripts.length===e.length&&this.external_scripts.every((t,n)=>t===e[n]))}createWorkers(){return this.updateExternalScripts()&&this.destroyWorkers(),this.workers?Promise.resolve():this.makeWorkers()}makeWorkers(){let t=!!this.gl.getExtension("OES_element_index_uint"),n=[];this.workers=[];for(let i=0;i<this.num_workers;i++){let r=new Worker(ix.workerURL);this.workers[i]=r,e.WorkerBroker.addWorker(r),e.log("debug",`Scene.makeWorkers: initializing worker ${i}`);let s=i;n.push(e.WorkerBroker.postMessage(r,"self.init",this.id,i,this.num_workers,this.log_level,e.Utils.device_pixel_ratio,t,this.external_scripts).then(t=>(e.log("debug",`Scene.makeWorkers: initialized worker ${t}`),t),t=>(e.log("error",`Scene.makeWorkers: failed to initialize worker ${s}:`,t),Promise.reject(t))))}return this.next_worker=0,Promise.all(n).then(()=>{e.log.setWorkers(this.workers)})}destroyWorkers(){this.selection=null,Array.isArray(this.workers)&&(e.log.setWorkers(null),this.workers.forEach(e=>{e.terminate()}),this.workers=null)}ready(){return!(!this.view.ready()||0===Object.keys(this.sources).length)}updateDevicePixelRatio(){e.Utils.updateDevicePixelRatio()&&e.WorkerBroker.postMessage(this.workers,"self.updateDevicePixelRatio",e.Utils.device_pixel_ratio).then(()=>this.rebuild()).then(()=>this.resizeMap(this.view.size.css.width,this.view.size.css.height))}resizeMap(t,i){0===t&&0===i||(this.dirty=!0,this.view.setViewportSize(t,i),this.gl&&n.resize(this.gl,t,i,e.Utils.device_pixel_ratio))}requestRedraw(){this.dirty=!0}immediateRedraw(){this.dirty=!0,this.update()}renderLoop(){this.render_loop_active=!0,this.update(),e.Task.setState({user_moving_view:this.view.user_input_active}),e.Task.processAll(),this.render_loop_stop?(this.render_loop_stop=!1,this.render_loop_active=!1):window.requestAnimationFrame(this.renderLoop.bind(this))}setupRenderLoop(){this.render_loop_active||setTimeout(()=>{this.renderLoop()},0)}update(){let t=this.dirty,n=!!this.selection&&this.selection.hasPendingRequests();var i=!(!1===t&&!1===n||!1===this.initialized||this.updating>0||!1===this.ready());return this.trigger("pre_update",i),this.view.update(),!!i&&(this.dirty=!1,this.updateDevicePixelRatio(),this.render({main:t,selection:n}),this.updateViewComplete(),this.media_capture.completeScreenshot(),this.trigger("post_update",i),(!0===this.animated||this.view.isAnimating())&&(this.dirty=!0),this.frame++,e.log("trace","Scene.render()"),!0)}render({main:t,selection:n}){var i=this.gl;if(this.updateBackground(),Object.keys(this.lights).forEach(e=>this.lights[e].update()),this.render_count_changed=!1,t&&(this.render_count=this.renderPass(),this.last_main_render=this.frame,this.render_count!==this.last_render_count&&(this.render_count_changed=!0,this.logFirstFrame(),this.getFeatureSelectionMapSize().then(t=>{this.selection_feature_count=t,e.log("info",`Scene: rendered ${this.render_count} primitives (${t} features in selection map)`)})),this.last_render_count=this.render_count),n){if(this.view.panning||this.view.user_input_active)return void this.selection.clearPendingRequests();!this.selection.locked&&this.last_selection_render<this.last_main_render&&(this.selection.bind(),this.renderPass("selection_program",{allow_blend:!1}),i.bindFramebuffer(i.FRAMEBUFFER,null),i.viewport(0,0,this.canvas.width,this.canvas.height),i.clearColor(...this.background.computed_color),this.last_selection_render=this.frame),this.selection.read()}return!0}renderPass(t="program",{allow_blend:n}={}){n=null==n||n,this.clearFrame();let i,r=0;const s=this.style_manager.getActiveBlendOrders();for(const{blend_order:o,styles:a}of s)for(let s=0;s<a.length;s++){let l=this.styles[a[s]];if(null==l)continue;if(l.blend!==i){let t=Object.assign({},e.Style.render_states[l.blend],{blend:n&&l.blend});this.setRenderState(t)}const u=n&&l.blend;if("translucent"===u)this.gl.colorMask(!1,!1,!1,!1),this.renderStyle(l.name,t,o),this.gl.colorMask(!0,!0,!0,!0),this.gl.depthFunc(this.gl.EQUAL),this.gl.enable(this.gl.STENCIL_TEST),this.gl.clearStencil(0),this.gl.clear(this.gl.STENCIL_BUFFER_BIT),this.gl.stencilFunc(this.gl.EQUAL,this.gl.ZERO,255),this.gl.stencilOp(this.gl.KEEP,this.gl.KEEP,this.gl.INCR),r+=this.renderStyle(l.name,t,o),this.gl.disable(this.gl.STENCIL_TEST),this.gl.depthFunc(this.gl.LESS);else if("opaque"!==u&&!0===l.stencil_proxy_tiles){const e=this.tile_manager.getRenderableTiles().filter(e=>e.meshes[l.name]).map(e=>e.proxy_level).reduce((e,t)=>(e.indexOf(t)>-1||e.push(t),e),[]).sort();if(e.length>1){this.gl.enable(this.gl.STENCIL_TEST),this.gl.clearStencil(0),this.gl.clear(this.gl.STENCIL_BUFFER_BIT),this.gl.stencilOp(this.gl.KEEP,this.gl.KEEP,this.gl.REPLACE);for(let n=0;n<e.length;n++)this.gl.stencilFunc(this.gl.GEQUAL,e.length-n,255),r+=this.renderStyle(l.name,t,o,e[n]);this.gl.disable(this.gl.STENCIL_TEST)}else r+=this.renderStyle(l.name,t,o)}else r+=this.renderStyle(l.name,t,o);i=l.blend}return r}renderStyle(e,t,n,i=null){let r,s=this.styles[e],o=!0,a=0,l=this.tile_manager.getRenderableTiles().filter(e=>"number"!=typeof i||e.proxy_level===i).map(t=>{if(t.meshes[e])return[t,t.meshes[e].filter(e=>e.variant.blend_order===n)]}).filter(e=>e),u=Math.max(...l.map(([,e])=>Math.max(...e.map(e=>e.variant.mesh_order))));for(let n=0;n<u+1;n++)for(let[i,u]of l){let l=!0;if(!i.shouldProxyForStyle(e))continue;const c=u.filter(e=>e.variant.mesh_order===n);if(0!==c.length){if(!0===o&&(o=!1,r=this.setupStyle(s,t),!r))return 0;c.forEach(e=>{!0===l&&(l=!1,this.view.setupTile(i,r)),s.render(e)&&this.requestRedraw(),a+=e.geometry_count})}}return a}setupStyle(e,t){let n;try{if(n=e.getProgram(t),!n)return}catch(t){return void this.trigger("warning",{type:"styles",message:`Error compiling style ${e.name}`,style:e,shader_errors:e.program&&e.program.shader_errors})}n.use(),e.setup(),n.uniform("1f","u_time",this.animated?(+new Date-this.start_time)/1e3:0),this.view.setupProgram(n);for(let e in this.lights)this.lights[e].setupProgram(n);return n}clearFrame(){this.initialized&&(this.render_states.depth_write.set({depth_write:!0}),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT|this.gl.STENCIL_BUFFER_BIT))}setRenderState({depth_test:e,depth_write:t,cull_face:n,blend:i}={}){if(!this.initialized)return;let r=this.render_states;e=!1!==e&&r.defaults.depth_test,t=!1!==t&&r.defaults.depth_write,n=!1!==n&&r.defaults.culling,i=null!=i?i:r.defaults.blending;let s=this.gl;r.depth_test.set({depth_test:e}),r.depth_write.set({depth_write:t}),r.culling.set({cull:n,face:r.defaults.culling_face}),i?"opaque"===i?r.blending.set({blend:!1}):"overlay"===i||"inlay"===i||"translucent"===i?r.blending.set({blend:!0,src:s.SRC_ALPHA,dst:s.ONE_MINUS_SRC_ALPHA,src_alpha:s.ONE,dst_alpha:s.ONE_MINUS_SRC_ALPHA}):"add"===i?r.blending.set({blend:!0,src:s.ONE,dst:s.ONE}):"multiply"===i&&r.blending.set({blend:!0,src:s.ZERO,dst:s.SRC_COLOR}):r.blending.set({blend:!1})}getFeatureAt(t,{radius:n}={}){if(!this.initialized)return e.log("debug","Scene.getFeatureAt() called before scene was initialized"),Promise.resolve();if(0===this.selection_feature_count)return Promise.resolve();this.selection||this.resetFeatureSelection();let i={x:t.x/this.view.size.css.width,y:t.y/this.view.size.css.height};return n=n>0?{x:n/this.view.size.css.width,y:n/this.view.size.css.height}:null,this.selection.getFeatureAt(i,{radius:n}).then(e=>Object.assign(e,{pixel:t})).catch(e=>Promise.resolve({error:e}))}async queryFeatures({filter:t,unique:n=!0,group_by:i=null,visible:r=null,geometry:s=!1}={}){if(!this.initialized)return[];t=e.Utils.serializeWithFunctions(t);const o=!0===(n="string"==typeof n?[n]:n)||Array.isArray(n)&&n.indexOf("$id")>-1,a=n&&(t=>{const i=Array.isArray(n)?e.sliceObject(t.properties,n):t.properties,r=o?t.id:null;return s?JSON.stringify({geometry:t.geometry,properties:i,id:r}):JSON.stringify({properties:i,id:r})}),l=(i=("string"==typeof i||Array.isArray(i))&&i)&&(t=>Array.isArray(i)?JSON.stringify(e.sliceObject(t,i)):t[i]),u=this.tile_manager.getRenderableTiles().map(e=>e.key),c=await e.WorkerBroker.postMessage(this.workers,"self.queryFeatures",{filter:t,visible:r,geometry:s,tile_keys:u}),h=[],d={},f={};return c.forEach(e=>e.forEach(e=>{if(a){const t=a(e);if(d[t])return;d[t]=!0}if(l){const t=l(e.properties);f[t]=f[t]||[],f[t].push(e)}else h.push(e)})),l?f:h}rebuild({initial:t=!1,new_generation:n=!0,sources:i=null,serialize_funcs:r,profile:s=!1,fade_in:o=!1}={}){return new Promise((a,l)=>{if(this.building){this.building.queued&&this.building.queued.reject&&(e.log("debug","Scene.rebuild: request superceded by a newer call"),this.building.queued.resolve(!1));let u={initial:t,new_generation:n,sources:i,serialize_funcs:r,profile:s,fade_in:o};return this.building.queued={resolve:a,reject:l,options:u},void e.log("trace","Scene.rebuild(): queuing request")}if(this.building={resolve:a,reject:l,initial:t},s&&this.debug.profile("Scene.rebuild"),n){this.generation=++Sn.generation;for(let e in this.styles)this.styles[e].setGeneration(this.generation)}this.syncConfigToWorker({serialize_funcs:r}),this.resetWorkerFeatureSelection(i),this.resetTime(),this.tile_manager.pruneToVisibleTiles(),this.tile_manager.forEachTile(e=>{(!i||i.indexOf(e.source.name)>-1)&&this.tile_manager.buildTile(e,{fade_in:o})}),this.tile_manager.updateTilesForView(),this.tile_manager.checkBuildQueue()}).then(()=>{s&&this.debug.profileEnd("Scene.rebuild")})}tileManagerBuildDone(){if(e.TextCanvas.pruneTextCache(),this.building){e.log("info","Scene: build geometry finished"),this.building.resolve&&(this.logFirstBuild(),this.building.resolve(!0));var t=this.building.queued;this.building=null,t?(e.log("debug","Scene: starting queued rebuild() request"),this.rebuild(t.options).then(t.resolve,t.reject)):this.tile_manager.updateLabels()}}async loadScene(t=null,{base_path:n,file_type:i}={}){this.config_source=t||this.config_source,"string"==typeof this.config_source?this.base_path=e.pathForURL(n||this.config_source):this.base_path=e.pathForURL(n),this.config_path=this.base_path;const{config:r,bundle:s,texture_nodes:o}=await pn.loadScene(this.config_source,{path:this.base_path,type:i});return this.config=r,this.config_bundle=s,{texture_nodes:o}}setDataSource(t,n){if(!t||!n||!n.type||!n.url&&!n.data)return void e.log("error","No name provided or not a valid config:",t,n);let i=null==this.config.sources[t],r=this.config.sources[t]=Object.assign({},n);return r.data&&"object"==typeof r.data&&(r.url=e.createObjectURL(new Blob([JSON.stringify(r.data)],{type:"application/json"})),delete r.data),i?this.updateConfig({rebuild:{sources:[t]}}):this.rebuild({sources:[t]})}createDataSources(t=!1){const n=[],i=Object.keys(this.sources);let r=0;for(var s in this.config.sources){const i=this.config.sources[s],o=this.sources[s];try{const t=kn(kn({},i),{},{name:s,id:r++});if(this.sources[s]=e.DataSource.create(t,this.sources),!this.sources[s])throw{}}catch(t){delete this.sources[s];const n=`Could not create data source: ${t.message}`;e.log("warn",`Scene: ${n}`,i),this.trigger("warning",{type:"sources",source:i,message:n})}(t||e.DataSource.tileLayoutChanged(this.sources[s],o))&&n.push(s)}i.forEach(e=>{this.config.sources[e]||(delete this.sources[e],n.push(e))}),n.length>0&&this.tile_manager.removeTiles(e=>n.indexOf(e.source.name)>-1);for(let e in this.config.layers){let t=this.config.layers[e];!1!==t.enabled&&t.data&&this.sources[t.data.source]&&(this.sources[t.data.source].builds_geometry_tiles=!0)}}loadTextures(){return e.Texture.createFromObject(this.gl,this.config.textures).then(()=>e.Texture.createDefault(this.gl))}freePreviousTextures(){this.prev_textures&&(this.prev_textures.forEach(t=>{!this.config.textures[t]&&e.Texture.textures[t]&&e.Texture.textures[t].destroy()}),this.prev_textures=null)}updateStyles(){if(!this.initialized&&!this.initializing)throw new Error("Scene.updateStyles() called before scene was initialized");this.styles=this.style_manager.build(this.config.styles),this.style_manager.initStyles(this);for(let e in this.styles)this.styles[e].setGL(this.gl);this.dirty=!0}get animated(){return!1!==this.config.scene.animated&&this.style_manager.getActiveStyles().some(e=>this.styles[e].animated)}getActiveCamera(){return this.view.getActiveCamera()}setActiveCamera(e){return this.view.setActiveCamera(e)}createLights(){this.lights={},e.debugSettings.wireframe&&(e.Light.enabled=!1);for(let t in this.config.lights){if(!this.config.lights[t]||"object"!=typeof this.config.lights[t])continue;let n=this.config.lights[t];n.name=t.replace("-","_"),n.visible=!1!==n.visible,n.visible&&(this.lights[n.name]=e.Light.create(this.view,n))}e.Light.inject(this.lights)}setBackground(){const t=this.config.scene.background;this.background={},t&&t.color&&(this.background.color=e.StyleParser.createColorPropertyCache(t.color)),this.background.color||(this.background.color=e.StyleParser.createColorPropertyCache([0,0,0,0]))}updateBackground(){const t=this.background.computed_color,n=this.background.computed_color=e.StyleParser.evalCachedColorProperty(this.background.color,{zoom:this.view.tile_zoom});t&&!n.some((e,n)=>t[n]!==e)||(1===n[3]?this.canvas.style.backgroundColor=`rgba(${n.map(e=>Math.floor(255*e)).join(", ")})`:this.canvas.style.backgroundColor="transparent",this.gl.clearColor(...n))}setIntrospection(e){return e!==this.introspection?(this.introspection=null!=e&&e,this.updating++,this.updateConfig({normalize:!1}).then(()=>this.updating--)):Promise.resolve()}updateConfig({loading:t=!1,rebuild:n=!0,serialize_funcs:i,texture_nodes:r={},normalize:s=!0,fade_in:o=!1}={}){this.generation=++Sn.generation,this.updating++,this.config=pn.applyGlobalProperties(this.config),s&&pn.normalize(this.config,this.config_bundle,r),pn.hoistTextureNodes(this.config,this.config_bundle,r),this.trigger(t?"load":"update",{config:this.config}),this.style_manager.init(),this.view.reset(),this.createLights(),this.createDataSources(t),this.loadTextures(),this.setBackground(),e.FontManager.loadFonts(this.config.fonts),this.updateStyles();let a=n?this.rebuild(Object.assign({initial:t,new_generation:!1,serialize_funcs:i,fade_in:o},"object"==typeof n&&n)):this.syncConfigToWorker({serialize_funcs:i});return this.updating--,this.view.updateBounds(),this.requestRedraw(),a.then(()=>{this.last_render_count=0,this.requestRedraw()})}syncConfigToWorker({serialize_funcs:t=!0}={}){let n=t?e.Utils.serializeWithFunctions(this.config):JSON.stringify(this.config);return e.WorkerBroker.postMessage(this.workers,"self.updateConfig",{config:n,generation:this.generation,introspection:this.introspection},e.debugSettings)}createListeners(){this.listeners={},this.listeners.view={move:()=>this.trigger("move")},this.view.subscribe(this.listeners.view),this.listeners.texture={update:()=>this.dirty=!0,warning:e=>this.trigger("warning",Object.assign({type:"textures"},e))},e.Texture.subscribe(this.listeners.texture),this.listeners.scene_loader={error:e=>this.trigger("error",Object.assign({type:"scene"},e))},pn.subscribe(this.listeners.scene_loader)}destroyListeners(){this.unsubscribeAll(),this.view.unsubscribe(this.listeners.view),e.Texture.unsubscribe(this.listeners.texture),pn.unsubscribe(this.listeners.scene_loader),this.listeners=null}destroyFeatureSelection(){this.selection&&(this.selection.destroy(),this.selection=null)}resetFeatureSelection(){this.selection=new e.FeatureSelection(this.gl,this.workers,()=>this.building),this.last_render_count=0}resetWorkerFeatureSelection(t=null){this.workers&&e.WorkerBroker.postMessage(this.workers,"self.resetFeatureSelection",t)}getFeatureSelectionMapSize(){return null==this.fetching_selection_map&&(this.fetching_selection_map=e.WorkerBroker.postMessage(this.workers,"self.getFeatureSelectionMapSize").then(e=>(this.fetching_selection_map=null,e.reduce((e,t)=>e+t)))),this.fetching_selection_map}resetTime(){this.start_time=+new Date}updateViewComplete(){!this.render_count_changed&&this.generation===this.last_complete_generation||this.building||this.tile_manager.isLoadingVisibleTiles()||!this.tile_manager.allVisibleTilesLabeled()||(this.tile_manager.updateLabels(),this.last_complete_generation=this.generation,this.trigger("view_complete",{first:!0!==this.view_complete}),this.view_complete=!0)}resetViewComplete(){this.last_complete_generation=null}screenshot({background:e="white"}={}){return this.requestRedraw(),this.media_capture.screenshot({background:e})}startVideoCapture(){return this.requestRedraw(),this.media_capture.startVideoCapture()}stopVideoCapture(){return this.media_capture.stopVideoCapture()}logFirstFrame(){0!==this.last_render_count||this.times.first_frame||(this.times.first_frame=+new Date-this.start_time,e.log("debug",`Scene: initial frame time: ${this.times.first_frame}`))}logFirstBuild(){null==this.times.first_build&&(this.times.first_build=+new Date-this.start_time,e.log("debug",`Scene: initial build time: ${this.times.first_build}`))}}var On;Sn.id=0,Sn.generation=0;const Pn={map:{},scrollWheelZoom:{},doubleClickZoom:{}};var Cn={leafletLayer:function(t){return function(t){if(void 0!==On)return new On(t);if(e.Thread.is_main){let n,i=t.leaflet||window.L,r=i.GridLayer?i.GridLayer:i.TileLayer,s=r===i.GridLayer?"1.x":"0.7.x",o={};return r===i.TileLayer&&(o._addTile=function(){},o._removeTile=function(){},o._reset=function(){r.prototype._reset.apply(this,arguments),this.scene&&this.scene.container&&this.scene.canvas&&this.scene.container.appendChild(this.scene.canvas)}),Object.assign(o,{initialize(e){e.showDebug=!!e.showDebug,i.setOptions(this,e),this.updateTangramDebugSettings(),this.createScene(),this.hooks={},this._updating_tangram=!1},createScene(){this.scene=Sn.create(this.options.scene,{numWorkers:this.options.numWorkers,preUpdate:this.options.preUpdate,postUpdate:this.options.postUpdate,continuousZoom:"1.x"===On.leafletVersion,wrapView:!0!==this.options.noWrap,highDensityDisplay:this.options.highDensityDisplay,logLevel:this.options.logLevel,introspection:this.options.introspection,webGLContextOptions:this.options.webGLContextOptions,disableRenderLoop:this.options.disableRenderLoop})},onAdd(t){this.scene||this.createScene(),r.prototype.onAdd.apply(this,arguments),this.hooks.resize=()=>{this._updating_tangram=!0,this.updateSize(),this._updating_tangram=!1},t.on("resize",this.hooks.resize),this.hooks.move=()=>{if(!this._updating_tangram){this._updating_tangram=!0,this.scene.view.setPanning(!0);var n=t.getCenter();n.zoom=Math.max(Math.min(t.getZoom(),t.getMaxZoom()||e.Geo.default_view_max_zoom),t.getMinZoom()),this.scene.view.setView(n),this._mapLayerCount>1&&this.scene.immediateRedraw(),this._updating_tangram=!1}},t.on("move",this.hooks.move),this.hooks.moveend=()=>{this.scene.view.setPanning(!1),this.scene.requestRedraw()},t.on("moveend",this.hooks.moveend),this.hooks.drag=()=>{this.scene.view.markUserInput()},t.on("drag",this.hooks.drag),this._map_pane_observer=new MutationObserver(e=>{e.forEach(()=>this.reverseTransform())}),this._map_pane_observer.observe(t.getPanes().mapPane,{attributes:!0}),this.modifyScrollWheelBehavior(t),this.modifyZoomBehavior(t),this.trackMapLayerCounts(t),this.setupSelectionEventHandlers(t),this.setSelectionEvents(this.options.events,{radius:this.options.selectionRadius}),this.scene.container=this.getContainer(),this.updateSize(),this.updateView(),this.resizeOnFirstVisible(),this.scene.subscribe({move:this.onTangramViewUpdate.bind(this)}),this.scene.load(this.options.scene,{base_path:this.options.sceneBasePath,file_type:this.options.sceneFileType,blocking:!1}).then(()=>{if(!this.options.attribution)for(const[,e]of Object.entries(this.scene.config.sources))e.attribution&&t.attributionControl.addAttribution(e.attribution);this._updating_tangram=!0,this.updateSize(),this.updateView(),this.reverseTransform(),this._updating_tangram=!1,this.fire("init")}).catch(e=>{this.fire("error",e)})},onRemove(e){r.prototype.onRemove.apply(this,arguments),e.off("layeradd layerremove overlayadd overlayremove",this._updateMapLayerCount),e.off("resize",this.hooks.resize),e.off("move",this.hooks.move),e.off("moveend",this.hooks.moveend),e.off("drag",this.hooks.drag),e.off("click",this.hooks.click),e.off("mousemove",this.hooks.mousemove),e.off("mouseout",this.hooks.mouseout),document.removeEventListener("visibilitychange",this.hooks.visibilitychange),this.hooks={},this._map_pane_observer.disconnect(),this.scene&&(this.scene.destroy(),this.scene=null)},createTile(e){var t=e.x+"/"+e.y+"/"+e.z,n=document.createElement("div");if(n.setAttribute("data-tile-key",t),n.style.width="256px",n.style.height="256px",this.options.showDebug){var i=document.createElement("div");i.textContent=t,i.style.position="absolute",i.style.left=0,i.style.top=0,i.style.color="white",i.style.fontSize="16px",i.style.textOutline="1px #000000",i.style.padding="8px",n.appendChild(i),n.style.borderStyle="solid",n.style.borderColor="white",n.style.borderWidth="1px"}return n},modifyScrollWheelBehavior(e){if(this.scene.view.continuous_zoom&&e.scrollWheelZoom&&!1!==this.options.modifyScrollWheel){e.options.zoomSnap=0;const a=e.scrollWheelZoom.enabled();e.scrollWheelZoom.disable(),i.Browser.chrome||i.Browser.safari?e.scrollWheelZoom._onWheelScroll=function(e){var t=i.DomEvent.getWheelDelta(e);this._delta+=t,this._lastMousePos=this._map.mouseEventToContainerPoint(e),this._performZoom(),i.DomEvent.stop(e)}:e.options.wheelDebounceTime=20;const l=(r=function(e){e._moveEnd(!0),e.fire("viewreset")},s=2*e.options.wheelDebounceTime,function(){var e=this,t=arguments;clearTimeout(o),o=setTimeout(function(){o=null,r.apply(e,t)},s)});Pn.scrollWheelZoom._performZoom||(Pn.scrollWheelZoom._performZoom=e.scrollWheelZoom._performZoom);var t=this;e.scrollWheelZoom._performZoom=function(){if(this._map===t._map){var e=this._map,i=e.getZoom();e._stop();var r=this._delta/(4*this._map.options.wheelPxPerZoomLevel);this._delta=0,i+r>=this._map.getMaxZoom()?r=this._map.getMaxZoom()-i:i+r<=this._map.getMinZoom()&&(r=this._map.getMinZoom()-i),r&&("center"===e.options.scrollWheelZoom?n(t,e.getCenter(),i+r):n(t,this._lastMousePos,i+r),l(e))}else Pn.scrollWheelZoom._performZoom.call(this)},a&&e.scrollWheelZoom.enable()}var r,s,o},modifyZoomBehavior(e){if(this.scene.view.continuous_zoom&&!1!==this.options.modifyZoomBehavior){var t=this;const r=function(t,r,s){e._stop();var o=e._zoom;r=i.latLng(r),s=void 0===s?o:s,s=Math.min(s,e.getMaxZoom());var a=Date.now();return e._moveStart(!0),function l(){var u=(Date.now()-a)/75;u<=1?(e._flyToFrame=i.Util.requestAnimFrame(l,e),n(t,r,o+(s-o)*u)):n(t,r,s)._moveEnd(!0)}.call(e),e};if(e.doubleClickZoom){const n=e.doubleClickZoom.enabled();e.doubleClickZoom.disable(),Pn.doubleClickZoom._onDoubleClick||(Pn.doubleClickZoom._onDoubleClick=e.doubleClickZoom._onDoubleClick),e.doubleClickZoom._onDoubleClick=function(e){if(this._map===t._map){var n=this._map,i=n.getZoom(),s=n.options.zoomDelta,o=e.originalEvent.shiftKey?i-s:i+s;"center"===n.options.doubleClickZoom?r(t,n.getCenter(),o):r(t,n.containerPointToLatLng(e.containerPoint),o)}else Pn.doubleClickZoom._onDoubleClick.call(this,e)},n&&e.doubleClickZoom.enable()}e._zoomAnimated&&(Pn.map._animateZoom||(Pn.map._animateZoom=e._animateZoom),e._animateZoom=function(e,n,s,o){this===t._map?(s&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=n,r(t,e,n)),setTimeout(i.Util.bind(this._onZoomTransitionEnd,this),250)):Pn.map._animateZoom.call(this,e,n,s,o)})}},updateView(){var t=this._map.getCenter();t.zoom=Math.max(Math.min(this._map.getZoom(),this._map.getMaxZoom()||e.Geo.default_view_max_zoom),this._map.getMinZoom()),this.scene.view.setView(t)},updateSize(){var e=this._map.getSize();this.scene.resizeMap(e.x,e.y)},resizeOnFirstVisible(){let e=!0;this.hooks.visibilitychange=()=>{e&&(e=!1,this.updateSize())},document.addEventListener("visibilitychange",this.hooks.visibilitychange)},onTangramViewUpdate(){if(!this._map||this._updating_tangram)return;let e=this._map.getCenter(),t=this.scene.view.center;e.lng===t.lng&&e.lat===t.lat&&this._map.getZoom()===this.scene.view.zoom||(this._updating_tangram=!0,this._map.setView([this.scene.view.center.lat,this.scene.view.center.lng],this.scene.view.zoom,{animate:!1}),this._updating_tangram=!1)},render(){this.scene&&this.scene.update()},reverseTransform(){if(this._map&&this.scene&&this.scene.container){var e=this._map.containerPointToLayerPoint([0,0]);i.DomUtil.setPosition(this.scene.container,e)}},setupSelectionEventHandlers(e){this._selection_events={},this._selection_radius=null,this.hooks.click=e=>{"function"==typeof this._selection_events.click&&this.scene.getFeatureAt(e.containerPoint,{radius:this._selection_radius}).then(t=>{let n=Object.assign({},t,{leaflet_event:e});this._selection_events.click(n)})},e.on("click",this.hooks.click),this.hooks.mousemove=e=>{"function"==typeof this._selection_events.hover&&this.scene.getFeatureAt(e.containerPoint,{radius:this._selection_radius}).then(t=>{let n=Object.assign({},t,{leaflet_event:e});this._selection_events.hover(n)})},e.on("mousemove",this.hooks.mousemove),this.hooks.mouseout=e=>{"function"==typeof this._selection_events.hover&&this._selection_events.hover({changed:!0,leaflet_event:e})},e.on("mouseout",this.hooks.mouseout)},setSelectionEvents(e,{radius:t}={}){this._selection_events=Object.assign(this._selection_events,e),this._selection_radius=void 0!==t?t:this._selection_radius},trackMapLayerCounts(e){this._updateMapLayerCount=()=>{let t=e.getPanes().mapPane.childNodes;this._mapLayerCount=0;for(let e=0;e<t.length;e++)this._mapLayerCount+=t[e].childNodes.length},e.on("layeradd layerremove overlayadd overlayremove",this._updateMapLayerCount),this._updateMapLayerCount()},updateTangramDebugSettings(){e.mergeDebugSettings(this.options.debug||{})}}),n=function(e,t,n){var r=e._map,s=e.scene,o=r.getZoomScale(n),a=r.getSize().divideBy(2),l=(t instanceof i.Point?t:r.latLngToContainerPoint(t)).subtract(a).multiplyBy(1-1/o),u=r.containerPointToLatLng(a.add(l));return s&&s.view.markUserInput(),r._move(u,n,{flyTo:!0})},"function"!=typeof(On=r.extend(o)).remove&&(On.prototype.remove=function(){this._map&&this._map.removeLayer(this),this.fire("remove")}),On.layerBaseClass=r,On.leafletVersion=s,new On(t)}}(t)},debug:{log:e.log,yaml:cn,Utils:e.Utils,Geo:e.Geo,Vector:e.Vector,DataSource:e.DataSource,GLSL:e.GLSL,ShaderProgram:e.ShaderProgram,VertexData:e.VertexData,Texture:e.Texture,Material:e.Material,Light:e.Light,Scene:Sn,WorkerBroker:e.WorkerBroker,Task:e.Task,StyleManager:e.StyleManager,StyleParser:e.StyleParser,TileID:e.TileID,Collision:e.Collision,FeatureSelection:e.FeatureSelection,TextCanvas:e.TextCanvas,debugSettings:e.debugSettings},version:e.version};return Cn});try{ix.debug.ESM=!0,ix.debug.SHA="d0b887d09a3645aad91a18bd3bd0362d74627da3","object"==typeof window&&(window.Tangram=ix)}catch(iy){}var sx,ox,ax,lx=ix,ux=Object.freeze({__proto__:null,default:lx});sx=L.Marker.prototype._initIcon,ox=L.Marker.prototype._setPos,ax="msTransform"===L.DomUtil.TRANSFORM,L.Marker.addInitHook(function(){var e=this.options.icon&&this.options.icon.options&&this.options.icon.options.iconAnchor;e&&(e=e[0]+"px "+e[1]+"px"),this.options.rotationOrigin=this.options.rotationOrigin||e||"center bottom",this.options.rotationAngle=this.options.rotationAngle||0,this.on("drag",function(e){e.target._applyRotation()})}),L.Marker.include({_initIcon:function(){sx.call(this)},_setPos:function(e){ox.call(this,e),this._applyRotation()},_applyRotation:function(){this.options.rotationAngle&&(this._icon.style[L.DomUtil.TRANSFORM+"Origin"]=this.options.rotationOrigin,ax?this._icon.style[L.DomUtil.TRANSFORM]="rotate("+this.options.rotationAngle+"deg)":this._icon.style[L.DomUtil.TRANSFORM]+=" rotateZ("+this.options.rotationAngle+"deg)")},setRotationAngle:function(e){return this.options.rotationAngle=e,this.update(),this},setRotationOrigin:function(e){return this.options.rotationOrigin=e,this.update(),this}});var cx,hx=Object.freeze({__proto__:null}),dx={exports:{}};var fx=(cx||(cx=1,function(e){!function(t,n){e.exports=t(Ka()),void 0!==n&&n.L&&(n.L.PolylineOffset=t(L))}(function(e){function t(e,t){if(e&&!(e.length<1))for(var n=1,i=e.length;n<i;n++)t(e[n-1],e[n])}function n(e,t){if(e.x===t.x)return e.y===t.y?null:{x:e.x};var n=(t.y-e.y)/(t.x-e.x);return{a:n,b:e.y-n*e.x}}function i(e,t,i,r){var s=n(e,t),o=n(i,r);if(null===s||null===o)return null;if(s.hasOwnProperty("x"))return o.hasOwnProperty("x")?null:{x:s.x,y:o.a*s.x+o.b};if(o.hasOwnProperty("x"))return{x:o.x,y:s.a*o.x+s.b};if(s.a===o.a)return null;var a=(o.b-s.b)/(s.a-o.a);return{x:a,y:s.a*a+s.b}}function r(e,t,n){return{x:e.x+t*Math.cos(n),y:e.y+t*Math.sin(n)}}var s={offsetPointLine:function(n,i){var s=[];return t(n,e.bind(function(e,t){if(e.x!==t.x||e.y!==t.y){var n=Math.atan2(e.y-t.y,e.x-t.x)-Math.PI/2;s.push({offsetAngle:n,original:[e,t],offset:[r(e,i,n),r(t,i,n)]})}},this)),s},offsetPoints:function(e,t){var n=this.offsetPointLine(e,t);return this.joinLineSegments(n,t)},joinSegments:function(e,t,n){return this.circularArc(e,t,n).filter(function(e){return e})},joinLineSegments:function(n,i){var r=[],s=n[0],o=n[n.length-1];return s&&o&&(r.push(s.offset[0]),t(n,e.bind(function(e,t){r=r.concat(this.joinSegments(e,t,i))},this)),r.push(o.offset[1])),r},segmentAsVector:function(e){return{x:e[1].x-e[0].x,y:e[1].y-e[0].y}},getSignedAngle:function(e,t){const n=this.segmentAsVector(e),i=this.segmentAsVector(t);return Math.atan2(n.x*i.y-n.y*i.x,n.x*i.x+n.y*i.y)},circularArc:function(e,t,n){if(e.offsetAngle===t.offsetAngle)return[e.offset[1]];const s=this.getSignedAngle(e.offset,t.offset);if(s*n>0&&s*this.getSignedAngle(e.offset,[e.offset[0],t.offset[1]])>0)return[i(e.offset[0],e.offset[1],t.offset[0],t.offset[1])];var o=[],a=e.original[1],l=n>0,u=l?t.offsetAngle:e.offsetAngle,c=l?e.offsetAngle:t.offsetAngle;c<u&&(c+=2*Math.PI);for(var h=Math.PI/8,d=u;d<c;d+=h)o.push(r(a,n,d));return o.push(r(a,n,c)),l?o.reverse():o}};return e.Polyline.include({_projectLatlngs:function(t,n,i){if(t.length>0&&t[0]instanceof e.LatLng){var r=t.map(e.bind(function(e){var t=this._map.latLngToLayerPoint(e);return i&&i.extend(t),t},this));this.options.offset&&(r=e.PolylineOffset.offsetPoints(r,this.options.offset)),n.push(r.map(function(t){return e.point(t.x,t.y)}))}else t.forEach(e.bind(function(e){this._projectLatlngs(e,n,i)},this))}}),e.Polyline.include({setOffset:function(e){return this.options.offset=e,this.redraw(),this}}),s},window)}(dx)),dx.exports),px=ye({__proto__:null,default:we(fx)},[fx]),mx=function(){return!0};Xa.Map.SelectArea=Xa.Map.BoxZoom.extend({statics:{SELECT_AREA_SELECTED:"selectarea:selected",SELECT_AREA_START:"selectarea:start",SELECT_AREA_TOGGLED:"selectarea:toggled"},options:{shiftKey:!1,ctrlKey:!0,validate:mx,autoDisable:!1,cursor:"crosshair"},initialize:function(e,t){Xa.Util.setOptions(this,t||{}),Xa.Map.BoxZoom.prototype.initialize.call(this,e),this._validate=null,this._moved=!1,this._autoDisable=!this.options.ctrlKey&&this.options.autoDisable,this._lastLayerPoint=null,this._beforeCursor=null,this.setValidate(this.options.validate),this.setAutoDisable(this.options.autoDisable)},setValidate:function(e){var t=this;return"function"!=typeof e&&(e=mx),this._validate=function(n){return e.call(t,n)},this},setAutoDisable:function(e){this._autoDisable=!!e},setControlKey:function(e){var t=this._enabled;t&&this.disable(),this.options.ctrlKey=!!e,e&&(this.options.shiftKey=!1),t&&this.enable()},setShiftKey:function(e){var t=this._enabled;t&&this.disable(),this.options.shiftKey=!!e,e&&(this.options.ctrlKey=!1),t&&this.enable()},enable:function(e,t){this.options.shiftKey?this._map.boxZoom&&this._map.boxZoom.disable():this.options.ctrlKey||this._map.dragging.disable(),Xa.Map.BoxZoom.prototype.enable.call(this),this.options.ctrlKey||this._setCursor(),e&&this.setValidate(e),this.setAutoDisable(t),this._map.fire(Xa.Map.SelectArea.SELECT_AREA_TOGGLED)},disable:function(){Xa.Map.BoxZoom.prototype.disable.call(this),this.options.ctrlKey||this._restoreCursor(),this.options.shiftKey?this._map.boxZoom&&this._map.boxZoom.enable():this._map.dragging.enable(),this._map.fire(Xa.Map.SelectArea.SELECT_AREA_TOGGLED)},addHooks:function(){Xa.Map.BoxZoom.prototype.addHooks.call(this),Xa.DomEvent.on(document,"keyup",this._onKeyUp,this).on(document,"keydown",this._onKeyPress,this).on(document,"contextmenu",this._onMouseDown,this).on(window,"blur",this._onBlur,this),this._map.on("dragstart",this._onMouseDown,this)},removeHooks:function(){Xa.Map.BoxZoom.prototype.removeHooks.call(this),Xa.DomEvent.off(document,"keyup",this._onKeyUp,this).off(document,"keydown",this._onKeyPress,this).off(document,"contextmenu",this._onMouseDown,this).off(window,"blur",this._onBlur,this),this._map.off("dragstart",this._onMouseDown,this)},_onMouseDown:function(e){if(this._moved=!1,this._lastLayerPoint=null,this.options.shiftKey&&!e.shiftKey||this.options.ctrlKey&&!e.ctrlKey||1!==e.which&&1!==e.button)return!1;Xa.DomEvent.stop(e);var t=this._map.mouseEventToLayerPoint(e);if(!this._validate(t))return!1;Xa.DomUtil.disableTextSelection(),Xa.DomUtil.disableImageDrag(),this._startLayerPoint=t,Xa.DomEvent.on(document,"mousemove",this._onMouseMove,this).on(document,"mouseup",this._onMouseUp,this).on(document,"keydown",this._onKeyDown,this)},_onMouseMove:function(e){this._moved||(this._box=Xa.DomUtil.create("div","leaflet-zoom-box",this._pane),Xa.DomUtil.setPosition(this._box,this._startLayerPoint),this._map.fire(Xa.Map.SelectArea.SELECT_AREA_START));var t=this._startLayerPoint,n=this._box,i=this._map.mouseEventToLayerPoint(e),r=i.subtract(t);if(this._validate(i)){this._lastLayerPoint=i;var s=new Xa.Point(Math.min(i.x,t.x),Math.min(i.y,t.y));Xa.DomUtil.setPosition(n,s),this._moved=!0,n.style.width=Math.max(0,Math.abs(r.x)-4)+"px",n.style.height=Math.max(0,Math.abs(r.y)-4)+"px"}},_onKeyUp:function(e){27===e.keyCode?this._moved&&this._box&&this._finish():this.options.ctrlKey&&(this._restoreCursor(),this._map.dragging.enable())},_onKeyPress:function(e){this.options.ctrlKey&&(e.ctrlKey||"dragstart"===e.type)&&null===this._beforeCursor&&(this._setCursor(),this._map.dragging._draggable._onUp(e),this._map.dragging.disable())},_onBlur:function(e){this._restoreCursor(),this._map.dragging.enable()},_setCursor:function(){this._beforeCursor=this._container.style.cursor,this._container.style.cursor=this.options.cursor},_restoreCursor:function(){this._container.style.cursor=this._beforeCursor,this._beforeCursor=null},_onMouseUp:function(e){this._finish();var t=this._map,n=this._lastLayerPoint;if(n&&!this._startLayerPoint.equals(n)){Xa.DomEvent.stop(e);var i=t.layerPointToLatLng(this._startLayerPoint),r=t.layerPointToLatLng(n),s=new Xa.LatLngBounds(i,r);this._autoDisable?this.disable():this._restoreCursor(),this._moved=!1,Xa.Util.requestAnimFrame(function(){t.fire(Xa.Map.SelectArea.SELECT_AREA_SELECTED,{bounds:s,start:i,end:r})})}}}),Xa.Map.mergeOptions({selectArea:!1}),Xa.Map.addInitHook("addHandler","selectArea",Xa.Map.SelectArea);const _x=Xa.Map.SelectArea;var gx=Object.freeze({__proto__:null,default:_x});function yx(){return!0}Ya.SVG.include({_resetTransformPath:function(e){e._path.setAttributeNS(null,"transform","")},transformPath:function(e,t){e._path.setAttributeNS(null,"transform","matrix("+t.join(" ")+")")}}),Ya.SVG.include(Ya.Browser.vml?{_resetTransformPath:function(e){e._skew&&(e._skew.on=!1,e._path.removeChild(e._skew),e._skew=null)},transformPath:function(e,t){let n=e._skew;n||(n=Ya.SVG.create("skew"),e._path.appendChild(n),n.style.behavior="url(#default#VML)",e._skew=n);const i=t[0].toFixed(8)+" "+t[1].toFixed(8)+" "+t[2].toFixed(8)+" "+t[3].toFixed(8)+" 0 0",r=Math.floor(t[4]).toFixed()+", "+Math.floor(t[5]).toFixed(),s=this._path.style;let o=parseFloat(s.left),a=parseFloat(s.top),l=parseFloat(s.width),u=parseFloat(s.height);isNaN(o)&&(o=0),isNaN(a)&&(a=0),(isNaN(l)||!l)&&(l=1),(isNaN(u)||!u)&&(u=1);const c=(-o/l-.5).toFixed(8)+" "+(-a/u-.5).toFixed(8);n.on="f",n.matrix=i,n.origin=c,n.offset=r,n.on=!0}}:{}),Ya.Canvas.include({_resetTransformPath:function(e){this._containerCopy&&(delete this._containerCopy,e._containsPoint_&&(e._containsPoint=e._containsPoint_,delete e._containsPoint_,this._requestRedraw(e)))},transformPath:function(e,t){let n=this._containerCopy;const i=this._ctx;let r;const s=Ya.Browser.retina?2:1,o=this._bounds,a=o.getSize(),l=o.min;n||(n=this._containerCopy=document.createElement("canvas"),r=n.getContext("2d"),n.width=s*a.x,n.height=s*a.y,this._removePath(e),this._redraw(),r.translate(s*o.min.x,s*o.min.y),r.drawImage(this._container,0,0),this._initPath(e),e._containsPoint_=e._containsPoint,e._containsPoint=yx),i.save(),i.clearRect(l.x,l.y,a.x*s,a.y*s),i.setTransform(1,0,0,1,0,0),i.restore(),i.save(),i.drawImage(this._containerCopy,0,0,a.x,a.y),i.transform.apply(i,t),this._drawing=!0,e._updatePath(),this._drawing=!1,i.restore()}}),
|
|
27
|
-
/**
|
|
28
|
-
* Leaflet vector features drag functionality
|
|
29
|
-
* @author Alexander Milevski <info@w8r.name>
|
|
30
|
-
* @preserve
|
|
31
|
-
*/
|
|
32
|
-
Ya.Path.include({_transform:function(e){return this._renderer&&(e?this._renderer.transformPath(this,e):(this._renderer._resetTransformPath(this),this._update())),this},_onMouseClick:function(e){this.dragging&&this.dragging.moved()||this._map.dragging&&this._map.dragging.moved()||this._fireMouseEvent(e)}});const vx={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},bx={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"};function xx(e,t){const n=e.x-t.x,i=e.y-t.y;return Math.sqrt(n*n+i*i)}Ya.Handler.PathDrag=Ya.Handler.extend({statics:{DRAGGING_CLS:"leaflet-path-draggable"},initialize:function(e){this._path=e,this._matrix=null,this._startPoint=null,this._dragStartPoint=null,this._mapDraggingWasEnabled=!1,this._path._dragMoved=!1},addHooks:function(){this._path.on("mousedown",this._onDragStart,this),this._path.options.className=this._path.options.className?this._path.options.className+" "+Ya.Handler.PathDrag.DRAGGING_CLS:Ya.Handler.PathDrag.DRAGGING_CLS,this._path._path&&Ya.DomUtil.addClass(this._path._path,Ya.Handler.PathDrag.DRAGGING_CLS)},removeHooks:function(){this._path.off("mousedown",this._onDragStart,this),this._path.options.className=this._path.options.className.replace(new RegExp("\\s+"+Ya.Handler.PathDrag.DRAGGING_CLS),""),this._path._path&&Ya.DomUtil.removeClass(this._path._path,Ya.Handler.PathDrag.DRAGGING_CLS)},moved:function(){return this._path._dragMoved},_onDragStart:function(e){const t=e.originalEvent._simulated?"touchstart":e.originalEvent.type;this._mapDraggingWasEnabled=!1,this._startPoint=e.containerPoint.clone(),this._dragStartPoint=e.containerPoint.clone(),this._matrix=[1,0,0,1,0,0],Ya.DomEvent.stop(e.originalEvent),Ya.DomUtil.addClass(this._path._renderer._container,"leaflet-interactive"),Ya.DomEvent.on(document,bx[t],this._onDrag,this).on(document,vx[t],this._onDragEnd,this),this._path._map.dragging.enabled()&&(this._path._map.dragging.disable(),this._mapDraggingWasEnabled=!0),this._path._dragMoved=!1,this._path._popup&&this._path._popup.close(),this._replaceCoordGetters(e)},_onDrag:function(e){Ya.DomEvent.stop(e);const t=e.touches&&e.touches.length>=1?e.touches[0]:e,n=this._path._map.mouseEventToContainerPoint(t);if("touchmove"===e.type&&!this._path._dragMoved&&this._dragStartPoint.distanceTo(n)<=this._path._map.options.tapTolerance)return;const i=n.x,r=n.y,s=i-this._startPoint.x,o=r-this._startPoint.y;(s||o)&&(this._path._dragMoved||(this._path._dragMoved=!0,this._path.options.interactive=!1,this._path._map.dragging._draggable._moved=!0,this._path.fire("dragstart",e),this._path.bringToFront()),this._matrix[4]+=s,this._matrix[5]+=o,this._startPoint.x=i,this._startPoint.y=r,this._path.fire("predrag",e),this._path._transform(this._matrix),this._path.fire("drag",e))},_onDragEnd:function(e){const t=this._path._map.mouseEventToContainerPoint(e),n=this.moved();if(n&&(this._transformPoints(this._matrix),this._path._updatePath(),this._path._project(),this._path._transform(null),Ya.DomEvent.stop(e)),Ya.DomEvent.off(document,"mousemove touchmove",this._onDrag,this),Ya.DomEvent.off(document,"mouseup touchend",this._onDragEnd,this),this._restoreCoordGetters(),n){this._path.fire("dragend",{distance:xx(this._dragStartPoint,t)});const e=this._path._containsPoint;this._path._containsPoint=Ya.Util.falseFn,Ya.Util.requestAnimFrame(function(){this._path._dragMoved=!1,this._path.options.interactive=!0,this._path._containsPoint=e},this)}this._mapDraggingWasEnabled&&this._path._map.dragging.enable()},_transformPoints:function(e,t){const n=this._path,i=L.point(e[4],e[5]),r=n._map.options.crs,s=r.transformation,o=r.scale(n._map.getZoom()),a=r.projection,l=s.untransform(i,o).subtract(s.untransform(Ya.point(0,0),o)),u=!t;if(n._bounds=new Ya.LatLngBounds,n._point)t=a.unproject(a.project(n._latlng)._add(l)),u&&(n._latlng=t,n._point._add(i));else if(n._rings||n._parts){const e=n._rings||n._parts;let r=n._latlngs;t=t||r,Ya.Util.isArray(r[0])||(r=[r],t=[t]);for(let s=0,o=e.length;s<o;s++){t[s]=t[s]||[];for(let o=0,c=e[s].length;o<c;o++){const c=r[s][o];t[s][o]=a.unproject(a.project(c)._add(l)),u&&(n._bounds.extend(r[s][o]),e[s][o]._add(i))}}}return t},_replaceCoordGetters:function(){this._path.getLatLng?(this._path.getLatLng_=this._path.getLatLng,this._path.getLatLng=Ya.Util.bind(function(){return this.dragging._transformPoints(this.dragging._matrix,{})},this._path)):this._path.getLatLngs&&(this._path.getLatLngs_=this._path.getLatLngs,this._path.getLatLngs=Ya.Util.bind(function(){return this.dragging._transformPoints(this.dragging._matrix,[])},this._path))},_restoreCoordGetters:function(){this._path.getLatLng_?(this._path.getLatLng=this._path.getLatLng_,delete this._path.getLatLng_):this._path.getLatLngs_&&(this._path.getLatLngs=this._path.getLatLngs_,delete this._path.getLatLngs_)}}),Ya.Handler.PathDrag.makeDraggable=function(e){return e.dragging=new Ya.Handler.PathDrag(e),e},Ya.Path.prototype.makeDraggable=function(){return Ya.Handler.PathDrag.makeDraggable(this)},Ya.Path.addInitHook(function(){this.options.draggable?(this.options.interactive=!0,this.dragging||Ya.Handler.PathDrag.makeDraggable(this),this.dragging.enable()):this.dragging&&this.dragging.disable()});const wx=Ya.Handler.PathDrag;var Ex,Ax=Object.freeze({__proto__:null,default:wx}),Tx={exports:{}};var kx=(Ex||(Ex=1,function(e){!function(t,n){e.exports=t(Ka()),void 0!==n&&n.L&&(n.L.Arrow=t(L))}(function(e){const t=e.FeatureGroup.extend({options:{distanceUnit:"km",stretchFactor:1,arrowheadLength:4,arrowheadClosingLine:!1,arrowheadDegree:155,clickableWidth:10,validator:function(e){return void 0!==e.latlng&&void 0!==e.distance&&!isNaN(e.distance)},colorScheme:function(){return this.color},circleRadiusInvalidPoint:1e3,color:"#333",opacity:.9,fillOpacity:.9,weight:4,smoothFactor:0,radius:5,defaultPointOptions:{stroke:!1,fillOpacity:.8,fillColor:"#111",radius:7},invalidPointOptions:{stroke:!1,fillOpacity:.8,fillColor:"red",radius:7},drawSourceMarker:!1,sourceMarkerOptions:{stroke:!1,fillOpacity:1,fillColor:"#333",radius:5}},initialize:function(t,n){e.Util.setOptions(this,n),this.setData(t)},onAdd:function(e){this._map=e,this.redraw(),e.on("viewreset",this._reset,this)},onRemove:function(){for(const e in this._layers)this._layers.hasOwnProperty(e)&&this._map.removeLayer(this._layers[e]);void 0!==this._sourceMarker&&this._map.removeLayer(this._sourceMarker),this._map.off("viewreset",this._reset,this)},redraw:function(){if(this._map)if(this._layers={},"function"==typeof this.options.popupContent&&this.bindPopup(this.options.popupContent(this._data)),this._data.valid&&"function"==typeof this.options.colorScheme&&(this.options.color=this.options.colorScheme(this._data)),this._data.distance=parseFloat(this._data.distance),this._data.valid&&this._data.distance&&this._data.angle){const t=[this._data.latlng,this._calculateEndPoint(this._data.latlng,this._data.distance,this._data.angle)],n=this._calculateArrowArray(t[1]),i=e.Util.setOptions({},this.pathOptions);i.opacity=0,i.weight=this.options.clickableWidth;const r=new e.Polyline([t,n],i),s=new e.Polyline([t,n],this.options);this.addLayer(r),this.addLayer(s),this.options.drawSourceMarker&&(void 0===this._sourceMarker?(this.options.sourceMarkerOptions.fillColor=this.color,this._sourceMarker=e.circleMarker(this._data.latlng,this.options.sourceMarkerOptions)):this._sourceMarker.setLatLng(this._data.latlng))}else{let t;const n=this._data.valid?this.options.defaultPointOptions:this.options.invalidPointOptions;t="km"===this.options.distanceUnit.toLowerCase()?e.circle(this._data.latlng,this.options.radius/10,n):e.circleMarker(this._data.latlng,n),this.addLayer(t)}},setAngle:function(e){isNaN(e)?this._data.angle=0:this.options.isWindDegree?(this._data.angle=e-180,"px"===this.options.distanceUnit.toLowerCase()&&(this._data.angle-=90)):this._data.angle=e,this.redraw()},setDistance:function(e){isNaN(e)?this._data.distance=0:this._data.distance=parseFloat(e),this.redraw()},setData:function(e){this._data=e,this.options.validator(this._data)?(this._data.valid=!0,this.setAngle(e.degree)):(this._data.valid=!1,this._data.distance=NaN,this._data.degree=NaN)},_reset:function(){"px"===this.options.distanceUnit.toLowerCase()&&this.redraw()},_calculateEndPoint:function(t,n,i){let r=n*this.options.stretchFactor,s=Math.PI/180,o=180/Math.PI;if("km"===this.options.distanceUnit.toLowerCase()){const n=i*s;r/=6378.137;const a=Math.acos(Math.cos(r)*Math.cos((90-t.lat)*s)+Math.sin((90-t.lat)*s)*Math.sin(r)*Math.cos(n)),l=Math.asin(Math.sin(r)*Math.sin(n)/Math.sin(a));return new e.LatLng(90-a*o,l*o+t.lng)}if("px"===this.options.distanceUnit.toLowerCase()){const n=this._map.latLngToLayerPoint(t),o=i*s,a=e.point(Math.cos(o)*r,Math.sin(o)*r),l=n.add(a);return this._map.layerPointToLatLng(l)}throw Error("calculate end point undefined for distanceUnit: "+this.options.distanceUnit)},_calculateArrowArray:function(t){const n=this._data.angle;void 0!==t.length&&(t=new e.LatLng(t));const i=this._calculateEndPoint(t,this.options.arrowheadLength,n-this.options.arrowheadDegree),r=[i,t,this._calculateEndPoint(t,this.options.arrowheadLength,n+this.options.arrowheadDegree)];return this.options.arrowheadClosingLine&&r.push(i),r}});return t},window)}(Tx)),Tx.exports),Sx=ye({__proto__:null,default:we(kx)},[kx]);export{Tu as API_METHODS,eh as Accordion,Ch as AlertDialog,Go as AlertStore,gu as ApiService,Ib as AuthPage,uu as AuthStore,wh as Button,ay as CSVUploader,Rh as Card,lf as Checkbox,yf as CopyText,Fb as DartcomAuthProvider,jb as DartcomInitializeProvider,Yb as DartcomLocalizationProvider,_u as DartcomMobxProvider,ex as DartcomProviders,Af as DateField,Sh as DeleteButton,Ym as DragList,h_ as DraggableContainer,__ as ErrorBoundary,kb as ExcelUploader,xf as Form,bf as FormErrorMessage,yu as GlobalConfig,Th as IconButton,g_ as Input,Hg as LeafletLayer,kf as List,Kg as Loader,Qa as MapService,Xg as Modal,hu as ModalStore,Tf as NoData,ve as Operations,ku as PanelsNames,of as Paragraph,fu as RootStore,Qg as Select,y_ as SourceLayers,mu as StoreContext,Jg as Tabs,Wg as TangramLayer,v_ as TangramSourceNames,Ef as TextField,Ph as UploadButton,xe as _testApiKeys,$o as alertStore,_g as allTrafficSigns,Xc as arraySchema,cu as authStore,E_ as cameraConfig,og as catIds,dn as copyInformation,Jc as dateRequiredSchema,Qc as dateSchema,un as encodeString,w_ as getAdminAreaLayers,Ng as getAllLayers,Lg as getAllPointLayers,Rg as getAllPolygonLayers,Mg as getAllPolylineLayers,zg as getBackendDate,b_ as getBuildingLayers,x_ as getBuiltupAreaLayers,A_ as getCameraLayers,T_ as getCityPOILayers,S_ as getConditionLayers,ag as getDefaultPOI,mn as getEntityNames,O_ as getFacilityAreaLayers,_n as getImageSrc,L_ as getLanduseAreaGeometryLayer,M_ as getLanduseAreaLabelLayer,N_ as getLanduseAreaLayers,z_ as getLaneMarkingArrowLayers,Dg as getLayerModalsNames,Pg as getLayerName,H_ as getLinkLayers,Y_ as getNatureFieldLayers,J_ as getNatureForestGeometryLayer,eg as getNatureForestLayers,pn as getNewId,tg as getOceanAreaLayers,ng as getOneWayLayers,cg as getPOILayers,lg as getPOITypeLayer,rg as getPillarLayers,hg as getPointAddressLayers,dg as getRailroadLayers,Hc as getStringRequiredSchema,Wc as getStringSchema,yg as getTrafficSignImgSrc,gg as getTrafficSignLayers,xg as getTrafficSignalLayers,fn as getUniqueKey,cn as getUrlencodedBody,Cg as getValidLayer,wg as getWaterAreaLayers,Eg as getWaterLinkLayers,R_ as landuseAreaFeatureTypes,P_ as landuseAreaLayerGeometryData,C_ as landuseAreaLayerLabelData,Zo as localStateService,Za as localizationService,qa as loggerService,Ja as mapService,du as modalStore,Yg as modalStyle,Yc as numberRequiredSchema,Kc as numberSchema,vg as parseTrafficSignCSVFile,ig as pillarConfig,lu as queryService,pu as rootStore,hn as showSnackbar,Fg as sourceUrl,sg as text_source,Ig as tile_size,fg as trafficSignConfig,bg as trafficSignalConfig,pg as trafficSigns,mg as trafficSignsDop,be as useDeviceType,wf as useFormContext,vu as useGetUser,bu as useLazyGetUser,wu as useShowErrorSnackbar,xu as useShowSnackbar,Eu as useSignIn,Au as useSignOut};
|
|
33
|
-
//# sourceMappingURL=index.esm.js.map
|
|
1
|
+
export{Operations}from"./lib/types.esm.js";export{useDeviceType}from"./lib/hooks/useDeviceType.esm.js";export{useGetUser,useLazyGetUser}from"./lib/hooks/useGetUser.esm.js";export{useShowErrorSnackbar}from"./lib/hooks/useShowErrorSnackbar.esm.js";export{useShowSnackbar}from"./lib/hooks/useShowSnackbar.esm.js";export{useSignIn}from"./lib/hooks/useSignIn.esm.js";export{useSignOut}from"./lib/hooks/useSignOut.esm.js";export{copyInformation,encodeString,getEntityNames,getImageSrc,getNewId,getUniqueKey,getUrlencodedBody,showSnackbar}from"./lib/utils.esm.js";export{_testApiKeys}from"./configs/global/constants.esm.js";export{GlobalConfig}from"./configs/global/global.esm.js";export{API_METHODS}from"./constants/api.esm.js";export{PanelsNames}from"./constants/map.esm.js";export{arraySchema,dateRequiredSchema,dateSchema,getStringRequiredSchema,getStringSchema,numberRequiredSchema,numberSchema}from"./constants/schema.esm.js";export{default as Accordion}from"./components/accordion/accordion.esm.js";export{default as AlertDialog}from"./components/alert-dialog/alert-dialog.esm.js";export{default as Button}from"./components/buttons/button/button.esm.js";export{default as DeleteButton}from"./components/buttons/delete/delete.esm.js";export{default as IconButton}from"./components/buttons/icon/icon.esm.js";export{default as UploadButton}from"./components/buttons/upload/upload.esm.js";export{default as Card}from"./components/card/card.esm.js";export{default as Checkbox}from"./components/checkbox/checkbox.esm.js";export{default as CopyText}from"./components/copy-text/copy-text.esm.js";export{default as DateField}from"./components/date-field/date-field.esm.js";export{default as DragList}from"./components/drag-list/drag-list.esm.js";export{default as DraggableContainer}from"./components/draggable-container/draggable-container.esm.js";export{default as ErrorBoundary}from"./components/error-boundary/error-boundary.esm.js";export{default as FormErrorMessage}from"./components/form/error-message/error-message.esm.js";export{default as Form}from"./components/form/form.esm.js";export{useFormContext}from"./components/form/hooks/useFormContext.esm.js";export{default as Input}from"./components/input/input.esm.js";export{SourceLayers,TangramSourceNames}from"./components/layers/leaflet/lib/types.esm.js";export{getAllLayers,getAllPointLayers,getAllPolygonLayers,getAllPolylineLayers,getBackendDate,getLayerModalsNames,getLayerName,getValidLayer}from"./components/layers/leaflet/lib/utils.esm.js";export{sourceUrl,tile_size}from"./components/layers/leaflet/config/constants.esm.js";export{getBuildingLayers}from"./components/layers/leaflet/layers/building/utils.esm.js";export{getBuiltupAreaLayers}from"./components/layers/leaflet/layers/builtup-area/utils.esm.js";export{getAdminAreaLayers}from"./components/layers/leaflet/layers/admin-area/utils.esm.js";export{getCameraLayers}from"./components/layers/leaflet/layers/camera/lib/utils.esm.js";export{cameraConfig}from"./components/layers/leaflet/layers/camera/config/constants.esm.js";export{getCityPOILayers}from"./components/layers/leaflet/layers/city-POI/utils.esm.js";export{getConditionLayers}from"./components/layers/leaflet/layers/condition/utils.esm.js";export{getFacilityAreaLayers}from"./components/layers/leaflet/layers/facility-area/utils.esm.js";export{landuseAreaFeatureTypes,landuseAreaLayerGeometryData,landuseAreaLayerLabelData}from"./components/layers/leaflet/layers/landuse-area/constants.esm.js";export{getLanduseAreaGeometryLayer,getLanduseAreaLabelLayer,getLanduseAreaLayers}from"./components/layers/leaflet/layers/landuse-area/utils.esm.js";export{getLaneMarkingArrowLayers}from"./components/layers/leaflet/layers/lane-marking-arrow/utils.esm.js";export{getLinkLayers}from"./components/layers/leaflet/layers/link/utils.esm.js";export{getNatureFieldLayers}from"./components/layers/leaflet/layers/nature-field/utils.esm.js";export{getNatureForestGeometryLayer,getNatureForestLayers}from"./components/layers/leaflet/layers/nature-forest/utils.esm.js";export{getOceanAreaLayers}from"./components/layers/leaflet/layers/ocean-area/utils.esm.js";export{getOneWayLayers}from"./components/layers/leaflet/layers/one-way/utils.esm.js";export{getPillarLayers}from"./components/layers/leaflet/layers/pillar/lib/utils.esm.js";export{pillarConfig}from"./components/layers/leaflet/layers/pillar/config/constants.esm.js";export{catIds,text_source}from"./components/layers/leaflet/layers/POI/constants.esm.js";export{getDefaultPOI,getPOILayers,getPOITypeLayer}from"./components/layers/leaflet/layers/POI/utils.esm.js";export{getPointAddressLayers}from"./components/layers/leaflet/layers/point-address/utils.esm.js";export{getRailroadLayers}from"./components/layers/leaflet/layers/railroad/utils.esm.js";export{getTrafficSignImgSrc,getTrafficSignLayers,parseTrafficSignCSVFile}from"./components/layers/leaflet/layers/traffic-sign/lib/utils.esm.js";export{allTrafficSigns,trafficSignConfig,trafficSigns,trafficSignsDop}from"./components/layers/leaflet/layers/traffic-sign/config/constants.esm.js";export{getTrafficSignalLayers}from"./components/layers/leaflet/layers/traffic-signal/lib/utils.esm.js";export{trafficSignalConfig}from"./components/layers/leaflet/layers/traffic-signal/config/constants.esm.js";export{getWaterAreaLayers}from"./components/layers/leaflet/layers/water-area/utils.esm.js";export{getWaterLinkLayers}from"./components/layers/leaflet/layers/water-link/utils.esm.js";export{default as LeafletLayer}from"./components/layers/leaflet/leaflet.esm.js";export{TangramLayer}from"./components/layers/leaflet/services/tangram-layer.esm.js";export{default as List}from"./components/list/list.esm.js";export{default as Loader}from"./components/loader/loader.esm.js";export{default as Modal}from"./components/modal/modal.esm.js";export{modalStyle}from"./components/modal/styles.esm.js";export{default as NoData}from"./components/no-data/no-data.esm.js";export{default as Paragraph}from"./components/paragraph/paragraph.esm.js";export{default as Select}from"./components/select/select.esm.js";export{default as Tabs}from"./components/tabs/tabs.esm.js";export{default as TextField}from"./components/text-field/text-field.esm.js";export{CSVUploader}from"./components/uploader/csv/csv.esm.js";export{default as ExcelUploader}from"./components/uploader/excel/excel.esm.js";export{default as AuthPage}from"./pages/auth/auth.esm.js";export{default as DartcomAuthProvider}from"./providers/auth/auth.esm.js";export{default as DartcomInitializeProvider}from"./providers/initialize/initialize.esm.js";export{default as DartcomLocalizationProvider}from"./providers/localization/localization.esm.js";export{RootStore,rootStore}from"./providers/mobx/store.esm.js";export{AlertStore,alertStore}from"./providers/mobx/stores/alert.esm.js";export{AuthStore,authStore}from"./providers/mobx/stores/auth.esm.js";export{ModalStore,modalStore}from"./providers/mobx/stores/modal.esm.js";export{DartcomMobxProvider,StoreContext}from"./providers/mobx/mobx.esm.js";export{default as DartcomProviders}from"./providers/providers.esm.js";export{ApiService}from"./services/api/api.esm.js";export{localStateService}from"./services/local-state/local-state.esm.js";export{localizationService}from"./services/localization/localization.esm.js";export{loggerService}from"./services/logger/logger.esm.js";export{MapService,mapService}from"./services/map/map.esm.js";export{queryService}from"./services/query/query.esm.js";
|