@dartcom/ui-kit 3.4.1 → 3.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_commonjsHelpers.js +8 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/hoist-non-react-statics.cjs.js +6 -0
- package/dist/_virtual/hoist-non-react-statics.cjs.js.map +1 -0
- package/dist/_virtual/index.js +12 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/_virtual/index2.js +8 -0
- package/dist/_virtual/index2.js.map +1 -0
- package/dist/_virtual/index3.js +6 -0
- package/dist/_virtual/index3.js.map +1 -0
- package/dist/_virtual/index4.js +6 -0
- package/dist/_virtual/index4.js.map +1 -0
- package/dist/_virtual/index5.js +6 -0
- package/dist/_virtual/index5.js.map +1 -0
- package/dist/_virtual/index6.js +6 -0
- package/dist/_virtual/index6.js.map +1 -0
- package/dist/_virtual/react-is.development.js +6 -0
- package/dist/_virtual/react-is.development.js.map +1 -0
- package/dist/_virtual/react-is.development2.js +6 -0
- package/dist/_virtual/react-is.development2.js.map +1 -0
- package/dist/_virtual/react-is.development3.js +6 -0
- package/dist/_virtual/react-is.development3.js.map +1 -0
- package/dist/_virtual/react-is.production.js +6 -0
- package/dist/_virtual/react-is.production.js.map +1 -0
- package/dist/_virtual/react-is.production.min.js +6 -0
- package/dist/_virtual/react-is.production.min.js.map +1 -0
- package/dist/_virtual/react-is.production.min2.js +6 -0
- package/dist/_virtual/react-is.production.min2.js.map +1 -0
- package/dist/components/buttons/delete/delete.js +68 -0
- package/dist/components/buttons/delete/delete.js.map +1 -0
- package/dist/components/buttons/edit/edit.js +35 -0
- package/dist/components/buttons/edit/edit.js.map +1 -0
- package/dist/components/checkbox/checkbox.js +70 -0
- package/dist/components/checkbox/checkbox.js.map +1 -0
- package/dist/components/drag-list/drag-list.js +30 -0
- package/dist/components/drag-list/drag-list.js.map +1 -0
- package/dist/components/drag-list/draggable/draggable.js +34 -0
- package/dist/components/drag-list/draggable/draggable.js.map +1 -0
- package/dist/components/form/form.js +30 -0
- package/dist/components/form/form.js.map +1 -0
- package/dist/components/input/input.js +54 -0
- package/dist/components/input/input.js.map +1 -0
- package/dist/components/layers/leaflet/hooks/useGetLeafletLayer.js +51 -0
- package/dist/components/layers/leaflet/hooks/useGetLeafletLayer.js.map +1 -0
- package/dist/components/layers/leaflet/leaflet.js +42 -0
- package/dist/components/layers/leaflet/leaflet.js.map +1 -0
- package/dist/components/list/list.js +54 -0
- package/dist/components/list/list.js.map +1 -0
- package/dist/components/no-data/no-data.js +16 -0
- package/dist/components/no-data/no-data.js.map +1 -0
- package/dist/components/paragraph/paragraph.js +17 -0
- package/dist/components/paragraph/paragraph.js.map +1 -0
- package/dist/components/select/select.js +52 -0
- package/dist/components/select/select.js.map +1 -0
- package/dist/components/text-field/text-field.js +13 -0
- package/dist/components/text-field/text-field.js.map +1 -0
- package/dist/configs/global/constants.js +11 -0
- package/dist/configs/global/constants.js.map +1 -0
- package/dist/configs/global/global.js +63 -0
- package/dist/configs/global/global.js.map +1 -0
- package/dist/constants/api.js +10 -0
- package/dist/constants/api.js.map +1 -0
- package/dist/constants/map.js +10 -0
- package/dist/constants/map.js.map +1 -0
- package/dist/esm/types/components/checkbox/checkbox.stories.d.ts.map +1 -1
- package/dist/esm/types/components/dialog/dialog.d.ts.map +1 -1
- package/dist/esm/types/components/select/select.stories.d.ts.map +1 -1
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +11 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js.map +1 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +16 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/extends.js.map +1 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +12 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js.map +1 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +16 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js.map +1 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +12 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js.map +1 -0
- package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +65 -0
- package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js.map +1 -0
- package/dist/node_modules/@dnd-kit/core/dist/core.esm.js +3461 -0
- package/dist/node_modules/@dnd-kit/core/dist/core.esm.js.map +1 -0
- package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +535 -0
- package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.js.map +1 -0
- package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js +359 -0
- package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js.map +1 -0
- package/dist/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js +446 -0
- package/dist/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js.map +1 -0
- package/dist/node_modules/@emotion/hash/dist/emotion-hash.esm.js +60 -0
- package/dist/node_modules/@emotion/hash/dist/emotion-hash.esm.js.map +1 -0
- package/dist/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js +21 -0
- package/dist/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js.map +1 -0
- package/dist/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js +14 -0
- package/dist/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js.map +1 -0
- package/dist/node_modules/@emotion/react/dist/emotion-element-f0de968e.browser.esm.js +130 -0
- package/dist/node_modules/@emotion/react/dist/emotion-element-f0de968e.browser.esm.js.map +1 -0
- package/dist/node_modules/@emotion/react/dist/emotion-react.browser.esm.js +150 -0
- package/dist/node_modules/@emotion/react/dist/emotion-react.browser.esm.js.map +1 -0
- package/dist/node_modules/@emotion/serialize/dist/emotion-serialize.esm.js +232 -0
- package/dist/node_modules/@emotion/serialize/dist/emotion-serialize.esm.js.map +1 -0
- package/dist/node_modules/@emotion/sheet/dist/emotion-sheet.esm.js +141 -0
- package/dist/node_modules/@emotion/sheet/dist/emotion-sheet.esm.js.map +1 -0
- package/dist/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js +190 -0
- package/dist/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js.map +1 -0
- package/dist/node_modules/@emotion/styled/dist/emotion-styled.browser.esm.js +18 -0
- package/dist/node_modules/@emotion/styled/dist/emotion-styled.browser.esm.js.map +1 -0
- package/dist/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js +57 -0
- package/dist/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js.map +1 -0
- package/dist/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js +34 -0
- package/dist/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js.map +1 -0
- package/dist/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js +50 -0
- package/dist/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js.map +1 -0
- package/dist/node_modules/@mui/icons-material/esm/Delete.js +14 -0
- package/dist/node_modules/@mui/icons-material/esm/Delete.js.map +1 -0
- package/dist/node_modules/@mui/icons-material/esm/Edit.js +14 -0
- package/dist/node_modules/@mui/icons-material/esm/Edit.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Autocomplete/Autocomplete.js +1228 -0
- package/dist/node_modules/@mui/material/esm/Autocomplete/Autocomplete.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Autocomplete/autocompleteClasses.js +15 -0
- package/dist/node_modules/@mui/material/esm/Autocomplete/autocompleteClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Backdrop/Backdrop.js +231 -0
- package/dist/node_modules/@mui/material/esm/Backdrop/Backdrop.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Backdrop/backdropClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/Backdrop/backdropClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Box/Box.js +41 -0
- package/dist/node_modules/@mui/material/esm/Box/Box.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Box/boxClasses.js +10 -0
- package/dist/node_modules/@mui/material/esm/Box/boxClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Button/Button.js +710 -0
- package/dist/node_modules/@mui/material/esm/Button/Button.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Button/buttonClasses.js +15 -0
- package/dist/node_modules/@mui/material/esm/Button/buttonClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/ButtonBase/ButtonBase.js +472 -0
- package/dist/node_modules/@mui/material/esm/ButtonBase/ButtonBase.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/ButtonBase/Ripple.js +109 -0
- package/dist/node_modules/@mui/material/esm/ButtonBase/Ripple.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/ButtonBase/TouchRipple.js +353 -0
- package/dist/node_modules/@mui/material/esm/ButtonBase/TouchRipple.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/ButtonBase/buttonBaseClasses.js +15 -0
- package/dist/node_modules/@mui/material/esm/ButtonBase/buttonBaseClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/ButtonBase/touchRippleClasses.js +10 -0
- package/dist/node_modules/@mui/material/esm/ButtonBase/touchRippleClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/ButtonGroup/ButtonGroupButtonContext.js +36 -0
- package/dist/node_modules/@mui/material/esm/ButtonGroup/ButtonGroupButtonContext.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/ButtonGroup/ButtonGroupContext.js +36 -0
- package/dist/node_modules/@mui/material/esm/ButtonGroup/ButtonGroupContext.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Checkbox/Checkbox.js +304 -0
- package/dist/node_modules/@mui/material/esm/Checkbox/Checkbox.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Checkbox/checkboxClasses.js +15 -0
- package/dist/node_modules/@mui/material/esm/Checkbox/checkboxClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Chip/Chip.js +652 -0
- package/dist/node_modules/@mui/material/esm/Chip/Chip.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Chip/chipClasses.js +15 -0
- package/dist/node_modules/@mui/material/esm/Chip/chipClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/CircularProgress/CircularProgress.js +337 -0
- package/dist/node_modules/@mui/material/esm/CircularProgress/CircularProgress.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/CircularProgress/circularProgressClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/CircularProgress/circularProgressClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/DefaultPropsProvider/DefaultPropsProvider.js +28 -0
- package/dist/node_modules/@mui/material/esm/DefaultPropsProvider/DefaultPropsProvider.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Dialog/Dialog.js +535 -0
- package/dist/node_modules/@mui/material/esm/Dialog/Dialog.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Dialog/DialogContext.js +33 -0
- package/dist/node_modules/@mui/material/esm/Dialog/DialogContext.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Dialog/dialogClasses.js +15 -0
- package/dist/node_modules/@mui/material/esm/Dialog/dialogClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/DialogActions/DialogActions.js +121 -0
- package/dist/node_modules/@mui/material/esm/DialogActions/DialogActions.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/DialogActions/dialogActionsClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/DialogActions/dialogActionsClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/DialogContent/DialogContent.js +134 -0
- package/dist/node_modules/@mui/material/esm/DialogContent/DialogContent.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/DialogContent/dialogContentClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/DialogContent/dialogContentClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/DialogContentText/DialogContentText.js +101 -0
- package/dist/node_modules/@mui/material/esm/DialogContentText/DialogContentText.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/DialogContentText/dialogContentTextClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/DialogContentText/dialogContentTextClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/DialogTitle/DialogTitle.js +105 -0
- package/dist/node_modules/@mui/material/esm/DialogTitle/DialogTitle.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/DialogTitle/dialogTitleClasses.js +15 -0
- package/dist/node_modules/@mui/material/esm/DialogTitle/dialogTitleClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Fade/Fade.js +234 -0
- package/dist/node_modules/@mui/material/esm/Fade/Fade.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/FilledInput/FilledInput.js +540 -0
- package/dist/node_modules/@mui/material/esm/FilledInput/FilledInput.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/FilledInput/filledInputClasses.js +19 -0
- package/dist/node_modules/@mui/material/esm/FilledInput/filledInputClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/FormControl/FormControl.js +330 -0
- package/dist/node_modules/@mui/material/esm/FormControl/FormControl.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/FormControl/FormControlContext.js +36 -0
- package/dist/node_modules/@mui/material/esm/FormControl/FormControlContext.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/FormControl/formControlClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/FormControl/formControlClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/FormControl/formControlState.js +22 -0
- package/dist/node_modules/@mui/material/esm/FormControl/formControlState.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/FormControl/useFormControl.js +33 -0
- package/dist/node_modules/@mui/material/esm/FormControl/useFormControl.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/FormControlLabel/FormControlLabel.js +308 -0
- package/dist/node_modules/@mui/material/esm/FormControlLabel/FormControlLabel.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/FormControlLabel/formControlLabelClasses.js +15 -0
- package/dist/node_modules/@mui/material/esm/FormControlLabel/formControlLabelClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/FormHelperText/FormHelperText.js +211 -0
- package/dist/node_modules/@mui/material/esm/FormHelperText/FormHelperText.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/FormHelperText/formHelperTextClasses.js +15 -0
- package/dist/node_modules/@mui/material/esm/FormHelperText/formHelperTextClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/FormLabel/FormLabel.js +207 -0
- package/dist/node_modules/@mui/material/esm/FormLabel/FormLabel.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/FormLabel/formLabelClasses.js +15 -0
- package/dist/node_modules/@mui/material/esm/FormLabel/formLabelClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/GlobalStyles/GlobalStyles.js +31 -0
- package/dist/node_modules/@mui/material/esm/GlobalStyles/GlobalStyles.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Grow/Grow.js +287 -0
- package/dist/node_modules/@mui/material/esm/Grow/Grow.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/IconButton/IconButton.js +345 -0
- package/dist/node_modules/@mui/material/esm/IconButton/IconButton.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/IconButton/iconButtonClasses.js +15 -0
- package/dist/node_modules/@mui/material/esm/IconButton/iconButtonClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Input/Input.js +385 -0
- package/dist/node_modules/@mui/material/esm/Input/Input.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Input/inputClasses.js +19 -0
- package/dist/node_modules/@mui/material/esm/Input/inputClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/InputBase/InputBase.js +779 -0
- package/dist/node_modules/@mui/material/esm/InputBase/InputBase.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/InputBase/inputBaseClasses.js +15 -0
- package/dist/node_modules/@mui/material/esm/InputBase/inputBaseClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/InputBase/utils.js +37 -0
- package/dist/node_modules/@mui/material/esm/InputBase/utils.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/InputLabel/InputLabel.js +309 -0
- package/dist/node_modules/@mui/material/esm/InputLabel/InputLabel.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/InputLabel/inputLabelClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/InputLabel/inputLabelClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/List/List.js +159 -0
- package/dist/node_modules/@mui/material/esm/List/List.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/List/ListContext.js +36 -0
- package/dist/node_modules/@mui/material/esm/List/ListContext.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/List/listClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/List/listClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/ListItem/ListItem.js +414 -0
- package/dist/node_modules/@mui/material/esm/ListItem/ListItem.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/ListItem/listItemClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/ListItem/listItemClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/ListItemButton/listItemButtonClasses.js +10 -0
- package/dist/node_modules/@mui/material/esm/ListItemButton/listItemButtonClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/ListItemSecondaryAction/ListItemSecondaryAction.js +121 -0
- package/dist/node_modules/@mui/material/esm/ListItemSecondaryAction/ListItemSecondaryAction.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/ListItemSecondaryAction/listItemSecondaryActionClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/ListItemSecondaryAction/listItemSecondaryActionClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/ListSubheader/ListSubheader.js +192 -0
- package/dist/node_modules/@mui/material/esm/ListSubheader/ListSubheader.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/ListSubheader/listSubheaderClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/ListSubheader/listSubheaderClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Menu/Menu.js +364 -0
- package/dist/node_modules/@mui/material/esm/Menu/Menu.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Menu/menuClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/Menu/menuClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/MenuList/MenuList.js +315 -0
- package/dist/node_modules/@mui/material/esm/MenuList/MenuList.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Modal/Modal.js +415 -0
- package/dist/node_modules/@mui/material/esm/Modal/Modal.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Modal/ModalManager.js +220 -0
- package/dist/node_modules/@mui/material/esm/Modal/ModalManager.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Modal/modalClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/Modal/modalClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Modal/useModal.js +218 -0
- package/dist/node_modules/@mui/material/esm/Modal/useModal.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/NativeSelect/NativeSelectInput.js +271 -0
- package/dist/node_modules/@mui/material/esm/NativeSelect/NativeSelectInput.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/NativeSelect/nativeSelectClasses.js +15 -0
- package/dist/node_modules/@mui/material/esm/NativeSelect/nativeSelectClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/OutlinedInput/NotchedOutline.js +162 -0
- package/dist/node_modules/@mui/material/esm/OutlinedInput/NotchedOutline.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/OutlinedInput/OutlinedInput.js +454 -0
- package/dist/node_modules/@mui/material/esm/OutlinedInput/OutlinedInput.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/OutlinedInput/outlinedInputClasses.js +19 -0
- package/dist/node_modules/@mui/material/esm/OutlinedInput/outlinedInputClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Paper/Paper.js +196 -0
- package/dist/node_modules/@mui/material/esm/Paper/Paper.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Paper/paperClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/Paper/paperClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Popover/Popover.js +610 -0
- package/dist/node_modules/@mui/material/esm/Popover/Popover.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Popover/popoverClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/Popover/popoverClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Popper/BasePopper.js +400 -0
- package/dist/node_modules/@mui/material/esm/Popper/BasePopper.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Popper/Popper.js +234 -0
- package/dist/node_modules/@mui/material/esm/Popper/Popper.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Popper/popperClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/Popper/popperClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Portal/Portal.js +117 -0
- package/dist/node_modules/@mui/material/esm/Portal/Portal.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Select/Select.js +324 -0
- package/dist/node_modules/@mui/material/esm/Select/Select.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Select/SelectInput.js +701 -0
- package/dist/node_modules/@mui/material/esm/Select/SelectInput.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Select/selectClasses.js +15 -0
- package/dist/node_modules/@mui/material/esm/Select/selectClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Slide/Slide.js +361 -0
- package/dist/node_modules/@mui/material/esm/Slide/Slide.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/SvgIcon/SvgIcon.js +259 -0
- package/dist/node_modules/@mui/material/esm/SvgIcon/SvgIcon.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/SvgIcon/svgIconClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/SvgIcon/svgIconClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/TextField/TextField.js +481 -0
- package/dist/node_modules/@mui/material/esm/TextField/TextField.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/TextField/textFieldClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/TextField/textFieldClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/TextareaAutosize/TextareaAutosize.js +281 -0
- package/dist/node_modules/@mui/material/esm/TextareaAutosize/TextareaAutosize.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Typography/Typography.js +295 -0
- package/dist/node_modules/@mui/material/esm/Typography/Typography.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Typography/typographyClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/Typography/typographyClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/Unstable_TrapFocus/FocusTrap.js +357 -0
- package/dist/node_modules/@mui/material/esm/Unstable_TrapFocus/FocusTrap.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/colors/blue.js +13 -0
- package/dist/node_modules/@mui/material/esm/colors/blue.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/colors/common.js +11 -0
- package/dist/node_modules/@mui/material/esm/colors/common.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/colors/green.js +14 -0
- package/dist/node_modules/@mui/material/esm/colors/green.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/colors/grey.js +23 -0
- package/dist/node_modules/@mui/material/esm/colors/grey.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/colors/lightBlue.js +13 -0
- package/dist/node_modules/@mui/material/esm/colors/lightBlue.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/colors/orange.js +13 -0
- package/dist/node_modules/@mui/material/esm/colors/orange.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/colors/purple.js +14 -0
- package/dist/node_modules/@mui/material/esm/colors/purple.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/colors/red.js +13 -0
- package/dist/node_modules/@mui/material/esm/colors/red.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/internal/SwitchBase.js +383 -0
- package/dist/node_modules/@mui/material/esm/internal/SwitchBase.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/internal/svg-icons/ArrowDropDown.js +14 -0
- package/dist/node_modules/@mui/material/esm/internal/svg-icons/ArrowDropDown.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/internal/svg-icons/Cancel.js +14 -0
- package/dist/node_modules/@mui/material/esm/internal/svg-icons/Cancel.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/internal/svg-icons/CheckBox.js +14 -0
- package/dist/node_modules/@mui/material/esm/internal/svg-icons/CheckBox.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/internal/svg-icons/CheckBoxOutlineBlank.js +14 -0
- package/dist/node_modules/@mui/material/esm/internal/svg-icons/CheckBoxOutlineBlank.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/internal/svg-icons/Close.js +14 -0
- package/dist/node_modules/@mui/material/esm/internal/svg-icons/Close.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/internal/svg-icons/IndeterminateCheckBox.js +14 -0
- package/dist/node_modules/@mui/material/esm/internal/svg-icons/IndeterminateCheckBox.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/internal/switchBaseClasses.js +12 -0
- package/dist/node_modules/@mui/material/esm/internal/switchBaseClasses.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/createColorScheme.js +56 -0
- package/dist/node_modules/@mui/material/esm/styles/createColorScheme.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/createGetSelector.js +68 -0
- package/dist/node_modules/@mui/material/esm/styles/createGetSelector.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/createMixins.js +23 -0
- package/dist/node_modules/@mui/material/esm/styles/createMixins.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/createPalette.js +340 -0
- package/dist/node_modules/@mui/material/esm/styles/createPalette.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/createTheme.js +106 -0
- package/dist/node_modules/@mui/material/esm/styles/createTheme.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/createThemeNoVars.js +157 -0
- package/dist/node_modules/@mui/material/esm/styles/createThemeNoVars.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/createThemeWithVars.js +428 -0
- package/dist/node_modules/@mui/material/esm/styles/createThemeWithVars.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/createTransitions.js +98 -0
- package/dist/node_modules/@mui/material/esm/styles/createTransitions.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/createTypography.js +100 -0
- package/dist/node_modules/@mui/material/esm/styles/createTypography.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/defaultTheme.js +11 -0
- package/dist/node_modules/@mui/material/esm/styles/defaultTheme.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/excludeVariablesFromRoot.js +11 -0
- package/dist/node_modules/@mui/material/esm/styles/excludeVariablesFromRoot.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/getOverlayAlpha.js +17 -0
- package/dist/node_modules/@mui/material/esm/styles/getOverlayAlpha.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/identifier.js +8 -0
- package/dist/node_modules/@mui/material/esm/styles/identifier.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/rootShouldForwardProp.js +10 -0
- package/dist/node_modules/@mui/material/esm/styles/rootShouldForwardProp.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/shadows.js +16 -0
- package/dist/node_modules/@mui/material/esm/styles/shadows.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/shouldSkipGeneratingVar.js +12 -0
- package/dist/node_modules/@mui/material/esm/styles/shouldSkipGeneratingVar.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/slotShouldForwardProp.js +11 -0
- package/dist/node_modules/@mui/material/esm/styles/slotShouldForwardProp.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/stringifyTheme.js +60 -0
- package/dist/node_modules/@mui/material/esm/styles/stringifyTheme.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/styled.js +19 -0
- package/dist/node_modules/@mui/material/esm/styles/styled.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/useTheme.js +41 -0
- package/dist/node_modules/@mui/material/esm/styles/useTheme.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/styles/zIndex.js +19 -0
- package/dist/node_modules/@mui/material/esm/styles/zIndex.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/transitions/utils.js +19 -0
- package/dist/node_modules/@mui/material/esm/transitions/utils.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/useAutocomplete/useAutocomplete.js +1065 -0
- package/dist/node_modules/@mui/material/esm/useAutocomplete/useAutocomplete.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/useLazyRipple/useLazyRipple.js +112 -0
- package/dist/node_modules/@mui/material/esm/useLazyRipple/useLazyRipple.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/utils/capitalize.js +10 -0
- package/dist/node_modules/@mui/material/esm/utils/capitalize.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/utils/createSimplePaletteValueFilter.js +48 -0
- package/dist/node_modules/@mui/material/esm/utils/createSimplePaletteValueFilter.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/utils/createSvgIcon.js +48 -0
- package/dist/node_modules/@mui/material/esm/utils/createSvgIcon.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/utils/debounce.js +10 -0
- package/dist/node_modules/@mui/material/esm/utils/debounce.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/utils/getScrollbarSize.js +10 -0
- package/dist/node_modules/@mui/material/esm/utils/getScrollbarSize.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/utils/isMuiElement.js +10 -0
- package/dist/node_modules/@mui/material/esm/utils/isMuiElement.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/utils/memoTheme.js +10 -0
- package/dist/node_modules/@mui/material/esm/utils/memoTheme.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/utils/mergeSlotProps.js +82 -0
- package/dist/node_modules/@mui/material/esm/utils/mergeSlotProps.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/utils/ownerDocument.js +10 -0
- package/dist/node_modules/@mui/material/esm/utils/ownerDocument.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/utils/ownerWindow.js +10 -0
- package/dist/node_modules/@mui/material/esm/utils/ownerWindow.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/utils/unsupportedProp.js +10 -0
- package/dist/node_modules/@mui/material/esm/utils/unsupportedProp.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/utils/useControlled.js +11 -0
- package/dist/node_modules/@mui/material/esm/utils/useControlled.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/utils/useEnhancedEffect.js +11 -0
- package/dist/node_modules/@mui/material/esm/utils/useEnhancedEffect.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/utils/useEventCallback.js +11 -0
- package/dist/node_modules/@mui/material/esm/utils/useEventCallback.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/utils/useForkRef.js +11 -0
- package/dist/node_modules/@mui/material/esm/utils/useForkRef.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/utils/useId.js +11 -0
- package/dist/node_modules/@mui/material/esm/utils/useId.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/utils/useSlot.js +87 -0
- package/dist/node_modules/@mui/material/esm/utils/useSlot.js.map +1 -0
- package/dist/node_modules/@mui/material/esm/zero-styled/index.js +29 -0
- package/dist/node_modules/@mui/material/esm/zero-styled/index.js.map +1 -0
- package/dist/node_modules/@mui/styled-engine/esm/GlobalStyles/GlobalStyles.js +29 -0
- package/dist/node_modules/@mui/styled-engine/esm/GlobalStyles/GlobalStyles.js.map +1 -0
- package/dist/node_modules/@mui/styled-engine/esm/index.js +52 -0
- package/dist/node_modules/@mui/styled-engine/esm/index.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/DefaultPropsProvider/DefaultPropsProvider.js +78 -0
- package/dist/node_modules/@mui/system/esm/DefaultPropsProvider/DefaultPropsProvider.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/GlobalStyles/GlobalStyles.js +67 -0
- package/dist/node_modules/@mui/system/esm/GlobalStyles/GlobalStyles.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/RtlProvider/index.js +38 -0
- package/dist/node_modules/@mui/system/esm/RtlProvider/index.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/borders/borders.js +67 -0
- package/dist/node_modules/@mui/system/esm/borders/borders.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/breakpoints/breakpoints.js +90 -0
- package/dist/node_modules/@mui/system/esm/breakpoints/breakpoints.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/colorManipulator/colorManipulator.js +326 -0
- package/dist/node_modules/@mui/system/esm/colorManipulator/colorManipulator.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/compose/compose.js +31 -0
- package/dist/node_modules/@mui/system/esm/compose/compose.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/createBox/createBox.js +62 -0
- package/dist/node_modules/@mui/system/esm/createBox/createBox.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/createBreakpoints/createBreakpoints.js +87 -0
- package/dist/node_modules/@mui/system/esm/createBreakpoints/createBreakpoints.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/createStyled/createStyled.js +298 -0
- package/dist/node_modules/@mui/system/esm/createStyled/createStyled.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/createTheme/applyStyles.js +94 -0
- package/dist/node_modules/@mui/system/esm/createTheme/applyStyles.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/createTheme/createSpacing.js +38 -0
- package/dist/node_modules/@mui/system/esm/createTheme/createSpacing.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/createTheme/createTheme.js +56 -0
- package/dist/node_modules/@mui/system/esm/createTheme/createTheme.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/createTheme/shape.js +10 -0
- package/dist/node_modules/@mui/system/esm/createTheme/shape.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/cssContainerQueries/cssContainerQueries.js +80 -0
- package/dist/node_modules/@mui/system/esm/cssContainerQueries/cssContainerQueries.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/cssGrid/cssGrid.js +100 -0
- package/dist/node_modules/@mui/system/esm/cssGrid/cssGrid.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/cssVars/createGetCssVar.js +29 -0
- package/dist/node_modules/@mui/system/esm/cssVars/createGetCssVar.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/cssVars/cssVarsParser.js +138 -0
- package/dist/node_modules/@mui/system/esm/cssVars/cssVarsParser.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/cssVars/getColorSchemeSelector.js +31 -0
- package/dist/node_modules/@mui/system/esm/cssVars/getColorSchemeSelector.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/cssVars/prepareCssVars.js +171 -0
- package/dist/node_modules/@mui/system/esm/cssVars/prepareCssVars.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/cssVars/prepareTypographyVars.js +18 -0
- package/dist/node_modules/@mui/system/esm/cssVars/prepareTypographyVars.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/memoTheme.js +35 -0
- package/dist/node_modules/@mui/system/esm/memoTheme.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/memoize/memoize.js +16 -0
- package/dist/node_modules/@mui/system/esm/memoize/memoize.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/merge/merge.js +17 -0
- package/dist/node_modules/@mui/system/esm/merge/merge.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/palette/palette.js +34 -0
- package/dist/node_modules/@mui/system/esm/palette/palette.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/preprocessStyles.js +33 -0
- package/dist/node_modules/@mui/system/esm/preprocessStyles.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/responsivePropType/responsivePropType.js +10 -0
- package/dist/node_modules/@mui/system/esm/responsivePropType/responsivePropType.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/sizing/sizing.js +76 -0
- package/dist/node_modules/@mui/system/esm/sizing/sizing.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/spacing/spacing.js +165 -0
- package/dist/node_modules/@mui/system/esm/spacing/spacing.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/style/style.js +84 -0
- package/dist/node_modules/@mui/system/esm/style/style.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/styleFunctionSx/defaultSxConfig.js +301 -0
- package/dist/node_modules/@mui/system/esm/styleFunctionSx/defaultSxConfig.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/styleFunctionSx/extendSxProp.js +59 -0
- package/dist/node_modules/@mui/system/esm/styleFunctionSx/extendSxProp.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/styleFunctionSx/styleFunctionSx.js +142 -0
- package/dist/node_modules/@mui/system/esm/styleFunctionSx/styleFunctionSx.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/useTheme/useTheme.js +16 -0
- package/dist/node_modules/@mui/system/esm/useTheme/useTheme.js.map +1 -0
- package/dist/node_modules/@mui/system/esm/useThemeWithoutDefault/useThemeWithoutDefault.js +37 -0
- package/dist/node_modules/@mui/system/esm/useThemeWithoutDefault/useThemeWithoutDefault.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/ClassNameGenerator/ClassNameGenerator.js +23 -0
- package/dist/node_modules/@mui/utils/esm/ClassNameGenerator/ClassNameGenerator.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/HTMLElementType/HTMLElementType.js +21 -0
- package/dist/node_modules/@mui/utils/esm/HTMLElementType/HTMLElementType.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/appendOwnerState/appendOwnerState.js +34 -0
- package/dist/node_modules/@mui/utils/esm/appendOwnerState/appendOwnerState.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/capitalize/capitalize.js +19 -0
- package/dist/node_modules/@mui/utils/esm/capitalize/capitalize.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/chainPropTypes/chainPropTypes.js +15 -0
- package/dist/node_modules/@mui/utils/esm/chainPropTypes/chainPropTypes.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/clamp/clamp.js +10 -0
- package/dist/node_modules/@mui/utils/esm/clamp/clamp.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/composeClasses/composeClasses.js +60 -0
- package/dist/node_modules/@mui/utils/esm/composeClasses/composeClasses.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/createChainedFunction/createChainedFunction.js +24 -0
- package/dist/node_modules/@mui/utils/esm/createChainedFunction/createChainedFunction.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/debounce/debounce.js +24 -0
- package/dist/node_modules/@mui/utils/esm/debounce/debounce.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/deepmerge/deepmerge.js +91 -0
- package/dist/node_modules/@mui/utils/esm/deepmerge/deepmerge.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/elementAcceptingRef/elementAcceptingRef.js +49 -0
- package/dist/node_modules/@mui/utils/esm/elementAcceptingRef/elementAcceptingRef.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/elementTypeAcceptingRef/elementTypeAcceptingRef.js +48 -0
- package/dist/node_modules/@mui/utils/esm/elementTypeAcceptingRef/elementTypeAcceptingRef.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/exactProp/exactProp.js +27 -0
- package/dist/node_modules/@mui/utils/esm/exactProp/exactProp.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/extractEventHandlers/extractEventHandlers.js +24 -0
- package/dist/node_modules/@mui/utils/esm/extractEventHandlers/extractEventHandlers.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/formatMuiErrorMessage/formatMuiErrorMessage.js +22 -0
- package/dist/node_modules/@mui/utils/esm/formatMuiErrorMessage/formatMuiErrorMessage.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/generateUtilityClass/generateUtilityClass.js +28 -0
- package/dist/node_modules/@mui/utils/esm/generateUtilityClass/generateUtilityClass.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/generateUtilityClasses/generateUtilityClasses.js +16 -0
- package/dist/node_modules/@mui/utils/esm/generateUtilityClasses/generateUtilityClasses.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/getDisplayName/getDisplayName.js +46 -0
- package/dist/node_modules/@mui/utils/esm/getDisplayName/getDisplayName.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/getReactElementRef/getReactElementRef.js +44 -0
- package/dist/node_modules/@mui/utils/esm/getReactElementRef/getReactElementRef.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/getScrollbarSize/getScrollbarSize.js +14 -0
- package/dist/node_modules/@mui/utils/esm/getScrollbarSize/getScrollbarSize.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/integerPropType/integerPropType.js +52 -0
- package/dist/node_modules/@mui/utils/esm/integerPropType/integerPropType.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/isFocusVisible/isFocusVisible.js +22 -0
- package/dist/node_modules/@mui/utils/esm/isFocusVisible/isFocusVisible.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/isHostComponent/isHostComponent.js +13 -0
- package/dist/node_modules/@mui/utils/esm/isHostComponent/isHostComponent.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/isMuiElement/isMuiElement.js +35 -0
- package/dist/node_modules/@mui/utils/esm/isMuiElement/isMuiElement.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/mergeSlotProps/mergeSlotProps.js +97 -0
- package/dist/node_modules/@mui/utils/esm/mergeSlotProps/mergeSlotProps.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/omitEventHandlers/omitEventHandlers.js +24 -0
- package/dist/node_modules/@mui/utils/esm/omitEventHandlers/omitEventHandlers.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/ownerDocument/ownerDocument.js +10 -0
- package/dist/node_modules/@mui/utils/esm/ownerDocument/ownerDocument.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/ownerWindow/ownerWindow.js +13 -0
- package/dist/node_modules/@mui/utils/esm/ownerWindow/ownerWindow.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/refType/refType.js +10 -0
- package/dist/node_modules/@mui/utils/esm/refType/refType.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/resolveComponentProps/resolveComponentProps.js +17 -0
- package/dist/node_modules/@mui/utils/esm/resolveComponentProps/resolveComponentProps.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/resolveProps/resolveProps.js +62 -0
- package/dist/node_modules/@mui/utils/esm/resolveProps/resolveProps.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/setRef/setRef.js +27 -0
- package/dist/node_modules/@mui/utils/esm/setRef/setRef.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/unsupportedProp/unsupportedProp.js +17 -0
- package/dist/node_modules/@mui/utils/esm/unsupportedProp/unsupportedProp.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/useControlled/useControlled.js +69 -0
- package/dist/node_modules/@mui/utils/esm/useControlled/useControlled.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/useEnhancedEffect/useEnhancedEffect.js +37 -0
- package/dist/node_modules/@mui/utils/esm/useEnhancedEffect/useEnhancedEffect.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/useEventCallback/useEventCallback.js +44 -0
- package/dist/node_modules/@mui/utils/esm/useEventCallback/useEventCallback.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/useForkRef/useForkRef.js +85 -0
- package/dist/node_modules/@mui/utils/esm/useForkRef/useForkRef.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/useId/useId.js +71 -0
- package/dist/node_modules/@mui/utils/esm/useId/useId.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/useLazyRef/useLazyRef.js +45 -0
- package/dist/node_modules/@mui/utils/esm/useLazyRef/useLazyRef.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/useOnMount/useOnMount.js +40 -0
- package/dist/node_modules/@mui/utils/esm/useOnMount/useOnMount.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/usePreviousProps/usePreviousProps.js +36 -0
- package/dist/node_modules/@mui/utils/esm/usePreviousProps/usePreviousProps.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/useSlotProps/useSlotProps.js +44 -0
- package/dist/node_modules/@mui/utils/esm/useSlotProps/useSlotProps.js.map +1 -0
- package/dist/node_modules/@mui/utils/esm/useTimeout/useTimeout.js +43 -0
- package/dist/node_modules/@mui/utils/esm/useTimeout/useTimeout.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/createPopper.js +201 -0
- package/dist/node_modules/@popperjs/core/lib/createPopper.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/contains.js +31 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/contains.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js +49 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js +77 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js +65 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js +12 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js +14 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js +37 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js +13 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js +33 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getNodeName.js +10 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getNodeName.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js +19 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js +76 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getParentNode.js +27 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getParentNode.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js +24 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js +39 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindow.js +19 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindow.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js +18 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js +21 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/instanceOf.js +28 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/instanceOf.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js +12 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js +18 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/isTableElement.js +12 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/isTableElement.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js +34 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/enums.js +59 -0
- package/dist/node_modules/@popperjs/core/lib/enums.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/applyStyles.js +92 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/applyStyles.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/arrow.js +97 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/arrow.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/computeStyles.js +177 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/computeStyles.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/eventListeners.js +56 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/eventListeners.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/flip.js +154 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/flip.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/hide.js +68 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/hide.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/offset.js +62 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/offset.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/popperOffsets.js +31 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/popperOffsets.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/preventOverflow.js +149 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/preventOverflow.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/popper.js +31 -0
- package/dist/node_modules/@popperjs/core/lib/popper.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js +51 -0
- package/dist/node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/computeOffsets.js +76 -0
- package/dist/node_modules/@popperjs/core/lib/utils/computeOffsets.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/debounce.js +22 -0
- package/dist/node_modules/@popperjs/core/lib/utils/debounce.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/detectOverflow.js +71 -0
- package/dist/node_modules/@popperjs/core/lib/utils/detectOverflow.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/expandToHashMap.js +13 -0
- package/dist/node_modules/@popperjs/core/lib/utils/expandToHashMap.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getAltAxis.js +10 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getAltAxis.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getBasePlacement.js +10 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getBasePlacement.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getFreshSideObject.js +15 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getFreshSideObject.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js +10 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getOppositePlacement.js +18 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getOppositePlacement.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js +16 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getVariation.js +10 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getVariation.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/math.js +10 -0
- package/dist/node_modules/@popperjs/core/lib/utils/math.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/mergeByName.js +21 -0
- package/dist/node_modules/@popperjs/core/lib/utils/mergeByName.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/mergePaddingObject.js +12 -0
- package/dist/node_modules/@popperjs/core/lib/utils/mergePaddingObject.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/orderModifiers.js +51 -0
- package/dist/node_modules/@popperjs/core/lib/utils/orderModifiers.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/rectToClientRect.js +15 -0
- package/dist/node_modules/@popperjs/core/lib/utils/rectToClientRect.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/userAgent.js +18 -0
- package/dist/node_modules/@popperjs/core/lib/utils/userAgent.js.map +1 -0
- package/dist/node_modules/@popperjs/core/lib/utils/within.js +15 -0
- package/dist/node_modules/@popperjs/core/lib/utils/within.js.map +1 -0
- package/dist/node_modules/@react-leaflet/core/lib/context.js +16 -0
- package/dist/node_modules/@react-leaflet/core/lib/context.js.map +1 -0
- package/dist/node_modules/axios/index.js +46 -0
- package/dist/node_modules/axios/index.js.map +1 -0
- package/dist/node_modules/axios/lib/adapters/adapters.js +133 -0
- package/dist/node_modules/axios/lib/adapters/adapters.js.map +1 -0
- package/dist/node_modules/axios/lib/adapters/fetch.js +291 -0
- package/dist/node_modules/axios/lib/adapters/fetch.js.map +1 -0
- package/dist/node_modules/axios/lib/adapters/xhr.js +207 -0
- package/dist/node_modules/axios/lib/adapters/xhr.js.map +1 -0
- package/dist/node_modules/axios/lib/axios.js +92 -0
- package/dist/node_modules/axios/lib/axios.js.map +1 -0
- package/dist/node_modules/axios/lib/cancel/CancelToken.js +139 -0
- package/dist/node_modules/axios/lib/cancel/CancelToken.js.map +1 -0
- package/dist/node_modules/axios/lib/cancel/CanceledError.js +29 -0
- package/dist/node_modules/axios/lib/cancel/CanceledError.js.map +1 -0
- package/dist/node_modules/axios/lib/cancel/isCancel.js +11 -0
- package/dist/node_modules/axios/lib/cancel/isCancel.js.map +1 -0
- package/dist/node_modules/axios/lib/core/Axios.js +242 -0
- package/dist/node_modules/axios/lib/core/Axios.js.map +1 -0
- package/dist/node_modules/axios/lib/core/AxiosError.js +114 -0
- package/dist/node_modules/axios/lib/core/AxiosError.js.map +1 -0
- package/dist/node_modules/axios/lib/core/AxiosHeaders.js +318 -0
- package/dist/node_modules/axios/lib/core/AxiosHeaders.js.map +1 -0
- package/dist/node_modules/axios/lib/core/InterceptorManager.js +75 -0
- package/dist/node_modules/axios/lib/core/InterceptorManager.js.map +1 -0
- package/dist/node_modules/axios/lib/core/buildFullPath.js +28 -0
- package/dist/node_modules/axios/lib/core/buildFullPath.js.map +1 -0
- package/dist/node_modules/axios/lib/core/dispatchRequest.js +87 -0
- package/dist/node_modules/axios/lib/core/dispatchRequest.js.map +1 -0
- package/dist/node_modules/axios/lib/core/mergeConfig.js +112 -0
- package/dist/node_modules/axios/lib/core/mergeConfig.js.map +1 -0
- package/dist/node_modules/axios/lib/core/settle.js +33 -0
- package/dist/node_modules/axios/lib/core/settle.js.map +1 -0
- package/dist/node_modules/axios/lib/core/transformData.js +34 -0
- package/dist/node_modules/axios/lib/core/transformData.js.map +1 -0
- package/dist/node_modules/axios/lib/defaults/index.js +165 -0
- package/dist/node_modules/axios/lib/defaults/index.js.map +1 -0
- package/dist/node_modules/axios/lib/defaults/transitional.js +13 -0
- package/dist/node_modules/axios/lib/defaults/transitional.js.map +1 -0
- package/dist/node_modules/axios/lib/env/data.js +6 -0
- package/dist/node_modules/axios/lib/env/data.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +62 -0
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +82 -0
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/bind.js +20 -0
- package/dist/node_modules/axios/lib/helpers/bind.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/buildURL.js +73 -0
- package/dist/node_modules/axios/lib/helpers/buildURL.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/combineURLs.js +21 -0
- package/dist/node_modules/axios/lib/helpers/combineURLs.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/composeSignals.js +53 -0
- package/dist/node_modules/axios/lib/helpers/composeSignals.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/cookies.js +59 -0
- package/dist/node_modules/axios/lib/helpers/cookies.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +99 -0
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +21 -0
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/isAxiosError.js +20 -0
- package/dist/node_modules/axios/lib/helpers/isAxiosError.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +21 -0
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/null.js +9 -0
- package/dist/node_modules/axios/lib/helpers/null.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/parseHeaders.js +61 -0
- package/dist/node_modules/axios/lib/helpers/parseHeaders.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/parseProtocol.js +12 -0
- package/dist/node_modules/axios/lib/helpers/parseProtocol.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +51 -0
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/resolveConfig.js +67 -0
- package/dist/node_modules/axios/lib/helpers/resolveConfig.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/speedometer.js +59 -0
- package/dist/node_modules/axios/lib/helpers/speedometer.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/spread.js +34 -0
- package/dist/node_modules/axios/lib/helpers/spread.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/throttle.js +49 -0
- package/dist/node_modules/axios/lib/helpers/throttle.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/toFormData.js +225 -0
- package/dist/node_modules/axios/lib/helpers/toFormData.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +25 -0
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/trackStream.js +93 -0
- package/dist/node_modules/axios/lib/helpers/trackStream.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/validator.js +105 -0
- package/dist/node_modules/axios/lib/helpers/validator.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js +9 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js +9 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +11 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/browser/index.js +20 -0
- package/dist/node_modules/axios/lib/platform/browser/index.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/common/utils.js +52 -0
- package/dist/node_modules/axios/lib/platform/common/utils.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/index.js +14 -0
- package/dist/node_modules/axios/lib/platform/index.js.map +1 -0
- package/dist/node_modules/axios/lib/utils.js +788 -0
- package/dist/node_modules/axios/lib/utils.js.map +1 -0
- package/dist/node_modules/clsx/dist/clsx.js +9 -0
- package/dist/node_modules/clsx/dist/clsx.js.map +1 -0
- package/dist/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js +117 -0
- package/dist/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js.map +1 -0
- package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js +193 -0
- package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js.map +1 -0
- package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.production.min.js +29 -0
- package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.production.min.js.map +1 -0
- package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/index.js +22 -0
- package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/index.js.map +1 -0
- package/dist/node_modules/mobx/dist/mobx.esm.js +5378 -0
- package/dist/node_modules/mobx/dist/mobx.esm.js.map +1 -0
- package/dist/node_modules/object-assign/index.js +102 -0
- package/dist/node_modules/object-assign/index.js.map +1 -0
- package/dist/node_modules/prop-types/checkPropTypes.js +118 -0
- package/dist/node_modules/prop-types/checkPropTypes.js.map +1 -0
- package/dist/node_modules/prop-types/factoryWithThrowingShims.js +77 -0
- package/dist/node_modules/prop-types/factoryWithThrowingShims.js.map +1 -0
- package/dist/node_modules/prop-types/factoryWithTypeCheckers.js +628 -0
- package/dist/node_modules/prop-types/factoryWithTypeCheckers.js.map +1 -0
- package/dist/node_modules/prop-types/index.js +36 -0
- package/dist/node_modules/prop-types/index.js.map +1 -0
- package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.js +24 -0
- package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.js.map +1 -0
- package/dist/node_modules/prop-types/lib/has.js +14 -0
- package/dist/node_modules/prop-types/lib/has.js.map +1 -0
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +193 -0
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js.map +1 -0
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +29 -0
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js.map +1 -0
- package/dist/node_modules/prop-types/node_modules/react-is/index.js +22 -0
- package/dist/node_modules/prop-types/node_modules/react-is/index.js.map +1 -0
- package/dist/node_modules/react-hook-form/dist/index.esm.js +611 -0
- package/dist/node_modules/react-hook-form/dist/index.esm.js.map +1 -0
- package/dist/node_modules/react-is/cjs/react-is.development.js +145 -0
- package/dist/node_modules/react-is/cjs/react-is.development.js.map +1 -0
- package/dist/node_modules/react-is/cjs/react-is.production.js +142 -0
- package/dist/node_modules/react-is/cjs/react-is.production.js.map +1 -0
- package/dist/node_modules/react-is/index.js +22 -0
- package/dist/node_modules/react-is/index.js.map +1 -0
- package/dist/node_modules/react-leaflet/lib/hooks.js +11 -0
- package/dist/node_modules/react-leaflet/lib/hooks.js.map +1 -0
- package/dist/node_modules/react-transition-group/esm/Transition.js +637 -0
- package/dist/node_modules/react-transition-group/esm/Transition.js.map +1 -0
- package/dist/node_modules/react-transition-group/esm/TransitionGroup.js +195 -0
- package/dist/node_modules/react-transition-group/esm/TransitionGroup.js.map +1 -0
- package/dist/node_modules/react-transition-group/esm/TransitionGroupContext.js +10 -0
- package/dist/node_modules/react-transition-group/esm/TransitionGroupContext.js.map +1 -0
- package/dist/node_modules/react-transition-group/esm/config.js +10 -0
- package/dist/node_modules/react-transition-group/esm/config.js.map +1 -0
- package/dist/node_modules/react-transition-group/esm/utils/ChildMapping.js +149 -0
- package/dist/node_modules/react-transition-group/esm/utils/ChildMapping.js.map +1 -0
- package/dist/node_modules/react-transition-group/esm/utils/PropTypes.js +24 -0
- package/dist/node_modules/react-transition-group/esm/utils/PropTypes.js.map +1 -0
- package/dist/node_modules/react-transition-group/esm/utils/reflow.js +8 -0
- package/dist/node_modules/react-transition-group/esm/utils/reflow.js.map +1 -0
- package/dist/node_modules/stylis/src/Enum.js +23 -0
- package/dist/node_modules/stylis/src/Enum.js.map +1 -0
- package/dist/node_modules/stylis/src/Middleware.js +36 -0
- package/dist/node_modules/stylis/src/Middleware.js.map +1 -0
- package/dist/node_modules/stylis/src/Parser.js +200 -0
- package/dist/node_modules/stylis/src/Parser.js.map +1 -0
- package/dist/node_modules/stylis/src/Serializer.js +42 -0
- package/dist/node_modules/stylis/src/Serializer.js.map +1 -0
- package/dist/node_modules/stylis/src/Tokenizer.js +242 -0
- package/dist/node_modules/stylis/src/Tokenizer.js.map +1 -0
- package/dist/node_modules/stylis/src/Utility.js +133 -0
- package/dist/node_modules/stylis/src/Utility.js.map +1 -0
- package/dist/node_modules/tangram/dist/tangram.min.js +52 -0
- package/dist/node_modules/tangram/dist/tangram.min.js.map +1 -0
- package/dist/scene.yaml.js +2 -0
- package/dist/scene.yaml.js.map +1 -0
- package/dist/services/api/api.service.js +44 -0
- package/dist/services/api/api.service.js.map +1 -0
- package/package.json +31 -33
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// define() gets called for each chunk generated by the first Rollup pass.
|
|
4
|
+
// The order the chunks are called in is controlled by the imports in bundle.js:
|
|
5
|
+
//
|
|
6
|
+
// shared.js: shared dependencies between main and worker threads
|
|
7
|
+
// scene_worker.js: worker thread code
|
|
8
|
+
// index.js: main thread code
|
|
9
|
+
|
|
10
|
+
// Once all chunks have been provided, the worker thread code is assembled,
|
|
11
|
+
// incorporating the shared chunk code, then turned into a blob URL which
|
|
12
|
+
// can be used to instantiate the worker.
|
|
13
|
+
|
|
14
|
+
var shared, worker, Tangram = {};
|
|
15
|
+
|
|
16
|
+
function define(_, chunk) {
|
|
17
|
+
if (!shared) {
|
|
18
|
+
shared = chunk;
|
|
19
|
+
} else if (!worker) {
|
|
20
|
+
worker = chunk;
|
|
21
|
+
} else {
|
|
22
|
+
var worker_bundle = 'var shared_chunk = {}; (' + shared + ')(shared_chunk); (' + worker + ')(shared_chunk);';
|
|
23
|
+
var shared_chunk = {};
|
|
24
|
+
shared(shared_chunk);
|
|
25
|
+
Tangram = chunk(shared_chunk);
|
|
26
|
+
Tangram.workerURL = window.URL.createObjectURL(new Blob([worker_bundle], { type: 'text/javascript' }));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
define(["exports"],(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=true,t.is_main=false,self.window={document:{}},self.document=self.window.document;}function i(e){return i="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},i(e)}function r(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return ("string"===t?String:Number)(e)}(e,"string");return "symbol"==i(t)?t:t+""}function n(e,t,i){return (t=r(t))in e?Object.defineProperty(e,t,{value:i,enumerable:true,configurable:true,writable:true}):e[t]=i,e}var s,o="v0.22.0",a=s={},l=0,u={};function h(e){var t=[];"string"==typeof e&&(t=e.split("."),e=t.pop());var i=s.targets;for(let e=0;e<t.length;e++){if(!i[t[e]])return [];i=i[t[e]];}return [e,i]}function c(e,t=null,i=null,r=[]){if(!e)return r;if(Array.isArray(e))e.forEach(((t,i)=>c(t,e,i,r)));else if("object"==typeof e)if(e instanceof ArrayBuffer)r.push({object:e,parent:t,property:i});else if(e.buffer instanceof ArrayBuffer)r.push({object:e.buffer,parent:t,property:i});else for(let t in e)c(e[t],e,t,r);return r}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=c(this.value);},t.is_main&&(s.postMessage=function(e,t,...i){if(Array.isArray(e))return Promise.all(e.map((e=>s.postMessage(e,t,...i))));let r={};"object"==typeof t&&(r=t,t=t.method);var n=new Promise(((e,r)=>{u[l]={method:t,message:i,resolve:e,reject:r};}));let o,a=[];return i&&1===i.length&&i[0]instanceof s.withTransferables&&(a=i[0].transferables,i=i[0].value),o={type:"main_send",message_id:l,method:t,message:i},r.stringify&&(o=JSON.stringify(o)),e.postMessage(o,a.map((e=>e.object))),d(a),a.length>0&&m("trace",`'${t}' transferred ${a.length} objects to worker thread`),l++,n},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 i="string"==typeof t.data?JSON.parse(t.data):t.data,r=i.message_id;if("worker_reply"===i.type)u[r]&&(i.error?u[r].reject(i.error):u[r].resolve(i.message),delete u[r]);else if("worker_send"===i.type&&null!=r){let t,n,o,a,l;try{if([a,o]=h(i.method),!o)throw Error(`Worker broker could not dispatch message type ${i.method} on target ${i.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 ${i.method} on target ${i.target} because object has no method with that name`);t=l.apply(o,i.message);}catch(e){n=e;}let u,c=[];t instanceof Promise?t.then((t=>{t instanceof s.withTransferables&&(c=t.transferables,t=t.value[0]),u={type:"main_reply",message_id:r,message:t},e.postMessage(u,c.map((e=>e.object))),d(c),c.length>0&&m("trace",`'${a}' transferred ${c.length} objects to worker thread`);}),(t=>{e.postMessage({type:"main_reply",message_id:r,error:t instanceof Error?`${t.message}: ${t.stack}`:t});})):(t instanceof s.withTransferables&&(c=t.transferables,t=t.value[0]),u={type:"main_reply",message_id:r,message:t,error:n instanceof Error?`${n.message}: ${n.stack}`:n},e.postMessage(u,c.map((e=>e.object))),d(c),c.length>0&&m("trace",`'${a}' transferred ${c.length} objects to worker thread`));}}));},s.getMessages=function(){return u},s.getMessageId=function(){return l}),t.is_worker&&(s.postMessage=function(e,...t){let i={};"object"==typeof e&&(i=e,e=e.method);var r=new Promise(((i,r)=>{u[l]={method:e,message:t,resolve:i,reject:r};}));let n,o=[];return t&&1===t.length&&t[0]instanceof s.withTransferables&&(o=t[0].transferables,t=t[0].value),n={type:"worker_send",message_id:l,method:e,message:t},i.stringify&&(n=JSON.stringify(n)),self.postMessage(n,o.map((e=>e.object))),d(o),o.length>0&&m("trace",`'${e}' transferred ${o.length} objects to main thread`),l++,r},self.addEventListener("message",(function(e){let t="string"==typeof e.data?JSON.parse(e.data):e.data,i=t.message_id;if("main_reply"===t.type)u[i]&&(t.error?u[i].reject(t.error):u[i].resolve(t.message),delete u[i]);else if("main_send"===t.type&&null!=i){let e,r,n,o,a;try{if([o,n]=h(t.method),!n)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(a="function"==typeof n[o]&&n[o],!a)throw Error(`Worker broker could not dispatch message type ${t.method} because worker has no method with that name`);e=a.apply(n,t.message);}catch(e){r=e;}let l,u=[];e instanceof Promise?e.then((e=>{e instanceof s.withTransferables&&(u=e.transferables,e=e.value[0]),l={type:"worker_reply",message_id:i,message:e},self.postMessage(l,u.map((e=>e.object))),d(u),u.length>0&&m("trace",`'${o}' transferred ${u.length} objects to main thread`);}),(e=>{self.postMessage({type:"worker_reply",message_id:i,error:e instanceof Error?`${e.message}: ${e.stack}`:e});})):(e instanceof s.withTransferables&&(u=e.transferables,e=e.value[0]),l={type:"worker_reply",message_id:i,message:e,error:r instanceof Error?`${r.message}: ${r.stack}`:r},self.postMessage(l,u.map((e=>e.object))),d(u),u.length>0&&m("trace",`'${o}' transferred ${u.length} objects to main thread`));}})));const f={silent:-1,error:0,warn:1,info:2,debug:3,trace:4},_={};let p={};function m(e,...i){let r="object"==typeof e?e.level:e;if(f[r]<=f[m.level]){if(t.is_worker)return a.postMessage({method:"_logProxy",stringify:true},e,...i);{if("object"==typeof e&&true===e.once){if(p[JSON.stringify(i)])return Promise.resolve(false);p[JSON.stringify(i)]=true;}let n=function(e){if(t.is_main)return _[e]=_[e]||(console[e]?console[e]:console.log).bind(console),_[e]}(r);i.length>1?n(`Tangram ${o} [${r}]: ${i[0]}`,...i.slice(1)):n(`Tangram ${o} [${r}]: ${i[0]}`);}return Promise.resolve(true)}return Promise.resolve(false)}m.level="info",m.workers=null,m.setLevel=function(e){m.level=e,t.is_main&&Array.isArray(m.workers)&&a.postMessage(m.workers,"_logSetLevelProxy",e);},t.is_main&&(m.setWorkers=function(e){m.workers=e;},m.reset=function(){p={};}),a.addTarget("_logProxy",m),a.addTarget("_logSetLevelProxy",m.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,i=6e4,r="text",n="GET",s={},o=null,l=false){if(t.is_worker&&g.isMicrosoft())return m("debug","Proxying request for URL to worker",e),o&&(g._proxy_requests[o]=true),a.postMessage("Utils.io",e,i,r,n,s,o,true);var u=new XMLHttpRequest,h=new Promise(((t,o)=>{if(u.open(n,e,true),u.timeout=i,u.responseType=r,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 h=h.then((e=>(o&&delete g._requests[o],l?a.withTransferables(e):e))),o&&(g._requests[o]=u),h},g.cancelRequest=function(e){if(t.is_worker&&g._proxy_requests[e])return a.postMessage("Utils.cancelRequest",e);g._requests[e]?(m("trace",`Cancelling network request key '${e}'`),g._requests[e].abort(),delete g._requests[e]):m("trace",`Could not find network request key '${e}'`);},g.serializeWithFunctions=function(e){if("function"==typeof e)return e.toString();return JSON.stringify(e,(function(e,t){return "function"==typeof t?t.toString():t}))},g.use_high_density_display=true,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,i){if(!Array.isArray(t)||!Array.isArray(t[0]))return t;if(t.length<1)return t;var r,n,s,o,a;if(e<=t[0][0])o=t[0][1],"function"==typeof i&&(o=i(o));else if(e>=t[t.length-1][0])o=t[t.length-1][1],"function"==typeof i&&(o=i(o));else for(var l=0;l<t.length-1;l++)if(e>=t[l][0]&&e<t[l+1][0]){if(r=t[l][0],n=t[l+1][0],Array.isArray(t[l][1])){o=[];for(var u=0;u<t[l][1].length;u++)"function"==typeof i?(a=i(t[l][1][u]),s=i(t[l+1][1][u])-a,o[u]=s*(e-r)/(n-r)+a):(s=t[l+1][1][u]-t[l][1][u],o[u]=s*(e-r)/(n-r)+t[l][1][u]);}else "function"==typeof i?(a=i(t[l][1]),o=(s=i(t[l+1][1])-a)*(e-r)/(n-r)+a):o=(s=t[l+1][1]-t[l][1])*(e-r)/(n-r)+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 x=y={draw_label_collision_boxes:false,draw_label_texture_boxes:false,suppress_label_fade_in:false,suppress_label_snap_animation:false,show_hidden_labels:false,layer_stats:false,wireframe:false};function b(e){if("string"==typeof e&&-1===e.search(/^(data|blob):/)){let t=e.indexOf("?");t>-1&&(e=e.substr(0,t));let i=e.indexOf("#");return i>-1&&(e=e.substr(0,i)),e.substr(0,e.lastIndexOf("/")+1)||""}return ""}function v(e){if("string"==typeof e)return !(e.search(/^(http|https|data|blob):/)>-1||"//"===e.substr(0,2))}let A;function T(e,t){e=e.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===i?"":decodeURIComponent(i[1].replace(/\+/g," "))}const w={id:0,queue:[],max_time:20,start_time:null,state:{},add(e){e.id=w.id++,e.max_time=e.max_time||w.max_time,e.pause_factor=e.pause_factor||1;let t=new Promise(((t,i)=>{e.resolve=t,e.reject=i;}));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<w.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||false!==e.user_moving_view)return e.pause?(e.pause--,true):(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(true!==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>=w.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<w.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 E(e){let t=[];return Object.assign(e,{subscribe(e){ -1===t.indexOf(e)&&t.push(e);},unsubscribe(e){let i=t.indexOf(e);i>-1&&t.splice(i,1);},unsubscribeAll(){t=[];},trigger(e,...i){t.forEach((t=>{if("function"==typeof t[e])try{t[e](...i);}catch(t){m("warn",`Caught exception in listener for event '${e}':`,t);}}));},hasSubscribersFor(e){let i=false;return t.forEach((t=>{"function"==typeof t[e]&&(i=true);})),i}})}function R(e,t){let i={};return t.forEach((t=>i[t]=e[t])),i}class M{constructor(e,t,i={}){i=M.sliceOptions(i),this.gl=e,this.texture=e.createTexture(),this.texture&&(this.valid=true),this.bind(),this.name=t,this.retain_count=0,this.config_type=null,this.loading=null,this.loaded=false,this.filtering=i.filtering,this.density=i.density||1,this.sprites=i.sprites,this.texcoords={},this.sizes={},this.css_sizes={},this.aspects={},this.setData(1,1,new Uint8Array([0,0,0,0]),{filtering:"nearest"}),this.loaded=false,M.textures[this.name]&&(this.retain_count=M.textures[this.name].retain_count,M.textures[this.name].retain_count=0,M.textures[this.name].destroy()),M.textures[this.name]=this,M.texture_configs[this.name]=JSON.stringify(Object.assign({name:t},i)),this.load(i),m("trace",`creating Texture ${this.name}`);}destroy({force:e}={}){this.retain_count>0&&!e?m("error",`Texture '${this.name}': destroying texture with retain count of '${this.retain_count}'`):this.valid&&(this.gl.deleteTexture(this.texture),this.texture=null,M.textures[this.name]===this&&(delete M.textures[this.name],delete M.texture_configs[this.name]),this.valid=false,m("trace",`destroying Texture ${this.name}`));}retain(){this.retain_count++;}release(){this.retain_count<=0&&m("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&&(M.activeUnit!==e&&(this.gl.activeTexture(this.gl.TEXTURE0+e),M.activeUnit=e,M.boundTexture=null),M.boundTexture!==this.texture&&(this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),M.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 i=new Image;i.onload=()=>{try{if("data:"===this.url.slice(0,5)){const e=document.createElement("canvas"),r=e.getContext("2d");e.width=i.width,e.height=i.height,r.drawImage(i,0,0),this.setElement(e,t);}else this.setElement(i,t);}catch(e){this.loaded=false,m("warn",`Texture '${this.name}': failed to load url: '${this.url}'`,e,t),M.trigger("warning",{message:`Failed to load texture from ${this.url}`,error:e,texture:t});}this.loaded=true,e(this);},i.onerror=i=>{this.loaded=false,m("warn",`Texture '${this.name}': failed to load url: '${this.url}'`,i,t),M.trigger("warning",{message:`Failed to load texture from ${this.url}`,error:i,texture:t}),e(this);},g.isSafari()&&"data:"===this.url.slice(0,5)||(i.crossOrigin="anonymous"),i.src=this.url;})),this.loading}setData(e,t,i,r={}){return this.width=e,this.height=t,Array.isArray(i)&&(i=new Uint8Array(i)),this.update(i,r),this.setFiltering(r),this.loaded=true,this.loading=Promise.resolve(this),this.loading}setElement(e,t){let i=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=false;let e=`the 'element' parameter (\`element: ${JSON.stringify(i)}\`) must be a CSS `;e+="selector string, or a <canvas>, <image> or <video> object",m("warn",`Texture '${this.name}': ${e}`,t),M.trigger("warning",{message:`Failed to load texture because ${e}`,texture:t});}return this.loaded=true,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,false!==t.UNPACK_FLIP_Y_WEBGL),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.UNPACK_PREMULTIPLY_ALPHA_WEBGL||false),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)),M.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=true,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=false,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))),M.trigger("update",this);}}calculateSprites(){if(this.sprites)for(let e in this.sprites){let t=this.sprites[e];this.texcoords[e]=M.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))}}M.create=function(e,t,i){return new M(e,t,i)},M.retain=function(e){M.textures[e]&&M.textures[e].retain();},M.release=function(e){M.textures[e]&&M.textures[e].release();},M.destroy=function(e){Object.keys(M.textures).forEach((t=>{var i=M.textures[t];i.gl===e&&i.destroy({force:true});}));},M.getSpriteInfo=function(e,t){let i=M.textures[e];return i&&{size:i.sizes[t],css_size:i.css_sizes[t],aspect:i.aspects[t],texcoords:i.texcoords[t]}},M.getTexcoordsForSprite=function(e,t,i){var r=i[1]-e[1]-t[1];return [e[0]/i[0],r/i[1],(t[0]+e[0])/i[0],(t[1]+r)/i[1]]},M.createFromObject=function(e,t){let i=[];if(t)for(let r in t){let n=t[r];if(n.skip_create)continue;if(!M.changed(r,n))continue;let s=M.create(e,r,n);i.push(s.loading);}return Promise.all(i)},M.default="__default",M.createDefault=function(e){return M.create(e,M.default)},M.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}},M.changed=function(e,t){let i=M.textures[e];if(i){if("element"===i.config_type||null!=t.element)return true;if(t=M.sliceOptions(t),M.texture_configs[e]===JSON.stringify(Object.assign({name:e},t)))return false}return true},M.getInfo=function(e){if(e||(e=Object.keys(M.textures)),Array.isArray(e))return Promise.all(e.map((e=>M.getInfo(e))));var t=M.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)},M.syncTexturesToWorker=function(e){return a.postMessage("Texture.getInfo",e).then((e=>(e&&e.filter((e=>e)).forEach((e=>M.textures[e.name]=e)),M.textures)))},M.getMaxTextureSize=function(e){return e.getParameter(e.MAX_TEXTURE_SIZE)},M.textures={},M.texture_configs={},M.boundTexture=null,M.activeUnit=null,a.addTarget("Texture",M),E(M);var z={parseUniforms:function(e={}){var t=[];for(const[i,r]of Object.entries(e))if("number"==typeof r)t.push({type:"float",method:"1f",name:i,value:r,path:[i]});else if(Array.isArray(r)){if("number"==typeof r[0])r.length>=2&&r.length<=4?t.push({type:"vec"+r.length,method:r.length+"fv",name:i,value:r,path:[i]}):r.length>4&&t.push({type:"float[]",method:"1fv",name:i+"[0]",value:r,path:[i]});else if("string"==typeof r[0])for(let e=0;e<r.length;e++)t.push({type:"sampler2D",method:"1i",name:i+"["+e+"]",value:r[e],path:[i,e]});else if(Array.isArray(r[0])&&"number"==typeof r[0][0]&&r[0].length>=2&&r[0].length<=4)for(let e=0;e<r.length;e++)t.push({type:"vec"+r[0].length,method:r[0].length+"fv",name:i+"["+e+"]",value:r[e],path:[i,e]});}else "boolean"==typeof r?t.push({type:"bool",method:"1i",name:i,value:r,path:[i]}):"string"==typeof r&&t.push({type:"sampler2D",method:"1i",name:i,value:r,path:[i]});return t},defineVariable:function(e,t){var i,r;if("number"==typeof t)i="float";else if(Array.isArray(t))"number"==typeof t[0]?t.length>=2&&t.length<=4?i="vec"+t.length:(i="float",r=t.length):"string"==typeof t[0]?(i="sampler2D",r=t.length):Array.isArray(t[0])&&"number"==typeof t[0][0]&&t[0].length>=2&&t[0].length<=4&&(i="vec"+t[0].length,r=t.length);else if("boolean"==typeof t)i="bool";else {if("string"!=typeof t)return;i="sampler2D";}var n="";return n+=`${i} ${e}`,r&&(n+=`[${r}]`),n+=";\n"},defineUniform:function(e,t){var i=z.defineVariable(e,t);if(i)return "uniform "+i},expandVec3:function(e,t=1){let i;if(Array.isArray(e)){if(2!==e.length)return e;i=[...e,t].map(parseFloat);}else i=[e,e,e].map(parseFloat);if(i&&i.every((e=>"number"==typeof e&&!isNaN(e))))return i},expandVec4:function(e,t=1){let i;if(Array.isArray(e)){if(3!==e.length)return e;i=[...e,t].map(parseFloat);}else i=[e,e,e,t].map(parseFloat);if(i&&i.every((e=>"number"==typeof e&&!isNaN(e))))return i}};let P=[];function S(e,t){let i=P.filter((t=>t[0]===e))[0];return i=i&&i[1],i||(P.push([e,{}]),i=P[P.length-1][1]),i[t]||(i[t]=e.getExtension(t)),i[t]}function N(e){var t,i,r=0;if(0===e.length)return r;for(t=0,i=e.length;t<i;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return r}function k(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var O,L;var I=(L||(L=1,O=function(e){e=String(e);for(var t,i=[];t=e.match(/ERROR\:([^\n]+)/);){e=e.slice(t.index+1);var r=(o=t[1].trim()).split(":"),n=r.slice(2).join(":").trim(),s=parseInt(r[0],10),o=parseInt(r[1],10);i.push({message:n,file:s,line:o});}return i}),O),F=k(I);const D=/^\s*#pragma.*$/gm,U=/\\\s*\n/gm;class G{constructor(e,t,i,r){r=r||{},this.gl=e,this.program=null,this.compiled=false,this.compiling=false,this.error=null,this.defines=Object.assign({},r.defines||{}),this.blocks=Object.assign({},r.blocks||{}),this.block_scopes=Object.assign({},r.block_scopes||{}),this.extensions=r.extensions||[],this.dependent_uniforms=r.uniforms,this.uniforms={},this.attribs={},this.vertex_source=t,this.fragment_source=i,this.id=G.id++,this.name=r.name;}destroy(){this.gl.useProgram(null),this.gl.deleteProgram(this.program),this.program=null,this.uniforms={},this.attribs={},this.compiled=false;}use(){this.compiled&&(G.current!==this&&this.gl.useProgram(this.program),G.current=this);}compile(){if(this.compiling)throw new Error(`ShaderProgram.compile(): skipping for ${this.id} (${this.name}) because already compiling`);this.compiling=true,this.compiled=false,this.error=null,this.computed_vertex_source=this.vertex_source,this.computed_fragment_source=this.fragment_source;let e=this.checkExtensions();var t,i=this.buildDefineList(),r=this.buildShaderBlockList();for(var n in r){var s=r[n];if(s&&(!Array.isArray(s)||0!==s.length)){t=new RegExp("^\\s*#pragma\\s+tangram:\\s+"+n+"\\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)),i["TANGRAM_BLOCK_"+n.replace(/[\s-]+/g,"_").toUpperCase()]=true;}}}this.computed_vertex_source=this.computed_vertex_source.replace(D,""),this.computed_fragment_source=this.computed_fragment_source.replace(D,""),this.ensureUniforms(this.dependent_uniforms);let u="",h=this.gl.getShaderPrecisionFormat(this.gl.FRAGMENT_SHADER,this.gl.HIGH_FLOAT);u=h&&h.precision>0?"precision highp float;\n":"precision mediump float;\n",i.TANGRAM_VERTEX_SHADER=true,i.TANGRAM_FRAGMENT_SHADER=false,this.computed_vertex_source=u+G.buildDefineString(i)+this.computed_vertex_source,i.TANGRAM_VERTEX_SHADER=false,i.TANGRAM_FRAGMENT_SHADER=true,this.computed_fragment_source=G.buildExtensionString(e)+u+G.buildDefineString(i)+this.computed_fragment_source,this.computed_vertex_source=this.computed_vertex_source.replace(U,""),this.computed_fragment_source=this.computed_fragment_source.replace(U,"");try{this.program=G.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=false,this.compiling=false,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 G.defines)t[e]=G.defines[e];for(e in this.defines)t[e]=this.defines[e];return t}buildShaderBlockList(){let e,t={};for(e in G.blocks)t[e]=[],Array.isArray(G.blocks[e])?t[e].push(...G.blocks[e].map(((t,i)=>({key:e,source:t,num:i,scope:"ShaderProgram"})))):t[e]=[{key:e,source:G.blocks[e],num:0,scope:"ShaderProgram"}];for(e in this.blocks)if(t[e]=t[e]||[],Array.isArray(this.blocks[e])){let i=this.block_scopes&&this.block_scopes[e]||[],r=null,n=0;for(let s=0;s<this.blocks[e].length;s++)i[s]!==r&&(r=i[s],n=0),t[e].push({key:e,source:this.blocks[e][s],num:n,scope:r||this.name}),n++;}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])=>z.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=true){this.compiled&&(t&&(this.texture_unit=0),z.parseUniforms(e).forEach((({name:e,type:t,value:i,method:r})=>{"sampler2D"===t?this.setTextureUniform(e,i):this.uniform(r,e,i);})));}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 i=M.textures[t];null!=i?(i.bind(this.texture_unit),this.uniform("1i",e,this.texture_unit),this.texture_unit++):m("warn",`Cannot find texture '${t}'`);}uniform(e,t,i){if(!this.compiled)return;this.uniforms[t]=this.uniforms[t]||{};let r=this.uniforms[t];r.name=t,void 0===r.location&&(r.location=this.gl.getUniformLocation(this.program,t)),r.method=e,r.value=i,this.updateUniform(r);}updateUniform(e){this.compiled&&e&&null!=e.location&&(this.use(),this.commitUniform(e));}commitUniform(e){let t=e.location,i=e.value;switch(e.method){case "1i":this.gl.uniform1i(t,i);break;case "1f":this.gl.uniform1f(t,i);break;case "2f":this.gl.uniform2f(t,i[0],i[1]);break;case "3f":this.gl.uniform3f(t,i[0],i[1],i[2]);break;case "4f":this.gl.uniform4f(t,i[0],i[1],i[2],i[3]);break;case "1iv":this.gl.uniform1iv(t,i);break;case "3iv":this.gl.uniform3iv(t,i);break;case "1fv":this.gl.uniform1fv(t,i);break;case "2fv":this.gl.uniform2fv(t,i);break;case "3fv":this.gl.uniform3fv(t,i);break;case "4fv":this.gl.uniform4fv(t,i);break;case "Matrix3fv":this.gl.uniformMatrix3fv(t,false,i);break;case "Matrix4fv":this.gl.uniformMatrix4fv(t,false,i);}}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 i=this.lines(e);if(i)return i[t]}block(e,t){let i,r=this.lines(e);for(let e=0;e<t&&e<r.length;e++){let t=r[e],n=t.match(/\/\/ tangram-block-start: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/);n&&n.length>1?i={scope:n[1],name:n[2],num:n[3]}:(n=t.match(/\/\/ tangram-block-end: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/),n&&n.length>1&&(i=null)),i&&(i.line=null==i.line?-1:i.line+1,i.source=t);}return i}checkExtensions(){let e=[];return this.extensions.forEach((t=>{let i=S(this.gl,t),r=`TANGRAM_EXTENSION_${t}`;this.defines[r]=null!=i,i?e.push(t):m("debug",`Could not enable extension '${t}'`);})),e}}G.id=0,G.current=null,G.defines={},G.blocks={},G.reset=function(){G.programs_by_source={},G.shaders_by_source={};},G.reset(),G.buildDefineString=function(e){var t="";for(var i in e)null!=e[i]&&false!==e[i]&&("boolean"==typeof e[i]&&true===e[i]?t+="#define "+i+"\n":"number"==typeof e[i]&&Math.floor(e[i])===e[i]?t+="#define "+i+" "+e[i].toFixed(1)+"\n":t+="#define "+i+" "+e[i]+"\n");return t},G.buildExtensionString=function(e){let t="";return (e=e||[]).forEach((e=>{t+=`#ifdef GL_${e}\n#extension GL_${e} : enable\n#endif\n`;})),t},G.addBlock=function(e,...t){G.blocks[e]=G.blocks[e]||[],G.blocks[e].push(...t);},G.removeBlock=function(e){G.blocks[e]=[];},G.replaceBlock=function(e,...t){G.removeBlock(e),G.addBlock(e,...t);},G.updateProgram=function(e,t,i,r){let n=N(e._tangram_id+"::"+i+"::"+r);if(G.programs_by_source[n])return m("trace","Reusing identical source GL program object"),G.programs_by_source[n];var s=G.createShader(e,i,e.VERTEX_SHADER),o=G.createShader(e,r,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 n=new Error(`WebGL program error:\n VALIDATE_STATUS: ${e.getProgramParameter(t,e.VALIDATE_STATUS)}\n ERROR: ${e.getError()}\n --- Vertex Shader ---\n ${i}\n --- Fragment Shader ---\n ${r}`);throw Object.assign(new Error(n),{type:"program"})}return G.programs_by_source[n]=t,t},G.createShader=function(e,t,i){let r=N(e._tangram_id+"::"+t);if(G.shaders_by_source[r])return m("trace","Reusing identical source GL shader object"),G.shaders_by_source[r];let n=e.createShader(i);if(e.shaderSource(n,t),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS)){let t=i===e.VERTEX_SHADER?"vertex":"fragment",r=e.getShaderInfoLog(n),s=F(r);throw Object.assign(new Error(r),{type:t,errors:s})}return G.shaders_by_source[r]=n,n};var C,j={disabled:false,bound_vao:[],init(e){let t;true!==this.disabled&&(t=S(e,"OES_vertex_array_object")),null!=t?m("info","Vertex Array Object extension available"):true!==this.disabled?m("warn","Vertex Array Object extension NOT available"):m("warn","Vertex Array Object extension force disabled");},getExtension(e,t){if(true!==this.disabled)return S(e,t)},create(e,t,i){let r={};r.setup=t,r.teardown=i;let n=this.getExtension(e,"OES_vertex_array_object");return null!=n&&(r._vao=n.createVertexArrayOES(),n.bindVertexArrayOES(r._vao)),r.setup(),r},getCurrentBinding(e){let t=this.bound_vao.filter((t=>t[0]===e))[0];return t&&t[1]},setCurrentBinding(e,t){let i=this.bound_vao,r=i.filter((t=>t[0]===e))[0];null==r?i.push([e,t]):r[1]=t;},bind(e,t){let i=this.getExtension(e,"OES_vertex_array_object");if(null!=t)null!=i&&null!=t._vao?(i.bindVertexArrayOES(t._vao),this.setCurrentBinding(e,t)):t.setup();else {let t=this.getCurrentBinding(e);null!=i?i.bindVertexArrayOES(null):null!=t&&"function"==typeof t.teardown&&t.teardown(),this.setCurrentBinding(e,null);}},destroy(e,t){let i=this.getExtension(e,"OES_vertex_array_object");null!=i&&null!=t&&null!=t._vao&&(i.deleteVertexArrayOES(t._vao),t._vao=null);}};function V(e,...t){for(let i=0;i<t.length;i++){let r=t[i];if(r)for(let t in r){let i=r[t];null===i||"object"!=typeof i||Array.isArray(i)?void 0!==i&&(e[t]=i):null===e[t]||"object"!=typeof e[t]||Array.isArray(e[t])?e[t]=V({},i):e[t]=V(e[t],i);}}return e}var $=C={};C.default_source_max_zoom=18,C.default_view_max_zoom=20,C.max_style_zoom=25,C.tile_size=256,C.half_circumference_meters=20037508.342789244,C.circumference_meters=2*C.half_circumference_meters,C.min_zoom_meters_per_pixel=C.circumference_meters/C.tile_size;let B=[];C.metersPerPixel=function(e){return B[e]=B[e]||C.min_zoom_meters_per_pixel/Math.pow(2,e),B[e]};let q=[];C.metersPerTile=function(e){return q[e]=q[e]||C.circumference_meters/Math.pow(2,e),q[e]},C.tile_scale=4096,C.units_per_pixel=C.tile_scale/C.tile_size,C.height_scale=16;let X=[];C.unitsPerMeter=function(e){return X[e]=X[e]||C.tile_scale/(C.tile_size*C.metersPerPixel(e)),X[e]},C.metersForTile=function(e){return {x:e.x*C.circumference_meters/Math.pow(2,e.z)-C.half_circumference_meters,y:-(e.y*C.circumference_meters/Math.pow(2,e.z)-C.half_circumference_meters)}},C.tileForMeters=function([e,t],i){return {x:Math.floor((e+C.half_circumference_meters)/(C.circumference_meters/Math.pow(2,i))),y:Math.floor((-t+C.half_circumference_meters)/(C.circumference_meters/Math.pow(2,i))),z:i}},C.wrapTile=function({x:e,y:t,z:i},r={x:true,y:false}){var n=(1<<i)-1;return r.x&&(e&=n),r.y&&(t&=n),{x:e,y:t,z:i}},C.metersToLatLng=function(e){return e[0]/=C.half_circumference_meters,e[1]/=C.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},C.latLngToMeters=function(e){return e[1]=Math.log(Math.tan(e[1]*Math.PI/360+Math.PI/4))/Math.PI,e[1]*=C.half_circumference_meters,e[0]*=C.half_circumference_meters/180,e},C.tileSpaceToLatlng=function(e,t,i){const r=C.unitsPerMeter(t);return C.transformGeometry(e,(e=>{e[0]=e[0]/r+i.x,e[1]=e[1]/r+i.y,C.metersToLatLng(e);})),e},C.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},C.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)));})));},C.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)},C.findBoundingBox=function(e){for(var t=1/0,i=-1/0,r=1/0,n=-1/0,s=e[0].length,o=0;o<s;o++){var a=e[0][o];a[0]<t&&(t=a[0]),a[1]<r&&(r=a[1]),a[0]>i&&(i=a[0]),a[1]>n&&(n=a[1]);}return [t,r,i,n]},C.geometryType=function(e){return "Polygon"===e||"MultiPolygon"===e?"polygon":"LineString"===e||"MultiLineString"===e?"line":"Point"===e||"MultiPoint"===e?"point":void 0},C.centroid=function(e,t=true){if(!e||0===e.length)return;let i,r=0,n=0,s=0,o=e[0],a=o.length;t&&(i=o[0],o=o.map((e=>[e[0]-i[0],e[1]-i[1]])));for(let e=0,t=a-1;e<a;t=e,e++){let i=o[e],a=o[t],l=i[1]*a[0]-a[1]*i[0];r+=(i[0]+a[0])*l,n+=(i[1]+a[1])*l,s+=3*l;}if(!s)return;let l=[r/s,n/s];return t&&(l[0]+=i[0],l[1]+=i[1]),l},C.multiCentroid=function(e){let t=0,i=null;for(let r=0;r<e.length;r++){let n=C.centroid(e[r]);n&&(i=i||[0,0],i[0]+=n[0],i[1]+=n[1],t++);}return t>0&&(i[0]/=t,i[1]/=t),i},C.signedPolygonRingAreaSum=function(e){let t=0,i=e.length;for(let r=0;r<i-1;r++){let i=e[r],n=e[r+1];t+=i[0]*n[1]-n[0]*i[1];}return t+=e[i-1][0]*e[0][1]-e[0][0]*e[i-1][1],t},C.polygonRingArea=function(e){return Math.abs(C.signedPolygonRingAreaSum(e))/2},C.polygonArea=function(e){if(e)return C.polygonRingArea(e[0])},C.multiPolygonArea=function(e){let t=0;for(let i=0;i<e.length;i++)t+=C.polygonArea(e[i]);return t},C.ringWinding=function(e){let t=C.signedPolygonRingAreaSum(e);return t>0?"CW":t<0?"CCW":void 0};const H={functions:{},num_functions:0,num_cached:0};function W(e,t){if("string"==typeof e)e=Y(e,t);else if(null!=e&&"object"==typeof e)for(let i in e)e[i]=W(e[i],t);return e}function Y(e,t){let i="string"==typeof e&&e.match(/^\s*function[^(]*\(([^)]*)\)\s*?\{([\s\S]*)\}$/m);if(i&&i.length>2)try{const e=i[2],r="function"==typeof t?t(e):e,n=N(r);if(void 0===H.functions[n]){let t=i[1].length>0&&i[1].split(",").map((e=>e.trim())).filter((e=>e));t=t.length>0?t:["context"],H.functions[n]=new Function(t.toString(),r),H.functions[n].source=e,H.num_functions++;}else H.num_cached++;return H.functions[n]}catch(t){return e}return e}var Z,J={};var K=k(function(){if(Z)return J;Z=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 i(e){return e<0?0:e>1?1:e}function r(e){return "%"===e[e.length-1]?t(parseFloat(e)/100*255):t(parseInt(e))}function n(e){return "%"===e[e.length-1]?i(parseFloat(e)/100):i(parseFloat(e))}function s(e,t,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?e+(t-e)*i*6:2*i<1?t:3*i<2?e+(t-e)*(2/3-i)*6:e}try{J.parseCSSColor=function(i){var o,a=i.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 h=a.substr(0,l),c=a.substr(l+1,u-(l+1)).split(","),d=1;switch(h){case "rgba":if(4!==c.length)return null;d=n(c.pop());case "rgb":return 3!==c.length?null:[r(c[0]),r(c[1]),r(c[2]),d];case "hsla":if(4!==c.length)return null;d=n(c.pop());case "hsl":if(3!==c.length)return null;var f=(parseFloat(c[0])%360+360)%360/360,_=n(c[1]),p=n(c[2]),m=p<=.5?p*(_+1):p+_-p*_,g=2*p-m;return [t(255*s(g,m,f+1/3)),t(255*s(g,m,f)),t(255*s(g,m,f-1/3)),d];default:return null}}return null};}catch(e){}return J}());const Q={},ee=e=>Math.max(e,0),te=e=>isNaN(e)?0:e,ie=e=>Array.isArray(e)?e.map(parseFloat).map(te):te(parseFloat(e)),re=e=>Array.isArray(e)?e.map(ie).map(ee):ee(ie(e));Object.assign(Q,{clampPositive:ee,noNaN:te,parseNumber:ie,parsePositiveNumber:re}),Q.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 `},Q.zeroPair=Object.freeze([0,0]),Q.defaults={color:[1,1,1,1],width:1,size:1,extrude:false,height:20,min_height:0,order:0,z:0,outline:{color:[0,0,0,0],width:0},material:{ambient:1,diffuse:1}},Q.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]}},Q.getFeatureParseContext=function(e,t,i){return {feature:e,id:e.id,tile:t,global:i,zoom:t.style_z,geometry:$.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 ne={STATIC:0,DYNAMIC:1,ZOOM:2};Q.CACHE_TYPE=ne,Q.createPropertyCache=function(e,t=null,i=null){if(null==e)return;if(e.value)return {value:e.value,zoom:e.zoom?{}:null,type:e.type};let r={value:e,type:ne.STATIC};return Array.isArray(r.value)&&Array.isArray(r.value[0])?(r.zoom={},r.type=ne.ZOOM):"function"==typeof r.value&&(r.type=ne.DYNAMIC,r.dynamic_transform="function"==typeof i?i:null),"function"==typeof t&&(r.zoom?r.value=r.value.map(((e,i)=>[e[0],t(e[1],i)])):"function"!=typeof r.value&&(r.value=t(r.value,0))),r},Q.createColorPropertyCache=function(e){return Q.createPropertyCache(e,(e=>"Style.color.pseudoRandomColor"===e?Y(Q.wrapFunction(Q.macros["Style.color.pseudoRandomColor"])):"Style.color.randomColor"===e?Q.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 Q.createPropertyCache(e.value,((i,r)=>(Array.isArray(i)?(i=i.map(((t,i)=>e.has_ratio[r][i]?t:re(t))).map(((i,n)=>e.has_pct[r][n]?t.css_size[n]*i/100:i)),e.has_ratio[r][0]?i[0]=i[1]*t.aspect:e.has_ratio[r][1]&&(i[1]=i[0]/t.aspect)):(i=re(i),i=e.has_pct[r]?t.css_size.map((e=>e*i/100)):[i,i]),i)))}function he(e,t){try{return e(t)}catch(i){m("warn",`Property function in layer '${t.layers[t.layers.length-1]}' failed with\n`,`error ${i.stack}\n`,`function '${e.source}'\n`,t.feature,t);}}Q.createPointSizePropertyCache=function(e,t){let i=null,r=null;if(se(e))i=[true];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])))&&(i=e.map((e=>Array.isArray(e[1])?e[1].map((e=>se(e))):se(e[1]))),r=e.map((e=>Array.isArray(e[1])&&e[1].map((e=>oe(e))))),r.some((e=>Array.isArray(e)&&e.every((e=>e))))))throw le}else if(e.some(ae)&&(i=[e.map(se)],r=[e.map(oe)],r[0].every((e=>e))))throw le}else if(oe(e))throw "this value only allowed as half of an array, eg [16px, auto]:";if(i||r){if(!t)throw "% or 'auto' keywords can only be used to specify point size when a texture is defined";(e={value:e}).has_pct=i,e.has_ratio=r,e.sprites={};}else e=Q.createPropertyCache(e,re);return e},Q.evalCachedPointSizeProperty=function(e,t,i,r){if(null!=e)return e.has_pct||e.has_ratio?t?(e.sprites[t.sprite]||(e.sprites[t.sprite]=ue(e,t)),Q.evalCachedProperty(e.sprites[t.sprite],r)):(e.texture=e.texture||ue(e,i),Q.evalCachedProperty(e.texture,r)):Q.evalCachedProperty(e,r)},Q.evalCachedProperty=function(e,t){return null==e?void 0:e.dynamic?he(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,he(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)},Q.convertUnits=function(e,t){if(null!=e.value)return "px"===e.units?e.value*$.metersPerPixel(t.zoom):e.value;if("string"==typeof e)"px"===e.trim().slice(-2)?(e=ie(e),e*=$.metersPerPixel(t.zoom)):e=ie(e);else if(Array.isArray(e))return Array.isArray(e[0])?e.map((e=>[e[0],Q.convertUnits(e[1],t)])):e.map((e=>Q.convertUnits(e,t)));return e},Q.parseUnits=function(e){var t={value:ie(e)};return 0!==t.value&&"string"==typeof e&&"px"===e.trim().slice(-2)&&(t.units="px"),t},Q.evalCachedDistanceProperty=function(e,t){return null==e?void 0:e.dynamic?he(e.dynamic,t):e.zoom&&e.zoom[t.zoom]?e.zoom[t.zoom]:"function"==typeof e.value?(e.dynamic=e.value,he(e.dynamic,t)):e.zoom?(e.zoom[t.zoom]=g.interpolate(t.zoom,e.value,(e=>Q.convertUnits(e,t))),e.zoom[t.zoom]):Q.convertUnits(e.value,t)},Q.string_colors={},Q.colorForString=function(e){if(Q.string_colors[e])return Q.string_colors[e];let t=K.parseCSSColor(e);return t&&4===t.length?(t[0]/=255,t[1]/=255,t[2]/=255):t=Q.defaults.color,Q.string_colors[e]=t,t},Q.evalCachedColorProperty=function(e,t={}){if(null!=e){if(e.dynamic){let i=he(e.dynamic,t);return "string"==typeof i&&(i=Q.colorForString(i)),i&&null==i[3]&&(i[3]=1),i}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 i=he(e.dynamic,t);return "string"==typeof i&&(i=Q.colorForString(i)),i&&null==i[3]&&(i[3]=1),i}if("string"==typeof e.value)return e.static=Q.colorForString(e.value),e.static;if(e.zoom){if(!e.zoom_preprocessed){for(let t=0;t<e.value.length;t++){let i=e.value[t];i&&"string"==typeof i[1]&&(i[1]=Q.colorForString(i[1]));}e.zoom_preprocessed=true;}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}},Q.evalCachedColorPropertyWithAlpha=function(e,t,i){const r=Q.evalCachedColorProperty(e,i);if(null!=r&&null!=t){const e=Q.evalCachedProperty(t,i);if(null!=e)return [r[0],r[1],r[2],e]}return r},Q.parseColor=function(e,t={}){if("function"==typeof e&&(e=he(e,t)),"string"==typeof e)e=Q.colorForString(e);else if(Array.isArray(e)&&Array.isArray(e[0])){for(let t=0;t<e.length;t++){let i=e[t];"string"==typeof i[1]&&(i[1]=Q.colorForString(i[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},Q.calculateOrder=function(e,t){return "function"==typeof e?e=he(e,t):"string"==typeof e&&(e=t.feature.properties[e]?t.feature.properties[e]:re(e)),e},Q.evalProperty=function(e,t){return "function"==typeof e?he(e,t):e};class ce{constructor(e,t,i){this.gl=e,this.workers=t,this._lock_fn="function"==typeof i&&i,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=M.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()||false}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(...ce.defaultColor);}getFeatureAt(e,{radius:t}){return !e||e.x<0||e.y<0||e.x>1||e.y>1?Promise.resolve({feature:null,changed:false}):new Promise(((i,r)=>{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:i,reject:r};}))}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 i=this.requests[t];if(i.sent)continue;let r,n,s=255,{point:o,radius:l}=i;if(l){let e=Math.min(this.fbo_size.width,this.fbo_size.height);n={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},n={x:1,y:1};if((null==this.pixels||this.pixels.byteLength<n.x*n.y*4)&&(this.pixels=new Uint8Array(n.x*n.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),n.x,n.y,e.RGBA,e.UNSIGNED_BYTE,this.pixels);let u=4*(Math.round(n.y/2)*n.x+Math.round(n.x/2)),h=this.pixels[u]+(this.pixels[u+1]<<8)+(this.pixels[u+2]<<16);if(h>0)r=h+(this.pixels[u+3]<<24)>>>0,s=this.pixels[u+3];else {let e=-1>>>0;u=0;for(let t=0;t<n.y;t++)for(let i=0;i<n.x;i++,u+=4)if(h=this.pixels[u]+(this.pixels[u+1]<<8)+(this.pixels[u+2]<<16),h>0){let o=(i-n.x/2)*(i-n.x/2)+(t-n.y/2)*(t-n.y/2);o<=e&&(r=h+(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:i.id,key:r}).then((e=>{this.finishRead(e);})):this.finishRead({id:i.id}),i.sent=true;}e.bindFramebuffer(e.FRAMEBUFFER,null);}}),this.read_delay);}finishRead(e){var t=this.requests[e.id];if(t){var i=e.feature,r=false;(null!=i&&null==this.feature||null==i&&null!=this.feature||null!=i&&null!=this.feature&&JSON.stringify(i)!==JSON.stringify(this.feature))&&(r=true),this.feature=i,t.resolve({feature:i,changed:r,request:t}),delete this.requests[e.id];}else m("error","FeatureSelection.finishRead(): could not find message",e);}static makeEntry(e){this.map_entry++;var t=255&this.map_entry,i=this.map_entry>>8&255,r=this.map_entry>>16&255,n=this.map_prefix,s=t/255,o=i/255,a=r/255,l=n/255,u=t+(i<<8)+(r<<16)+(n<<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,i){var r=this.makeEntry(t);return r.feature={id:e.id,properties:e.properties,source_name:i.source,source_layer:i.layer,layers:i.layers,tile:this.tiles[t.key].tile},r.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;ce.map={},ce.tiles={},ce.map_size=0,ce.map_entry=0,ce.map_prefix=0,ce.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 _e{constructor(e,t,i,r,n){n=n||{},this.gl=e,this.vertex_data=t,this.element_data=i,this.vertex_layout=r,this.vertex_buffer=this.gl.createBuffer(),this.buffer_size=this.vertex_data.byteLength,this.draw_mode=n.draw_mode||this.gl.TRIANGLES,this.data_usage=n.data_usage||this.gl.STATIC_DRAW,this.vertices_per_geometry=3,this.uniforms=n.uniforms,this.textures=n.textures,this.retain=n.retain||false,this.created_at=+new Date,this.fade_in_time=n.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=false,this.element_data?(this.toggle_element_array=true,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=true;}render(e={}){if(!this.valid)return false;var t=e.program||G.current;t.use(),this.uniforms&&(t.saveUniforms(this.uniforms),t.setUniforms(this.uniforms,false));let i=(+new Date-this.created_at)/1e3;return t.uniform("1f","u_visible_time",i),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),j.bind(this.gl,null),this.uniforms&&t.restoreUniforms(this.uniforms),i<this.fade_in_time}bind(e){let t=this.vaos[e.id];t?j.bind(this.gl,t):this.vaos[e.id]=j.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 false;this.valid=false;for(let e in this.vaos)j.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=>M.release(e))),true}}const pe=["emission","ambient","diffuse","specular"];class me{constructor(e){e=e||{},pe.forEach((t=>{const i=e[t];null!=i&&(i.texture?this[t]={texture:i.texture,mapping:i.mapping||"spheremap",scale:z.expandVec3(null!=i.scale?i.scale:1),amount:z.expandVec4(null!=i.amount?i.amount:1)}:"number"==typeof i||Array.isArray(i)?this[t]={amount:z.expandVec4(i)}:this[t]="string"==typeof i?{amount:Q.parseColor(i)}:i);})),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:z.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){pe.forEach((t=>{let i=`TANGRAM_MATERIAL_${t.toUpperCase()}`,r=i+"_TEXTURE";e.defines[i]=null!=this[t],this[t]&&this[t].texture&&(e.defines[r]=true,e.defines[r+"_"+this[t].mapping.toUpperCase()]=true,e.defines[`TANGRAM_MATERIAL_TEXTURE_${this[t].mapping.toUpperCase()}`]=true,e.texcoords=e.texcoords||"uv"===this[t].mapping);})),this.normal&&this.normal.texture&&(e.defines.TANGRAM_MATERIAL_NORMAL_TEXTURE=true,e.defines["TANGRAM_MATERIAL_NORMAL_TEXTURE_"+this.normal.mapping.toUpperCase()]=true,e.defines[`TANGRAM_MATERIAL_TEXTURE_${this.normal.mapping.toUpperCase()}`]=true,e.texcoords=e.texcoords||"uv"===this.normal.mapping),e.replaceShaderBlock(me.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){pe.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;me.block="material";var ye=ge={};ge.copy=function(e){for(var t=[],i=e.length,r=0;r<i;r++)t[r]=e[r];return t},ge.neg=function(e){for(var t=[],i=e.length,r=0;r<i;r++)t[r]=-e[r];return t},ge.add=function(e,t){for(var i=[],r=Math.min(e.length,t.length),n=0;n<r;n++)i[n]=e[n]+t[n];return i},ge.sub=function(e,t){for(var i=[],r=Math.min(e.length,t.length),n=0;n<r;n++)i[n]=e[n]-t[n];return i},ge.signed_area=function(e,t,i){return (t[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(t[1]-e[1])},ge.mult=function(e,t){var i,r=[],n=e.length;if("number"==typeof t)for(i=0;i<n;i++)r[i]=e[i]*t;else for(n=Math.min(e.length,t.length),i=0;i<n;i++)r[i]=e[i]*t[i];return r},ge.div=function(e,t){var i,r=[];if("number"==typeof t)for(i=0;i<e.length;i++)r[i]=e[i]/t;else {var n=Math.min(e.length,t.length);for(i=0;i<n;i++)r[i]=e[i]/t[i];}return r},ge.perp=function(e,t){return [t[1]-e[1],e[0]-t[0]]},ge.rot=function(e,t){var i=Math.cos(t),r=Math.sin(t);return [e[0]*i-e[1]*r,e[0]*r+e[1]*i]},ge.angle=function([e,t]){return Math.atan2(t,e)},ge.angleBetween=function(e,t){var i=ge.dot(ge.normalize(ge.copy(e)),ge.normalize(ge.copy(t)));return i>1&&(i=1),Math.acos(i)},ge.isEqual=function(e,t){for(var i=e.length,r=0;r<i;r++)if(e[r]!==t[r])return false;return true},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 i=0,r=Math.min(e.length,t.length),n=0;n<r;n++)i+=e[n]*t[n];return i};class xe{constructor(e,t){this.name=t.name,this.view=e,null==t.ambient||"number"==typeof t.ambient?this.ambient=z.expandVec3(t.ambient||0):this.ambient=Q.parseColor(t.ambient).slice(0,3),null==t.diffuse||"number"==typeof t.diffuse?this.diffuse=z.expandVec3(null!=t.diffuse?t.diffuse:1):this.diffuse=Q.parseColor(t.diffuse).slice(0,3),null==t.specular||"number"==typeof t.specular?this.specular=z.expandVec3(t.specular||0):this.specular=Q.parseColor(t.specular).slice(0,3);}static create(e,t){if(xe.types[t.type])return new xe.types[t.type](e,t)}static setMode(e,t){ true===e&&(e="fragment"),e=xe.enabled&&(null!=e?e:"fragment"),t.defines.TANGRAM_LIGHTING_FRAGMENT="fragment"===e,t.defines.TANGRAM_LIGHTING_VERTEX="vertex"===e;}static inject(e){if(G.removeBlock(xe.block),!xe.enabled)return;let t="";if(e&&Object.keys(e).length>0){let i={};for(let t in e)i[e[t].type]=true;for(let e in i)xe.types[e].inject();for(let i in e)e[i].inject(),t+=`calculateLight(${i}, _eyeToPoint, _normal);\n`;}let i=`\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 }`;G.addBlock(xe.block,i);}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 `;G.addBlock(xe.block,e),G.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);}}xe.types={},xe.block="lighting",xe.enabled=true;xe.types.ambient=class extends xe{constructor(e,t){super(e,t),this.type="ambient",this.struct_name="AmbientLight";}static inject(){G.addBlock(xe.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);}};xe.types.directional=class extends xe{constructor(e,t){if(super(e,t),this.type="directional",this.struct_name="DirectionalLight",t.direction)this._direction=t.direction;else {let e=135,i=Math.sin(60*Math.PI/180);this._direction=[Math.cos(Math.PI*e/180)*i,Math.sin(Math.PI*e/180)*i,-0.5],null==t.ambient&&(this.ambient=z.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(){G.addBlock(xe.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 xe{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(){G.addBlock(xe.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(),G.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT=0!==this.attenuation,G.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS=null!=this.radius&&null!=this.radius[0],G.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS=null!=this.radius;}update(){this.updateEyePosition();}updateEyePosition(){if("world"===this.origin){const e=$.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]=Q.convertUnits(this.position[2],{zoom:this.view.zoom,meters_per_pixel:$.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=Q.convertUnits(this.position,{zoom:this.view.zoom,meters_per_pixel:$.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),G.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT&&e.uniform("1f",`u_${this.name}.attenuationExponent`,this.attenuation),G.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS&&e.uniform("1f",`u_${this.name}.innerRadius`,Q.convertUnits(this.radius[0],{zoom:this.view.zoom,meters_per_pixel:$.metersPerPixel(this.view.zoom)})),G.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS&&e.uniform("1f",`u_${this.name}.outerRadius`,Q.convertUnits(this.radius[1],{zoom:this.view.zoom,meters_per_pixel:$.metersPerPixel(this.view.zoom)}));}}xe.types.point=be;xe.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(){G.addBlock(xe.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 ve extends Error{constructor(e){super(),this.name="MethodNotImplemented",this.message="Method "+e+" must be implemented in subclass";}}class Ae{constructor(e,t){if(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){m({level:"warn",once:true},`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&&(Ae.types[e]=t);}static create(e,t){if("function"==typeof Ae.types[e.type]){const i=Ae.types[e.type](e);if(i)return new i(e,t)}}static tileLayoutChanged(e,t){if(!e||!t)return true;const i=["max_zoom","zooms","min_display_zoom","max_display_zoom","bounds","tile_size","zoom_offset"],r=R(e.config,i),n=R(t.config,i);return JSON.stringify(r)!==JSON.stringify(n)}static projectData(e){var t=+new Date;for(var i in e.layers)for(var r=e.layers[i].features.length,n=0;n<r;n++){var s=e.layers[i].features[n];$.transformGeometry(s.geometry,this.projectCoord);} void 0!==e.debug&&(e.debug.projection=+new Date-t);}static projectCoord(e){$.latLngToMeters(e);}static scaleData(e,{coords:{z:t},min:i}){let r=$.unitsPerMeter(t);for(var n in e.layers)for(var s=e.layers[n].features.length,o=0;o<s;o++){var a=e.layers[n].features[o];$.transformGeometry(a.geometry,(e=>{e[0]=(e[0]-i.x)*r,e[1]=(e[1]-i.y)*r*-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 i=e.source_data.layers[t];i&&i.features&&i.features.forEach((e=>{$.transformGeometry(e.geometry,(e=>{e[1]=-e[1],this.pad_scale&&(e[0]=Math.round(e[0]*(1+this.pad_scale)-$.tile_scale*this.pad_scale/2),e[1]=Math.round(e[1]*(1+this.pad_scale)-$.tile_scale*this.pad_scale/2));})),this.updateDefaultWinding(e.geometry);}));}return e.default_winding=this.default_winding||"CCW",e}))}_load(){throw new ve("_load")}copyTileData(e,t){return m("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:$.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))&&(m({level:"warn",once:true},`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=$.ringWinding(e.coordinates[0]):"MultiPolygon"===e.type&&(this.default_winding=$.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 false;for(let t=0;t<this.rasters.length;t++){const i=this.rasters[t];if(this.sources[i]&&this.sources[i]!==this&&!this.sources[i].includesTile(e,e.z))return false}return true}validate(){}}Ae.types={};let Te=0;class we extends Ae{constructor(e,t){super(e,t),this.response_type="";let[i,r]=function(e,t){if(!t||0===Object.keys(t).length)return [e,[]];var i=e.indexOf("?"),r=e.indexOf("#"),n="";r>-1&&(n=e.slice(r),e=e.slice(0,r)),-1===i&&(i=e.length,e+="?"),i++;var s="",o=[];for(var a in t)""===T(a,e)?s+=`${a}=${t[a]}&`:o.push([a,t[a]]);return [e=e.slice(0,i)+s+e.slice(i)+n,o]}(e.url,e.url_params);this.url=i,r.forEach((([t,i])=>{m({level:"warn",once:true},`Data source '${this.name}': parameter '${t}' already present in URL '${e.url}', skipping value '${t}=${i}' 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),i=e.source_data;return i.url=t,e.debug=e.debug||{},e.debug.network=+new Date,new Promise((r=>{let n=Te+++"-"+t,s=g.io(t,6e4,this.response_type,"GET",this.request_headers,n);i.request_id=n,i.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,i,t):i.layers={},e.debug.parsing=+new Date-e.debug.parsing,r(e);}));})).catch((t=>{i.error=t.stack,r(e);}));}))}validate(e){if("string"!=typeof e.url)throw Error("Network data source must provide a string `url` property")}formatURL(){throw new ve("formatURL")}parseSourceData(){throw new ve("parseSourceData")}}class Ee extends we{constructor(e,t){super(e,t),this.tiled=true,this.bounds=this.parseBounds(e),this.builds_geometry_tiles=false,this.tms=true===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):m({level:"warn",once:true},`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,i,r,n]=e.bounds;return {latlng:[...e.bounds],meters:{min:$.latLngToMeters([t,n]),max:$.latLngToMeters([r,i])},tiles:{min:{},max:{}}}}}checkBounds(e,t){if(t){e=$.wrapTile(e);let i=t.tiles.min[e.z];i||(i=t.tiles.min[e.z]=$.tileForMeters(t.meters.min,e.z));let r=t.tiles.max[e.z];if(r||(r=t.tiles.max[e.z]=$.tileForMeters(t.meters.max,e.z)),e.y<i.y||e.y>r.y)return false;if(i.x<=r.x){if(e.x<i.x||e.x>r.x)return false}else if(e.x>r.x&&e.x<i.x)return false}return true}includesTile(e,t){return !!super.includesTile(e,t)&&!!this.checkBounds(e,this.bounds)}formatURL(e,t){let i=$.wrapTile(t.coords,{x:true});this.tms&&(i.y=Math.pow(2,i.z)-1-i.y);let r=e.replace("{x}",i.x).replace("{y}",i.y).replace("{z}",i.z).replace("{r}",this.getDensityModifier()).replace("{q}",this.toQuadKey(i));return null!=this.url_subdomains&&(r=r.replace("{s}",this.url_subdomains[this.next_url_subdomain]),this.next_url_subdomain=(this.next_url_subdomain+1)%this.url_subdomains.length),r}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:i}){let r="";for(let n=i;n>0;n--){let i=0,s=1<<n-1;e&s&&i++,t&s&&(i+=2),r+=i.toString();}return r}static urlHasTilePattern(e){return e&&(e.search("{x}")>-1&&e.search("{y}")>-1&&e.search("{z}")>-1||e.search("{q}")>-1)}}const Re={coord(e){return {x:e.x,y:e.y,z:e.z,key:this.coordKey(e)}},coordKey:({x:e,y:t,z:i})=>e+"/"+t+"/"+i,key(e,t,i){if(!(e.y<0||e.y>=1<<e.z||e.z<0))return [t.name,e.x,e.y,e.z,i].join("/")},normalizedKey(e,t,i){return this.key(this.normalizedCoord(e,t),t,i)},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:i},r){if(i!==(r=Math.max(0,r))){let n=Math.pow(2,i-r);e=Math.floor(e/n),t=Math.floor(t/n),i=r;}return this.coord({x:e,y:t,z:i})},coordForTileZooms({x:e,y:t,z:i},r){const n=this.findZoomInRange(i,r);return n!==i?this.coordAtZoom({x:e,y:t,z:i},n):this.coord({x:e,y:t,z:i})},findZoomInRange:(e,t)=>t.filter((t=>e>=t)).reverse()[0]||t[0],isDescendant(e,t){if(t.z>e.z){let{x:i,y:r}=this.coordAtZoom(t,e.z);return e.x===i&&e.y===r}return false},parent({coords:e,source:t,style_z:i}){if(i>0){i--;const r=Math.max(i-t.zoom_bias,t.zooms[0]),n=this.coordForTileZooms(this.coordAtZoom(e,r),t.zooms);return n.z>i?null:{key:this.key(n,t,i),coords:n,style_z:i,source:t}}},children({coords:e,source:t,style_z:i},r={}){i++;const n=this.coordForTileZooms(this.coordAtZoom(e,i-t.zoom_bias),t.zooms);if(n.z===e.z)return [{key:this.key(n,t,i),coords:n,style_z:i,source:t}];{const s=this.key(n,t,i);if(r[t.id]=r[t.id]||{},null==r[t.id][s]){const o=Math.pow(2,n.z-e.z),a=e.x*o,l=e.y*o;let u=[];for(let e=a;e<a+o;e++)for(let r=l;r<l+o;r++){let s=this.coord({x:e,y:r,z:n.z});u.push({key:this.key(s,t,i),coords:s,style_z:i,source:t});}r[t.id][s]=u;}return r[t.id][s]}}};class Me extends Ee{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=$.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),i=t.key;if(!this.textures[i]){let e=this.formatURL(this.url,{coords:t});this.textures[i]={name:e,url:e,filtering:this.filtering,coords:t};}return this.textures[i]}adjustRasterTileZoom(e){let t=e.coords;const i=this.sources[e.source];if(i!==this){let r=this.zoom_bias-i.zoom_bias;r>0?t=Re.normalizedCoord(e.coords,{zoom_bias:r,zooms:this.zooms}):(r<0&&m({level:"warn",once:true},`Raster source '${this.name}' supports higher zoom detail than source '${i.name}' it's attached to. Downsampling this source ${-r} extra zoom levels to match.`),t=Re.coordForTileZooms(t,this.zooms));}return t}}class ze extends Me{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=true,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:i}){let r=this.adjustRasterTileZoom(e);const n="opaque"!==t,s=`raster-${this.name}-${r.key}-${n?"alpha":"opaque"}-${i}`;if(M.textures[s])return {name:s,coords:r,skip_create:true};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 i=n?null!=t.alpha?t.alpha:this.alpha:1;return this.drawImage(t.url,t.bounds,i,e,o,l)}))),{name:s,element:a,filtering:this.filtering,coords:r}}async drawImage(e,t,i,r,n,s){const o=N(e);this.load_image[o]=this.load_image[o]||this.loadImage(e);const a=await this.load_image[o],l=$.metersPerPixel(r.coords.z)/n/(this.tile_size/$.tile_size),u=(t.meters.min[0]-r.min.x)/l,h=-(t.meters.min[1]-r.min.y)/l,c=(t.meters.max[0]-t.meters.min[0])/l,d=-(t.meters.max[1]-t.meters.min[1])/l;s.globalAlpha=null!=i?i:1,s.drawImage(a,u,h,c,d);}loadImage(e){return new Promise((t=>{let i=new Image;i.onload=()=>t(i),i.onerror=i=>{m("warn",`Raster source '${this.name}': failed to load url: '${e}'`,i),t(null);},g.isSafari()&&"data:"===e.slice(0,5)||(i.crossOrigin="anonymous"),i.src=e;}))}includesTile(e,t){return !!Ae.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 i="Raster data source must provide a `bounds` parameter, or an array of `composite` raster ";i+="image objects that each have a `bounds` parameter";if(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(i);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(i)}}}Ae.register("Raster",(e=>Me.urlHasTilePattern(e.url)?Me:ze));function Pe(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r);}return i}function Se(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Pe(Object(i),true).forEach((function(t){n(e,t,i[t]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Pe(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t));}));}return e}var Ne={init({generation:e,styles:t,sources:i={},introspection:r}={}){this.setGeneration(e),this.styles=t,this.sources=i,this.defines=Object.prototype.hasOwnProperty.call(this,"defines")&&this.defines||{},this.shaders=Object.prototype.hasOwnProperty.call(this,"shaders")&&this.shaders||{},this.introspection=r||false,this.selection=this.selection||this.introspection||false,this.compile_setup=false,this.program=null,this.selection_program=null,this.feature_style={},this.vertex_template=[],this.tile_data={},this.stencil_proxy_tiles=true,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()}`]=true,this.removeShaderBlock("setup"),this.material instanceof me||(me.isValid(this.material)||(this.material=Q.defaults.material),this.material=new me(this.material)),this.material.inject(this),xe.setMode(this.lighting,this),this.setupRasters(),this.setupCustomAttributes(),this.initialized=true;},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=false;},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 i=t.meshes[e];0!==i.vertex_data.vertex_count?(i.vertex_data.end(),i.vertex_elements=i.vertex_data.element_buffer,i.vertex_data=i.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 i=this.tile_data[e.id].meshes;if(null==i[t.key]){const e=this.vertexLayoutForMeshVariant(t);i[t.key]={variant:t,vertex_data:e.createVertexData()};}return i[t.key]},vertexLayoutForMeshVariant(){},meshVariantTypeForDraw(){},addFeature(e,t,i){let r=i.tile;if(r.generation!==this.generation)return;this.tile_data[r.id]||this.startData(r);let n=this.parseFeature(e,t,i);n&&this.buildGeometry(e.geometry,n,i)>0&&(e.generation=this.generation);},buildGeometry(e,t,i){let r;if("Polygon"===e.type?r=this.buildPolygons([e.coordinates],t,i):"MultiPolygon"===e.type?r=this.buildPolygons(e.coordinates,t,i):"LineString"===e.type?r=this.buildLines([e.coordinates],t,i):"MultiLineString"===e.type?r=this.buildLines(e.coordinates,t,i):"Point"===e.type?r=this.buildPoints([e.coordinates],t,i):"MultiPoint"===e.type&&(r=this.buildPoints(e.coordinates,t,i)),r>0&&x.layer_stats){let e=i.tile;e.debug.layers=e.debug.layers||{list:{},tree:{}};let t=e.debug.layers.list,n=e.debug.layers.tree,s={};i.layers.forEach((e=>{ke(t,e,1,r,{[this.name]:r},{[this.baseStyle()]:r});let i=n,o=s,a=e.split(":");for(let e=0;e<a.length;e++){let t=a[e];i[t]=i[t]||{features:0,geoms:0,styles:{},base:{}},null==o[t]&&(o[t]={},ke(i,t,1,r,{[this.name]:r},{[this.baseStyle()]:r})),e<a.length-1&&(i[t].layers=i[t].layers||{}),i=i[t].layers,o=o[t];}}));}return r},parseFeature(e,t,i){try{var r=this.feature_style;if(r.order=this.parseOrder(t.order,i),null==r.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 m({level:"warn",once:!0},e)}if(!(r=this._parseFeature(e,t,i)))return;if(this.shaders.attributes){r.attributes=r.attributes||{};for(const e in this.shaders.attributes)r.attributes[e]=Q.evalCachedProperty(t.attributes&&t.attributes[e],i),"number"!=typeof r.attributes[e]&&(r.attributes[e]=0);}return this.selection?r.interactive=Q.evalProperty(t.interactive,i):r.interactive=!1,!0===r.interactive?r.selection_color=ce.makeColor(e,i.tile,i):r.selection_color=ce.defaultColor,r}catch(t){m("error","Style.parseFeature: style parsing error",e,r,t.stack);}},_parseFeature(){return this.feature_style},preprocess(e){if(!e.preprocessed){if(this.draw)for(let t in this.draw){let i=this.draw[t];"object"!=typeof i||Array.isArray(i)?null==e[t]&&(e[t]=i):e[t]=V({},i,e[t]);}if(this.selection?this.introspection&&(e.interactive=true):e.interactive=false,!(e=this._preprocess(e)))return;if(this.shaders.attributes){e.attributes=e.attributes||{};for(const t in this.shaders.attributes)e.attributes[t]=Q.createPropertyCache(null!=e.attributes[t]?e.attributes[t]:0);}e.preprocessed=true;}return e},_preprocess:e=>e,parseOrder:(e,t)=>"number"!=typeof e?Q.calculateOrder(e,t):e,scaleOrder:e=>2*e,parseColor(e,t){return e?Q.evalCachedColorProperty(e,t):this.shaders.blocks.color||this.shaders.blocks.filter?Q.defaults.color:void 0},buildPolygons:()=>0,buildLines:()=>0,buildPoints:()=>0,setGL(e){this.gl=e,this.max_texture_size=M.getMaxTextureSize(this.gl);},makeMesh(e,t,i={}){let r=this.vertexLayoutForMeshVariant(i.variant);return x.wireframe?(t=function(e){const t=new Uint16Array(2*e.length);for(let i=0;i<e.length;i+=3)t.set([e[i],e[i+1],e[i+1],e[i+2],e[i+2],e[i]],2*i);return t}(t),new _e(this.gl,e,t,r,Se(Se({},i),{},{draw_mode:this.gl.LINES}))):new _e(this.gl,e,t,r,i)},render:e=>e.render(),getProgram(e="program"){this.compileSetup();const t=this[e];if(t&&!t.error){if(!t.compiled){m("debug",`Compiling style '${this.name}', program key '${e}'`);try{t.compile();}catch(t){throw m("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=true;}var i=this.shaders&&this.shaders.blocks,r=this.shaders&&this.shaders.block_scopes,n=Object.assign({},this.shaders&&this.shaders.uniforms);for(let e in n)null==n[e]&&m({level:"warn",once:true},`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 G(this.gl,this.vertex_shader_src,this.fragment_shader_src,{name:this.name,defines:e,uniforms:n,blocks:i,block_scopes:r,extensions:s}),this.selection?this.selection_program=new G(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:n,blocks:i,block_scopes:r,extensions:s}):this.selection_program=null,this.compile_setup=true;}},addShaderBlock(e,t,i=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(i);},removeShaderBlock(e){this.shaders.blocks&&(this.shaders.blocks[e]=null),this.shaders.block_scopes&&(this.shaders.block_scopes[e]=null);},replaceShaderBlock(e,t,i=null){this.removeShaderBlock(e),this.addShaderBlock(e,t,i);},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=true:"normal"===this.raster&&(this.defines.TANGRAM_RASTER_TEXTURE_NORMAL=true);let e=Object.keys(this.sources).filter((e=>this.sources[e]instanceof Me)).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=true,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 i;try{i=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(!i||i.length<1)return t;if(i.some((e=>!e.loaded)))return null;t.uniforms.u_raster_mask_alpha=true===this.sources[e.rasters[0]].mask_alpha;const r=t.uniforms.u_rasters=[],n=t.uniforms.u_raster_sizes=[],s=t.uniforms.u_raster_offsets=[];return i.forEach((i=>{const o=i.index;if(r[o]=i.name,t.textures.push(i.name),n[o]=[i.width,i.height],e.coords.z>i.coords.z){let t=e.coords.z-i.coords.z,r=Math.pow(2,t);s[o]=[(e.coords.x%r+r)%r/r,(r-1-e.coords.y%r)/r,1/r];}else s[o]=[0,0,1];})),t},async loadTextures(e){let t={},i={},r=[];e.rasters.map((e=>this.sources[e])).filter((e=>e)).forEach(((n,s)=>{n instanceof Me&&r.push(n.tileTexture(e,this).then((e=>{t[e.name]=e,i[e.name]=s;})));})),await Promise.all(r),await M.createFromObject(this.gl,t);let n=await Promise.all(Object.keys(t).map((e=>M.textures[e]&&M.textures[e].load())).filter((e=>e)));return n.forEach((e=>e.retain())),n.map((e=>({name:e.name,width:e.width,height:e.height,loaded:e.loaded,index:i[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&&(false!==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,i]of Object.entries(this.shaders.attributes))"float"===i.type&&e.push({name:`a_${t}`,size:1,type:fe.FLOAT,normalized:false});return e},addCustomAttributesToVertexTemplate(e,t){if(this.shaders.attributes)for(let i in this.shaders.attributes)this.vertex_template[t++]=null!=e.attributes[i]?e.attributes[i]:0;},setup(){this.setUniforms(),this.material.setupProgram(G.current);},setUniforms(){var e,t=G.current;t&&t.setUniforms(null===(e=this.shaders)||void 0===e?void 0:e.uniforms,true);},render_states:{opaque:{depth_test:true,depth_write:true},translucent:{depth_test:true,depth_write:true},add:{depth_test:true,depth_write:false},multiply:{depth_test:true,depth_write:false},inlay:{depth_test:true,depth_write:false},overlay:{depth_test:false,depth_write:false}},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 ke(e,t,i,r,n,s){e[t]=e[t]||{features:0,geoms:0,styles:{},base:{}},e[t].features+=i,e[t].geoms+=r;for(let i in n)e[t].styles[i]=e[t].styles[i]||0,e[t].styles[i]+=n[i];for(let i in s)e[t].base[i]=e[t].base[i]||0,e[t].base[i]+=s[i];}let Oe=Math.pow(2,16)-1,Le=false;class Ie{constructor(){this.array=[],this.has_overflown=false;}push(e){this.has_overflown&&!Le||e>Oe&&(this.has_overflown=true,!Le)||this.array.push(e);}end(){if(this.array.length){let t=(e=this.array,new(this.has_overflown&&Le?Uint32Array:Uint16Array)(e));return this.array=[],this.has_overflown=false,t}return false;var e;}}Ie.setElementIndexUint=function(e){Le=e;};let Fe={[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 De{constructor(e,{prealloc:t=500}={}){this.vertex_layout=e,this.vertex_elements=new Ie,this.stride=this.vertex_layout.stride,De.array_pool.length>0?(this.vertex_buffer=De.array_pool.pop(),this.byte_length=this.vertex_buffer.byteLength,this.size=Math.floor(this.byte_length/this.stride),m("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=Fe[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),De.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(),m("trace",`VertexData: ${this.size} vertices total, realloc count ${this.realloc_count}`),this}}De.array_pool=[];class Ue{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,i=0;for(let e=0;e<this.attribs.length;e++){let r=this.attribs[e];if(null==r.static){r.offset=this.stride,r.byte_size=r.size;let e=0;switch(r.type){case fe.FLOAT:case fe.INT:case fe.UNSIGNED_INT:r.byte_size*=4,e=2;break;case fe.SHORT:case fe.UNSIGNED_SHORT:r.byte_size*=2,e=1;}3&r.byte_size&&(r.byte_size+=4-(3&r.byte_size)),this.stride+=r.byte_size;let n=r.offset>>e;for(let t=0;t<r.size;t++)this.components.push({type:r.type,shift:e,offset:n++,index:i++});this.index[r.name]=t,t+=r.size,this.offset[r.name]=r.offset;}else r.static=Array.isArray(r.static)?r.static:[r.static],r.method=`vertexAttrib${r.static.length}fv`;}}enableDynamicAttributes(e,t){for(const t in Ue.enabled_attribs)e.disableVertexAttribArray(t);Ue.enabled_attribs={},this.dynamic_attribs.forEach((i=>{const r=t.attribute(i.name).location;-1!==r&&(e.enableVertexAttribArray(r),e.vertexAttribPointer(r,i.size,i.type,i.normalized,this.stride,i.offset),Ue.enabled_attribs[r]=t);}));}enableStaticAttributes(e,t){this.static_attribs.forEach((i=>{const r=t.attribute(i.name).location;-1!==r&&e[i.method]instanceof Function&&(e.enableVertexAttribArray(r),e[i.method](r,i.static),e.disableVertexAttribArray(r));}));}createVertexData(){return new De(this)}getAddVertexFunction(){return null==this.addVertex&&this.createAddVertexFunction(),this.addVertex}createAddVertexFunction(){let e=N(JSON.stringify(this.attribs));if(null==Ue.add_vertex_funcs[e]){let t,i=["var t, o;"],r=[...this.components];r.sort(((e,t)=>e.type!==t.type?e.type-t.type:e.index-t.index));for(let e=0;e<r.length;e++){let n=r[e];t!==n.type&&(i.push(`t = vs[${n.type}];`),i.push(`o = off${n.shift?" >> "+n.shift:""};`),t=n.type),i.push(`t[o + ${n.offset}] = v[${n.index}];`);}i=i.join("\n");let n=new Function("v","vs","off",i);Ue.add_vertex_funcs[e]=n;}this.addVertex=Ue.add_vertex_funcs[e];}}Ue.enabled_attribs={},Ue.add_vertex_funcs={};const Ge=[{x:0,y:0},{x:$.tile_scale,y:-$.tile_scale}],Ce=[0,0,1,1];function je(e,t,i){let r=Ge[0],n=Ge[1];return e[0]<=r.x+i&&t[0]<=r.x+i||e[0]>=n.x-i&&t[0]>=n.x-i||e[1]>=r.y-i&&t[1]>=r.y-i||e[1]<=n.y+i&&t[1]<=n.y+i}function Ve(e,t){t=t||0;let i=Ge[0],r=Ge[1];return e[0]<=i.x+t||e[0]>=r.x-t||e[1]>=i.y-t||e[1]<=r.y+t}var $e,Be={exports:{}};var qe=function(){if($e)return Be.exports;function e(e,n,s){s=s||2;var o,a,h,c,f,_,p,m=n&&n.length,g=m?n[0]*s:e.length,y=t(e,0,g,s,true),x=[];if(!y||y.next===y.prev)return x;if(m&&(y=function(e,r,n,s){var o,a,h,c=[];for(o=0,a=r.length;o<a;o++)(h=t(e,r[o]*s,o<a-1?r[o+1]*s:e.length,s,false))===h.next&&(h.steiner=true),c.push(d(h));for(c.sort(l),o=0;o<c.length;o++)u(c[o],n),n=i(n,n.next);return n}(e,n,y,s)),e.length>80*s){o=h=e[0],a=c=e[1];for(var b=s;b<g;b+=s)(f=e[b])<o&&(o=f),(_=e[b+1])<a&&(a=_),f>h&&(h=f),_>c&&(c=_);p=0!==(p=Math.max(h-o,c-a))?1/p:0;}return r(y,x,s,o,a,p),x}function t(e,t,i,r,n){var s,o;if(n===E(e,t,i,r)>0)for(s=t;s<i;s+=r)o=A(s,e[s],e[s+1],o);else for(s=i-r;s>=t;s-=r)o=A(s,e[s],e[s+1],o);return o&&m(o,o.next)&&(T(o),o=o.next),o}function i(e,t){if(!e)return e;t||(t=e);var i,r=e;do{if(i=false,r.steiner||!m(r,r.next)&&0!==p(r.prev,r,r.next))r=r.next;else {if(T(r),(r=t=r.prev)===r.next)break;i=true;}}while(i||r!==t);return t}function r(e,t,l,u,h,d,f){if(e){!f&&d&&function(e,t,i,r){var n=e;do{null===n.z&&(n.z=c(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,i,r,n,s,o,a,l,u=1;do{for(i=e,e=null,s=null,o=0;i;){for(o++,r=i,a=0,t=0;t<u&&(a++,r=r.nextZ);t++);for(l=u;a>0||l>0&&r;)0!==a&&(0===l||!r||i.z<=r.z)?(n=i,i=i.nextZ,a--):(n=r,r=r.nextZ,l--),s?s.nextZ=n:e=n,n.prevZ=s,s=n;i=r;}s.nextZ=null,u*=2;}while(o>1)}(n);}(e,u,h,d);for(var _,p,m=e;e.prev!==e.next;)if(_=e.prev,p=e.next,d?s(e,u,h,d):n(e))t.push(_.i/l),t.push(e.i/l),t.push(p.i/l),T(e),e=p.next,m=p.next;else if((e=p)===m){f?1===f?r(e=o(i(e),t,l),t,l,u,h,d,2):2===f&&a(e,t,l,u,h,d):r(i(e),t,l,u,h,d,1);break}}}function n(e){var t=e.prev,i=e,r=e.next;if(p(t,i,r)>=0)return false;for(var n=e.next.next;n!==e.prev;){if(f(t.x,t.y,i.x,i.y,r.x,r.y,n.x,n.y)&&p(n.prev,n,n.next)>=0)return false;n=n.next;}return true}function s(e,t,i,r){var n=e.prev,s=e,o=e.next;if(p(n,s,o)>=0)return false;for(var a=n.x<s.x?n.x<o.x?n.x:o.x:s.x<o.x?s.x:o.x,l=n.y<s.y?n.y<o.y?n.y:o.y:s.y<o.y?s.y:o.y,u=n.x>s.x?n.x>o.x?n.x:o.x:s.x>o.x?s.x:o.x,h=n.y>s.y?n.y>o.y?n.y:o.y:s.y>o.y?s.y:o.y,d=c(a,l,t,i,r),_=c(u,h,t,i,r),m=e.prevZ,g=e.nextZ;m&&m.z>=d&&g&&g.z<=_;){if(m!==e.prev&&m!==e.next&&f(n.x,n.y,s.x,s.y,o.x,o.y,m.x,m.y)&&p(m.prev,m,m.next)>=0)return false;if(m=m.prevZ,g!==e.prev&&g!==e.next&&f(n.x,n.y,s.x,s.y,o.x,o.y,g.x,g.y)&&p(g.prev,g,g.next)>=0)return false;g=g.nextZ;}for(;m&&m.z>=d;){if(m!==e.prev&&m!==e.next&&f(n.x,n.y,s.x,s.y,o.x,o.y,m.x,m.y)&&p(m.prev,m,m.next)>=0)return false;m=m.prevZ;}for(;g&&g.z<=_;){if(g!==e.prev&&g!==e.next&&f(n.x,n.y,s.x,s.y,o.x,o.y,g.x,g.y)&&p(g.prev,g,g.next)>=0)return false;g=g.nextZ;}return true}function o(e,t,r){var n=e;do{var s=n.prev,o=n.next.next;!m(s,o)&&g(s,n,n.next,o)&&b(s,o)&&b(o,s)&&(t.push(s.i/r),t.push(n.i/r),t.push(o.i/r),T(n),T(n.next),n=e=o),n=n.next;}while(n!==e);return i(n)}function a(e,t,n,s,o,a){var l=e;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&_(l,u)){var h=v(l,u);return l=i(l,l.next),h=i(h,h.next),r(l,t,n,s,o,a),void r(h,t,n,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 i,r=t,n=e.x,s=e.y,o=-1/0;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var a=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=n&&a>o){if(o=a,a===n){if(s===r.y)return r;if(s===r.next.y)return r.next}i=r.x<r.next.x?r:r.next;}}r=r.next;}while(r!==t);if(!i)return null;if(n===o)return i;var l,u=i,c=i.x,d=i.y,_=1/0;r=i;do{n>=r.x&&r.x>=c&&n!==r.x&&f(s<d?n:o,s,c,d,s<d?o:n,s,r.x,r.y)&&(l=Math.abs(s-r.y)/(n-r.x),b(r,e)&&(l<_||l===_&&(r.x>i.x||r.x===i.x&&h(i,r)))&&(i=r,_=l)),r=r.next;}while(r!==u);return i}(e,t),t){var r=v(t,e);i(t,t.next),i(r,r.next);}}function h(e,t){return p(e.prev,e,t.prev)<0&&p(t.next,e,e.next)<0}function c(e,t,i,r,n){return (e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function d(e){var t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;}while(t!==e);return i}function f(e,t,i,r,n,s,o,a){return (n-o)*(t-a)-(e-o)*(s-a)>=0&&(e-o)*(r-a)-(i-o)*(t-a)>=0&&(i-o)*(s-a)-(n-o)*(r-a)>=0}function _(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&g(i,i.next,e,t))return true;i=i.next;}while(i!==e);return false}(e,t)&&(b(e,t)&&b(t,e)&&function(e,t){var i=e,r=false,n=(e.x+t.x)/2,s=(e.y+t.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&n<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;}while(i!==e);return r}(e,t)&&(p(e.prev,e,t.prev)||p(e,t.prev,t))||m(e,t)&&p(e.prev,e,e.next)>0&&p(t.prev,t,t.next)>0)}function p(e,t,i){return (t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function m(e,t){return e.x===t.x&&e.y===t.y}function g(e,t,i,r){var n=x(p(e,t,i)),s=x(p(e,t,r)),o=x(p(i,r,e)),a=x(p(i,r,t));return n!==s&&o!==a||(!(0!==n||!y(e,i,t))||(!(0!==s||!y(e,r,t))||(!(0!==o||!y(i,e,r))||!(0!==a||!y(i,t,r)))))}function y(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function x(e){return e>0?1:e<0?-1:0}function b(e,t){return p(e.prev,e,e.next)<0?p(e,t,e.next)>=0&&p(e,e.prev,t)>=0:p(e,t,e.prev)<0||p(e,e.next,t)<0}function v(e,t){var i=new w(e.i,e.x,e.y),r=new w(t.i,t.x,t.y),n=e.next,s=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function A(e,t,i,r){var n=new w(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function T(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 w(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=false;}function E(e,t,i,r){for(var n=0,s=t,o=i-r;s<i;s+=r)n+=(e[o]-e[s])*(e[s+1]+e[o+1]),o=s;return n}return $e=1,Be.exports=e,Be.exports.default=e,e.deviation=function(e,t,i,r){var n=t&&t.length,s=n?t[0]*i:e.length,o=Math.abs(E(e,0,s,i));if(n)for(var a=0,l=t.length;a<l;a++){var u=t[a]*i,h=a<l-1?t[a+1]*i:e.length;o-=Math.abs(E(e,u,h,i));}var c=0;for(a=0;a<r.length;a+=3){var d=r[a]*i,f=r[a+1]*i,_=r[a+2]*i;c+=Math.abs((e[d]-e[_])*(e[f+1]-e[d+1])-(e[d]-e[f])*(e[_+1]-e[d+1]));}return 0===o&&0===c?0:Math.abs((c-o)/o)},e.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},r=0,n=0;n<e.length;n++){for(var s=0;s<e[n].length;s++)for(var o=0;o<t;o++)i.vertices.push(e[n][s][o]);n>0&&(r+=e[n-1].length,i.holes.push(r));}return i},Be.exports}(),Xe=k(qe);function He(e,t,i=0,r=e.length-1,n=Ye){for(;r>i;){if(r-i>600){const s=r-i+1,o=t-i+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);He(e,t,Math.max(i,Math.floor(t-o*l/s+u)),Math.min(r,Math.floor(t+(s-o)*l/s+u)),n);}const s=e[t];let o=i,a=r;for(We(e,i,t),n(e[r],s)>0&&We(e,i,r);o<a;){for(We(e,o,a),o++,a--;n(e[o],s)<0;)o++;for(;n(e[a],s)>0;)a--;}0===n(e[i],s)?We(e,i,a):(a++,We(e,a,r)),a<=t&&(i=a+1),t<=a&&(r=a-1);}}function We(e,t,i){const r=e[t];e[t]=e[i],e[i]=r;}function Ye(e,t){return e<t?-1:e>t?1:0}const Ze=[0,0,1];function Je(e,t,i,{texcoord_index:r,texcoord_scale:n,texcoord_normalize:s}){let o,a,l,u,h,c,d,f,_,p,m,g,y=t.vertex_elements,x=e.length,b=0;r&&(s=s||1,[o,a,l,u]=n||Ce);for(let n=0;n<x;n++){const x=500;let A=e[n];A.length>x&&(A=[...A],He(A,x,1,A.length-1,((e,t)=>t.area-e.area)),A=A.slice(0,x));const T=(v=Xe.flatten(A),Xe(v.vertices,v.holes,v.dimensions)),w=T.length,E=t.vertex_count;if(w){r&&([h,c,d,f]=$.findBoundingBox(A),_=d-h,p=f-c,m=(l-o)/_,g=(u-a)/p);for(let e=0;e<A.length;e++){let n=A[e];for(let e=0;e<n.length;e++){let l=n[e];i[0]=l[0],i[1]=l[1],r&&(i[r+0]=((l[0]-h)*m+o)*s,i[r+1]=((l[1]-c)*g+a)*s),t.addVertex(i);}}for(let e=0;e<w;e++)y.push(E+T[e]);b+=w/3;}}var v;return b}var Ke='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',Qe="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(Ne);Object.assign(et,{name:"polygons",built_in:true,vertex_shader_src:Ke,fragment_shader_src:Qe,selection:true,init(){Ne.init.apply(this,arguments),this.defines.TANGRAM_NORMAL_ATTRIBUTE=true,this.defines.TANGRAM_TEXTURE_COORDS=this.texcoords;},_parseFeature(e,t,i){var r=this.feature_style;return r.color=this.parseColor(t.color,i),r.color?(r.alpha=Q.evalCachedProperty(t.alpha,i),r.variant=t.variant,r.z=Q.evalCachedDistanceProperty(t.z,i)||Q.defaults.z,r.z*=$.height_scale,r.extrude=Q.evalProperty(t.extrude,i),r.extrude&&(true===r.extrude?(r.height=e.properties.height||Q.defaults.height,r.min_height=e.properties.min_height||Q.defaults.min_height):"number"==typeof r.extrude?(r.height=r.extrude,r.min_height=0):Array.isArray(r.extrude)&&(r.min_height=r.extrude[0],r.height=r.extrude[1]),r.height*=$.height_scale,r.min_height*=$.height_scale),r.tile_edges=t.tile_edges,r):null},_preprocess(e){return e.color=Q.createColorPropertyCache(e.color),e.alpha=Q.createPropertyCache(e.alpha),e.z=Q.createPropertyCache(e.z,Q.parseUnits),this.computeVariant(e),e},computeVariant(e){const t=e.interactive?1:0,i=null!=e.extrude?1:0,r=this.texcoords?1:0,n=this.getBlendOrderForDraw(e),s=[t,i,r,n].join("/");e.variant=s,null==this.variants[s]&&(this.variants[s]={key:s,blend_order:n,mesh_order:0,selection:t,normal:i,texcoords:r});},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.key]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:false},{name:"a_normal",size:3,type:fe.BYTE,normalized:true,static:e.normal?null:[0,0,1]},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:true},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:true,static:e.selection?null:[0,0,0,0]},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:true,static:e.texcoords?null:[0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new Ue(t);}return this.vertex_layouts[e.key]},meshVariantTypeForDraw(e){return this.variants[e.variant]},makeVertexTemplate(e,t){let i=0;return 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),t.variant.normal&&(this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=127),this.vertex_template[i++]=255*e.color[0],this.vertex_template[i++]=255*e.color[1],this.vertex_template[i++]=255*e.color[2],this.vertex_template[i++]=255*(null!=e.alpha?e.alpha:e.color[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.texcoords&&(this.vertex_template[i++]=0,this.vertex_template[i++]=0),this.addCustomAttributesToVertexTemplate(e,i),this.vertex_template},buildPolygons(e,t,i){let r=this.getTileMesh(i.tile,this.meshVariantTypeForDraw(t)),n=r.vertex_data,s=n.vertex_layout,o=this.makeVertexTemplate(t,r),a={texcoord_index:s.index.a_texcoord,texcoord_normalize:65535,remove_tile_edges:!t.tile_edges,tile_edge_tolerance:$.tile_scale*i.tile.pad_scale*4,winding:i.winding};return t.extrude&&t.height?function(e,t,i,r,n,s,o,a,{remove_tile_edges:l,tile_edge_tolerance:u,texcoord_index:h,texcoord_scale:c,texcoord_normalize:d,winding:f}){var _=t+(r||0),p=t+i;s[2]=p;var m=Je(e,n,s,{texcoord_index:h,texcoord_scale:c,texcoord_normalize:d}),g=n.vertex_elements,y=n.vertex_count;if(h){d=d||1;var[x,b,v,A]=c||Ce,T=[[x,A],[x,b],[v,b],[v,A]];}for(var w=e.length,E=0;E<w;E++)for(var R=e[E],M=0;M<R.length;M++)for(var z=R[M],P=0;P<z.length-1;P++){if(l&&je(z[P],z[P+1],u))continue;let e,t;"CCW"===f?(e=P,t=P+1):(e=P+1,t=P);var S=[[z[t][0],z[t][1],p],[z[t][0],z[t][1],_],[z[e][0],z[e][1],_],[z[e][0],z[e][1],p]];let i=ye.normalize([z[t][0]-z[e][0],z[t][1]-z[e][1],0]),r=ye.cross(Ze,i);s[o+0]=r[0]*a,s[o+1]=r[1]*a,s[o+2]=r[2]*a;for(var N=0;N<S.length;N++)s[0]=S[N][0],s[1]=S[N][1],s[2]=S[N][2],h&&(s[h+0]=T[N][0]*d,s[h+1]=T[N][1]*d),n.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,m+=2;}return m}(e,t.z,t.height,t.min_height,n,o,s.index.a_normal,127,a):Je(e,n,o,a)}});const tt=[0,0],it={butt:0,square:1,round:2},rt={miter:0,bevel:1,round:2},nt=$.tile_scale,st=[0,0],ot=[1,0],at=[.5,0];function lt(e,t){if(!(e.length<2)){var i,r,n,s,{join_type:o,cap_type:a,closed_polygon:l,remove_tile_edges:u,tile_edge_tolerance:h,v_scale:c,miter_len_sq:d}=t,f=null!=t.texcoord_index,_=0;if(l&&o===rt.miter){var p=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!==p){var m=function(e,t){var i=[];for(let n=0;n<e.length;n++){var r=(n+t)%e.length;0!==r&&i.push(e[r]);}return i.push(i[0]),i}(e,p);return t.extra_lines=t.extra_lines||[],void t.extra_lines.push(m)}}var g=0,y=e.length-1,x=0;for(i=e[g],r=e[g+1];ye.isEqual(i,r);)if(i=r,r=e[++g+1],x++,g===e.length-1)return;for(;ye.isEqual(e[y],e[y-1]);)if(x++,0===--y)return;if(!(e.length<2+x))if(s=ye.normalize(ye.perp(i,r)),u&&je(i,r,h)){var b=ut(e,g,h);b&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(b));}else {l?function(e,t,i,r,n){if(void 0===r||Ve(e))_t(e,i,i,1,0,n,1),_t(e,i,i,0,0,n,-1);else {var s=0;r===rt.miter?ct(s,e,t,i,n.miter_len_sq,true,n):dt(r,s,e,t,i,true,n);}}(i,n=ye.normalize(ye.perp(e[y-1],i)),s,o,t):(Ve(i)||(gt(i,_,s,a,true,t),f&&a!==it.butt&&(_+=.5*c*t.texcoord_width)),_t(i,s,s,1,_,t,1),_t(i,s,s,0,_,t,-1)),f&&(_+=c*ye.length(ye.sub(r,i)));for(var v=g+1;v<y;v++){var A=v,T=v+1;if(i=e[A],r=e[T],!ye.isEqual(i,r)){if(u&&je(i,r,h)){_t(i,s,s,1,_,t,1),_t(i,s,s,0,_,t,-1),ft(1,t);var w=ut(e,A+1,h);return void(w&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(w)))}n=s,s=ye.normalize(ye.perp(i,r)),o===rt.miter?ct(_,i,n,s,d,false,t):dt(o,_,i,n,s,false,t),f&&(_+=c*ye.length(ye.sub(r,i)));}}i=r,n=s,l?function(e,t,i,r,n,s){if(Ve(e))_t(e,t,t,1,n,s,1),_t(e,t,t,0,n,s,-1),ft(1,s);else {var o=ht(t,i);r===rt.miter&&ye.lengthSq(o)>s.miter_len_sq&&(r=rt.bevel),r===rt.miter?(_t(e,o,t,1,n,s,1),_t(e,o,t,0,n,s,-1),ft(1,s)):(_t(e,t,t,1,n,s,1),_t(e,t,t,0,n,s,-1),ft(1,s));}}(i,n,s=ye.normalize(ye.perp(i,e[1])),o,_,t):(_t(i,n,s,1,_,t,1),_t(i,n,s,0,_,t,-1),ft(1,t),Ve(i)||gt(i,_,n,a,false,t));}}}function ut(e,t,i){for(var r=t;e[r+1]&&je(e[r],e[r+1],i);)r++;return e.length-r>=2&&e.slice(r)}function ht(e,t){var i=ye.normalize(ye.add(e,t)),r=2/(1+Math.abs(ye.dot(e,i)));return ye.mult(i,r*r)}function ct(e,t,i,r,n,s,o){var a=ht(i,r);ye.lengthSq(a)>n?dt(rt.bevel,e,t,i,r,s,o):(_t(t,a,a,1,e,o,1),_t(t,a,a,0,e,o,-1),s||ft(1,o));}function dt(e,t,i,r,n,s,o){var a=ht(r,n),l=n[0]*r[1]-n[1]*r[0]>0;null!=o.texcoord_index&&(st[1]=t,ot[1]=t),l?(_t(i,a,a,1,t,o,1),_t(i,r,a,0,t,o,-1),s||ft(1,o),mt(i,ye.neg(r),a,ye.neg(n),a,st,ot,st,false,e===rt.bevel,o),_t(i,a,a,1,t,o,1),_t(i,n,a,0,t,o,-1)):(_t(i,r,a,1,t,o,1),_t(i,a,a,0,t,o,-1),s||ft(1,o),mt(i,r,ye.neg(a),n,a,ot,st,ot,false,e===rt.bevel,o),_t(i,n,a,1,t,o,1),_t(i,a,a,0,t,o,-1));}function ft(e,t){for(var i=t.vertex_data.vertex_elements,r=t.vertex_data.vertex_count-2*e-2,n=0;n<e;n++)i.push(r+2*n+2),i.push(r+2*n+1),i.push(r+2*n+0),i.push(r+2*n+2),i.push(r+2*n+3),i.push(r+2*n+1),t.geom_count+=2;}function _t(e,t,i,r,n,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]=i[0]*s.offset,a[s.offset_index+1]=i[1]*s.offset),null!=s.texcoord_index&&(a[s.texcoord_index+0]=65535*r,a[s.texcoord_index+1]=65535*n),l.addVertex(a);}var pt=[0,0];function mt(e,t,i,r,n,s,o,a,l,u,h){for(var c=t[0]*r[1]-t[1]*r[0],d=ye.dot(t,r),f=Math.atan2(c,d);f>=Math.PI;)f-=2*Math.PI;if(u)_=1;else {var _=function(e,t){e<0&&(e=-e);var i=t>10?Math.log2(t/5):1;return Math.ceil(e/Math.PI*i)}(f,h.half_width);if(_<1)return}var p=h.vertex_data.vertex_count,m=h.vertex_data.vertex_elements;_t(e,i,n,o[0],o[1],h,1),_t(e,t,n,s[0],s[1],h,1);var g=t,y=null!=h.texcoord_index;if(y)if(l)var x=ye.sub(s,o);else {pt=ye.copy(s);var b=ye.div(ye.sub(a,s),_);}var v=f/_;let A,T,w=f<0?-1:1;c>0?(A=2,T=1):(A=1,T=2);for(var E=0;E<_;E++)0===E&&f<0&&(g=ye.neg(g)),g=ye.rot(g,v),y&&(l?(x=ye.rot(x,v),pt[0]=x[0]+o[0],pt[1]=x[1]*h.texcoord_width*h.v_scale+o[1]):pt=ye.add(pt,b)),_t(e,g,n,pt[0],pt[1],h,w),m.push(p+E+A),m.push(p),m.push(p+E+T);}function gt(e,t,i,r,n,s){var o=ye.neg(i),a=null!=s.texcoord_index;switch(r){case it.square:var l;n?(l=[i[1],-i[0]],_t(e,ye.add(i,l),i,1,t,s,1),_t(e,ye.add(o,l),i,0,t,s,1),a&&(t+=.5*s.texcoord_width*s.v_scale),_t(e,i,i,1,t,s,1),_t(e,o,i,0,t,s,1)):(l=[-i[1],i[0]],_t(e,i,i,1,t,s,1),_t(e,o,i,0,t,s,1),a&&(t+=.5*s.texcoord_width*s.v_scale),_t(e,ye.add(i,l),i,1,t,s,1),_t(e,ye.add(o,l),i,0,t,s,1)),ft(1,s);break;case it.round:var u,h,c=st,d=ot,f=at;n?(u=i,h=o,a&&(t+=.5*s.texcoord_width*s.v_scale,c=ot,d=st,f=at)):(u=o,h=i),a&&(st[1]=t,ot[1]=t,at[1]=t),mt(e,u,tt,h,i,c,f,d,true,false,s);break;case it.butt:return}}const yt=[255,255,255,255],xt=[0,0,0,0];const bt=Object.create(Ne);Object.assign(bt,{name:"lines",built_in:true,vertex_shader_src:Ke,fragment_shader_src:Qe,selection:true,init(){Ne.init.apply(this,arguments),this.defines.TANGRAM_EXTRUDE_LINES=true,this.defines.TANGRAM_TEXTURE_COORDS=true,this.outline_feature_style={},this.inline_feature_style=this.feature_style,this.dash_textures={};},calcDistance:(e,t)=>Q.evalCachedDistanceProperty(e,t)||0,calcDistanceNextZoom(e,t){t.zoom++;let i=this.calcDistance(e,t);return t.zoom--,i},calcWidth(e,t,i){let r,n=this.calcDistance(e.width,i);if(!(n<0)){if(r=e.next_width?this.calcDistanceNextZoom(e.next_width,i):n/2,0===n&&0===r||r<0)return false;if(t.width_unscaled=n,t.next_width_unscaled=r,e.next_width){r*=2;let e=.5*(n+r);t.width=e*i.units_per_meter_overzoom,t.width_scale=1-r/e;}else t.width=n*i.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)*i.units_per_meter_overzoom/i.tile.overzoom2),true}},calcOffset(e,t,i){if(e.offset_precalc)t.offset=e.offset_precalc,t.offset_scale=e.offset_scale_precalc;else if(e.offset){let r=this.calcDistance(e.offset,i);if(e.next_offset){let n=2*this.calcDistanceNextZoom(e.next_offset,i);Math.abs(r)>=Math.abs(n)?(t.offset=r*i.units_per_meter_overzoom,t.offset_scale=0!==r?1-n/r:0):(t.offset=n*i.units_per_meter_overzoom,t.offset_scale=0!==n?-1*(1-r/n):0);}else t.offset=r*i.units_per_meter_overzoom,t.offset_scale=0;}else t.offset=0,t.offset_scale=0;},_parseFeature(e,t,i){var r=this.feature_style;if(false!==this.calcWidth(t,r,i)&&(this.calcOffset(t,r,i),r.color=this.parseColor(t.color,i),r.color)){if(r.alpha=Q.evalCachedProperty(t.alpha,i),r.variant=t.variant,r.z=Q.evalCachedDistanceProperty(t.z,i)||Q.defaults.z,r.height=e.properties.height||Q.defaults.height,r.extrude=Q.evalProperty(t.extrude,i),r.extrude&&("number"==typeof r.extrude?r.height=r.extrude:Array.isArray(r.extrude)&&(r.height=r.extrude[1])),r.extrude&&r.height&&(r.z+=r.height),r.z*=$.height_scale,r.cap=t.cap,r.join=t.join,r.miter_limit=t.miter_limit,r.tile_edges=t.tile_edges,r.outline=r.outline||{width:{},next_width:{},preprocessed:true},t.outline&&false!==t.outline.visible&&t.outline.color&&t.outline.width){let e=2*this.calcDistance(t.outline.width,i),n=2*this.calcDistanceNextZoom(t.outline.next_width,i);0===e&&0===n||e<0||n<0?(r.outline.width.value=null,r.outline.next_width.value=null,r.outline.color=null,r.outline.inline_texcoord_width=null,r.outline.texcoords=false):(r.outline.width.value=e+r.width_unscaled,r.outline.next_width.value=n+r.next_width_unscaled,r.outline.inline_texcoord_width=r.texcoord_width,r.outline.offset_precalc=r.offset,r.outline.offset_scale_precalc=r.offset_scale,r.outline.color=t.outline.color,r.outline.alpha=t.outline.alpha,r.outline.interactive=t.outline.interactive,r.outline.cap=t.outline.cap,r.outline.join=t.outline.join,r.outline.miter_limit=t.outline.miter_limit,r.outline.texcoords=t.outline.texcoords,r.outline.extrude=t.outline.extrude,r.outline.z=t.outline.z,r.outline.style=t.outline.style,r.outline.variant=t.outline.variant,t.outline.order?r.outline.order=this.parseOrder(t.outline.order,i):r.outline.order=r.order,r.outline.order>r.order&&(r.outline.order=r.order),r.outline.order-=.5);}else r.outline.width.value=null,r.outline.next_width.value=null,r.outline.color=null,r.outline.inline_texcoord_width=null;return r}},_preprocess(e){if(e.color=Q.createColorPropertyCache(e.color),e.alpha=Q.createPropertyCache(e.alpha),e.width=Q.createPropertyCache(e.width,Q.parseUnits),e.width&&e.width.type!==Q.CACHE_TYPE.STATIC&&(e.next_width=Q.createPropertyCache(e.width,Q.parseUnits)),e.offset=e.offset&&Q.createPropertyCache(e.offset,Q.parseUnits),e.offset&&e.offset.type!==Q.CACHE_TYPE.STATIC&&(e.next_offset=Q.createPropertyCache(e.offset,Q.parseUnits)),e.z=Q.createPropertyCache(e.z,Q.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&&Q.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=true,e.outline.style=e.outline.style||this.name,e.outline.color=Q.createColorPropertyCache(e.outline.color),e.outline.alpha=Q.createPropertyCache(e.outline.alpha),e.outline.width=Q.createPropertyCache(e.outline.width,Q.parseUnits),e.outline.next_width=Q.createPropertyCache(e.outline.width,Q.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&&Q.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)):(m({level:"warn",once:true},`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]=true;const i=function(e,t={}){const i=t.dash_color||yt,r=t.background_color||xt,n=e,s=t.scale||1;n.length%2==1&&Array.prototype.push.apply(n,n);let o=true,a=[];for(let e=0;e<n.length;e++){let t=Math.floor(n[e]*s);for(let e=0;e<t;e++)Array.prototype.push.apply(a,o?i:r);o=!o;}return a.reverse(),a=new Uint8Array(a),{pixels:a,length:a.length/4}}(e,{scale:20});M.create(this.gl,t,{data:i.pixels,height:i.length,width:1,filtering:"nearest"});}},async endData(e){const t=await Ne.endData.call(this,e);if(t){t.uniforms.u_has_line_texture=false,t.uniforms.u_texture=M.default,t.uniforms.u_v_scale_adjust=$.tile_scale;let e=[];for(let i in t.meshes){let r=t.meshes[i].variant;if(r.texture){let n=t.meshes[i].uniforms=t.meshes[i].uniforms||{};if(n.u_has_line_texture=true,n.u_texture=r.texture,n.u_texture_ratio=1,r.dash&&(n.u_v_scale_adjust=20*$.tile_scale,n.u_has_dash=null!=r.dash_background_color?1:0,n.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]=true;try{await a.postMessage(this.main_thread_target+".getDashTexture",r.dash);}catch(e){m("trace",`${this.name}: line dash texture create failed because style no longer on main thread`);}}if(null==M.textures[r.texture])e.push(M.syncTexturesToWorker([r.texture]).then((e=>{let t=e[r.texture];t&&(n.u_texture_ratio=t.height/t.width);})));else {let e=M.textures[r.texture];n.u_texture_ratio=e.height/e.width;}}}await Promise.all(e);}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 i=this.getBlendOrderForDraw(e);t+="/"+i,t=N(t),e.variant=t,null==this.variants[t]&&(this.variants[t]={key:t,blend_order:i,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:false},{name:"a_extrude",size:2,type:fe.SHORT,normalized:false},{name:"a_offset",size:2,type:fe.SHORT,normalized:false,static:e.offset?null:[0,0]},{name:"a_z_and_offset_scale",size:2,type:fe.SHORT,normalized:false,static:e.z_or_offset?null:[0,0]},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:true,static:e.texcoords?null:[0,0]},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:true},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:true,static:e.selection?null:[0,0,0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new Ue(t);}return this.vertex_layouts[e.key]},meshVariantTypeForDraw(e){return this.variants[e.variant]},makeVertexTemplate(e,t){let i=0;return this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=1024*e.width_scale,this.vertex_template[i++]=this.scaleOrder(e.order),this.vertex_template[i++]=0,this.vertex_template[i++]=0,t.variant.offset&&(this.vertex_template[i++]=0,this.vertex_template[i++]=0),t.variant.z_or_offset&&(this.vertex_template[i++]=e.z||0,this.vertex_template[i++]=1024*e.offset_scale),t.variant.texcoords&&(this.vertex_template[i++]=0,this.vertex_template[i++]=0),this.vertex_template[i++]=255*e.color[0],this.vertex_template[i++]=255*e.color[1],this.vertex_template[i++]=255*e.color[2],this.vertex_template[i++]=255*(null!=e.alpha?e.alpha:e.color[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]),this.addCustomAttributesToVertexTemplate(e,i),this.vertex_template},buildLines(e,t,i,r){if(this.feature_style=this.outline_feature_style,t.outline&&null!=t.outline.color&&null!=t.outline.width.value){var n=this.styles[t.outline.style];n&&n.addFeature(i.feature,t.outline,i);}this.feature_style=this.inline_feature_style;let s=this.getTileMesh(i.tile,this.meshVariantTypeForDraw(t)),o=s.vertex_data,a=o.vertex_layout;return function(e,t,i,r,n,s,o,a){var l,u=t.cap?it[t.cap]:it.butt,h=t.join?rt[t.join]:rt.miter;if(h===rt.miter){const e=t.miter_limit||3;var c=e*e;}n.a_texcoord&&(l=1/(t.texcoord_width*nt));var d={closed_polygon:s,remove_tile_edges:o,tile_edge_tolerance:a,miter_len_sq:c,join_type:h,cap_type:u,vertex_data:i,vertex_template:r,half_width:t.width/2,extrude_index:n.a_extrude,offset_index:n.a_offset,v_scale:l,texcoord_index:n.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,r&&r.closed_polygon,!t.tile_edges&&r&&r.remove_tile_edges,$.tile_scale*i.tile.pad_scale*2)},buildPolygons(e,t,i){let r=0;for(let n=0;n<e.length;n++)r+=this.buildLines(e[n],t,i,{closed_polygon:true,remove_tile_edges:true});return r}});const vt=128/Math.PI,At=16384/Math.PI,Tt=[0,2,2,0],wt=[1,1,3,3],Et=new Array(4);const Rt=["left","top-left","bottom-left"],Mt=["right","top-right","bottom-right"],zt=["top","top-left","top-right"],Pt=["bottom","bottom-left","bottom-right"],St={computeOffset(e,t,i,r=null){if(!i||"center"===i)return e;let n=[e[0],e[1]];return r=r||this.default_buffer,this.isLeftAnchor(i)?(n[0]-=t[0]/2,"left"===i&&(n[0]-=r[0])):this.isRightAnchor(i)&&(n[0]+=t[0]/2,"right"===i&&(n[0]+=r[1])),this.isTopAnchor(i)?(n[1]-=t[1]/2,"top"===i&&(n[1]-=r[2])):this.isBottomAnchor(i)&&(n[1]+=t[1]/2,"bottom"===i&&(n[1]+=r[3])),n},alignForAnchor(e){if(e&&"center"!==e){if(this.isLeftAnchor(e))return "right";if(this.isRightAnchor(e))return "left"}return "center"},isLeftAnchor:e=>Rt.indexOf(e)>-1,isRightAnchor:e=>Mt.indexOf(e)>-1,isTopAnchor:e=>zt.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 Nt(e,t){return !(e[2]<t[0]||e[0]>t[2]||e[3]<t[1]||e[1]>t[3])}const kt=[[1,0],[0,1]],Ot=[],Lt=[];let It,Ft,Dt,Ut;class Gt{constructor(e,t,i,r,n){this.dimension=[r/2,n/2],this.angle=i,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(){if(0===this.angle)return [this.quad[0],this.quad[1],this.quad[4],this.quad[5]];return [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],i=this.dimension[1];if(0===this.angle)this.quad=[e[0]-t,e[1]-i,e[0]+t,e[1]-i,e[0]+t,e[1]+i,e[0]-t,e[1]+i],this.axis_0=kt[0],this.axis_1=kt[1];else {let r=Math.cos(this.angle)*t,n=Math.sin(this.angle)*t,s=-Math.sin(this.angle)*i,o=Math.cos(this.angle)*i;this.quad=[e[0]-r-s,e[1]-n-o,e[0]+r-s,e[1]+n-o,e[0]+r+s,e[1]+n+o,e[0]-r+s,e[1]-n+o],this.updateAxes();}}static projectToAxis(e,t,i){let r=e.quad;return It=r[0]*t[0]+r[1]*t[1],Ft=r[2]*t[0]+r[3]*t[1],Dt=r[4]*t[0]+r[5]*t[1],Ut=r[6]*t[0]+r[7]*t[1],i[0]=Math.min(It,Ft,Dt,Ut),i[1]=Math.max(It,Ft,Dt,Ut),i}static axisCollide(e,t,i,r){return Gt.projectToAxis(e,i,Ot),Gt.projectToAxis(t,i,Lt),!(Lt[0]>Ot[1]||Lt[1]<Ot[0])&&(Gt.projectToAxis(e,r,Ot),Gt.projectToAxis(t,r,Lt),!(Lt[0]>Ot[1]||Lt[1]<Ot[0]))}static intersect(e,t){return Gt.axisCollide(e,t,e.axis_0,e.axis_1)&&Gt.axisCollide(e,t,t.axis_0,t.axis_1)}}class Ct{constructor(e,t={}){this.id=Ct.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=false;}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:jt(this.layout)}}update(){this.align=this.layout.align||St.alignForAnchor(this.anchor);}occluded(e,t=null){let i=false,r=e.aabb,n=e.obb;return r.length>0&&function(e,t,i){for(let r=0;r<t.length&&(!Nt(e,t[r])||null==i(r));r++);}(this.aabb,r,(e=>{if(!t||r[e]!==t.aabb)return 0===this.obb.angle&&0===n[e].angle||Gt.intersect(this.obb,n[e])?(i=true,true):void 0})),i}inTileBounds(){return this.aabb[0]>=0&&this.aabb[1]>-$.tile_scale&&this.aabb[0]<$.tile_scale&&this.aabb[1]<=0||this.aabb[2]>=0&&this.aabb[3]>-$.tile_scale&&this.aabb[2]<$.tile_scale&&this.aabb[3]<=0}mayRepeatAcrossTiles(){if(this.layout.collide)return true;const e=this.layout.repeat_distance;return 0!==e&&(Math.abs(this.position[0])<e||Math.abs(this.position[0]-$.tile_scale)<e||Math.abs(this.position[1])<e||Math.abs(-(this.position[1]-$.tile_scale))<e)}discard(e,t=null){return !!this.throw_away||this.occluded(e,t)}}function jt(e){return {priority:e.priority,collide:e.collide,repeat_distance:e.repeat_distance,repeat_group:e.repeat_group,buffer:e.buffer,italic:e.italic}}Ct.add=function(e,t){if(e.placed=true,e.aabb&&(t.aabb.push(e.aabb),t.obb.push(e.obb)),e.aabbs)for(let i=0;i<e.aabbs.length;i++)t.aabb.push(e.aabbs[i]),t.obb.push(e.obbs[i]);},Ct.id=0,Ct.id_prefix=0,Ct.id_multiplier=0,Ct.nextLabelId=function(){return Ct.id_prefix+Ct.id++*Ct.id_multiplier},Ct.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 i=this.positions[e],r=t[0]-i[0],n=t[1]-i[1];if(r*r+n*n<this.repeat_dist_sq)return true}}add(e){e&&e.position&&this.positions.push(e.position);}static clear(e){this.groups[e]={};}static check(e,t,i){if(t.repeat_distance&&t.repeat_group&&this.groups[i][t.repeat_group])return this.groups[i][t.repeat_group].check(e)}static add(e,t,i){t.repeat_distance&&t.repeat_group&&(null==this.groups[i][t.repeat_group]&&(this.groups[i][t.repeat_group]=new Vt(t.repeat_group,t.repeat_distance*t.repeat_scale)),this.groups[i][t.repeat_group].add(e));}}Vt.groups={};class $t{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 i=[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=i[1];t<=i[3];t++){this.cells[t]=this.cells[t]||{};for(let r=i[0];r<=i[2];r++)this.cells[t][r]=this.cells[t][r]||{aabb:[],obb:[]},e.cells.push(this.cells[t][r]);}}}const Bt={tiles:{},grid:null,initGrid(e){this.grid=null==e?null:new $t(e.anchor,e.span);},startTile(e,{apply_repeat_groups:t=true,return_hidden:i=false}={}){let r=this.tiles[e]={bboxes:{aabb:[],obb:[]},objects:{},labels:{},styles:{},repeat:t,return_hidden:i};null==r.complete&&(r.complete=new Promise(((e,t)=>{r.resolve=e,r.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]=true;},collide(e,t,i){let r=this.tiles[i];if(!r)return m("trace","Collision.collide() called with null tile",i,this.tiles,t,e),Promise.resolve([]);let n=r.objects;for(let i=0;i<e.length;i++){let r=e[i],s=r.label.layout.priority;n[s]=n[s]||{},n[s][t]=n[s][t]||[],n[s][t].push(r);}return delete r.styles[t],0===Object.keys(r.styles).length&&this.endTile(i),r.complete.then((()=>(r.resolve=null,r.labels[t]||[])))},endTile(e){let t=this.tiles[e],i=t.labels;this.grid&&this.addLabelsToGrid(e),t.repeat&&Vt.clear(e);let r=Object.keys(t.objects).sort(((e,t)=>e-t));for(let n=0;n<r.length;n++){let s=t.objects[r[n]];if(s)for(let r in s){let n=s[r];i[r]=i[r]||[];for(let s=0;s<n.length;s++){let o=n[s];this.canBePlaced(o,e,o.linked,t)?o.linked?this.canBePlaced(o.linked,e,o,t)?(o.show=true,(o.label.breach||o.linked.label.breach)&&(o.label.breach=true,o.linked.label.breach=true),(o.label.may_repeat_across_tiles||o.linked.label.may_repeat_across_tiles)&&(o.label.may_repeat_across_tiles=true,o.linked.label.may_repeat_across_tiles=true),i[r].push(o),this.place(o,e,t),this.place(o.linked,e,t)):t.return_hidden&&(o.show=false,i[r].push(o)):(o.show=true,i[r].push(o),this.place(o,e,t)):t.return_hidden&&(o.show=false,i[r].push(o));}}}delete this.tiles[e],t.resolve();},addLabelsToGrid(e){const t=this.tiles[e];for(const e in t.objects){const i=t.objects[e];if(i)for(const e in i){i[e].forEach((e=>this.grid.addLabel(e.label)));}}},canBePlaced(e,t,i=null,{repeat:r=true}={}){let n=e.label,s=e.label.layout;if(null!=n.placed)return n.placed;let o=!s.collide;if(o||(o=this.grid&&n.cells?n.cells.reduce(((e,t)=>(e&&n.discard(t,i&&i.label)&&(e=false),e)),true):!n.discard(this.tiles[t].bboxes,i&&i.label)),o){if(!r||!Vt.check(n,s,t))return true;n.placed=false;}else s.collide&&(n.placed=false);return n.placed},place({label:e},t,{repeat:i=true}){null==e.placed&&(i&&Vt.add(e,e.layout,t),this.grid&&e.cells?e.cells.forEach((t=>Ct.add(e,t))):Ct.add(e,this.tiles[t].bboxes));}};class qt extends Ct{constructor(e,t,i,r=0){super(t,i),this.type="point",this.position=[e[0],e[1]],this.angle=r,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=false;}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=St.computeOffset(this.offset,e.size,e.anchor,St.zero_buffer),this.offset=St.computeOffset(this.offset,e.size,this.anchor,St.zero_buffer),e.offset!==Q.zeroPair&&(this.offset===Q.zeroPair?this.offset=e.offset:(this.offset[0]+=e.offset[0],this.offset[1]+=e.offset[1]));}this.offset=St.computeOffset(this.offset,this.size,this.anchor);}updateBBoxes(){let e=(this.size[0]+2*this.layout.buffer[0])*this.unit_scale*Ct.epsilon,t=(this.size[1]+2*this.layout.buffer[1])*this.unit_scale*Ct.epsilon;this.layout.italic&&(e+=5*this.unit_scale),this.obb=new Gt(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 false;if(super.discard(e,t)){if(Array.isArray(this.layout.anchor))for(let i=this.start_anchor_index;i<this.layout.anchor.length;i++)if(this.anchor=this.layout.anchor[i],this.update(),!super.discard(e,t))return false;return true}return false}}qt.PLACEMENT={VERTEX:0,MIDPOINT:1,SPACED:2,CENTROID:3};const Xt=qt.PLACEMENT;function Ht(e,t,i){const r=[],n=i.placement,s=Math.max(t[0],t[1])*i.placement_min_length_ratio*i.units_per_pixel;if(n===Xt.SPACED){let n=function(e,t,i){let r=i.units_per_pixel,n=(i.placement_spacing||80)*r,s=function(e){let t=0;for(let i=0;i<e.length-1;i++)t+=Yt(e[i],e[i+1]);return t}(e);if(s<=t)return false;let o=Math.max(Math.floor(s/n),1),a=[],l=[],u=.5*(s-(o-1)*n);for(let r=0;r<o;r++){let{position:r,angle:s}=Zt(e,u,t,i);null!=r&&null!=s&&(a.push(r),l.push(s)),u+=n;}return {positions:a,angles:l}}(e,s,i);if(!n)return [];let o=n.positions,a=n.angles;for(let e=0;e<o.length;e++){let n=o[e],s=a[e];true!==i.tile_edges&&Ve(n)||r.push(new qt(n,t,i,s));}}else if(n===Xt.VERTEX){let n,s;for(let o=0;o<e.length-1;o++)if(n=e[o],s=e[o+1],true===i.tile_edges||!Ve(n)){const e=Wt(n,s,i.angle);r.push(new qt(n,t,i,e));}const o=Wt(n,s,i.angle);r.push(new qt(s,t,i,o));}else if(n===Xt.MIDPOINT)for(let n=0;n<e.length-1;n++){let o=e[n],a=e[n+1],l=[.5*(o[0]+a[0]),.5*(o[1]+a[1])];if((true===i.tile_edges||!Ve(l))&&(!s||Yt(o,a)>s)){const e=Wt(o,a,i.angle);r.push(new qt(l,t,i,e));}}return r}function Wt(e,t,i=0){return "auto"===i?Math.atan2(t[0]-e[0],t[1]-e[1]):i}function Yt(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))}function Zt(e,t,i,r){let n,s,o=0;for(let a=0;a<e.length-1;a++){let l=e[a],u=e[a+1];const h=Yt(l,u);if(!(h<=i)&&(o+=h,o>t)){n=Jt(l,u,o-t),s=Wt(l,u,r.angle);break}}return {position:n,angle:s}}function Jt(e,t,i){let r=i/Yt(e,t);return [r*e[0]+(1-r)*t[0],r*e[1]+(1-r)*t[1]]}const Kt={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 i={};e.font=e.font||this.defaults,i.supersample=e.supersample_text?1.5:1,i.can_articulate=e.can_articulate,i.fill=Q.evalCachedColorPropertyWithAlpha(e.font.fill,e.font.alpha,t),i.fill=g.toCSSColor(i.fill),e.font.stroke&&e.font.stroke.color&&(i.stroke=Q.evalCachedColorPropertyWithAlpha(e.font.stroke.color,e.font.stroke.alpha,t),i.stroke=g.toCSSColor(i.stroke),i.stroke_width=Q.evalCachedProperty(e.font.stroke.width,t)),true!==e.font.underline||i.can_articulate||(i.underline_width=1.5*i.supersample),e.font.background&&!i.can_articulate&&(i.background_color=Q.evalCachedColorPropertyWithAlpha(e.font.background.color,e.font.background.alpha,t),i.background_color=g.toCSSColor(i.background_color),i.background_color&&(i.background_width=Q.evalCachedProperty(e.font.background.width,t)),i.background_stroke_color=e.font.background.stroke&&e.font.background.stroke.color&&Q.evalCachedColorPropertyWithAlpha(e.font.background.stroke.color,e.font.background.stroke.alpha,t),i.background_stroke_color&&(i.background_stroke_color=g.toCSSColor(i.background_stroke_color),i.background_stroke_width=null!=e.font.background.stroke.width?Q.evalCachedProperty(e.font.background.stroke.width,t):1)),i.weight=Q.evalCachedProperty(e.font.weight,t)||this.defaults.weight,"number"==typeof i.weight&&(i.weight=Math.min(Math.max(i.weight,1),1e3)),e.font.family?(i.family=e.font.family,i.family!==this.defaults.family&&(i.family+=", "+this.defaults.family)):i.family=this.defaults.family,i.style=e.font.style||this.defaults.style,i.transform=e.font.transform,i.px_size=Q.evalCachedProperty(e.font.px_size,t)*i.supersample,i.font_css=this.fontCSS(i);let r=e.text_wrap;return null!=r||i.can_articulate||(r=true),true===r&&(r=this.defaults.text_wrap),i.text_wrap=r,i.max_lines=e.max_lines||this.defaults.max_lines,i},fontCSS:({style:e,weight:t,px_size:i,family:r})=>[e,t,i+"px",r].filter((e=>e)).join(" ")};var Qt,ei={exports:{}};var ti,ii=k((Qt||(Qt=1,ti=ei,function(){function e(e,t){document.addEventListener?e.addEventListener("scroll",t,false):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 i(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 r(e){var t=e.a.offsetWidth,i=t+100;return e.f.style.width=i+"px",e.c.scrollLeft=i,e.b.scrollLeft=e.b.scrollWidth+100,e.g!==t&&(e.g=t,true)}function n(t,i){function n(){var e=s;r(e)&&e.a.parentNode&&i(e.g);}var s=t;e(t.b,n),e(t.c,n),r(t);}function s(e,t){var i=t||{};this.family=e,this.style=i.style||"normal",this.weight=i.weight||"normal",this.stretch=i.stretch||"normal";}var o=null,a=null,l=null,u=null;function h(){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 c(e,t){return [e.style,e.weight,h()?e.stretch:"","100px",t].join(" ")}s.prototype.load=function(e,r){var s=this,l=e||"BESbswy",h=0,d=r||3e3,f=(new Date).getTime();return new Promise((function(e,r){var _;if(null===u&&(u=!!document.fonts),(_=u)&&(null===a&&(a=/OS X.*Version\/10\..*Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor)),_=!a),_){_=new Promise((function(e,t){!function i(){(new Date).getTime()-f>=d?t():document.fonts.load(c(s,'"'+s.family+'"'),l).then((function(t){1<=t.length?e():setTimeout(i,25);}),(function(){t();}));}();}));var p=new Promise((function(e,t){h=setTimeout(t,d);}));Promise.race([p,_]).then((function(){clearTimeout(h),e(s);}),(function(){r(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!=m&&-1!=g||-1!=m&&-1!=y||-1!=g&&-1!=y)&&((t=m!=g&&m!=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&&(m==x&&g==x&&y==x||m==b&&g==b&&y==b||m==v&&g==v&&y==v)),t=!t),t&&(A.parentNode&&A.parentNode.removeChild(A),clearTimeout(h),e(s));}var u=new t(l),_=new t(l),p=new t(l),m=-1,g=-1,y=-1,x=-1,b=-1,v=-1,A=document.createElement("div");A.dir="ltr",i(u,c(s,"sans-serif")),i(_,c(s,"serif")),i(p,c(s,"monospace")),A.appendChild(u.a),A.appendChild(_.a),A.appendChild(p.a),document.body.appendChild(A),x=u.a.offsetWidth,b=_.a.offsetWidth,v=p.a.offsetWidth,function e(){if((new Date).getTime()-f>=d)A.parentNode&&A.parentNode.removeChild(A),r(s);else {var t=document.hidden;true!==t&&void 0!==t||(m=u.a.offsetWidth,g=_.a.offsetWidth,y=p.a.offsetWidth,a()),h=setTimeout(e,50);}}(),n(u,(function(e){m=e,a();})),i(u,c(s,'"'+s.family+'",sans-serif')),n(_,(function(e){g=e,a();})),i(_,c(s,'"'+s.family+'",serif')),n(p,(function(e){y=e,a();})),i(p,c(s,'"'+s.family+'",monospace'));}));}))},ti.exports=s;}()),ei.exports));const ri={fonts_loaded:Promise.resolve(),last_loaded:null,loadFonts(e){const t=JSON.stringify(e)===this.last_loaded;if(e&&!t){const t=[];for(const i in e)Array.isArray(e[i])?e[i].forEach((e=>t.push(this.loadFontFace(i,e)))):t.push(this.loadFontFace(i,e[i]));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 i={family:e};"object"==typeof t&&(Object.assign(i,t),"string"==typeof t.url&&await this.injectFontFace(i));try{i.weight="string"==typeof i.weight?i.weight.split(" ")[0]:i.weight;const t=new ii(e,i);await t.load(),m("debug",`Font face '${e}' is available`,i);}catch(t){m("warn",`Font face '${e}' is NOT available`,i,t);}},async injectFontFace({family:e,url:t,weight:i,style:r}){ void 0===this.supports_native_font_loading&&(this.supports_native_font_loading=void 0!==window.FontFace);let n=t;if("blob:"===t.slice(0,5)){n=(await g.io(t,6e4,"arraybuffer")).body;let e=new Uint8Array(n);if(this.supports_native_font_loading)n=e;else {let t="";for(let i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);n="data:font/opentype;base64,"+btoa(t);}}if(this.supports_native_font_loading){let t;"string"==typeof n?t=new FontFace(e,`url(${encodeURI(n)})`,{weight:i,style:r}):n instanceof Uint8Array&&(t=new FontFace(e,n,{weight:i,style:r})),document.fonts.add(t),m("trace","Adding FontFace to document.fonts:",t);}else {let t=`\n @font-face {\n font-family: '${e}';\n font-weight: ${i||"normal"};\n font-style: ${r||"normal"};\n src: url(${encodeURI(n)});\n }`,s=document.createElement("style");s.appendChild(document.createTextNode("")),document.head.appendChild(s),s.sheet.insertRule(t,0),m("trace","Injecting CSS font face:",t);}}},ni=new RegExp("[֑-߿יִ-﷽ﹰ-ﻼ]");function si(e){return ni.test(e)}const oi="\0-/:-@[-`{-¿×÷ʹ-˿ -⯿‐-\u2029 -⯿",ai=new RegExp("["+oi+"]+");function li(e){return ai.test(e)}const ui=new RegExp("^["+oi+"-ۿ]+"),hi=new RegExp("["+oi+"آ-إاد-زوٱ-ٷڈ-ڙۄ-ۋۏےۓۮۯ]"),ci=new RegExp("^[ؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ۭ]+"),di="[̀-֑ͯ-ׇֽֿׁׂׅׄަ-ްऀ-ःऺ-ौॎॏ॑-ॗॢॣঁ-ঃ়া-ৌৗৢৣਁ-ਃ਼-ੌੑઁ-ઃ઼ા-ૌૢૣଁ-ଃ଼ା-ୌୖୗୢୣஂா-்ௗఀ-ఃా-ౌౕౖౢౣಁ-ಃ಼ಾ-ೌೕೖೢೣഁ-ഃാ-ൌൎൗൢൣංඃ්-ෟෲෳัิ-ฺ็-๎ັິ-ຼ່-ໍ༹༘༙༵༷༾༿ཱ-ྃ྆྇ྍ-ྼ࿆ါ-း်-ှၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏႚ-ႝ឴-៑៓ᩕ-ᩞᩡ-᩼᷀-᷿⃐-]",fi=new RegExp(`^.(?:${di}+)?([्্੍્୍్್്྄္្᩠᩿]\\W(?:${di}+)?)*`),_i={Mongolian:"᠀-"},pi=Object.keys(_i).map((e=>_i[e])).join(""),mi=new RegExp("["+pi+"]");function gi(e,t,i){const r=t?1:2;if(e.length<r)return [e];let n=e;if(i.segment[n])return i.stats.segment_hits++,i.segment[n];let s=[];if(ui.exec(e)){s=e.split(hi);let t=-1;for(var o=0;o<s.length-1;o++){if(o>0){let e=ci.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="",i=e,n=0;for(;n<r&&i.length;n++){let e=(fi.exec(i)||i)[0];t+=e,i=i.substring(e.length);}s.push(t),e=e.substring(t.length);}return t&&s.reverse(),i.stats.segment_misses++,i.segment[n]=s,s}class yi{constructor(e,t=1/0,i=1/0){this.width=0,this.height=0,this.lines=[],this.max_lines=t,this.text_wrap=i,this.context=e;}createLine(e){return this.lines.length<this.max_lines&&new xi(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,true}return this.addEllipsis(),false}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(yi.ellipsis).width);e.append(yi.ellipsis),e.width+=t,e.width>this.width&&(this.width=e.width);}finish(e){e?this.push(e):this.addEllipsis();}static parse(e,t,i,r,n){let s;s="number"==typeof t?e.split(" "):[e];let o=new yi(n,i,t),a=o.createLine(r);for(let e=0;e<s.length;e++){let i=s[e].split("\n"),n=0===e;for(let s=0;s<i.length&&a;s++){let l=i[s];si(l)&&li(l[l.length-1])&&(l+="");let u=n?l:" "+l;if(t&&e>0&&a.exceedsTextwrap(u)){if(a=o.advance(a,r),!a)break;a.append(l),n=true;}else a.append(u);s<i.length-1&&(a=o.advance(a,r),n=true);}e===s.length-1&&o.finish(a);}return o}}yi.ellipsis="...";class xi{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 bi(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r);}return i}function vi(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?bi(Object(i),true).forEach((function(t){n(e,t,i[t]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):bi(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t));}));}return e}class Ai{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:i,stroke_width:r,px_size:n,supersample:s}){this.px_size=n;let o=this.context,a=g.device_pixel_ratio*s;i&&r>0&&(o.strokeStyle=i,o.lineWidth=r*a),o.fillStyle=t,o.font=e,o.miterLimit=2;}async textSizes(e,t){return await ri.loadFonts(),w.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:i}=e;for(t.style_idx=t.style_idx||0;t.style_idx<t.styles.length;){let n=t.styles[t.style_idx];null==t.text_idx&&(t.text_idx=0,t.texts=Object.keys(i[n]));let s=i[n],o=true;for(;t.text_idx<t.texts.length;){let i=t.texts[t.text_idx],a=s[i],l=a.text_settings;if(o&&(this.setFont(l),o=false),a.size=this.textSize(n,i,l).size,l.can_articulate){let e=false,t=false;if(si(i)&&(li(i)?e=true:t=true),a.isRTL=e,a.no_curving=t||(r=i,mi.test(r)),a.vertical_buffer=this.vertical_text_buffer,a.segment_sizes=[],!a.no_curving){let t=gi(i,e,Ai.cache);a.segments=t;for(let e=0;e<t.length;e++)a.segment_sizes.push(this.textSize(n,t[e],l).size);}}if(t.text_idx++,!w.shouldContinue(e))return false}t.text_idx=null,t.style_idx++;}var r;return w.finish(e,i),true}textSize(e,t,{transform:i,text_wrap:r,max_lines:n,stroke_width:s=0,background_color:o,background_stroke_width:a=0,background_width:l,underline_width:u=0,supersample:h}){if(Ai.cache.text[e]=Ai.cache.text[e]||{},Ai.cache.text[e][t])return Ai.cache.stats.text_hits++,Ai.cache.text[e][t];Ai.cache.stats.text_misses++,Ai.cache.text_count++;const c=g.device_pixel_ratio*h,d=this.applyTextTransform(t,i),f=this.context,_=this.vertical_text_buffer*c,p=(s+this.horizontal_text_buffer)*c;l=null!=l?l:this.background_size;const m=o||a?(l+a)*c:0,y=(2+u+(u?s+1:0))*c,x=this.px_size+y;let{width:b,height:v,lines:A}=yi.parse(d,r,n,x,f);b+=2*m,v+=2*m;let T=[b/c,v/c],w=[b+2*p,v+2*_],E=[w[0]/c,w[1]/c];return Ai.cache.text[e][t]={lines:A,size:{collision_size:T,texture_size:w,logical_size:E,horizontal_buffer:p,vertical_buffer:_,dpr:c,line_height:x,background_size:m}},Ai.cache.text[e][t]}drawTextMultiLine(e,[t,i],r,n,s){const{dpr:o,collision_size:a,texture_size:l,line_height:u,horizontal_buffer:h,vertical_buffer:c}=r;if(n.background_color||n.background_stroke_color){const e=n.background_stroke_color,r=(n.background_stroke_width||0)*o;this.context.save(),n.background_color&&(this.context.fillStyle=n.background_color,this.context.fillRect(t+h+("curved"===s?l[0]:0)+r,i+c+r,o*a[0]-2*r,o*a[1]-2*r)),e&&r&&(this.context.strokeStyle=e,this.context.lineWidth=r,this.context.strokeRect(t+h+("curved"===s?l[0]:0)+.5*r,i+c+.5*r,o*a[0]-r,o*a[1]-r)),this.context.restore();}const d=n.underline_width||0,f=n.stroke_width||0;let _=i-(d?.5*(d+f+1)*o:0);for(let i=0;i<e.length;i++){let o=e[i];this.drawTextLine(o,[t,_],r,n,s),_+=u;}this.drawTextDebug([t,i],r,s);}drawTextLine(e,[t,i],r,n,s){const{stroke:o,stroke_width:a,transform:l,align:u="center"}=n,{horizontal_buffer:h,vertical_buffer:c,texture_size:d,background_size:f,line_height:_,dpr:p}=r,m=(n.underline_width||0)*p,g=this.applyTextTransform(e.text,l);let y;"left"===u?y=t+h+f:"center"===u?y=t+d[0]/2-e.width/2:"right"===u&&(y=t+d[0]-e.width-h-f);const x=i+.75*c+_+f-.5*m,b=o&&a>0&&"curved"===s?d[0]:0;if(m){this.context.save(),this.context.strokeStyle=this.context.fillStyle,this.context.lineWidth=m;const t=x+(.5*a+2)*p+.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,x),this.context.fillText(g,y,x);}drawTextDebug([e,t],i,r){const{dpr:n,horizontal_buffer:s,vertical_buffer:o,texture_size:a,collision_size:l}=i;x.draw_label_collision_boxes&&(this.context.save(),this.context.strokeStyle="blue",this.context.lineWidth=2,this.context.strokeRect(e+s,t+o,n*l[0],n*l[1]),"curved"===r&&this.context.strokeRect(e+a[0]+s,t+o,n*l[0],n*l[1]),this.context.restore()),x.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"===r&&this.context.strokeRect(e+2+a[0],t+2,a[0]-4,a[1]-4),this.context.restore());}rasterize(e,t,i,r,n){return w.add({type:"rasterizeLabels",run:this.processRasterizeTask.bind(this),cancel:this.cancelRasterizeTask.bind(this),pause_factor:2,user_moving_view:false,texts:e,textures:t,texture_prefix:r,gl:n,tile_id:i,cursor:{styles:Object.keys(e),texts:null,style_idx:0,text_idx:null,texture_idx:0,texture_resize:true,texture_names:[]}})}processRasterizeTask(e){let t,{cursor:i,texts:r,textures:n}=e;for(;i.texture_idx<e.textures.length;){for(t=n[i.texture_idx],i.texture_resize&&(i.texture_resize=false,this.resize(...t.texture_size));i.style_idx<i.styles.length;){let n=i.styles[i.style_idx];null==i.text_idx&&(i.text_idx=0,i.texts=Object.keys(r[n]));let s=r[n],o=true;for(;i.text_idx<i.texts.length;){let r=i.texts[i.text_idx],a=s[r],l=a.text_settings;if(o&&(this.setFont(l),o=false),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]!==i.texture_idx)continue;let o,u=a.isRTL?r.split().reverse().join():r,h=t.texcoord_cache[n][u];if(h.texcoord)o=h.texcoord;else {let e=h.texture_position,{size:i,lines:r}=this.textSize(n,u,l);this.drawTextMultiLine(r,e,i,l,s),o=M.getTexcoordsForSprite(e,i.texture_size,t.texture_size),h.texcoord=o;}a.texcoords[s]={texcoord:o,texture_id:h.texture_id};}else if("curved"===s){let r=a.segments;a.texcoords.curved=a.texcoords.curved||[],a.texcoords_stroke=a.texcoords_stroke||[];for(let o=0;o<r.length;o++){if(a.textures[e][o]!==i.texture_idx)continue;let u,h,c=r[o],d=t.texcoord_cache[n][c];if(d.texcoord)u=d.texcoord,h=d.texcoord_stroke,a.texcoords_stroke.push(h);else {let e=d.texture_position,{size:i,lines:r}=this.textSize(n,c,l);this.drawTextMultiLine(r,e,i,l,s),u=M.getTexcoordsForSprite(e,i.texture_size,t.texture_size);let o=[e[0]+i.texture_size[0],e[1]];h=M.getTexcoordsForSprite(o,i.texture_size,t.texture_size),d.texcoord=u,d.texcoord_stroke=h,a.texcoords_stroke.push(h);}a.texcoords.curved.push({texcoord:u,texture_id:d.texture_id});}}}}else {let e=this.textSize(n,r,l).lines;const s=vi({},l);for(let r in a.align)a.align[r].texture_id===i.texture_idx&&(s.align=r,this.drawTextMultiLine(e,a.align[r].texture_position,a.size,s),a.align[r].texcoords=M.getTexcoordsForSprite(a.align[r].texture_position,a.size.texture_size,t.texture_size));}if(i.text_idx++,!w.shouldContinue(e))return false}i.text_idx=null,i.style_idx++;}let s=e.texture_prefix+i.texture_idx;M.create(e.gl,s,{element:this.canvas,filtering:"linear",UNPACK_PREMULTIPLY_ALPHA_WEBGL:true}),M.retain(s),i.texture_names.push(s),i.texture_idx++,i.texture_resize=true,i.style_idx=0;}return w.finish(e,i.texture_names),true}cancelRasterizeTask(e){m("trace",`RasterizeTask: release textures [${e.cursor.texture_names.join(", ")}]`),e.cursor.texture_names.forEach((e=>M.release(e)));}setTextureTextPositions(e,t){let i={cx:0,cy:0,width:0,height:0,column_width:0,texture_id:0,texcoord_cache:{}},r=[];for(let n in e){let s=e[n];for(let e in s){let o,a=s[e];if(a.text_settings.can_articulate){a.textures=[],i.texcoord_cache[n]=i.texcoord_cache[n]||{};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(!i.texcoord_cache[n][l]){let e=a.size.texture_size;o=this.placeText(e[0],e[1],n,i,r,t),i.texcoord_cache[n][l]={texture_id:i.texture_id,texture_position:o};}a.textures[s]=i.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(!i.texcoord_cache[n][l]){let s=a.segment_sizes[e].texture_size,u=2*s[0];o=this.placeText(u,s[1],n,i,r,t),i.texcoord_cache[n][l]={texture_id:i.texture_id,texture_position:o};}a.textures[s].push(i.texture_id);}}}}else {let e=a.size.texture_size;for(let s in a.align)o=this.placeText(e[0],e[1],n,i,r,t),a.align[s].texture_id=i.texture_id,a.align[s].texture_position=o;}}}return i.column_width>0&&i.height>0&&(r[i.texture_id]={texture_size:[i.width,i.height],texcoord_cache:i.texcoord_cache}),r}placeText(e,t,i,r,n,s){let o;return r.cy+t>s?(r.cx+=r.column_width,r.cy=0,r.column_width=e):r.column_width=Math.max(r.column_width,e),r.cx+r.column_width<=s?(o=[r.cx,r.cy],r.cy+=t,r.height=Math.max(r.height,r.cy),r.width=Math.max(r.width,r.cx+r.column_width)):(n[r.texture_id]={texture_size:[r.width,r.height],texcoord_cache:r.texcoord_cache},r.texcoord_cache={},r.texcoord_cache[i]={},r.texture_id++,r.cx=0,r.cy=t,r.column_width=e,r.width=e,r.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,i]=e.match(Ai.font_size_re)||[];return i=i||"px","em"===i?t*=16:"pt"===i?t/=.75:"%"===i&&(t/=6.25),t=Q.parsePositiveNumber(t),t*=g.device_pixel_ratio,t}static pruneTextCache(){Ai.cache.text_count>Ai.cache.text_count_max&&(Ai.cache.text={},Ai.cache.text_count=0,m("debug","TextCanvas: pruning text cache")),Object.keys(Ai.cache.segment).length>Ai.cache.segment_count_max&&(Ai.cache.segment={},m("debug","TextCanvas: pruning segment cache"));}}function Ti(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r);}return i}Ai.font_size_re=/((?:[0-9]*\.)?[0-9]+)\s*(px|pt|em|%)?/,Ai.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 wi=0;const Ei={resetText(){t.is_main?this.canvas=new Ai:t.is_worker&&(this.texts={});},freeText(e){delete this.texts[e.id];},parseTextFeature(e,t,i,r){let n=this.parseTextSource(e,t,i);if(null==n||""===n)return;let s=Kt.compute(t,i),o=Kt.key(s);this.texts[r.id]=this.texts[r.id]||{};let a=this.texts[r.id][o]=this.texts[r.id][o]||{};if(n instanceof Object){let l=[],u=n.left+"-"+n.right;for(let h in n){let c=n[h];if(!c)continue;let d=this.computeTextLayout({},e,t,i,r,c,s,u,h);a[c]||(a[c]={text_settings:s,ref:0}),l.push({draw:t,text:c,text_settings_key:o,layout:d});}return l.length>0&&l}{let l=this.computeTextLayout({},e,t,i,r,n,s);return a[n]||(a[n]={text_settings:s,ref:0}),{draw:t,text:n,text_settings_key:o,layout:l}}},parseTextSource(e,t,i){let r,n=t.text_source||"name";if(null==n||Array.isArray(n)||"object"!=typeof n)r=this.parseTextSourceValue(n,e,i);else {r={};for(let t in n)r[t]=this.parseTextSourceValue(n[t],e,i);}return r},parseTextSourceValue(e,t,i){let r;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if("string"==typeof e[n]?r=t.properties[e[n]]:"function"==typeof e[n]&&(r=e[n](i)),r)return r}else "string"==typeof e?r=t.properties[e]:e instanceof Function&&(r=e(i));return r},async prepareTextLabels(e,t){if(0===Object.keys(this.texts[e.id]||{}).length)return [];try{const i=await a.postMessage(this.main_thread_target+".calcTextSizes",e.id,this.texts[e.id]);return e.canceled?(m("trace",`Style ${this.name}: stop tile build because tile was canceled: ${e.key}, post-calcTextSizes()`),[]):(this.texts[e.id]=i||[],i?this.buildTextLabels(e,t):(Bt.abortTile(e.id),[]))}catch(t){return Bt.abortTile(e.id),[]}},async collideAndRenderTextLabels(e,t,i){let r=await this.prepareTextLabels(e,i);if(0===r.length)return Bt.collide([],t,e.id),{};if(r=await Bt.collide(r,t,e.id),e.canceled)return m("trace",`stop tile build because tile was canceled: ${e.key}, post-collide()`),{};let s=this.texts[e.id];if(null==s||0===r.length)return {};this.cullTextStyles(s,r),r.forEach((e=>{let t=e.text_settings_key,i=s[t]&&s[t][e.text];i.text_settings.can_articulate?(i.type||(i.type=[]),-1===i.type.indexOf(e.label.type)&&i.type.push(e.label.type)):(i.align=i.align||{},i.align[e.label.align]={});}));try{const t=await a.postMessage(this.main_thread_target+".rasterizeTexts",e.id,e.key,s);return e.canceled?(m("trace",`stop tile build because tile was canceled: ${e.key}, post-rasterizeTexts()`),{}):function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Ti(Object(i),!0).forEach((function(t){n(e,t,i[t]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Ti(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t));}));}return e}({labels:r},t)}catch(e){return {}}},cullTextStyles(e,t){for(let i=0;i<t.length;i++){let r=t[i];e[r.text_settings_key][r.text].ref++;}for(let t in e)for(let i in e[t])e[t][i].ref<1&&delete e[t][i];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,i){let r=new Ai,n=Math.min(this.max_texture_size,2048),s=r.setTextureTextPositions(i,n),o=["labels",this.name,t,e,wi,""].join("-");return wi++,s=await r.rasterize(i,s,e,o,this.gl),s?{texts:i,textures:s}:{}},preprocessText(e){if(e&&e.font&&"object"==typeof e.font)return e.font.weight=Q.createPropertyCache(e.font.weight),e.font.fill=Q.createPropertyCache(e.font.fill||Kt.defaults.fill),e.font.alpha=Q.createPropertyCache(e.font.alpha),e.font.stroke&&(e.font.stroke.color=Q.createPropertyCache(e.font.stroke.color),e.font.stroke.alpha=Q.createPropertyCache(e.font.stroke.alpha)),e.font.background&&(e.font.background.color=Q.createPropertyCache(e.font.background.color),e.font.background.alpha=Q.createPropertyCache(e.font.background.alpha),e.font.background.width=Q.createPropertyCache(e.font.background.width,Q.parsePositiveNumber),e.font.background.stroke&&(e.font.background.stroke.color=Q.createPropertyCache(e.font.background.stroke.color),e.font.background.stroke.alpha=Q.createPropertyCache(e.font.background.stroke.alpha))),e.font.px_size=Q.createPropertyCache(e.font.size||Kt.defaults.size,Ai.fontPixelSize,Ai.fontPixelSize),e.font.stroke&&null!=e.font.stroke.width&&(e.font.stroke.width=Q.createPropertyCache(e.font.stroke.width,Q.parsePositiveNumber)),e.font.background&&e.font.background.stroke&&null!=e.font.background.stroke.width&&(e.font.background.stroke.width=Q.createPropertyCache(e.font.background.stroke.width,Q.parsePositiveNumber)),e.offset=Q.createPropertyCache(e.offset,(e=>Array.isArray(e)&&e.map(Q.parseNumber))),e.buffer=Q.createPropertyCache(e.buffer,(e=>(Array.isArray(e)?e:[e,e]).map(Q.parsePositiveNumber))),e.repeat_distance=Q.createPropertyCache(e.repeat_distance,Q.parsePositiveNumber),e},computeTextLayout(e,t,i,r,n,s,o,a,l){let u=e||{};return u=this.computeLayout(u,t,i,r,n),null==i.repeat_distance&&(u.repeat_distance="point"===r.geometry?0:$.tile_size,u.repeat_distance&&(u.repeat_distance*=u.units_per_pixel,u.repeat_scale=1,"function"==typeof i.repeat_group?u.repeat_group=i.repeat_group(r):u.repeat_group=i.repeat_group)),u.repeat_distance&&(a&&(u.repeat_group+="/"+a),u.repeat_group+="/"+s),u.subdiv=n.overzoom2,u.align=i.align,u.italic="normal"!==o.style,"right"===l?u.orientation=1:"left"===l&&(u.orientation=-1),u}};var Ri,Mi;var zi,Pi,Si=k(Mi?Ri:(Mi=1,Ri=function(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],o=t[4],a=t[5],l=t[6],u=t[7],h=t[8],c=t[9],d=t[10],f=t[11],_=t[12],p=t[13],m=t[14],g=t[15],y=i*a-r*o,x=i*l-n*o,b=i*u-s*o,v=r*l-n*a,A=r*u-s*a,T=n*u-s*l,w=h*p-c*_,E=h*m-d*_,R=h*g-f*_,M=c*m-d*p,z=c*g-f*p,P=d*g-f*m,S=y*P-x*z+b*M+v*R-A*E+T*w;return S?(S=1/S,e[0]=(a*P-l*z+u*M)*S,e[1]=(l*R-o*P-u*E)*S,e[2]=(o*z-a*R+u*w)*S,e[3]=(n*z-r*P-s*M)*S,e[4]=(i*P-n*R+s*E)*S,e[5]=(r*R-i*z-s*w)*S,e[6]=(p*T-m*A+g*v)*S,e[7]=(m*b-_*T-g*x)*S,e[8]=(_*A-p*b+g*y)*S,e):null}));var Ni,ki,Oi=k(Pi?zi:(Pi=1,zi=function(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],o=t[4],a=t[5],l=t[6],u=t[7],h=t[8],c=h*o-a*u,d=-h*s+a*l,f=u*s-o*l,_=i*c+r*d+n*f;return _?(_=1/_,e[0]=c*_,e[1]=(-h*r+n*u)*_,e[2]=(a*r-n*o)*_,e[3]=d*_,e[4]=(h*i-n*l)*_,e[5]=(-a*i+n*s)*_,e[6]=f*_,e[7]=(-u*i+r*l)*_,e[8]=(o*i-r*s)*_,e):null}));var Li,Ii,Fi=k(ki?Ni:(ki=1,Ni=function(e,t,i){var r=t[0],n=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],h=t[7],c=t[8],d=t[9],f=t[10],_=t[11],p=t[12],m=t[13],g=t[14],y=t[15],x=i[0],b=i[1],v=i[2],A=i[3];return e[0]=x*r+b*a+v*c+A*p,e[1]=x*n+b*l+v*d+A*m,e[2]=x*s+b*u+v*f+A*g,e[3]=x*o+b*h+v*_+A*y,x=i[4],b=i[5],v=i[6],A=i[7],e[4]=x*r+b*a+v*c+A*p,e[5]=x*n+b*l+v*d+A*m,e[6]=x*s+b*u+v*f+A*g,e[7]=x*o+b*h+v*_+A*y,x=i[8],b=i[9],v=i[10],A=i[11],e[8]=x*r+b*a+v*c+A*p,e[9]=x*n+b*l+v*d+A*m,e[10]=x*s+b*u+v*f+A*g,e[11]=x*o+b*h+v*_+A*y,x=i[12],b=i[13],v=i[14],A=i[15],e[12]=x*r+b*a+v*c+A*p,e[13]=x*n+b*l+v*d+A*m,e[14]=x*s+b*u+v*f+A*g,e[15]=x*o+b*h+v*_+A*y,e}));var Di,Ui,Gi=k(Ii?Li:(Ii=1,Li=function(e,t,i){var r,n,s,o,a,l,u,h,c,d,f,_,p=i[0],m=i[1],g=i[2];return t===e?(e[12]=t[0]*p+t[4]*m+t[8]*g+t[12],e[13]=t[1]*p+t[5]*m+t[9]*g+t[13],e[14]=t[2]*p+t[6]*m+t[10]*g+t[14],e[15]=t[3]*p+t[7]*m+t[11]*g+t[15]):(r=t[0],n=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],h=t[7],c=t[8],d=t[9],f=t[10],_=t[11],e[0]=r,e[1]=n,e[2]=s,e[3]=o,e[4]=a,e[5]=l,e[6]=u,e[7]=h,e[8]=c,e[9]=d,e[10]=f,e[11]=_,e[12]=r*p+a*m+c*g+t[12],e[13]=n*p+l*m+d*g+t[13],e[14]=s*p+u*m+f*g+t[14],e[15]=o*p+h*m+_*g+t[15]),e}));var Ci,ji,Vi=k(Ui?Di:(Ui=1,Di=function(e,t,i){var r=i[0],n=i[1],s=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,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}));var $i,Bi,qi,Xi,Hi=k(ji?Ci:(ji=1,Ci=function(e,t,i,r,n){var s=1/Math.tan(t/2),o=1/(r-n);return e[0]=s/i,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]=(n+r)*o,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*n*r*o,e[15]=0,e}));function Wi(){if(Bi)return $i;return Bi=1,$i=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 Yi,Zi,Ji=function(){if(Xi)return qi;Xi=1;var e=Wi();return qi=function(t,i,r,n){var s,o,a,l,u,h,c,d,f,_,p=i[0],m=i[1],g=i[2],y=n[0],x=n[1],b=n[2],v=r[0],A=r[1],T=r[2];if(Math.abs(p-v)<1e-6&&Math.abs(m-A)<1e-6&&Math.abs(g-T)<1e-6)return e(t);c=p-v,d=m-A,f=g-T,_=1/Math.sqrt(c*c+d*d+f*f),s=x*(f*=_)-b*(d*=_),o=b*(c*=_)-y*f,a=y*d-x*c,(_=Math.sqrt(s*s+o*o+a*a))?(s*=_=1/_,o*=_,a*=_):(s=0,o=0,a=0);l=d*a-f*o,u=f*s-c*a,h=c*o-d*s,(_=Math.sqrt(l*l+u*u+h*h))?(l*=_=1/_,u*=_,h*=_):(l=0,u=0,h=0);return t[0]=s,t[1]=l,t[2]=c,t[3]=0,t[4]=o,t[5]=u,t[6]=d,t[7]=0,t[8]=a,t[9]=h,t[10]=f,t[11]=0,t[12]=-(s*p+o*m+a*g),t[13]=-(l*p+u*m+h*g),t[14]=-(c*p+d*m+f*g),t[15]=1,t}}(),Ki=k(Ji),Qi=k(Wi());var er=k(Zi?Yi:(Zi=1,Yi=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 tr={fromValues(e,t,i){var r=new Float64Array(3);return r[0]=e,r[1]=t,r[2]=i,r}},ir={normalFromMat4:Si,invert:Oi},rr={multiply:Fi,translate:Gi,scale:Vi,perspective:Hi,lookAt:Ki,identity:Qi,copy:er};class nr{constructor(e,t,i={}){this.view=t,this.position=i.position,this.zoom=i.zoom;}static create(e,t,i){switch(i.type){case "isometric":return new or(e,t,i);case "flat":return new ar(e,t,i);default:return new sr(e,t,i)}}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){rr.multiply(e.model_view32,this.view_matrix,e.model),t.uniform("Matrix4fv","u_modelView",e.model_view32),ir.normalFromMat4(e.normal32,e.model_view32),ir.invert(e.inverse_normal32,e.normal32),t.uniform("Matrix3fv","u_normalMatrix",e.normal32),t.uniform("Matrix3fv","u_inverseNormalMatrix",e.inverse_normal32);}}class sr extends nr{constructor(e,t,i={}){super(e,t,i),this.type="perspective",this.focal_length=i.focal_length,this.fov=i.fov,this.focal_length||this.fov||(this.focal_length=[[16,2],[17,2.5],[18,3],[19,4],[20,6]]),this.vanishing_point=i.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),G.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:i,fov:r}){return t?(i=2*t/e,r=2*Math.atan(1/i)):(i?r=2*Math.atan(1/i):r&&(r=r*Math.PI/180,i=1/Math.tan(r/2)),t=e/2*i),{view_height:e,height:t,focal_length:i,fov:r}}updateMatrices(){var e=this.view.size.css.height*this.view.meters_per_pixel,{height:t,fov:i}=this.constrainCamera({view_height:e,focal_length:g.interpolate(this.view.zoom,this.focal_length),fov:g.interpolate(this.view.zoom,this.fov)}),r=[this.view.center.meters.x,this.view.center.meters.y,t];this.position_meters=r,rr.lookAt(this.view_matrix,tr.fromValues(r[0],r[1],0),tr.fromValues(r[0],r[1],-1),tr.fromValues(0,1,0)),rr.perspective(this.projection_matrix,i,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],rr.translate(this.projection_matrix,this.projection_matrix,tr.fromValues(e/2*this.view.aspect*(2*-this.vanishing_point_skew[0]),e/2*(2*-this.vanishing_point_skew[1]),0)),rr.translate(this.projection_matrix,this.projection_matrix,tr.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 or extends nr{constructor(e,t,i={}){super(e,t,i),this.type="isometric",this.axis=i.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),G.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,rr.identity(this.view_matrix),rr.translate(this.view_matrix,this.view_matrix,tr.fromValues(-e[0],-e[1],0)),rr.identity(this.projection_matrix),this.projection_matrix[8]=this.axis.x/this.view.aspect,this.projection_matrix[9]=this.axis.y,rr.scale(this.projection_matrix,this.projection_matrix,tr.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 ar extends or{constructor(e,t,i={}){super(e,t,i),this.type="flat";}update(){this.axis.x=0,this.axis.y=0,super.update();}}const lr=qt.PLACEMENT,ur=Object.create(Ne),hr="__shader_point";Object.assign(ur,Ei),Object.assign(ur,{name:"points",built_in:true,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:true,collision:true,blend:"overlay",init(e={}){Ne.init.call(this,e),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=true,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=false,this.reset();},setupDefines(){"overlay"!==this.blend&&(this.defines.TANGRAM_LAYER_ORDER=true),true===x.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),true!==x.suppress_label_snap_animation&&(this.defines.TANGRAM_VIEW_PAN_SNAP_RATE=2),true===x.show_hidden_labels&&(this.defines.TANGRAM_SHOW_HIDDEN_LABELS=true),true===x.wireframe&&(this.defines.TANGRAM_WIREFRAME=true);},reset(){this.queues={},this.resetText(),this.texture_missing_sprites={};},addFeature(e,t,i){let r=i.tile;if(r.generation!==this.generation)return;let n,s={};if(s.color=this.parseColor(t.color,i),s.texture=t.texture,s.label_texture=null,s.blend_order=t.blend_order,!s.color&&!s.texture)return;if(s.alpha=Q.evalCachedProperty(t.alpha,i),this.hasSprites(s)){if(n=this.parseSprite(s,t,i),!n)return void m({level:"debug",once:true},`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((i=>{i&&m("debug",`Example feature for layer group '${t.layers.join(", ")}'`,e);}));s.texcoords=n.texcoords;}else if(t.sprite)return void m({level:"warn",once:true},`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,n,i),t.outline&&(s.outline_width=Q.evalCachedProperty(t.outline.width,i)||Q.defaults.outline.width,s.outline_color=this.parseColor(t.outline.color,i)),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=Q.evalCachedProperty(t.outline.alpha,i);}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=Q.evalCachedProperty(t.placement_min_length_ratio,i),s.placement===lr.SPACED&&t.placement_spacing&&(s.placement_spacing=Q.evalCachedProperty(t.placement_spacing,i)),s.angle=Q.evalProperty(t.angle,i)||0,s.z=Q.evalCachedDistanceProperty(t.z,i)||Q.defaults.z,s.tile_edges=t.tile_edges,this.computeLayout(s,e,t,i,r);let o=t.text&&false!==t.text.visible&&this.parseTextFeature(e,t.text,i,r);Array.isArray(o)&&(o=null,m({level:"warn",once:true},`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,Bt.addStyle(this.collision_group_text,r.id)),this.queueFeature({feature:e,draw:t,context:i,style:s,text_feature:o},r),Bt.addStyle(this.collision_group_points,r.id);},calcSize(e,t,i,r){if(t.size=e.size,t.size){if(t.size=Q.evalCachedPointSizeProperty(e.size,i,M.textures[t.texture],r),null==t.size)return void m({level:"warn",once:true},`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=i&&i.css_size||[16,16];},hasSprites:e=>e.texture&&M.textures[e.texture]&&M.textures[e.texture].sprites,getSpriteInfo(e,t){let i=M.textures[e.texture].sprites[t]&&M.getSpriteInfo(e.texture,t);return t&&!i?(this.texture_missing_sprites[e.texture]=this.texture_missing_sprites[e.texture]||{},this.texture_missing_sprites[e.texture][t]||(m("debug",`Style: in style '${this.name}', could not find sprite '${t}' for texture '${e.texture}'`),this.texture_missing_sprites[e.texture][t]=true)):i&&(i.sprite=t),i},parseSprite(e,t,i){let r=Q.evalProperty(t.sprite,i);return this.getSpriteInfo(e,r)||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 m("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 i=[],r=[];t.forEach((e=>{let t=e.style,n=e.feature,s=n.geometry,o=this.buildLabels(t.size,s,t);for(let s=0;s<o.length;s++){let a=o[s],l={feature:n,draw:e.draw,context:e.context,style:t,label:a};if(r.push(l),e.text_feature){let t={feature:n,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};i.push(t),e.draw.text.optional||(l.linked=t);}}}));const[,{labels:n,texts:s,textures:o}]=await Promise.all([Bt.collide(r,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,Ne.addFeature.call(this,e.feature,e.draw,e.context);}));})),this.collideAndRenderTextLabels(e,this.collision_group_text,i)]);n&&s&&n.forEach((e=>{let t=e.text_settings_key,i=s[t]&&s[t][e.text],r=this.feature_style;r.label=e.label,r.linked=e.linked,r.size=i.size.logical_size,r.texcoords=i.align[e.label.align].texcoords,r.label_texture=o[i.align[e.label.align].texture_id],r.blend_order=e.draw.blend_order,Ne.addFeature.call(this,e.feature,e.draw,e.context);})),this.freeText(e);const a=await Ne.endData.call(this,e);return a&&o&&o.length&&(a.textures=a.textures||[],a.textures.push(...o)),a},_preprocess(e){e.color=Q.createColorPropertyCache(e.color),e.alpha=Q.createPropertyCache(e.alpha),e.texture=void 0!==e.texture?e.texture:this.texture,e.blend_order=this.getBlendOrderForDraw(e),e.outline&&(e.outline.color=Q.createColorPropertyCache(e.outline.color),e.outline.alpha=Q.createPropertyCache(e.outline.alpha),e.outline.width=Q.createPropertyCache(e.outline.width,Q.parsePositiveNumber)),e.z=Q.createPropertyCache(e.z,Q.parseUnits);try{e.size=Q.createPointSizePropertyCache(e.size,e.texture);}catch(t){return m({level:"warn",once:true},`Layer group '${e.layers.join(", ")}': ${t} (${JSON.stringify(e.size)}), features that match this layer group won't be drawn.`),null}if(e.offset=Q.createPropertyCache(e.offset,(e=>Array.isArray(e)&&e.map(Q.parseNumber))),e.buffer=Q.createPropertyCache(e.buffer,(e=>(Array.isArray(e)?e:[e,e]).map(Q.parsePositiveNumber))),e.repeat_distance=Q.createPropertyCache(e.repeat_distance,Q.parseNumber),e.placement=lr[e.placement&&e.placement.toUpperCase()],null==e.placement&&(e.placement=lr.VERTEX),e.placement_spacing=null!=e.placement_spacing?e.placement_spacing:80,e.placement_spacing=Q.createPropertyCache(e.placement_spacing,Q.parsePositiveNumber),e.placement_min_length_ratio=null!=e.placement_min_length_ratio?e.placement_min_length_ratio:1,e.placement_min_length_ratio=Q.createPropertyCache(e.placement_min_length_ratio,Q.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,i,r,n){let s=e||{};s.id=t,s.units_per_pixel=n.units_per_pixel||1,s.collide=false!==i.collide,s.anchor=i.anchor,s.offset=Q.evalCachedProperty(i.offset,r)||Q.zeroPair,s.buffer=Q.evalCachedProperty(i.buffer,r)||Q.zeroPair,s.repeat_distance=Q.evalCachedProperty(i.repeat_distance,r),s.repeat_distance&&(s.repeat_distance*=s.units_per_pixel,s.repeat_scale=1,"function"==typeof i.repeat_group?s.repeat_group=i.repeat_group(r):s.repeat_group=i.repeat_group||r.layer);let o=i.priority;return null!=o?"function"==typeof o&&(o=o(r)):o=-1>>>0,s.priority=o,s},buildTextLabels(e,t){let i=[];for(let r=0;r<t.length;r++){let n=t[r],s=this.texts[e.id][n.text_settings_key][n.text].size.collision_size;n.label=new qt(n.point_label.position,s,n.layout),i.push(n);}return i},buildLabels(e,t,i){let r=[];if("Point"===t.type)r.push(new qt(t.coordinates,e,i,i.angle));else if("MultiPoint"===t.type){let n=t.coordinates;for(let t=0;t<n.length;++t){let s=n[t];r.push(new qt(s,e,i,i.angle));}}else if("LineString"===t.type){let n=Ht(t.coordinates,e,i);for(let e=0;e<n.length;++e)r.push(n[e]);}else if("MultiLineString"===t.type){let n=t.coordinates;for(let t=0;t<n.length;t++){let s=Ht(n[t],e,i);for(let e=0;e<s.length;++e)r.push(s[e]);}}else if("Polygon"===t.type)if(i.placement===lr.CENTROID){let n=$.centroid(t.coordinates);n&&r.push(new qt(n,e,i,i.angle));}else {let n=t.coordinates;for(let t=0;t<n.length;t++){let s=Ht(n[t],e,i);for(let e=0;e<s.length;++e)r.push(s[e]);}}else if("MultiPolygon"===t.type)if(i.placement===lr.CENTROID){let n=$.multiCentroid(t.coordinates);n&&r.push(new qt(n,e,i,i.angle));}else {let n=t.coordinates;for(let t=0;t<n.length;t++){let s=n[t];for(let t=0;t<s.length;t++){let n=Ht(s[t],e,i);for(let e=0;e<n.length;++e)r.push(n[e]);}}}return r},makeVertexTemplate(e,t,i=true){let r=0;this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=e.z||0,this.vertex_template[r++]=this.scaleOrder(e.order),this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=e.label.layout.collide?0:1,t.variant.shader_point||(this.vertex_template[r++]=0,this.vertex_template[r++]=0),this.vertex_template[r++]=0,this.vertex_template[r++]=0;const n=e.color||Q.defaults.color;if(this.vertex_template[r++]=255*n[0],this.vertex_template[r++]=255*n[1],this.vertex_template[r++]=255*n[2],this.vertex_template[r++]=255*(null!=e.alpha?e.alpha:n[3]),t.variant.selection&&(this.vertex_template[r++]=255*e.selection_color[0],this.vertex_template[r++]=255*e.selection_color[1],this.vertex_template[r++]=255*e.selection_color[2],this.vertex_template[r++]=255*e.selection_color[3]),t.variant.shader_point){const t=e.outline_color||Q.defaults.outline.color;this.vertex_template[r++]=255*t[0],this.vertex_template[r++]=255*t[1],this.vertex_template[r++]=255*t[2],this.vertex_template[r++]=255*(null!=e.outline_alpha?e.outline_alpha:t[3]),this.vertex_template[r++]=e.outline_edge_pct||Q.defaults.outline.width;}return i&&this.addCustomAttributesToVertexTemplate(e,r),this.vertex_template},buildQuad:(e,t,i,r,n,s,o,a,l,u,h)=>t[0]<=0||t[1]<=0?0:function(e,t,i,r,n,s,o,a,l,u,h,c){const d=128*n[0],f=128*n[1];Et[0]=-d,Et[1]=-f,Et[2]=d,Et[3]=f;const _=h||Ce,p=t.vertex_elements;let m=t.vertex_count;for(let n=0;n<4;n++)i[r.a_position+0]=e[0],i[r.a_position+1]=e[1],i[r.a_shape+0]=Et[Tt[n]],i[r.a_shape+1]=Et[wt[n]],i[r.a_shape+2]=l,i[r.a_offset+0]=s[0],i[r.a_offset+1]=s[1],r.a_texcoord&&(i[r.a_texcoord+0]=65535*_[Tt[n]],i[r.a_texcoord+1]=65535*_[wt[n]]),c&&(i[r.a_pre_angles+0]=vt*a[0],i[r.a_pre_angles+1]=vt*a[1],i[r.a_pre_angles+2]=vt*a[2],i[r.a_pre_angles+3]=vt*a[3],i[r.a_angles+0]=At*u[0],i[r.a_angles+1]=At*u[1],i[r.a_angles+2]=At*u[2],i[r.a_angles+3]=At*u[3],i[r.a_offsets+0]=64*o[0],i[r.a_offsets+1]=64*o[1],i[r.a_offsets+2]=64*o[2],i[r.a_offsets+3]=64*o[3]),t.addVertex(i);return p.push(m+0),p.push(m+1),p.push(m+2),p.push(m+2),p.push(m+3),p.push(m+0),2}(e,u,h,u.vertex_layout.index,t,s,o,n,4096*i,r,a,l),build(e,t){let i=e.label;return "curved"===i.type?this.buildCurvedLabel(i,e,t):this.buildStraightLabel(i,e,t)},buildStraightLabel(e,t,i){let r,n,s=this.getTileMesh(i.tile,this.meshVariantTypeForDraw(t)),o=this.makeVertexTemplate(t,s);"point"!==e.type?(r=t.size[e.type],n=t.texcoords[e.type].texcoord):(r=t.size,n=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=false):t.texture?(s.uniforms.u_texture=t.texture,s.uniforms.u_point_type=1,s.uniforms.u_apply_color_blocks=true):(s.uniforms.u_texture=M.default,s.uniforms.u_point_type=3,s.uniforms.u_apply_color_blocks=true);let a=e.offset,l=this.buildQuad(e.position,r,e.angle,null,null,a,null,n,false,s.vertex_data,o);const u=t.linked&&t.linked.label.id;return this.trackLabel(e,u,s,l,i),l},buildCurvedLabel(e,t,i){let r,n,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],r=this.getTileMesh(i.tile,this.meshVariantTypeForDraw(t)),n=this.makeVertexTemplate(t,r),r.uniforms=r.uniforms||{},r.uniforms.u_texture=t.label_texture,r.uniforms.u_point_type=2,r.uniforms.u_apply_color_blocks=false;let u=e.offset||[0,0],h=e.position,c=e.angles[o],d=e.offsets[o],f=e.pre_angles[o],_=this.buildQuad(h,a,e.angle,c,f,u,d,l,true,r.vertex_data,n);s+=_;const p=t.linked&&t.linked.label.id;this.trackLabel(e,p,r,_,i);}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],r=this.getTileMesh(i.tile,this.meshVariantTypeForDraw(t)),n=this.makeVertexTemplate(t,r),r.uniforms=r.uniforms||{},r.uniforms.u_texture=t.label_texture,r.uniforms.u_point_type=2,r.uniforms.u_apply_color_blocks=false;let u=e.offset||[0,0],h=e.position,c=e.angles[o],d=e.offsets[o],f=e.pre_angles[o],_=this.buildQuad(h,a,e.angle,c,f,u,d,l,true,r.vertex_data,n);s+=_;const p=t.linked&&t.linked.label.id;this.trackLabel(e,p,r,_,i);}return s},trackLabel(e,t,i,r){if(e.layout.collide||e.may_repeat_across_tiles){i.labels=i.labels||{},i.labels[e.id]=i.labels[e.id]||{container:{label:e.toJSON(),linked:t},ranges:[]};const n=2*r,s=i.vertex_data.offset-i.vertex_data.stride*n;i.labels[e.id].ranges.push([s,n]);}},buildLines(e,t,i){return this.build(t,i)},buildPoints(e,t,i){return this.build(t,i)},buildPolygons(e,t,i){return this.build(t,i)},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.shader_point]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:false},{name:"a_shape",size:4,type:fe.SHORT,normalized:false},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:true,static:e.shader_point?[0,0]:null},{name:"a_offset",size:2,type:fe.SHORT,normalized:false},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:true},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:true,static:e.selection?null:[0,0,0,0]},{name:"a_outline_color",size:4,type:fe.UNSIGNED_BYTE,normalized:true,static:e.shader_point?null:[0,0,0,0]},{name:"a_outline_edge",size:1,type:fe.FLOAT,normalized:false,static:e.shader_point?null:0}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.shader_point]=new Ue(t);}return this.vertex_layouts[e.shader_point]},meshVariantTypeForDraw(e){const t=e.label_texture||e.texture||hr,i=t+"/"+e.blend_order;return null==this.variants[i]&&(this.variants[i]={key:i,selection:1,shader_point:t===hr,blend_order:e.blend_order,mesh_order:e.label_texture?1:0}),this.variants[i]},makeMesh(e,t,i={}){return i=Object.assign({},i,{fade_in_time:this.fade_in_time}),Ne.makeMesh.call(this,e,t,i)}});const cr=[0,.33,.66,.99];let dr=function(e,t,i,r){const n=[{type:"straight",tolerance:r.no_curving?1.8:1.5},{type:"curved"},{type:"straight",tolerance:2.3}];for(let s=0;s<n.length;s++){let o,a=n[s];if("straight"===a.type?o=new _r(t,i,r,a.tolerance):"curved"===a.type&&!r.no_curving&&i.length>2&&(o=new pr(e,i,r)),o&&!o.throw_away)return o}return false};class fr{constructor(e){this.id=Ct.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=false;}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:jt(this.layout)}}static splitLineByOrientation(e){let t=[e[0]],i=0,r=0,n=0,s=t,o=false;for(let a=1;a<e.length;a++){let l=e[a],u=e[a-1],h=ye.length(ye.sub(l,u));l[0]>u[0]?1===n?(t.push(l),i+=h,i>r&&(s=t,r=i,o=false)):(t=[u,l],i=h,i>r&&(s=t,r=i,o=false),n=1):l[0]<u[0]?-1===n?(t.unshift(l),i+=h,i>r&&(s=t,r=i,o=true)):(t=[l,u],i=h,i>r&&(s=t,r=i,o=true),n=-1):(-1===n?t.unshift(l):(t.push(l),n=1),i+=h,i>r&&(s=t,r=i,o=-1===n));}return [s,o]}discard(e,t=null){if(this.throw_away)return true;for(let i=0;i<this.obbs.length;i++){let r={aabb:this.aabbs[i],obb:this.obbs[i]};if(Ct.prototype.occluded.call(r,e,t))return true}return false}inTileBounds(){for(let e=0;e<this.aabbs.length;e++){let t={aabb:this.aabbs[e]};if(!Ct.prototype.inTileBounds.call(t))return false}return true}static createOBB(e,t,i,r,n,s,o){let a=e[0],l=e[1];return !s||0===s[0]&&0===s[1]||(a+=(s=ye.rot(s,n))[0]*o,l-=s[1]*o),new Gt(a,l,-r,t,i)}}class _r extends fr{constructor(e,t,i,r){super(i),this.type="straight",this.size=e,this.throw_away=!this.fit(e,t,i,r);}fit(e,t,i,r){let n,s=this.unit_scale;[t,n]=fr.splitLineByOrientation(t),"number"==typeof i.orientation&&(this.offset[1]+=1.2*(e[1]-i.vertical_buffer),n&&(this.offset[1]*=-1),-1===i.orientation&&(this.offset[1]*=-1));let o=yr(t),a=e[0]*s;for(let n=0;n<t.length-1;n++){let s,l=t[n],u=0,h=0,c=n+1;for(;c<t.length;){let d=t[c-1],f=t[c],_=gr(d,f);if(c!==n+1&&(u+=xr(_,s)),Math.abs(u)>.1)break;if(h+=o[c-1],mr(h,a)<r){let t=ye.mult(ye.add(l,f),.5);return this.angle=-_,Math.abs(this.angle-Math.PI/2)<.01&&(this.angle=-Math.PI/2,"number"==typeof i.orientation&&(this.offset[1]*=-1)),this.position=t,this.updateBBoxes(this.position,e,this.angle,this.angle,this.offset),true}s=_,c++;}}return false}updateBBoxes(e,t,i,r,n){let s=this.unit_scale;this.obbs=[],this.aabbs=[];let o=(t[0]+2*this.layout.buffer[0])*s*Ct.epsilon,a=(t[1]+2*this.layout.buffer[1])*s*Ct.epsilon,l=fr.createOBB(e,o,a,i,r,n,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 pr extends fr{constructor(e,t,i){super(i),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,i);}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:jt(this.layout)}}fit(e,t,i){let r,n=this.unit_scale,s=Math.max(...e.map((e=>e[1]))),o=s*n;[t,r]=fr.splitLineByOrientation(t),"number"==typeof i.orientation&&(this.offset[1]+=1.2*(s-i.vertical_buffer),r&&(this.offset[1]*=-1),-1===i.orientation&&(this.offset[1]*=-1));let a=yr(t),l=e.map((e=>e[0]*n)),u=a.reduce(((e,t)=>e+t),0),h=l.reduce(((e,t)=>e+t),0);if(h>u)return false;let c=t.length-1;if(c-0<2)return false;let d=pr.curvaturePlacement(t,u,a,h,0,c),f=t[d];if(-1===d||c-d<2)return false;this.position=f;for(var _=0;_<l.length;_++){this.offsets[_]=[],this.angles[_]=[],this.pre_angles[_]=[];for(var p=0;p<cr.length;p++){let e=cr[p],[i,r]=pr.scaleLine(e,t);f=i[d];let{positions:s,offsets:a,angles:u,pre_angles:h}=pr.placeAtIndex(d,i,r,l),c=a.map((e=>Math.sqrt(e[0]*e[0]+e[1]*e[1])/n));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],i=h[e],r=l[e],a=i+u[e],c=this.angle,d=fr.createOBB(t,r,o,a,c,this.offset,n),f=d.getExtent();this.obbs.push(d),this.aabbs.push(f);}}this.offsets[_].push(c[_]),this.angles[_].push(u[_]),this.pre_angles[_].push(h[_]);}}return true}static curvaturePlacement(e,t,i,r,n,s){n=n||0,s=s||e.length-1;var o=[];for(let t=n+1;t<s;t++){var a=e[t-1],l=e[t],u=e[t+1],h=ye.perp(l,a),c=ye.perp(u,l),d=ye.angleBetween(h,c);d>1&&(d=1/0),o.push(d);}o.push(1/0);var f=[],_=[],p=n,m=0;for(let e=0;e<n;e++)m+=i[e];for(;m+r<t;){for(var g=m+r,y=m,x=p,b=0;x<s&&y+i[x]<g&&(b+=o[x])!==1/0;)y+=i[x],x++;if(0===b)return p;var v=b/(x-p);f.push(b),_.push(v),m+=i[p],p++;}if(0===f.length)return -1;var A=Math.min.apply(null,f),T=_[f.indexOf(A)];return A<1.3&&T<.4?f.indexOf(A):-1}static scaleLine(e,t){var i=[t[0]],r=[];return t.forEach(((n,s)=>{if(s!==t.length-1){var o=ye.sub(t[s+1],t[s]),a=ye.mult(o,1+e);i.push(ye.add(i[s],a)),r.push(ye.length(a));}})),[i,r]}static placeAtIndex(e,t,i,r){let n=t[e],[s,o]=pr.getIndicesAndOffsets(e,i,r),a=pr.getPositionsFromIndicesAndOffsets(t,s,o),[l,u,h]=pr.getAnglesFromIndicesAndOffsets(n,s,t,a);return {positions:a,offsets:l,angles:u,pre_angles:h}}static getIndicesAndOffsets(e,t,i){let r=i.length,n=[],s=[],o=0,a=0,l=0;for(;o<r;){let u=i[o];for(;o<r&&a+.5*u<=l+t[e];){let t=a-l+.5*u;s.push(t),n.push(e),a+=u,o++,u=i[o];}l+=t[e],e++;}return [n,s]}static getPositionsFromIndicesAndOffsets(e,t,i){let r=[];for(let n=0;n<t.length;n++){let s=t[n],o=i[n],a=gr(e[s],e[s+1]),l=ye.rot([o,0],a),u=ye.add(e[s],l);r.push(u);}return r}static getAnglesFromIndicesAndOffsets(e,t,i,r){let n=[],s=[],o=[];for(let u=0;u<r.length;u++){let h=r[u],c=t[u],d=ye.sub(h,e),f=-ye.angle(d),_=(a=i[c],l=i[c+1],-gr(a,l))-f;if(u>0){let e=n[u-1],t=s[u-1];Math.abs(f-e)>Math.PI&&(f+=f>e?-2*Math.PI:2*Math.PI),Math.abs(t-_)>Math.PI&&(_+=_>t?-2*Math.PI:2*Math.PI);}n.push(f),s.push(_),o.push(d);}var a,l;return [o,n,s]}}function mr(e,t){return t/e}function gr(e,t){let i=ye.sub(t,e);return ye.angle(i)}function yr(e){let t=[];for(let i=0;i<e.length-1;i++){let r=e[i],n=e[i+1],s=Math.hypot(r[0]-n[0],r[1]-n[1]);t.push(s);}return t}function xr(e,t){let i,r;for(e>t?(i=t,r=e):(i=e,r=t);r-i>Math.PI;)i+=2*Math.PI;return Math.abs(r-i)}let br=Object.create(ur);Object.assign(br,{name:"text",super:ur,built_in:true,init(e={}){Ne.init.call(this,e),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=false,this.defines.TANGRAM_CURVED_LABEL=true,this.reset();},makeVertexTemplate(e,t){this.super.makeVertexTemplate.call(this,e,t,false);let i=t.vertex_data.vertex_layout.index.a_pre_angles;for(let e=0;e<12;e++)this.vertex_template[i++]=0;return this.addCustomAttributesToVertexTemplate(e,i),this.vertex_template},reset(){this.queues={},this.resetText();},addFeature(e,t,i){let r=i.tile;if(r.generation!==this.generation)return;let n=e.geometry.type;t.can_articulate="LineString"===n||"MultiLineString"===n,t.supersample_text="LineString"===n||"MultiLineString"===n;let s=this.parseTextFeature(e,t,i,r);s&&(s instanceof Array?s.forEach((t=>{t.feature=e,t.context=i,t.layout.vertex=false,this.queueFeature(t,r);})):(s.feature=e,s.context=i,s.layout.vertex=false,this.queueFeature(s,r)),Bt.addStyle(this.name,r.id));},async endData(e){let t=this.queues[e.id];delete this.queues[e.id];const{labels:i,texts:r,textures:n}=await this.collideAndRenderTextLabels(e,this.name,t);i&&r&&(this.texts[e.id]=r,i.forEach((t=>{let i=t.text_settings_key,r=this.texts[e.id][i]&&this.texts[e.id][i][t.text],s=this.feature_style;s.label=t.label,r.text_settings.can_articulate?(s.size={},s.texcoords={},"straight"===t.label.type?(s.size.straight=r.size.logical_size,s.texcoords.straight=r.texcoords.straight,s.label_texture=n[r.texcoords.straight.texture_id]):(s.size.curved=r.segment_sizes.map((function(e){return e.logical_size})),s.texcoords_stroke=r.texcoords_stroke,s.texcoords.curved=r.texcoords.curved,s.label_textures=r.texcoords.curved.map((e=>n[e.texture_id])))):(s.size=r.size.logical_size,s.texcoords=r.align[t.label.align].texcoords,s.label_texture=n[r.align[t.label.align].texture_id]),s.blend_order=t.draw.blend_order,Ne.addFeature.call(this,t.feature,t.draw,t.context);}))),this.freeText(e);const s=await Ne.endData.call(this,e);if(s){n&&n.length&&s.textures.push(...n);for(let e in s.meshes)s.meshes[e].uniforms.u_apply_color_blocks=true;}return s},_preprocess(e){return e.blend_order=this.getBlendOrderForDraw(e),this.preprocessText(e)},buildTextLabels(e,t){let i=[];for(let n=0;n<t.length;n++){let s,o=t[n],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 r=a.segment_sizes.map((e=>e.collision_size));o.layout.no_curving=a.no_curving,s=this.buildLabels(r,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],i.push(t);}}return i},buildLabels(e,t,i,r){let n=[];if("LineString"===t.type)Array.prototype.push.apply(n,this.buildLineLabels(t.coordinates,e,i,r));else if("MultiLineString"===t.type){let s=t.coordinates;for(let t=0;t<s.length;++t)Array.prototype.push.apply(n,this.buildLineLabels(s[t],e,i,r));}else if("Point"===t.type)n.push(new qt(t.coordinates,e,i));else if("MultiPoint"===t.type){let r=t.coordinates;for(let t=0;t<r.length;++t)n.push(new qt(r[t],e,i));}else if("Polygon"===t.type){let r=$.centroid(t.coordinates);r&&n.push(new qt(r,e,i));}else if("MultiPolygon"===t.type){let r=$.multiCentroid(t.coordinates);r&&n.push(new qt(r,e,i));}return n},buildLineLabels(e,t,i,r){let n=[],s=Math.min(i.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),h=dr(t,r,u,i);h&&n.push(h);}}if(n.length<s){let s=dr(t,r,e,i);s&&n.push(s);}return n},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.shader_point]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:false},{name:"a_shape",size:4,type:fe.SHORT,normalized:false},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:true},{name:"a_offset",size:2,type:fe.SHORT,normalized:false},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:true},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:true,static:e.selection?null:[0,0,0,0]},{name:"a_pre_angles",size:4,type:fe.BYTE,normalized:false},{name:"a_angles",size:4,type:fe.SHORT,normalized:false},{name:"a_offsets",size:4,type:fe.UNSIGNED_SHORT,normalized:false}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.shader_point]=new Ue(t);}return this.vertex_layouts[e.shader_point]}}),br.texture_id=0;let vr=Object.create(et);Object.assign(vr,{name:"raster",super:et,built_in:true,init(){this.raster=this.raster||"color",this.super.init.apply(this,arguments),this.selection=false;},_preprocess(e){return e.color=e.color||Q.defaults.color,this.super._preprocess.apply(this,arguments)}});function Ar(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r);}return i}function Tr(e){return null!=e}function wr(e){return "("+e+")"}function Er(e){return "string"==typeof e?'"'+e+'"':e}function Rr(e){if("$"===e[0])return "context['"+e.substring(1)+"']";if(e.indexOf(".")>-1){if(-1===e.indexOf("\\."))return `context.feature.properties${e.split(".").map((e=>"['"+e+"']")).join("")}`;return `context.feature.properties${e.replace(/\\\./g,"__TANGRAM_DELIMITER__").split(".").map((e=>e.replace(/__TANGRAM_DELIMITER__/g,"."))).map((e=>"['"+e+"']")).join("")}`}return "context.feature.properties['"+e+"']"}function Mr(e,t){return wr(Er(t)+" === "+Rr(e))}function zr(e,t){return wr(`${"["+t.map(Er).join(",")+"]"}.indexOf(${Rr(e)}) > -1`)}function Pr(e,t){return wr(e.filter(Tr).map((function(e){return wr(e.join(" && "))})).join(" "+t+" "))}function Sr(e,t,i){return t&&t.length>0?Pr(t.map((function(e){return Dr(e,i)})),"||"):"true"}function Nr(e,t,i){return t&&t.length>0?Pr(t.map((function(e){return Dr(e,i)})),"&&"):"true"}function kr(e,t,i){return "!"+wr(Dr(t,i).join(" && "))}function Or(e,t,i){return "!"+wr(Sr(0,t,i))}function Lr(e,t){return wr(Rr(e)+(t?" != ":" == ")+"null")}function Ir(e,t,i){var r=[],n=i&&"function"==typeof i.rangeTransform&&i.rangeTransform;if(t.max){var s=n?n(t.max):t.max;r.push(Rr(e)+" < "+s);}if(t.min){var o=n?o=n(t.min):t.min;r.push(Rr(e)+" >= "+o);}return wr(r.join(" && "))}function Fr(e,t){let i=[];if(t.includes_any){const r="["+(Array.isArray(t.includes_any)?t.includes_any:[t.includes_any]).map(Er).join(",")+"]";i.push(`${Rr(e)} != null && ${r}.some(function(v) { return ${Rr(e)}.indexOf(v) > -1 })`);}if(t.includes_all){const r="["+(Array.isArray(t.includes_all)?t.includes_all:[t.includes_all]).map(Er).join(",")+"]";i.push(`${Rr(e)} != null && ${r}.every(function(v) { return ${Rr(e)}.indexOf(v) > -1 })`);}return wr(i.join(" && "))}function Dr(e,t){var i=[];if("function"==typeof e)return [wr(e.toString()+"(context)")];if(Array.isArray(e))return [Sr(0,e,t)];if(null==e)return ["true"];for(var r=Object.keys(e),n=0;n<r.length;n++){var s=r[n],o=e[s],a=typeof o;if("string"===a||"number"===a)i.push(Mr(s,o));else if("boolean"===a)i.push(Lr(s,o));else if("not"===s)i.push(kr(0,o,t));else if("any"===s)i.push(Sr(0,o,t));else if("all"===s)i.push(Nr(0,o,t));else if("none"===s)i.push(Or(0,o,t));else if(Array.isArray(o))i.push(zr(s,o));else if("object"===a&&null!=o)o.max||o.min?i.push(Ir(s,o,t)):(o.includes_any||o.includes_all)&&i.push(Fr(s,o));else {if(null!=o)throw new Error("Unknown Query syntax: "+o);i.push(" true ");}}return 0===r.length?["true"]:i}function Ur(e,t){return null==e?function(){return true}:new Function("context","return "+(wr(Dr(e,t).join(" && "))+";"))}const Gr=["filter","draw","visible","enabled","data","exclusive","priority"];let Cr={};function jr(e,t){let i,r=0;for(let t=0;t<e.length;t++)e[t].length>r&&(r=e[t].length);if(0===r)return null;let n={visible:true};for(let s=0;s<r;s++)i=[],e.forEach((e=>{e[s]&&e[s][t]&&-1===i.indexOf(e[s][t])&&i.push(e[s][t]);})),0!==i.length&&V(n,...i);return false===n.visible?null:n}const Vr=["any","all","not","none"];class $r{constructor({layer:e,name:t,parent:i,draw:r,visible:n,enabled:s,filter:o,exclusive:a,priority:l,styles:u}){if(this.id=$r.id++,this.config_data=e.data,this.parent=i,this.name=t,this.full_name=this.parent?this.parent.full_name+":"+this.name:this.name,this.draw=r,this.filter=o,this.exclusive=true===a,this.priority=null!=l?l:Number.MAX_SAFE_INTEGER,this.styles=u,this.is_built=false,s=void 0===s?n:s,this.enabled=false!==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`,m("warn",t),delete this.draw[e];}}build(){m("trace",`Building layer '${this.full_name}'`),this.buildFilter(),this.buildDraw(),this.is_built=true;}buildDraw(){this.draw=W(this.draw,Q.wrapFunction),this.calculatedDraw=function(e){let t=[];if(e.parent){let i=e.parent.calculatedDraw||[];t.push(...i);}return t.push(e.draw),t}(this);}buildFilter(){this.filter_original=this.filter,this.filter=W(this.filter,Q.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 m("warn",e)}try{this.buildZooms(),this.buildPropMatches(),null!=this.filter&&("function"==typeof this.filter||Object.keys(this.filter).length>0)?this.filter=Ur(this.filter,Xr):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}`,m("warn",t);}}buildZooms(){let e=this.filter&&this.filter.$zoom,t=typeof e;if(null!=e){if(this.zooms={},"number"===t)this.zooms[e]=true;else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.zooms[e[t]]=true;else if("object"===t&&(null!=e.min||null!=e.max)){let t=e.min||0,i=e.max||$.max_style_zoom;for(let e=t;e<i;e++)this.zooms[e]=true;}delete this.filter.$zoom;}}buildPropMatches(){this.filter&&!Array.isArray(this.filter)&&"function"!=typeof this.filter&&Object.keys(this.filter).forEach((e=>{if(-1===Vr.indexOf(e)){let t=this.filter[e],i=typeof t,r=Array.isArray(t);if(!r&&"string"!==i&&"number"!==i)return;"$"===e[0]?(this.context_prop_matches=this.context_prop_matches||[],this.context_prop_matches.push([e.substring(1),r?t:[t]]),delete this.filter[e]):-1===e.indexOf(".")&&(this.feature_prop_matches=this.feature_prop_matches||[],this.feature_prop_matches.push([e,r?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 i=this.feature_prop_matches[t],r=e.feature.properties[i[0]];if(null==r||-1===i[1].indexOf(r))return false}if(this.context_prop_matches)for(let t=0;t<this.context_prop_matches.length;t++){let i=this.context_prop_matches[t],r=e[i[0]];if(null==r||-1===i[1].indexOf(r))return false}return true}doesMatch(e){if(!this.enabled)return false;if(this.is_built||this.build(),null!=this.zooms&&!this.zooms[e.zoom])return false;if(!this.doPropMatches(e))return false;let t;if(this.filter instanceof Function)try{t=this.filter(e);}catch(t){let i=`Filter for this ${this.full_name}: \`filter: ${this.filter_original}\` `;i+=`failed with error '${t.message}', stack trace: ${t.stack}`,m("error",i,e.feature);}else t=null==this.filter;return !!t&&(this.children_to_parse&&(!function(e,t,i){for(let r in t){let n=t[r];if("object"!=typeof n||Array.isArray(n)){let t=`Layer value must be an object: cannot create layer '${r}: ${JSON.stringify(n)}'`;t+=`, under parent layer '${e.full_name}'.`,i[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?"),m("warn",t);}else Wr(r,n,e,i);}e.layers.sort(((e,t)=>{if(e.exclusive<t.exclusive)return 1;if(e.exclusive>t.exclusive)return -1;const i=e.exclusive?1:-1;return e.priority>t.priority?i:e.priority<t.priority?-i:e.full_name<t.full_name?i:e.full_name>t.full_name?-i:void 0}));}(this,this.children_to_parse,this.styles),delete this.children_to_parse),true)}}$r.id=0;class Br extends $r{constructor(e){super(e),this.is_leaf=true;}}class qr extends $r{constructor(e){super(e),this.is_tree=true,this.layers=e.layers||[];}addLayer(e){this.layers.push(e);}buildDrawGroups(e){let t=[],i=[];if(Yr(e,[this],t,i),t.length>0){let e=function(e){if(e.length>1){for(var t=e[0],i=1;i<e.length;i++)t+="/"+e[i];return t}return e[0]}(i);if(void 0===Cr[e]){let i=t.map((e=>e&&false!==e.visible&&e.calculatedDraw)),r={};for(let e=0;e<i.length;e++){let t=i[e];if(t)for(let e=0;e<t.length;e++){let i=t[e];for(let e in i)r[e]=true;}}for(let n in r)Cr[e]=Cr[e]||{},Cr[e][n]=jr(i,n),Cr[e][n]?(Cr[e][n].key=e+"/"+n,Cr[e][n].layers=t.map((e=>e&&e.full_name)),Cr[e][n].group=n):delete Cr[e][n];Cr[e]&&0===Object.keys(Cr[e]).length&&(Cr[e]=null);}return Cr[e]}}}const Xr={rangeTransform:e=>"string"==typeof e&&"px2"===e.trim().slice(-3)?`${parseFloat(e)} * context.meters_per_pixel_sq`:e};function Hr(e){return Gr.indexOf(e)>-1}function Wr(e,t,i,r){let n={name:e,layer:t=null==t?{}:t,parent:i,styles:r},[s,o]=function(e){let t={},i={};for(let r in e)Hr(r)?t[r]=e[r]:i[r]=e[r];return [t,i]}(t),a=(l=o,0===Object.keys(l).length);var l;let u;u=a&&null!=i?Br:qr;let h=new u(Object.assign(n,s));return h.enabled&&(i&&i.addLayer(h),h.children_to_parse=a?null:o),h}function Yr(e,t,i,r){let n=false,s=false;if(0!==t.length){for(let o=0;o<t.length;o++){let a=t[o];if(a.is_leaf){if(a.doesMatch(e)&&(n=true,i.push(a),r.push(a.id),a.exclusive))break}else if(a.is_tree&&a.doesMatch(e)&&(n=true,s=Yr(e,a.layers,i,r),s||(i.push(a),r.push(a.id)),a.exclusive))break}return n}}function Zr(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r);}return i}function Jr(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Zr(Object(i),true).forEach((function(t){n(e,t,i[t]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Zr(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t));}));}return e}let Kr=0,Qr=0;class en{constructor({coords:e,style_z:t,source:i,workers:r,view:n}){this.id=Kr++,this.view=n,this.source=i,this.generation=null,this.valid=true,this.visible=false,this.proxy_for=null,this.proxied_as=null,this.proxy_level=0,this.proxy_order_offset=0,this.fade_in=true,this.loading=false,this.loaded=false,this.built=false,this.labeled=false,this.error=null,this.debug={},this.style_z=t,this.coords=Re.normalizedCoord(e,this.source),this.key=Re.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=$.metersForTile(this.coords),this.max=$.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=$.metersPerPixel(this.style_z),this.meters_per_pixel_sq=this.meters_per_pixel*this.meters_per_pixel,this.units_per_pixel=$.units_per_pixel/this.overzoom2,this.units_per_meter_overzoom=$.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(r);}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(){w.removeForTile(this.id),this.workerMessage("self.removeTile",this.key),this.freeResources(),this.worker=null,this.valid=false;}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=true}={}){return this.generation=e,this.fade_in=t,this.loaded||(this.loading=true,this.built=false,this.labeled=false),this.workerMessage("self.buildTile",{tile:this.buildAsMessage()}).catch((e=>{throw e}))}static cancel(e){e&&(e.canceled=true,e.source_data&&e.source_data.request_id&&(g.cancelRequest(e.source_data.request_id),e.source_data.request_id=null),en.abortBuild(e));}static buildGeometry(e,{scene_id:t,layers:i,styles:r,global:n}){let s=e.source_data;e.debug.building=+new Date,e.debug.feature_count=0,e.debug.layers=null,Bt.startTile(e.id,{apply_repeat_groups:true});for(let t in i){let o=i[t];if(!o||!o.config_data){m("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=en.getDataForSource(s,o.config_data,t);for(let i=0;i<a.length;i++){let s=a[i],l=s.geom;if(l)for(let i=0;i<l.features.length;i++){let a=l.features[i];if(null==a.geometry)continue;let u=Q.getFeatureParseContext(a,e,n);u.winding=e.default_winding,u.source=e.source,u.layer=s.layer;let h=o.buildDrawGroups(u,true);if(h){for(let e in h){let i=h[e],n=i.style||e,s=r[n];s?(i=s.preprocess(i),null!=i&&false!==i.visible&&(u.layers=i.layers,s.addFeature(a,i,u))):m("warn",`Style '${n}' not found, skipping layer '${t}':`,i,a);}e.debug.feature_count++;}}}}e.debug.building=+new Date-e.debug.building;let o=this.stylesForTile(e,r).map((e=>r[e]));en.buildStyleGroups(e,o,t,(e=>e.collision?"collision":"non-collision"));}static stylesForTile(e,t){let i=[];for(let r in t)t[r].hasDataForTile(e)&&i.push(r);return i}static buildStyleGroups(e,t,i,r){const n=t.reduce(((e,t)=>{const i=r(t);return e[i]=e[i]||[],e[i].push(t),e}),{});if(0===Object.keys(n).length)return a.postMessage(`TileManager_${i}.buildTileStylesCompleted`,a.withTransferables({tile:en.slice(e),progress:{start:true,done:true}})),void Bt.resetTile(e.id);const s={};for(const t in n)en.buildStyleGroup({group_name:t,groups:n,tile:e,progress:s,scene_id:i});}static async buildStyleGroup({group_name:e,groups:t,tile:i,progress:r,scene_id:n}){const s=t[e],o={};try{await Promise.all(s.map((async function(e){const t=await e.endData(i);t&&(o[e.name]=t);}))),m("trace",`Finished style group '${e}' for tile ${i.key}`),t[e]=null,Object.keys(t).every((e=>null==t[e]))&&(r.done=!0),a.postMessage(`TileManager_${n}.buildTileStylesCompleted`,a.withTransferables({tile:Jr(Jr({},en.slice(i)),{},{mesh_data:o}),progress:r})),r.done&&Bt.resetTile(i.id);}catch(t){m("error",`Error for style group '${e}' for tile ${i.key}`,t&&t.stack||t);}}static getDataForSource(e,t,i){var r=[];if(null!=t&&null!=e&&null!=e.layers)if(true===t.all_layers){if(null!=t.layer){m({level:"warn",once:true},`Layer ${i} 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)r.push({layer:t,geom:e.layers[t]});}else !t.layer&&e.layers._default?r.push({geom:e.layers._default}):!t.layer&&i?r.push({layer:i,geom:e.layers[i]}):"string"==typeof t.layer?r.push({layer:t.layer,geom:e.layers[t.layer]}):Array.isArray(t.layer)&&t.layer.forEach((t=>{r.push({layer:t,geom:e.layers[t]});}));return r}buildMeshes(e,t){if(this.error)return;this.build_id=Qr++,t.start&&(this.debug.geometry_count=0,this.debug.buffer_size=0);let i={},r=this.mesh_data;if(r)for(let t in r){for(let n in r[t].meshes){let s=r[t].meshes[n];if(s.vertex_data){if(!e[t]){m("warn",`Could not create mesh because style '${t}' not found, for tile ${this.key}, aborting tile`);break}let n=Object.assign({},r[t]);n.uniforms=Object.assign({},n.uniforms,s.uniforms),n.variant=s.variant,s.labels&&(n.retain=true);let o=e[t].makeMesh(s.vertex_data,s.vertex_elements,n);o.variant=n.variant,o.labels=s.labels,i[t]=i[t]||[],i[t].push(o),null==o.variant.mesh_order&&(o.variant.mesh_order=i[t].length-1),this.debug.buffer_size+=o.buffer_size,this.debug.geometry_count+=o.geometry_count;}}i[t]&&i[t].sort(((e,t)=>{let i=e.variant.mesh_order,r=t.variant.mesh_order;return null==i?1:null==r||i<r?-1:1}));}delete this.mesh_data;for(let t in i)e[t].collision?(this.pending_label_meshes=this.pending_label_meshes||{},this.pending_label_meshes[t]=i[t]):(this.meshes[t]&&this.meshes[t].forEach((e=>e.destroy())),this.meshes[t]=i[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=true,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(w.removeForTile(e.id),Bt.abortTile(e.id),e.mesh_data)for(let t in e.mesh_data){let i=e.mesh_data[t].textures;i&&i.forEach((t=>{let i=M.textures[t];i&&(m("trace",`releasing texture ${t} for tile ${e.key}`),i.release());}));}}setProxyFor(e){e?(this.visible=true,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},i){i.uniform("4fv","u_tile_origin",[this.min.x,this.min.y,this.style_z,this.coords.z]),i.uniform("1f","u_tile_proxy_order_offset",this.proxy_order_offset),rr.identity(e),rr.translate(e,e,tr.fromValues(this.min.x,this.min.y,0)),rr.scale(e,e,tr.fromValues(this.span.x/$.tile_scale,this.span.y/$.tile_scale,1)),rr.copy(t,e),i.uniform("Matrix4fv","u_model",t),i.uniform("1i","u_tile_fade_in",this.fade_in&&"child"!==this.proxied_as);}static slice(e,t){let i=["id","key","loading","loaded","generation","error","debug"];Array.isArray(t)&&i.push(...t);var r={};for(let t=0;t<i.length;t++){const n=i[t];r[n]=e[n];}return r}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 i={};for(let e in this.debug) -1===t.indexOf(e)&&(i[e]=this.debug[e]);m("debug",`Tile ${e.done?"(done)":""}: debug for ${this.key}: [ ${JSON.stringify(i)} ]`);}}function tn(e,t){for(let i in e){let r=e[i];ke(t,i,r.features,r.geoms,r.styles,r.base),r.layers&&(t[i].layers=t[i].layers||{},tn(r.layers,t[i].layers));}}en.coord_children={};var rn,nn,sn,on={};function an(){return rn||(rn=1,on.read=function(e,t,i,r,n){var s,o,a=8*n-r-1,l=(1<<a)-1,u=l>>1,h=-7,c=i?n-1:0,d=i?-1:1,f=e[t+c];for(c+=d,s=f&(1<<-h)-1,f>>=-h,h+=a;h>0;s=256*s+e[t+c],c+=d,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=r;h>0;o=256*o+e[t+c],c+=d,h-=8);if(0===s)s=1-u;else {if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),s-=u;}return (f?-1:1)*o*Math.pow(2,s-r)},on.write=function(e,t,i,r,n,s){var o,a,l,u=8*s-n-1,h=(1<<u)-1,c=h>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:s-1,_=r?1:-1,p=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=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+c>=1?d/l:d*Math.pow(2,1-c))*l>=2&&(o++,l/=2),o+c>=h?(a=0,o=h):o+c>=1?(a=(t*l-1)*Math.pow(2,n),o+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;e[i+f]=255&a,f+=_,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;e[i+f]=255&o,f+=_,o/=256,u-=8);e[i+f-_]|=128*p;}),on}var ln,un,hn,cn,dn,fn,_n,pn,mn,gn=function(){if(sn)return nn;sn=1,nn=t;var e=an();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 i=4294967296,r=1/i;function n(e){return e.type===t.Bytes?e.readVarint()+e.pos:e.pos+1}function s(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function o(e,t,i){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.ceil(Math.log(t)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=e;n--)i.buf[n+r]=i.buf[n];}function a(e,t){for(var i=0;i<e.length;i++)t.writeVarint(e[i]);}function l(e,t){for(var i=0;i<e.length;i++)t.writeSVarint(e[i]);}function u(e,t){for(var i=0;i<e.length;i++)t.writeFloat(e[i]);}function h(e,t){for(var i=0;i<e.length;i++)t.writeDouble(e[i]);}function c(e,t){for(var i=0;i<e.length;i++)t.writeBoolean(e[i]);}function d(e,t){for(var i=0;i<e.length;i++)t.writeFixed32(e[i]);}function f(e,t){for(var i=0;i<e.length;i++)t.writeSFixed32(e[i]);}function _(e,t){for(var i=0;i<e.length;i++)t.writeFixed64(e[i]);}function p(e,t){for(var i=0;i<e.length;i++)t.writeSFixed64(e[i]);}function m(e,t){return (e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function g(e,t,i){e[i]=t,e[i+1]=t>>>8,e[i+2]=t>>>16,e[i+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,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),n=r>>3,s=this.pos;this.type=7&r,e(n,t,this),this.pos===s&&this.skip(r);}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=m(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=m(this.buf,this.pos)+m(this.buf,this.pos+4)*i;return this.pos+=8,e},readSFixed64:function(){var e=m(this.buf,this.pos)+y(this.buf,this.pos+4)*i;return this.pos+=8,e},readFloat:function(){var t=e.read(this.buf,this.pos,true,23,4);return this.pos+=4,t},readDouble:function(){var t=e.read(this.buf,this.pos,true,52,8);return this.pos+=8,t},readVarint:function(e){var t,i,r=this.buf;return t=127&(i=r[this.pos++]),i<128?t:(t|=(127&(i=r[this.pos++]))<<7,i<128?t:(t|=(127&(i=r[this.pos++]))<<14,i<128?t:(t|=(127&(i=r[this.pos++]))<<21,i<128?t:function(e,t,i){var r,n,o=i.buf;if(n=o[i.pos++],r=(112&n)>>4,n<128)return s(e,r,t);if(n=o[i.pos++],r|=(127&n)<<3,n<128)return s(e,r,t);if(n=o[i.pos++],r|=(127&n)<<10,n<128)return s(e,r,t);if(n=o[i.pos++],r|=(127&n)<<17,n<128)return s(e,r,t);if(n=o[i.pos++],r|=(127&n)<<24,n<128)return s(e,r,t);if(n=o[i.pos++],r|=(1&n)<<31,n<128)return s(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(true)},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,i){var r="",n=t;for(;n<i;){var s,o,a,l=e[n],u=null,h=l>239?4:l>223?3:l>191?2:1;if(n+h>i)break;1===h?l<128&&(u=l):2===h?128==(192&(s=e[n+1]))&&(u=(31&l)<<6|63&s)<=127&&(u=null):3===h?(s=e[n+1],o=e[n+2],128==(192&s)&&128==(192&o)&&((u=(15&l)<<12|(63&s)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===h&&(s=e[n+1],o=e[n+2],a=e[n+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,h=1):u>65535&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),n+=h;}return r}(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 i=n(this);for(e=e||[];this.pos<i;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var i=7&e;if(i===t.Varint)for(;this.buf[this.pos++]>127;);else if(i===t.Bytes)this.pos=this.readVarint()+this.pos;else if(i===t.Fixed32)this.pos+=4;else {if(i!==t.Fixed64)throw new Error("Unimplemented type: "+i);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 i=new Uint8Array(t);i.set(this.buf),this.buf=i,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*r),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*r),this.pos+4),this.pos+=8;},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var i,r;e>=0?(i=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,r=r+1|0));if(e>=0x10000000000000000||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos]=127&e;}(i,0,t),function(e,t){var i=(7&e)<<4;if(t.buf[t.pos++]|=i|((e>>>=3)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;t.buf[t.pos++]=127&e;}(r,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,i){for(var r,n,s=0;s<t.length;s++){if((r=t.charCodeAt(s))>55295&&r<57344){if(!n){r>56319||s+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null;}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128);}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&o(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i;},writeFloat:function(t){this.realloc(4),e.write(this.buf,t,this.pos,true,23,4),this.pos+=4;},writeDouble:function(t){this.realloc(8),e.write(this.buf,t,this.pos,true,52,8),this.pos+=8;},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i<t;i++)this.buf[this.pos++]=e[i];},writeRawMessage:function(e,t){this.pos++;var i=this.pos;e(t,this);var r=this.pos-i;r>=128&&o(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r;},writeMessage:function(e,i,r){this.writeTag(e,t.Bytes),this.writeRawMessage(i,r);},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,c,t);},writePackedFloat:function(e,t){this.writeMessage(e,u,t);},writePackedDouble:function(e,t){this.writeMessage(e,h,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,_,t);},writePackedSFixed64:function(e,t){this.writeMessage(e,p,t);},writeBytesField:function(e,i){this.writeTag(e,t.Bytes),this.writeBytes(i);},writeFixed32Field:function(e,i){this.writeTag(e,t.Fixed32),this.writeFixed32(i);},writeSFixed32Field:function(e,i){this.writeTag(e,t.Fixed32),this.writeSFixed32(i);},writeFixed64Field:function(e,i){this.writeTag(e,t.Fixed64),this.writeFixed64(i);},writeSFixed64Field:function(e,i){this.writeTag(e,t.Fixed64),this.writeSFixed64(i);},writeVarintField:function(e,i){this.writeTag(e,t.Varint),this.writeVarint(i);},writeSVarintField:function(e,i){this.writeTag(e,t.Varint),this.writeSVarint(i);},writeStringField:function(e,i){this.writeTag(e,t.Bytes),this.writeString(i);},writeFloatField:function(e,i){this.writeTag(e,t.Fixed32),this.writeFloat(i);},writeDoubleField:function(e,i){this.writeTag(e,t.Fixed64),this.writeDouble(i);},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t));}},nn}(),yn=k(gn),xn={};function bn(){if(cn)return hn;cn=1;var e=function(){if(un)return ln;function e(e,t){this.x=e,this.y=t;}return un=1,ln=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,i=e.y-this.y;return t*t+i*i},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,i=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=i,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),i=Math.sin(e),r=t*this.x-i*this.y,n=i*this.x+t*this.y;return this.x=r,this.y=n,this},_rotateAround:function(e,t){var i=Math.cos(e),r=Math.sin(e),n=t.x+i*(this.x-t.x)-r*(this.y-t.y),s=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=n,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},ln}();function t(e,t,r,n,s){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=s,e.readFields(i,this,t);}function i(e,t,i){1==e?t.id=i.readVarint():2==e?function(e,t){var i=e.readVarint()+e.pos;for(;e.pos<i;){var r=t._keys[e.readVarint()],n=t._values[e.readVarint()];t.properties[r]=n;}}(i,t):3==e?t.type=i.readVarint():4==e&&(t._geometry=i.pos);}function r(e){for(var t,i,r=0,n=0,s=e.length,o=s-1;n<s;o=n++)t=e[n],r+=((i=e[o]).x-t.x)*(t.y+i.y);return r}return hn=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var i,r=t.readVarint()+t.pos,n=1,s=0,o=0,a=0,l=[];t.pos<r;){if(!s){var u=t.readVarint();n=7&u,s=u>>3;}if(s--,1===n||2===n)o+=t.readSVarint(),a+=t.readSVarint(),1===n&&(i&&l.push(i),i=[]),i.push(new e(o,a));else {if(7!==n)throw new Error("unknown command "+n);i&&i.push(i[0].clone());}}return i&&l.push(i),l},t.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,i=1,r=0,n=0,s=0,o=1/0,a=-1/0,l=1/0,u=-1/0;e.pos<t;){if(!r){var h=e.readVarint();i=7&h,r=h>>3;}if(r--,1===i||2===i)(n+=e.readSVarint())<o&&(o=n),n>a&&(a=n),(s+=e.readSVarint())<l&&(l=s),s>u&&(u=s);else if(7!==i)throw new Error("unknown command "+i)}return [o,l,a,u]},t.prototype.toGeoJSON=function(e,i,n){var s,o,a=this.extent*Math.pow(2,n),l=this.extent*e,u=this.extent*i,h=this.loadGeometry(),c=t.types[this.type];function d(e){for(var t=0;t<e.length;t++){var i=e[t],r=180-360*(i.y+u)/a;e[t]=[360*(i.x+l)/a-180,360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90];}}switch(this.type){case 1:var f=[];for(s=0;s<h.length;s++)f[s]=h[s][0];d(h=f);break;case 2:for(s=0;s<h.length;s++)d(h[s]);break;case 3:for(h=function(e){var t=e.length;if(t<=1)return [e];for(var i,n,s=[],o=0;o<t;o++){var a=r(e[o]);0!==a&&(void 0===n&&(n=a<0),n===a<0?(i&&s.push(i),i=[e[o]]):i.push(e[o]));}i&&s.push(i);return s}(h),s=0;s<h.length;s++)for(o=0;o<h[s].length;o++)d(h[s][o]);}1===h.length?h=h[0]:c="Multi"+c;var _={type:"Feature",geometry:{type:c,coordinates:h},properties:this.properties};return "id"in this&&(_.id=this.id),_},hn}function vn(){if(fn)return dn;fn=1;var e=bn();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(i,this,t),this.length=this._features.length;}function i(e,t,i){15===e?t.version=i.readVarint():1===e?t.name=i.readString():5===e?t.extent=i.readVarint():2===e?t._features.push(i.pos):3===e?t._keys.push(i.readString()):4===e&&t._values.push(function(e){var t=null,i=e.readVarint()+e.pos;for(;e.pos<i;){var r=e.readVarint()>>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null;}return t}(i));}return dn=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 i=this._pbf.readVarint()+this._pbf.pos;return new e(this._pbf,i,this.extent,this._keys,this._values)},dn}var An=(mn||(mn=1,xn.VectorTile=function(){if(pn)return _n;pn=1;var e=vn();function t(t,i,r){if(3===t){var n=new e(r,r.readVarint()+r.pos);n.length&&(i[n.name]=n);}}return _n=function(e,i){this.layers=e.readFields(t,{},i);},_n}(),xn.VectorTileFeature=bn(),xn.VectorTileLayer=vn()),xn);const Tn=0,wn=1,En=2,Rn=["{","["];class Mn extends Ee{constructor(e,t){if(super(e,t),this.response_type="arraybuffer",true===e.parse_json)this.parse_json_type=wn;else if(Array.isArray(e.parse_json))this.parse_json_type=En,this.parse_json_prop_list=e.parse_json;else {if(null!=e.parse_json){m({level:"warn",once:true},`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=Tn;}}parseSourceData(e,t,i){var r=new Uint8Array(i),n=new yn(r);if(t.data=new An.VectorTile(n),t.layers=this.toGeoJSON(t.data),"function"==typeof this.transform){const i={min:Object.assign({},e.min),max:Object.assign({},e.max),coords:Object.assign({},e.coords)};t.layers=this.transform(t.layers,this.extra_data,i);}delete t.data;}toGeoJSON(e){var t={};for(var i in e.layers){for(var r=e.layers[i],n=$.tile_scale/r.extent,s={type:"FeatureCollection",features:[]},o=0;o<r.length;o++){var a=r.feature(o),l={type:"Feature",geometry:{},id:a.id,properties:a.properties};this.parseJSONProperties(l);for(var u=l.geometry,h=a.loadGeometry(),c=0;c<h.length;c++)for(var d=h[c],f=0;f<d.length;f++)d[f]=[d[f].x*n,d[f].y*n];u.coordinates=h,"Point"===An.VectorTileFeature.types[a.type]?1===h.length?(u.type="Point",u.coordinates=u.coordinates[0][0]):(u.type="MultiPoint",u.coordinates=u.coordinates[0]):"LineString"===An.VectorTileFeature.types[a.type]?1===h.length?(u.type="LineString",u.coordinates=u.coordinates[0]):u.type="MultiLineString":"Polygon"===An.VectorTileFeature.types[a.type]&&(u=zn(u)),s.features.push(l);}t[i]=s;}return t}parseJSONProperties(e){if(this.parse_json_type!==Tn){const t=e.properties;if(this.parse_json_type===En)this.parse_json_prop_list.forEach((e=>{try{t[e]=JSON.parse(t[e]);}catch(e){}}));else for(const e in t)if(Rn.indexOf(t[e][0])>-1)try{t[e]=JSON.parse(t[e]);}catch(e){}}}}function zn(e){let t,i=[],r=[];for(let n=0;n<e.coordinates.length;n++){let s=e.coordinates[n],o=$.ringWinding(s);null!=o&&(t=t||o,o===t&&r.length>0&&(i.push(r),r=[]),r.push(s));}return r.length>0&&i.push(r),1===i.length?(e.type="Polygon",e.coordinates=i[0]):i.length>1?(e.type="MultiPolygon",e.coordinates=i):e=null,e}function Pn(e,t,i,r){for(var n,s=r,o=i-t>>1,a=i-t,l=e[t],u=e[t+1],h=e[i],c=e[i+1],d=t+3;d<i;d+=3){var f=Sn(e[d],e[d+1],l,u,h,c);if(f>s)n=d,s=f;else if(f===s){var _=Math.abs(d-o);_<a&&(n=d,a=_);}}s>r&&(n-t>3&&Pn(e,t,n,r),e[n+2]=s,i-n>3&&Pn(e,n,i,r));}function Sn(e,t,i,r,n,s){var o=n-i,a=s-r;if(0!==o||0!==a){var l=((e-i)*o+(t-r)*a)/(o*o+a*a);l>1?(i=n,r=s):l>0&&(i+=o*l,r+=a*l);}return (o=e-i)*o+(a=t-r)*a}function Nn(e,t,i,r){var n={id:void 0===e?null:e,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,i=e.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)kn(e,t);else if("Polygon"===i||"MultiLineString"===i)for(var r=0;r<t.length;r++)kn(e,t[r]);else if("MultiPolygon"===i)for(r=0;r<t.length;r++)for(var n=0;n<t[r].length;n++)kn(e,t[r][n]);}(n),n}function kn(e,t){for(var i=0;i<t.length;i+=3)e.minX=Math.min(e.minX,t[i]),e.minY=Math.min(e.minY,t[i+1]),e.maxX=Math.max(e.maxX,t[i]),e.maxY=Math.max(e.maxY,t[i+1]);}function On(e,t,i,r){if(t.geometry){var n=t.geometry.coordinates,s=t.geometry.type,o=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),a=[],l=t.id;if(i.promoteId?l=t.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===s)Ln(n,a);else if("MultiPoint"===s)for(var u=0;u<n.length;u++)Ln(n[u],a);else if("LineString"===s)In(n,a,o,false);else if("MultiLineString"===s){if(i.lineMetrics){for(u=0;u<n.length;u++)a=[],In(n[u],a,o,false),e.push(Nn(l,"LineString",a,t.properties));return}Fn(n,a,o,false);}else if("Polygon"===s)Fn(n,a,o,true);else {if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<t.geometry.geometries.length;u++)On(e,{id:l,geometry:t.geometry.geometries[u],properties:t.properties},i,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<n.length;u++){var h=[];Fn(n[u],h,o,true),a.push(h);}}e.push(Nn(l,s,a,t.properties));}}function Ln(e,t){t.push(Dn(e[0])),t.push(Un(e[1])),t.push(0);}function In(e,t,i,r){for(var n,s,o=0,a=0;a<e.length;a++){var l=Dn(e[a][0]),u=Un(e[a][1]);t.push(l),t.push(u),t.push(0),a>0&&(o+=r?(n*u-l*s)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(u-s,2))),n=l,s=u;}var h=t.length-3;t[2]=1,Pn(t,0,h,i),t[h+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size;}function Fn(e,t,i,r){for(var n=0;n<e.length;n++){var s=[];In(e[n],s,i,r),t.push(s);}}function Dn(e){return e/360+.5}function Un(e){var t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function Gn(e,t,i,r,n,s,o,a){if(r/=t,s>=(i/=t)&&o<r)return e;if(o<i||s>=r)return null;for(var l=[],u=0;u<e.length;u++){var h=e[u],c=h.geometry,d=h.type,f=0===n?h.minX:h.minY,_=0===n?h.maxX:h.maxY;if(f>=i&&_<r)l.push(h);else if(!(_<i||f>=r)){var p=[];if("Point"===d||"MultiPoint"===d)Cn(c,p,i,r,n);else if("LineString"===d)jn(c,p,i,r,n,false,a.lineMetrics);else if("MultiLineString"===d)$n(c,p,i,r,n,false);else if("Polygon"===d)$n(c,p,i,r,n,true);else if("MultiPolygon"===d)for(var m=0;m<c.length;m++){var g=[];$n(c[m],g,i,r,n,true),g.length&&p.push(g);}if(p.length){if(a.lineMetrics&&"LineString"===d){for(m=0;m<p.length;m++)l.push(Nn(h.id,d,p[m],h.tags));continue}"LineString"!==d&&"MultiLineString"!==d||(1===p.length?(d="LineString",p=p[0]):d="MultiLineString"),"Point"!==d&&"MultiPoint"!==d||(d=3===p.length?"Point":"MultiPoint"),l.push(Nn(h.id,d,p,h.tags));}}}return l.length?l:null}function Cn(e,t,i,r,n){for(var s=0;s<e.length;s+=3){var o=e[s+n];o>=i&&o<=r&&(t.push(e[s]),t.push(e[s+1]),t.push(e[s+2]));}}function jn(e,t,i,r,n,s,o){for(var a,l,u=Vn(e),h=0===n?qn:Xn,c=e.start,d=0;d<e.length-3;d+=3){var f=e[d],_=e[d+1],p=e[d+2],m=e[d+3],g=e[d+4],y=0===n?f:_,x=0===n?m:g,b=false;o&&(a=Math.sqrt(Math.pow(f-m,2)+Math.pow(_-g,2))),y<i?x>i&&(l=h(u,f,_,m,g,i),o&&(u.start=c+a*l)):y>r?x<r&&(l=h(u,f,_,m,g,r),o&&(u.start=c+a*l)):Bn(u,f,_,p),x<i&&y>=i&&(l=h(u,f,_,m,g,i),b=true),x>r&&y<=r&&(l=h(u,f,_,m,g,r),b=true),!s&&b&&(o&&(u.end=c+a*l),t.push(u),u=Vn(e)),o&&(c+=a);}var v=e.length-3;f=e[v],_=e[v+1],p=e[v+2],(y=0===n?f:_)>=i&&y<=r&&Bn(u,f,_,p),v=u.length-3,s&&v>=3&&(u[v]!==u[0]||u[v+1]!==u[1])&&Bn(u,u[0],u[1],u[2]),u.length&&t.push(u);}function Vn(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function $n(e,t,i,r,n,s){for(var o=0;o<e.length;o++)jn(e[o],t,i,r,n,s,false);}function Bn(e,t,i,r){e.push(t),e.push(i),e.push(r);}function qn(e,t,i,r,n,s){var o=(s-t)/(r-t);return e.push(s),e.push(i+(n-i)*o),e.push(1),o}function Xn(e,t,i,r,n,s){var o=(s-i)/(n-i);return e.push(t+(r-t)*o),e.push(s),e.push(1),o}function Hn(e,t){for(var i=[],r=0;r<e.length;r++){var n,s=e[r],o=s.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)n=Wn(s.geometry,t);else if("MultiLineString"===o||"Polygon"===o){n=[];for(var a=0;a<s.geometry.length;a++)n.push(Wn(s.geometry[a],t));}else if("MultiPolygon"===o)for(n=[],a=0;a<s.geometry.length;a++){for(var l=[],u=0;u<s.geometry[a].length;u++)l.push(Wn(s.geometry[a][u],t));n.push(l);}i.push(Nn(s.id,o,n,s.tags));}return i}function Wn(e,t){var i=[];i.size=e.size,void 0!==e.start&&(i.start=e.start,i.end=e.end);for(var r=0;r<e.length;r+=3)i.push(e[r]+t,e[r+1],e[r+2]);return i}function Yn(e,t){if(e.transformed)return e;var i,r,n,s=1<<e.z,o=e.x,a=e.y;for(i=0;i<e.features.length;i++){var l=e.features[i],u=l.geometry,h=l.type;if(l.geometry=[],1===h)for(r=0;r<u.length;r+=2)l.geometry.push(Zn(u[r],u[r+1],t,s,o,a));else for(r=0;r<u.length;r++){var c=[];for(n=0;n<u[r].length;n+=2)c.push(Zn(u[r][n],u[r][n+1],t,s,o,a));l.geometry.push(c);}}return e.transformed=true,e}function Zn(e,t,i,r,n,s){return [Math.round(i*(e*r-n)),Math.round(i*(t*r-s))]}function Jn(e,t,i,r,n){for(var s=t===n.maxZoom?0:n.tolerance/((1<<t)*n.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:r,z:t,transformed:false,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<e.length;a++){o.numFeatures++,Kn(o,e[a],s,n);var l=e[a].minX,u=e[a].minY,h=e[a].maxX,c=e[a].maxY;l<o.minX&&(o.minX=l),u<o.minY&&(o.minY=u),h>o.maxX&&(o.maxX=h),c>o.maxY&&(o.maxY=c);}return o}function Kn(e,t,i,r){var n=t.geometry,s=t.type,o=[];if("Point"===s||"MultiPoint"===s)for(var a=0;a<n.length;a+=3)o.push(n[a]),o.push(n[a+1]),e.numPoints++,e.numSimplified++;else if("LineString"===s)Qn(o,n,e,i,false,false);else if("MultiLineString"===s||"Polygon"===s)for(a=0;a<n.length;a++)Qn(o,n[a],e,i,"Polygon"===s,0===a);else if("MultiPolygon"===s)for(var l=0;l<n.length;l++){var u=n[l];for(a=0;a<u.length;a++)Qn(o,u[a],e,i,true,0===a);}if(o.length){var h=t.tags||null;if("LineString"===s&&r.lineMetrics){for(var c in h={},t.tags)h[c]=t.tags[c];h.mapbox_clip_start=n.start/n.size,h.mapbox_clip_end=n.end/n.size;}var d={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:h};null!==t.id&&(d.id=t.id),e.features.push(d);}}function Qn(e,t,i,r,n,s){var o=r*r;if(r>0&&t.size<(n?o:r))i.numPoints+=t.length/3;else {for(var a=[],l=0;l<t.length;l+=3)(0===r||t[l+2]>o)&&(i.numSimplified++,a.push(t[l]),a.push(t[l+1])),i.numPoints++;n&&function(e,t){for(var i=0,r=0,n=e.length,s=n-2;r<n;s=r,r+=2)i+=(e[r]-e[s])*(e[r+1]+e[s+1]);if(i>0===t)for(r=0,n=e.length;r<n/2;r+=2){var o=e[r],a=e[r+1];e[r]=e[n-2-r],e[r+1]=e[n-1-r],e[n-2-r]=o,e[n-1-r]=a;}}(a,s),e.push(a);}}function es(e,t){return new ts(e,t)}function ts(e,t){var i=(t=this.options=function(e,t){for(var i in t)e[i]=t[i];return e}(Object.create(this.options),t)).debug;if(i&&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 r=function(e,t){var i=[];if("FeatureCollection"===e.type)for(var r=0;r<e.features.length;r++)On(i,e.features[r],t,r);else "Feature"===e.type?On(i,e,t):On(i,{geometry:e},t);return i}(e,t);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(e,t){var i=t.buffer/t.extent,r=e,n=Gn(e,1,-1-i,i,0,-1,2,t),s=Gn(e,1,1-i,2+i,0,-1,2,t);return (n||s)&&(r=Gn(e,1,-i,1+i,0,-1,2,t)||[],n&&(r=Hn(n,1).concat(r)),s&&(r=r.concat(Hn(s,-1)))),r}(r,t),r.length&&this.splitTile(r,0,0,0),i&&(r.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 is(e,t,i){return 32*((1<<e)*i+t)+e}Ae.register("MVT",(()=>Mn)),ts.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:false,promoteId:null,generateId:false,debug:0},ts.prototype.splitTile=function(e,t,i,r,n,s,o){for(var a=[e,t,i,r],l=this.options,u=l.debug;a.length;){r=a.pop(),i=a.pop(),t=a.pop(),e=a.pop();var h=1<<t,c=is(t,i,r),d=this.tiles[c];if(!d&&(u>1&&console.time("creation"),d=this.tiles[c]=Jn(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,r,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,n){if(t===l.maxZoom||t===n)continue;var _=1<<n-t;if(i!==Math.floor(s/_)||r!==Math.floor(o/_))continue}else if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue;if(d.source=null,0!==e.length){u>1&&console.time("clipping");var p,m,g,y,x,b,v=.5*l.buffer/l.extent,A=.5-v,T=.5+v,w=1+v;p=m=g=y=null,x=Gn(e,h,i-v,i+T,0,d.minX,d.maxX,l),b=Gn(e,h,i+A,i+w,0,d.minX,d.maxX,l),e=null,x&&(p=Gn(x,h,r-v,r+T,1,d.minY,d.maxY,l),m=Gn(x,h,r+A,r+w,1,d.minY,d.maxY,l),x=null),b&&(g=Gn(b,h,r-v,r+T,1,d.minY,d.maxY,l),y=Gn(b,h,r+A,r+w,1,d.minY,d.maxY,l),b=null),u>1&&console.timeEnd("clipping"),a.push(p||[],t+1,2*i,2*r),a.push(m||[],t+1,2*i,2*r+1),a.push(g||[],t+1,2*i+1,2*r),a.push(y||[],t+1,2*i+1,2*r+1);}}},ts.prototype.getTile=function(e,t,i){var r=this.options,n=r.extent,s=r.debug;if(e<0||e>24)return null;var o=1<<e,a=is(e,t=(t%o+o)%o,i);if(this.tiles[a])return Yn(this.tiles[a],n);s>1&&console.log("drilling down to z%d-%d-%d",e,t,i);for(var l,u=e,h=t,c=i;!l&&u>0;)u--,h=Math.floor(h/2),c=Math.floor(c/2),l=this.tiles[is(u,h,c)];return l&&l.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,h,c),s>1&&console.time("drilling down"),this.splitTile(l.source,u,h,c,e,t,i),s>1&&console.timeEnd("drilling down"),this.tiles[a]?Yn(this.tiles[a],n):null):null};class rs extends we{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&&m("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]=es(t[e],{maxZoom:this.max_zoom,tolerance:1.5,extent:$.tile_scale,buffer:1e-4});return this.loaded=true,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 i,r=$.wrapTile(e.coords,{x:true}),n=this.tile_indexes[t].getTile(r.z,r.x,r.y);if(n&&n.features){i={type:"FeatureCollection",features:[]};for(let e=0;e<n.features.length;e++){const t=n.features[e];let r={type:"Feature",geometry:{},id:t.id,properties:t.tags};if(1===t.type)r.geometry.coordinates=t.geometry.map((e=>[e[0],e[1]])),r.geometry.type="MultiPoint";else {if(2!==t.type&&3!==t.type)continue;if(r.geometry.coordinates=t.geometry.map((e=>e.map((e=>[e[0],e[1]])))),2===t.type)r.geometry.type="MultiLineString";else if(r.geometry=zn(r.geometry),null==r.geometry)continue}i.features.push(r);}}return i}formatURL(){return this.url}parseSourceData(e,t,i){let r="string"==typeof i?JSON.parse(i):i,n=this.getLayers(r);t.layers=this.preprocessLayers(n,e);}preprocessLayers(e,t){for(let t in e){let i=e[t];i.features=this.preprocessFeatures(i.features);}if("function"==typeof this.transform){const i={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,i):e=this.transform(e,this.extra_data,i);}return e}preprocessFeatures(e){if(e=e.filter((e=>null!=e.geometry)),this.config.generate_label_centroids){let t=[],i={label_placement:true};e.forEach((e=>{let r,n;if("Polygon"===e.geometry.type)r=e.geometry.coordinates,n=ss(r,e.id,e.properties,i),t.push(n);else if("MultiPolygon"===e.geometry.type){r=e.geometry.coordinates;let s=-1/0,o=0;for(let e=0;e<r.length;e++){let t=$.polygonArea(r[e]);t>s&&(s=t,o=e);}n=ss(r[o],e.id,e.properties,i),t.push(n);}})),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 ns extends Ee{constructor(e,t){super(e,t);}parseSourceData(e,t,i){let r="string"==typeof i?JSON.parse(i):i;this.prepareGeoJSON(r,e,t);}prepareGeoJSON(e,t,i){if("function"==typeof this.transform){const i={min:Object.assign({},t.min),max:Object.assign({},t.max),coords:Object.assign({},t.coords)};e=this.transform(e,this.extra_data,i);}i.layers=rs.prototype.getLayers(e);let r={coords:t.coords,min:$.metersForTile($.wrapTile(t.coords,{x:true}))};Ae.projectData(i),Ae.scaleData(i,r);}}function ss(e,t,i,r){let n=$.centroid(e);if(!n)return;let s={};return Object.assign(s,i,r),{type:"Feature",id:t,properties:s,geometry:{type:"Point",coordinates:n}}}function os(e){return e}function as(e,t){var i=t.id,r=t.bbox,n=null==t.properties?{}:t.properties,s=function(e,t){var i=function(e){if(null==(t=e.transform))return os;var t,i,r,n=t.scale[0],s=t.scale[1],o=t.translate[0],a=t.translate[1];return function(e,t){return t||(i=r=0),e[0]=(i+=e[0])*n+o,e[1]=(r+=e[1])*s+a,e}}(e),r=e.arcs;function n(e,t){t.length&&t.pop();for(var n=r[e<0?~e:e],s=0,o=n.length;s<o;++s)t.push(i(n[s].slice(),s));e<0&&function(e,t){for(var i,r=e.length,n=r-t;n<--r;)i=e[n],e[n++]=e[r],e[r]=i;}(t,o);}function s(e){return i(e.slice())}function o(e){for(var t=[],i=0,r=e.length;i<r;++i)n(e[i],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)}function u(e){var t,i=e.type;switch(i){case "GeometryCollection":return {type:i,geometries:e.geometries.map(u)};case "Point":t=s(e.coordinates);break;case "MultiPoint":t=e.coordinates.map(s);break;case "LineString":t=o(e.arcs);break;case "MultiLineString":t=e.arcs.map(o);break;case "Polygon":t=l(e.arcs);break;case "MultiPolygon":t=e.arcs.map(l);break;default:return null}return {type:i,coordinates:t}}return u(t)}(e,t);return null==i&&null==r?{type:"Feature",properties:n,geometry:s}:null==r?{type:"Feature",id:i,properties:n,geometry:s}:{type:"Feature",id:i,bbox:r,properties:n,geometry:s}}Ae.register("GeoJSON",(e=>ns.urlHasTilePattern(e.url)?ns:rs));class ls extends rs{parseSourceData(e,t,i){let r="string"==typeof i?JSON.parse(i):i;r=this.toGeoJSON(r);let n=this.getLayers(r);super.preprocessLayers(n,e),t.layers=n;}toGeoJSON(e){if(e.objects&&1===Object.keys(e.objects).length){let t=Object.keys(e.objects)[0];e=us(e,e.objects[t]);}else {let t={};for(let i in e.objects)t[i]=us(e,e.objects[i]);e=t;}return e}}function us(e,t){let i=function(e,t){return "GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map((function(t){return as(e,t)}))}:as(e,t)}(e,t);return "Feature"===i.type&&(i={type:"FeatureCollection",features:[i]}),i}class hs extends ns{constructor(e,t){super(e,t);}parseSourceData(e,t,i){let r="string"==typeof i?JSON.parse(i):i;r=ls.prototype.toGeoJSON(r),this.prepareGeoJSON(r,e,t);}}Ae.register("TopoJSON",(e=>hs.urlHasTilePattern(e.url)?hs:ls)),e.Collision=Bt,e.DataSource=Ae,e.FeatureSelection=ce,e.FilterOptions=Xr,e.FontManager=ri,e.GLSL=z,e.Geo=$,e.Label=Ct,e.LabelLineStraight=_r,e.LabelPoint=qt,e.Light=xe,e.Material=me,e.OBB=Gt,e.ShaderProgram=G,e.Style=Ne,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(ur)),this.register(Object.create(br)),this.register(Object.create(vr));}init(){G.removeBlock("global"),G.removeBlock("setup"),G.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"),G.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"),G.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"),G.defines.TANGRAM_EPSILON=1e-5,G.defines.TANGRAM_LAYER_DELTA=1/16384,G.defines.TANGRAM_TILE_SCALE=`vec3(${$.tile_scale}., ${$.tile_scale}., u_meters_per_pixel * ${$.tile_size}.)`,G.defines.TANGRAM_HEIGHT_SCALE=$.height_scale,G.defines.TANGRAM_ALPHA_TEST=.5;}destroy(e){Object.keys(this.styles).forEach((t=>{let i=this.styles[t];i.gl===e&&(m("trace",`StyleManager.destroy: destroying render style ${i.name}`),i.base&&this.remove(i.name),i.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]=true)),e)),{})),this.active_styles}getActiveBlendOrders(){return this.active_blend_orders}updateActiveBlendOrders(e){const t=[];e.forEach((e=>{Object.entries(e.meshes).forEach((([e,i])=>{i.forEach((i=>{const r=i.variant.blend_order;let n=t.findIndex((e=>e.blend_order===r));n=n>-1?n:t.push({blend_order:r,styles:[]})-1,-1===t[n].styles.indexOf(e)&&t[n].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 i=[];e.mix&&(Array.isArray(e.mix)?i.push(...e.mix):i.push(e.mix),i=i.map((e=>t[e])).filter((t=>t&&t!==e)),i.forEach((t=>e.mixed[t.name]=true))),i.push(e),e.animated=i.some((e=>e&&e.animated)),e.texcoords=i.some((e=>e&&e.texcoords)),e.base=i.map((e=>e.base)).filter((e=>e)).pop(),e.lighting=i.map((e=>e.lighting)).filter((e=>null!=e)).pop(),e.texture=i.map((e=>e.texture)).filter((e=>e)).pop(),e.raster=i.map((e=>e.raster)).filter((e=>null!=e)).pop(),e.dash=i.map((e=>e.dash)).filter((e=>null!=e)).pop(),e.dash_background_color=i.map((e=>e.dash_background_color)).filter((e=>null!=e)).pop(),i.some((e=>Object.prototype.hasOwnProperty.call(e,"blend")&&e.blend))&&(e.blend=i.map((e=>Object.prototype.hasOwnProperty.call(e,"blend")&&e.blend)).filter((e=>e)).pop()),e.blend_order=i.map((e=>e.blend_order)).filter((e=>null!=e)).pop(),e.defines=Object.assign({},...i.map((e=>e.defines)).filter((e=>e))),e.material=Object.assign({},...i.map((e=>e.material)).filter((e=>e)));let r=i.map((e=>e.draw)).filter((e=>e));return r.length>0&&(e.draw=V({},...r)),this.mixShaders(e,t,i),e}mixShaders(e,t,i){let r={},n=i.map((e=>e.shaders)).filter((e=>e));if(r.defines=Object.assign({},...n.map((e=>e.defines)).filter((e=>e))),r.attributes=Object.assign({},...n.map((e=>e.attributes)).filter((e=>e))),r.uniforms={},r._uniforms=e.shaders&&e.shaders.uniforms||{},r._uniform_scopes={},i.filter((e=>e.shaders&&e.shaders.uniforms)).forEach((e=>{for(let i in e.shaders.uniforms)r._uniform_scopes[i]=e.name,Object.defineProperty(r.uniforms,i,{enumerable:true,configurable:true,get:function(){return void 0!==r._uniforms[i]?r._uniforms[i]:t[r._uniform_scopes[i]].shaders.uniforms!==r.uniforms?t[r._uniform_scopes[i]].shaders.uniforms[i]:void 0},set:function(e){r._uniforms[i]=e;}});})),r.extensions=Object.keys(n.map((e=>e.extensions)).filter((e=>e)).reduce(((e,t)=>("string"==typeof t?e[t]=true:t.forEach((t=>e[t]=true)),e)),{})||{}),e.shaders&&e.shaders.blocks){e.shaders.block_scopes=e.shaders.block_scopes||{};for(let t in e.shaders.blocks){let i=e.shaders.blocks[t];e.shaders.block_scopes[t]=e.shaders.block_scopes[t]||[],Array.isArray(i)?e.shaders.block_scopes[t].push(...i.map((()=>e.name))):e.shaders.block_scopes[t].push(e.name);}}let s={};return n.forEach((e=>{if(!e.blocks)return;r.blocks=r.blocks||{},r.block_scopes=r.block_scopes||{};let t={};for(let i in e.blocks){let n=e.blocks[i],o=e.block_scopes[i];r.blocks[i]=r.blocks[i]||[],r.block_scopes[i]=r.block_scopes[i]||[],n=Array.isArray(n)?n:[n],o=Array.isArray(o)?o:[o];for(let e=0;e<n.length;e++)s[o[e]]||(t[o[e]]=true,r.blocks[i].push(n[e]),r.block_scopes[i].push(o[e]));}Object.assign(s,t);})),Object.assign(e.mixed,s),e.shaders=r,e}create(e,t,i={}){let r=V({},t);return r.name=e,r=this.mix(r,i),r.base&&this.base_styles[r.base]?this.styles[e]=r=Object.assign(Object.create(this.base_styles[r.base]),r):r.base=null,r}build(e){const t=function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Ar(Object(i),true).forEach((function(t){n(e,t,i[t]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Ar(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t));}));}return e}({},e);this.styles&&Object.values(this.styles).forEach((e=>a.removeTarget(e.main_thread_target)));const i=["opaque","add","multiply","overlay","inlay","translucent"],r=["polygons","lines","points","text","raster"];for(const e of i)for(const i of r){const r=e+"_"+i;null==t[r]&&(t[r]={base:i,blend:e});}let s=Object.keys(t).sort(((e,i)=>this.inheritanceDepth(e,t)-this.inheritanceDepth(i,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 i=0;for(;;){let r=t[e];if(!r)break;if(!r.mix)break;if(i++,Array.isArray(r.mix)){i+=Math.max(...r.mix.map((i=>{if(e!==i)return this.inheritanceDepth(i,t)})));break}if(e===r.mix)break;e=r.mix;}return i}},e.StyleParser=Q,e.Task=w,e.TextCanvas=Ai,e.Texture=M,e.Thread=t,e.Tile=en,e.TileID=Re,e.Utils=g,e.Vector=ye,e.VertexArrayObject=j,e.VertexData=De,e.VertexElements=Ie,e.View=class{constructor(e,t){E(this),this.scene=e,this.createMatrices(),this.zoom=null,this.center=null,this.bounds=null,this.meters_per_pixel=null,this.panning=false,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=false,this.size={css:{},device:{},meters:{}},this.aspect=null,this.buffer=0,this.continuous_zoom="boolean"!=typeof t.continuousZoom||t.continuousZoom,this.wrap=false!==t.wrapView,this.preserve_tiles_within_zoom=1,this.reset();}reset(){this.createCamera();}createCamera(){let e=this.getActiveCamera();e&&(this.camera=nr.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=true,t&&this.scene.config.cameras[t]&&delete this.scene.config.cameras[t].active),this.scene.updateConfig({rebuild:false,normalize:false}),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:i}={}){var r=false;return "number"==typeof e&&"number"==typeof t&&(this.center&&e===this.center.lng&&t===this.center.lat||(r=true,this.center={lng:e,lat:t})),"number"==typeof i&&i!==this.zoom&&(r=true,this.setZoom(i)),r&&this.updateBounds(),r}setZoom(e){let t=this.tile_zoom,i=this.baseZoom(e);this.continuous_zoom||(e=i),i!==t&&(this.zoom_direction=i>t?1:-1),this.zoom=e,this.tile_zoom=i,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=$.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=$.latLngToMeters([this.center.lng,this.center.lat]);this.center.meters={x:e[0],y:e[1]},this.center.tile=$.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=$.tileForMeters([this.bounds.sw.x,this.bounds.sw.y],e),i=$.tileForMeters([this.bounds.ne.x,this.bounds.ne.y],e),r=[t.x-this.buffer,i.x+this.buffer,i.y-this.buffer,t.y+this.buffer];if(false===this.wrap){let t=(1<<e)-1;r=r.map((e=>Math.min(Math.max(0,e),t)));}let n=[];for(let t=r[0];t<=r[1];t++)for(let i=r[2];i<=r[3];i++)n.push(Re.coord({x:t,y:i,z:e}));return n}pruneTilesForView(){this.ready()&&this.scene.tile_manager.removeTiles((e=>{if(e.visible||e.isProxy())return false;if(e.loading&&e.style_z!==this.tile_zoom)return true;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 true;const t=this.meters_per_pixel*$.tile_size,i=Re.coordAtZoom($.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),r=Re.coordAtZoom($.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<i.x||e.coords.x>r.x||e.coords.y<i.y||e.coords.y>r.y)&&(m("trace",`View: remove tile ${e.key} (as ${e.coords.key}) for being too far out of visible area (${i.key}, ${r.key})`),true)}));}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=n,e.addBaseURL=function(e,t){if(!e||!v(e))return e;var i,r="/"!==e[0];if(t?(i=document.createElement("a")).href=t:i=window.location,r){e=b(i.href)+e;}else {let t=i.origin;t||(t=i.protocol+"//"+i.host),e=t+e;}return e},e.buildFilter=Ur,e.cache=H,e.clearFunctionStringCache=function(){H.functions={},H.num_functions=0,H.num_cached=0;},e.compileFunctionStrings=W,e.createObjectURL=function(e){return void 0===A&&(A=window.URL&&window.URL.createObjectURL||window.webkitURL&&window.webkitURL.createObjectURL,"function"!=typeof A&&(A=null,m("warn","window.URL.createObjectURL (or vendor prefix) not found, unable to create local blob URLs"))),A?A(e):e},e.debugSettings=x,e.debugSumLayerStats=function(e){let t={},i={};return e.filter((e=>e.debug.layers)).forEach((e=>{Object.keys(e.debug.layers.list).forEach((i=>{let r=e.debug.layers.list[i];ke(t,i,r.features,r.geoms,r.styles,r.base);})),tn(e.debug.layers.tree,i);})),{list:t,tree:i}},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 i=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};i.prototype=t.prototype;}else i={};return Object.defineProperty(i,"__esModule",{value:true}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(i,t,r.get?r:{enumerable:true,get:function(){return e[t]}});})),i},e.getDefaultExportFromCjs=k,e.isLocalURL=function(e){if("string"==typeof e)return e.search(/^(data|blob):/)>-1},e.isRelativeURL=v,e.isReserved=Hr,e.layerCache=function(){return Cr},e.log=m,e.mergeDebugSettings=function(e){Object.assign(y,e);},e.mergeObjects=V,e.parseLayers=function(e,t){Cr={};let i={};for(let r in e){let n=e[r];n&&(i[r]=Wr(r,n,null,t));}return i},e.pathForURL=b,e.sliceObject=R,e.subscribeMixin=E,e.version=o;}));
|
|
32
|
+
|
|
33
|
+
define(["./shared"],(function(e){const t=Object.assign(self,{FeatureSelection:e.FeatureSelection,sources:{},styles:{},layers:{},tiles:{},init(t,r,i,s,o,l,n){return this.scene_id=t,this._worker_id=r,this.num_workers=i,e.log.setLevel(s),e.Utils.device_pixel_ratio=o,e.VertexElements.setElementIndexUint(l),e.FeatureSelection.setPrefix(this._worker_id),this.style_manager=new e.StyleManager,this.importExternalScripts(n),e.Label.id_prefix=r,e.Label.id_multiplier=i,r},importExternalScripts(t){if(0===t.length)return;e.log("debug","loading custom data source scripts in worker:",t);let r=Object.getOwnPropertyNames(window);importScripts(...t),Object.getOwnPropertyNames(window).forEach((e=>{ -1===r.indexOf(e)&&(this[e]=window[e]);}));},updateConfig({config:t,generation:r,introspection:i},s){return t=JSON.parse(t),e.mergeDebugSettings(s),this.generation=r,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 r=this.sources,i=[];this.sources={};for(let s in t.sources){if(JSON.stringify(this.last_config_sources[s])===JSON.stringify(t.sources[s])){this.sources[s]=r[s];continue}let o;t.sources[s]=e.compileFunctionStrings(t.sources[s]);try{o=e.DataSource.create(Object.assign({},t.sources[s],{name:s}),this.sources);}catch(e){continue}o&&(this.sources[s]=o,i.push(s));}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)||true!==this.getTile(t.key).loading)return t=this.tiles[t.key]=Object.assign(this.getTile(t.key)||{},t),this.awaitConfiguration().then((()=>{if(true!==t.loaded)t.loading=true,t.loaded=false,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=false,t.loaded=true,e.Tile.buildGeometry(t,this)):e.log("trace",`stop tile build after data source load because tile was removed: ${t.key}`);})).catch((r=>{t.loading=false,t.loaded=false,t.error=r.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(r){t.error=r.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 r in this.tiles){const i=this.tiles[r];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 r=this.tiles[t];null!=r&&(true===r.loading&&(e.log("trace",`cancel tile load for ${t}`),r.loading=false,e.Tile.cancel(r)),e.FeatureSelection.clearTile(t),delete this.tiles[t],e.log("trace",`remove tile from cache for ${t}`));},queryFeatures({filter:t,visible:r,geometry:i,tile_keys:s}){let o=[],l=s.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),l.forEach((s=>{for(let l in s.source_data.layers){let n=s.source_data.layers[l];if(null==n)return;n.features.forEach((n=>{const a=n.generation===this.generation;if(true===r&&!a||false===r&&a)return;let c=e.StyleParser.getFeatureParseContext(n,s,this.global);if(c.source=s.source,c.layer=l,c.id=n.id,!t(c))return;let u={type:n.type,id:n.id,properties:Object.assign({},n.properties,{$source:c.source,$layer:c.layer,$geometry:c.geometry,$visible:a})};true===i&&(u.geometry=e.Geo.copyGeometry(n.geometry),e.Geo.tileSpaceToLatlng(u.geometry,s.coords.z,s.min)),o.push(u);}));}})),o},getFeatureSelection({id:t,key:r}={}){var i=e.FeatureSelection.map[r];return {id:t,feature:i&&i.feature}},resetFeatureSelection(t=null){e.FeatureSelection.reset(t);},getFeatureSelectionMapSize:()=>e.FeatureSelection.getMapSize(),syncTextures(t){let r=[];return t&&r.push(...Object.keys(t)),e.log("trace","sync textures to worker:",r),r.length>0?e.Texture.syncTexturesToWorker(r):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);}));
|
|
34
|
+
|
|
35
|
+
define(["./shared"],(function(e){var t,r=t={};let i=0;function n(e,t){var r;const i=t[t.length-1];return null===(r=o(e,t))||void 0===r?void 0:r[i]}function s(e,t,r){const i=t[t.length-1],n=o(e,t);n&&(n[i]=r);}function o(e,t){if(0===t.length)return;let r=e;for(let e=0;e<t.length-1;e++){if(r=r[t[e]],null==r)return}return r}t.getContext=function(e,r){var n=false;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),n=true),e.addEventListener("webglcontextlost",(()=>{})),e.addEventListener("webglcontextrestored",(()=>{}));var s=e.getContext("webgl",r)||e.getContext("experimental-webgl",r);if(!s)throw new Error("Couldn't create WebGL context.");return s._tangram_id=i++,n?(t.resize(s,window.innerWidth,window.innerHeight,r.device_pixel_ratio),window.addEventListener("resize",(function(){t.resize(s,window.innerWidth,window.innerHeight,r.device_pixel_ratio);}))):t.resize(s,parseFloat(e.style.width),parseFloat(e.style.height),r.device_pixel_ratio),s},t.resize=function(e,t,r,i){i=i||window.devicePixelRatio||1,e.canvas.style.width=t+"px",e.canvas.style.height=r+"px",e.canvas.width=Math.round(t*i),e.canvas.height=Math.round(r*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 h(e,t){var r;const i=Array.isArray(t)?t:[t],n=o(e,i),s=i[i.length-1];return void 0!==(null==n||null===(r=n[l])||void 0===r?void 0:r[s])}function c(e,t=null,r={}){t=t?t+".":a;for(const i in e){const n=t+i,s=e[i];r[n]=s,"object"!=typeof s||Array.isArray(s)||c(s,n,r);}return r}function f(t,r,i,n){var s;let o;if(null!=i&&null!==(s=i[l])&&void 0!==s&&s[n]?o=i[l][n]:"string"==typeof r&&r.slice(0,7)===a&&(o=r),o){null==i[l]&&Object.defineProperty(i,l,{value:{}}),i[l][n]=o;let r,s=t[o];for(;"string"==typeof s&&s.slice(0,7)===a;){if(r=r||[o],r.indexOf(s)>-1){e.log({level:"warn",once:true},"Global properties: cyclical reference detected",r),s=null;break}r.push(s),s=t[s];}Object.defineProperty(i,n,{enumerable:true,get:function(){return s},set:function(e){delete i[l][n],delete i[n],i[n]=e;}});}else if(Array.isArray(r))for(let e=0;e<r.length;e++)f(t,r[e],r,e);else if("object"==typeof r)for(const e in r)f(t,r[e],r,e);return r}var d="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},p=[],g=[],m="undefined"!=typeof Uint8Array?Uint8Array:Array,_=false;function y(){_=true;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)p[t]=e[t],g[e.charCodeAt(t)]=t;g["-".charCodeAt(0)]=62,g["_".charCodeAt(0)]=63;}function b(e,t,r){for(var i,n,s=[],o=t;o<r;o+=3)i=(e[o]<<16)+(e[o+1]<<8)+e[o+2],s.push(p[(n=i)>>18&63]+p[n>>12&63]+p[n>>6&63]+p[63&n]);return s.join("")}function v(e){var t;_||y();for(var r=e.length,i=r%3,n="",s=[],o=16383,a=0,l=r-i;a<l;a+=o)s.push(b(e,a,a+o>l?l:a+o));return 1===i?(t=e[r-1],n+=p[t>>2],n+=p[t<<4&63],n+="=="):2===i&&(t=(e[r-2]<<8)+e[r-1],n+=p[t>>10],n+=p[t>>4&63],n+=p[t<<2&63],n+="="),s.push(n),s.join("")}function w(e,t,r,i,n){var s,o,a=8*n-i-1,l=(1<<a)-1,u=l>>1,h=-7,c=r?n-1:0,f=r?-1:1,d=e[t+c];for(c+=f,s=d&(1<<-h)-1,d>>=-h,h+=a;h>0;s=256*s+e[t+c],c+=f,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=i;h>0;o=256*o+e[t+c],c+=f,h-=8);if(0===s)s=1-u;else {if(s===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,i),s-=u;}return (d?-1:1)*o*Math.pow(2,s-i)}function k(e,t,r,i,n,s){var o,a,l,u=8*s-n-1,h=(1<<u)-1,c=h>>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:s-1,p=i?1:-1,g=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=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+c>=1?f/l:f*Math.pow(2,1-c))*l>=2&&(o++,l/=2),o+c>=h?(a=0,o=h):o+c>=1?(a=(t*l-1)*Math.pow(2,n),o+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;e[r+d]=255&a,d+=p,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;e[r+d]=255&o,d+=p,o/=256,u-=8);e[r+d-p]|=128*g;}var x={}.toString,S=Array.isArray||function(e){return "[object Array]"==x.call(e)};T.TYPED_ARRAY_SUPPORT=void 0===d.TYPED_ARRAY_SUPPORT||d.TYPED_ARRAY_SUPPORT;var A=E();function E(){return T.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function C(e,t){if(E()<t)throw new RangeError("Invalid typed array length");return T.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=T.prototype:(null===e&&(e=new T(t)),e.length=t),e}function T(e,t,r){if(!(T.TYPED_ARRAY_SUPPORT||this instanceof T))return new T(e,t,r);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 z(this,e,t,r)}function z(e,t,r,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,r,i){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===i?new Uint8Array(t):void 0===i?new Uint8Array(t,r):new Uint8Array(t,r,i);T.TYPED_ARRAY_SUPPORT?(e=t).__proto__=T.prototype:e=I(e,t);return e}(e,t,r,i):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!T.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=0|L(t,r);e=C(e,i);var n=e.write(t,r);n!==i&&(e=e.slice(0,n));return e}(e,t,r):function(e,t){if(B(t)){var r=0|F(t.length);return 0===(e=C(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return "number"!=typeof t.length||(i=t.length)!=i?C(e,0):I(e,t);if("Buffer"===t.type&&S(t.data))return I(e,t.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function O(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(O(t),e=C(e,t<0?0:0|F(t)),!T.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function I(e,t){var r=t.length<0?0:0|F(t.length);e=C(e,r);for(var i=0;i<r;i+=1)e[i]=255&t[i];return e}function F(e){if(e>=E())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+E().toString(16)+" bytes");return 0|e}function B(e){return !(null==e||!e._isBuffer)}function L(e,t){if(B(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 r=e.length;if(0===r)return 0;for(var i=false;;)switch(t){case "ascii":case "latin1":case "binary":return r;case "utf8":case "utf-8":case void 0:return le(e).length;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return 2*r;case "hex":return r>>>1;case "base64":return ue(e).length;default:if(i)return le(e).length;t=(""+t).toLowerCase(),i=true;}}function P(e,t,r){var i=false;if((void 0===t||t<0)&&(t=0),t>this.length)return "";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return "";if((r>>>=0)<=(t>>>=0))return "";for(e||(e="utf8");;)switch(e){case "hex":return J(this,t,r);case "utf8":case "utf-8":return G(this,t,r);case "ascii":return $(this,t,r);case "latin1":case "binary":return K(this,t,r);case "base64":return V(this,t,r);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return X(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=true;}}function D(e,t,r){var i=e[t];e[t]=e[r],e[r]=i;}function U(e,t,r,i,n){if(0===e.length)return -1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return -1;r=e.length-1;}else if(r<0){if(!n)return -1;r=0;}if("string"==typeof t&&(t=T.from(t,i)),B(t))return 0===t.length?-1:N(e,t,r,i,n);if("number"==typeof t)return t&=255,T.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):N(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function N(e,t,r,i,n){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,r/=2;}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(n){var h=-1;for(s=r;s<a;s++)if(u(e,s)===u(t,-1===h?0:s-h)){if(-1===h&&(h=s),s-h+1===l)return h*o}else -1!==h&&(s-=s-h),h=-1;}else for(r+l>a&&(r=a-l),s=r;s>=0;s--){for(var c=true,f=0;f<l;f++)if(u(e,s+f)!==u(t,f)){c=false;break}if(c)return s}return -1}function j(e,t,r,i){r=Number(r)||0;var n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;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[r+o]=a;}return o}function M(e,t,r,i){return he(le(t,e.length-r),e,r,i)}function Z(e,t,r,i){return he(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,i)}function W(e,t,r,i){return Z(e,t,r,i)}function Y(e,t,r,i){return he(ue(t),e,r,i)}function q(e,t,r,i){return he(function(e,t){for(var r,i,n,s=[],o=0;o<e.length&&!((t-=2)<0);++o)i=(r=e.charCodeAt(o))>>8,n=r%256,s.push(n),s.push(i);return s}(t,e.length-r),e,r,i)}function V(e,t,r){return 0===t&&r===e.length?v(e):v(e.slice(t,r))}function G(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n<r;){var s,o,a,l,u=e[n],h=null,c=u>239?4:u>223?3:u>191?2:1;if(n+c<=r)switch(c){case 1:u<128&&(h=u);break;case 2:128==(192&(s=e[n+1]))&&(l=(31&u)<<6|63&s)>127&&(h=l);break;case 3:s=e[n+1],o=e[n+2],128==(192&s)&&128==(192&o)&&(l=(15&u)<<12|(63&s)<<6|63&o)>2047&&(l<55296||l>57343)&&(h=l);break;case 4:s=e[n+1],o=e[n+2],a=e[n+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&&(h=l);}null===h?(h=65533,c=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h),n+=c;}return function(e){var t=e.length;if(t<=H)return String.fromCharCode.apply(String,e);var r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=H));return r}(i)}T.poolSize=8192,T._augment=function(e){return e.__proto__=T.prototype,e},T.from=function(e,t,r){return z(null,e,t,r)},T.TYPED_ARRAY_SUPPORT&&(T.prototype.__proto__=Uint8Array.prototype,T.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&T[Symbol.species]),T.alloc=function(e,t,r){return function(e,t,r,i){return O(t),t<=0?C(e,t):void 0!==r?"string"==typeof i?C(e,t).fill(r,i):C(e,t).fill(r):C(e,t)}(null,e,t,r)},T.allocUnsafe=function(e){return R(null,e)},T.allocUnsafeSlow=function(e){return R(null,e)},T.isBuffer=ce,T.compare=function(e,t){if(!B(e)||!B(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,i=t.length,n=0,s=Math.min(r,i);n<s;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0},T.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 true;default:return false}},T.concat=function(e,t){if(!S(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return T.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var i=T.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){var s=e[r];if(!B(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,n),n+=s.length;}return i},T.byteLength=L,T.prototype._isBuffer=true,T.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)D(this,t,t+1);return this},T.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)D(this,t,t+3),D(this,t+1,t+2);return this},T.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)D(this,t,t+7),D(this,t+1,t+6),D(this,t+2,t+5),D(this,t+3,t+4);return this},T.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?G(this,0,e):P.apply(this,arguments)},T.prototype.equals=function(e){if(!B(e))throw new TypeError("Argument must be a Buffer");return this===e||0===T.compare(this,e)},T.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+">"},T.prototype.compare=function(e,t,r,i,n){if(!B(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return -1;if(t>=r)return 1;if(this===e)return 0;for(var s=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(t>>>=0),a=Math.min(s,o),l=this.slice(i,n),u=e.slice(t,r),h=0;h<a;++h)if(l[h]!==u[h]){s=l[h],o=u[h];break}return s<o?-1:o<s?1:0},T.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},T.prototype.indexOf=function(e,t,r){return U(this,e,t,r,true)},T.prototype.lastIndexOf=function(e,t,r){return U(this,e,t,r,false)},T.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else {if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===i&&(i="utf8")):(i=r,r=void 0);}var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=false;;)switch(i){case "hex":return j(this,e,t,r);case "utf8":case "utf-8":return M(this,e,t,r);case "ascii":return Z(this,e,t,r);case "latin1":case "binary":return W(this,e,t,r);case "base64":return Y(this,e,t,r);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return q(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=true;}},T.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var H=4096;function $(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(127&e[n]);return i}function K(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function J(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var n="",s=t;s<r;++s)n+=ae(e[s]);return n}function X(e,t,r){for(var i=e.slice(t,r),n="",s=0;s<i.length;s+=2)n+=String.fromCharCode(i[s]+256*i[s+1]);return n}function Q(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function ee(e,t,r,i,n,s){if(!B(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<s)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}function te(e,t,r,i){t<0&&(t=65535+t+1);for(var n=0,s=Math.min(e.length-r,2);n<s;++n)e[r+n]=(t&255<<8*(i?n:1-n))>>>8*(i?n:1-n);}function re(e,t,r,i){t<0&&(t=4294967295+t+1);for(var n=0,s=Math.min(e.length-r,4);n<s;++n)e[r+n]=t>>>8*(i?n:3-n)&255;}function ie(e,t,r,i,n,s){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function ne(e,t,r,i,n){return n||ie(e,0,r,4),k(e,t,r,i,23,4),r+4}function se(e,t,r,i,n){return n||ie(e,0,r,8),k(e,t,r,i,52,8),r+8}T.prototype.slice=function(e,t){var r,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),T.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=T.prototype;else {var n=t-e;r=new T(n,void 0);for(var s=0;s<n;++s)r[s]=this[s+e];}return r},T.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||Q(e,t,this.length);for(var i=this[e],n=1,s=0;++s<t&&(n*=256);)i+=this[e+s]*n;return i},T.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||Q(e,t,this.length);for(var i=this[e+--t],n=1;t>0&&(n*=256);)i+=this[e+--t]*n;return i},T.prototype.readUInt8=function(e,t){return t||Q(e,1,this.length),this[e]},T.prototype.readUInt16LE=function(e,t){return t||Q(e,2,this.length),this[e]|this[e+1]<<8},T.prototype.readUInt16BE=function(e,t){return t||Q(e,2,this.length),this[e]<<8|this[e+1]},T.prototype.readUInt32LE=function(e,t){return t||Q(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},T.prototype.readUInt32BE=function(e,t){return t||Q(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},T.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Q(e,t,this.length);for(var i=this[e],n=1,s=0;++s<t&&(n*=256);)i+=this[e+s]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*t)),i},T.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Q(e,t,this.length);for(var i=t,n=1,s=this[e+--i];i>0&&(n*=256);)s+=this[e+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*t)),s},T.prototype.readInt8=function(e,t){return t||Q(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},T.prototype.readInt16LE=function(e,t){t||Q(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},T.prototype.readInt16BE=function(e,t){t||Q(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},T.prototype.readInt32LE=function(e,t){return t||Q(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},T.prototype.readInt32BE=function(e,t){return t||Q(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},T.prototype.readFloatLE=function(e,t){return t||Q(e,4,this.length),w(this,e,true,23,4)},T.prototype.readFloatBE=function(e,t){return t||Q(e,4,this.length),w(this,e,false,23,4)},T.prototype.readDoubleLE=function(e,t){return t||Q(e,8,this.length),w(this,e,true,52,8)},T.prototype.readDoubleBE=function(e,t){return t||Q(e,8,this.length),w(this,e,false,52,8)},T.prototype.writeUIntLE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||ee(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,s=0;for(this[t]=255&e;++s<r&&(n*=256);)this[t+s]=e/n&255;return t+r},T.prototype.writeUIntBE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||ee(this,e,t,r,Math.pow(2,8*r)-1,0);var n=r-1,s=1;for(this[t+n]=255&e;--n>=0&&(s*=256);)this[t+n]=e/s&255;return t+r},T.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,1,255,0),T.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},T.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,2,65535,0),T.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):te(this,e,t,true),t+2},T.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,2,65535,0),T.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):te(this,e,t,false),t+2},T.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,4,4294967295,0),T.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):re(this,e,t,true),t+4},T.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,4,4294967295,0),T.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):re(this,e,t,false),t+4},T.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);ee(this,e,t,r,n-1,-n);}var s=0,o=1,a=0;for(this[t]=255&e;++s<r&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+r},T.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);ee(this,e,t,r,n-1,-n);}var s=r-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+r},T.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,1,127,-128),T.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},T.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,2,32767,-32768),T.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):te(this,e,t,true),t+2},T.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,2,32767,-32768),T.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):te(this,e,t,false),t+2},T.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,4,2147483647,-2147483648),T.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):re(this,e,t,true),t+4},T.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||ee(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),T.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):re(this,e,t,false),t+4},T.prototype.writeFloatLE=function(e,t,r){return ne(this,e,t,true,r)},T.prototype.writeFloatBE=function(e,t,r){return ne(this,e,t,false,r)},T.prototype.writeDoubleLE=function(e,t,r){return se(this,e,t,true,r)},T.prototype.writeDoubleBE=function(e,t,r){return se(this,e,t,false,r)},T.prototype.copy=function(e,t,r,i){if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=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-r&&(i=e.length-t+r);var n,s=i-r;if(this===e&&r<t&&t<i)for(n=s-1;n>=0;--n)e[n+t]=this[n+r];else if(s<1e3||!T.TYPED_ARRAY_SUPPORT)for(n=0;n<s;++n)e[n+t]=this[n+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+s),t);return s},T.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===e.length){var n=e.charCodeAt(0);n<256&&(e=n);}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!T.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else "number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var s;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s<r;++s)this[s]=e;else {var o=B(e)?e:le(new T(e,i).toString()),a=o.length;for(s=0;s<r-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 r;t=t||1/0;for(var i=e.length,n=null,s=[],o=0;o<i;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320);}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;s.push(r);}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128);}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128);}else {if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128);}}return s}function ue(e){return function(e){var t,r,i,n,s,o;_||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 m(3*a/4-s),i=s>0?a-4:a;var l=0;for(t=0,r=0;t<i;t+=4,r+=3)n=g[e.charCodeAt(t)]<<18|g[e.charCodeAt(t+1)]<<12|g[e.charCodeAt(t+2)]<<6|g[e.charCodeAt(t+3)],o[l++]=n>>16&255,o[l++]=n>>8&255,o[l++]=255&n;return 2===s?(n=g[e.charCodeAt(t)]<<2|g[e.charCodeAt(t+1)]>>4,o[l++]=255&n):1===s&&(n=g[e.charCodeAt(t)]<<10|g[e.charCodeAt(t+1)]<<4|g[e.charCodeAt(t+2)]>>2,o[l++]=n>>8&255,o[l++]=255&n),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 he(e,t,r,i){for(var n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function ce(e){return null!=e&&(!!e._isBuffer||fe(e)||function(e){return "function"==typeof e.readFloatLE&&"function"==typeof e.slice&&fe(e.slice(0,0))}(e))}function fe(e){return !!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var de=Object.freeze({__proto__:null,Buffer:T,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return +e!=e&&(e=0),T.alloc(+e)},isBuffer:ce,kMaxLength:A});function pe(){throw new Error("setTimeout has not been defined")}function ge(){throw new Error("clearTimeout has not been defined")}var me=pe,_e=ge;function ye(e){if(me===setTimeout)return setTimeout(e,0);if((me===pe||!me)&&setTimeout)return me=setTimeout,setTimeout(e,0);try{return me(e,0)}catch(t){try{return me.call(null,e,0)}catch(t){return me.call(this,e,0)}}}"function"==typeof d.setTimeout&&(me=setTimeout),"function"==typeof d.clearTimeout&&(_e=clearTimeout);var be,ve=[],we=false,ke=-1;function xe(){we&&be&&(we=false,be.length?ve=be.concat(ve):ke=-1,ve.length&&Se());}function Se(){if(!we){var e=ye(xe);we=true;for(var t=ve.length;t;){for(be=ve,ve=[];++ke<t;)be&&be[ke].run();ke=-1,t=ve.length;}be=null,we=false,function(e){if(_e===clearTimeout)return clearTimeout(e);if((_e===ge||!_e)&&clearTimeout)return _e=clearTimeout,clearTimeout(e);try{return _e(e)}catch(t){try{return _e.call(null,e)}catch(t){return _e.call(this,e)}}}(e);}}function Ae(e,t){this.fun=e,this.array=t;}Ae.prototype.run=function(){this.fun.apply(null,this.array);};var Ee=d.performance||{};function Ce(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.')}Ee.now||Ee.mozNow||Ee.msNow||Ee.oNow||Ee.webkitNow;var Te,ze={exports:{}};var Oe,Re,Ie,Fe,Be,Le,Pe,De,Ue,Ne,je,Me,Ze,We,Ye,qe,Ve,Ge,He,$e,Ke,Je,Xe,Qe,et,tt,rt,it,nt,st,ot,at,lt,ut=(Te||(Te=1,ze.exports=function e(t,r,i){function n(o,a){if(!r[o]){if(!t[o]){if(!a&&Ce)return Ce(o);if(s)return s(o,true);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[o]={exports:{}};t[o][0].call(u.exports,(function(e){return n(t[o][1][e]||e)}),u,u.exports,e,t,r,i);}return r[o].exports}for(var s=Ce,o=0;o<i.length;o++)n(i[o]);return n}({1:[function(e,t,r){var i=e("./utils"),n=e("./support"),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(e){for(var t,r,n,o,a,l,u,h=[],c=0,f=e.length,d=f,p="string"!==i.getTypeOf(e);c<e.length;)d=f-c,n=p?(t=e[c++],r=c<f?e[c++]:0,c<f?e[c++]:0):(t=e.charCodeAt(c++),r=c<f?e.charCodeAt(c++):0,c<f?e.charCodeAt(c++):0),o=t>>2,a=(3&t)<<4|r>>4,l=1<d?(15&r)<<2|n>>6:64,u=2<d?63&n:64,h.push(s.charAt(o)+s.charAt(a)+s.charAt(l)+s.charAt(u));return h.join("")},r.decode=function(e){var t,r,i,o,a,l,u=0,h=0,c="data:";if(e.substr(0,c.length)===c)throw new Error("Invalid base64 input, it looks like a data url.");var f,d=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===s.charAt(64)&&d--,e.charAt(e.length-2)===s.charAt(64)&&d--,d%1!=0)throw new Error("Invalid base64 input, bad content length.");for(f=n.uint8array?new Uint8Array(0|d):new Array(0|d);u<e.length;)t=s.indexOf(e.charAt(u++))<<2|(o=s.indexOf(e.charAt(u++)))>>4,r=(15&o)<<4|(a=s.indexOf(e.charAt(u++)))>>2,i=(3&a)<<6|(l=s.indexOf(e.charAt(u++))),f[h++]=t,64!==a&&(f[h++]=r),64!==l&&(f[h++]=i);return f};},{"./support":30,"./utils":32}],2:[function(e,t,r){var i=e("./external"),n=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,r,i,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=i,this.compressedContent=n;}a.prototype={getContentWorker:function(){var e=new n(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 n(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,r){return e.pipe(new s).pipe(new o("uncompressedSize")).pipe(t.compressWorker(r)).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,r){var i=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},r.DEFLATE=e("./flate");},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){var i=e("./utils"),n=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e;}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==i.getTypeOf(e)?function(e,t,r,i){var s=n,o=i+r;e^=-1;for(var a=i;a<o;a++)e=e>>>8^s[255&(e^t[a])];return ~e}(0|t,e,e.length,0):function(e,t,r,i){var s=n,o=i+r;e^=-1;for(var a=i;a<o;a++)e=e>>>8^s[255&(e^t.charCodeAt(a))];return ~e}(0|t,e,e.length,0):0};},{"./utils":32}],5:[function(e,t,r){r.base64=false,r.binary=false,r.dir=false,r.createFolders=true,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null;},{}],6:[function(e,t,r){var i=null;i="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:i};},{lie:37}],7:[function(e,t,r){var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=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={};}r.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),false);},l.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],true);},l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null;},l.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:true,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta});};},r.compressWorker=function(e){return new l("Deflate",e)},r.uncompressWorker=function(){return new l("Inflate",{})};},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){function i(e,t){var r,i="";for(r=0;r<t;r++)i+=String.fromCharCode(255&e),e>>>=8;return i}function n(e,t,r,n,o,h){var c,f,d=e.file,p=e.compression,g=h!==a.utf8encode,m=s.transformTo("string",h(d.name)),_=s.transformTo("string",a.utf8encode(d.name)),y=d.comment,b=s.transformTo("string",h(y)),v=s.transformTo("string",a.utf8encode(y)),w=_.length!==d.name.length,k=v.length!==y.length,x="",S="",A="",E=d.dir,C=d.date,T={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(T.crc32=e.crc32,T.compressedSize=e.compressedSize,T.uncompressedSize=e.uncompressedSize);var z=0;t&&(z|=8),g||!w&&!k||(z|=2048);var O=0,R=0;E&&(O|=16),"UNIX"===o?(R=798,O|=function(e,t){var r=e;return e||(r=t?16893:33204),(65535&r)<<16}(d.unixPermissions,E)):(R=20,O|=function(e){return 63&(e||0)}(d.dosPermissions)),c=C.getUTCHours(),c<<=6,c|=C.getUTCMinutes(),c<<=5,c|=C.getUTCSeconds()/2,f=C.getUTCFullYear()-1980,f<<=4,f|=C.getUTCMonth()+1,f<<=5,f|=C.getUTCDate(),w&&(S=i(1,1)+i(l(m),4)+_,x+="up"+i(S.length,2)+S),k&&(A=i(1,1)+i(l(b),4)+v,x+="uc"+i(A.length,2)+A);var I="";return I+="\n\0",I+=i(z,2),I+=p.magic,I+=i(c,2),I+=i(f,2),I+=i(T.crc32,4),I+=i(T.compressedSize,4),I+=i(T.uncompressedSize,4),I+=i(m.length,2),I+=i(x.length,2),{fileRecord:u.LOCAL_FILE_HEADER+I+m+x,dirRecord:u.CENTRAL_FILE_HEADER+i(R,2)+I+i(b.length,2)+"\0\0\0\0"+i(O,4)+i(n,4)+m+x+b}}var s=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),l=e("../crc32"),u=e("../signature");function h(e,t,r,i){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=i,this.streamFiles=e,this.accumulate=false,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[];}s.inherits(h,o),h.prototype.push=function(e){var t=e.meta.percent||0,r=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:r?(t+100*(r-i-1))/r:100}}));},h.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=n(e,t,false,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}});}else this.accumulate=true;},h.prototype.closedSource=function(e){this.accumulate=false;var t=this.streamFiles&&!e.file.dir,r=n(e,t,true,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.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:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null;},h.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 r=this.bytesWritten-e,n=function(e,t,r,n,o){var a=s.transformTo("string",o(n));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(e,2)+i(e,2)+i(t,4)+i(r,4)+i(a.length,2)+a}(this.dirRecords.length,r,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}});},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume();},h.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},h.prototype.resume=function(){return !!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),true):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),true))},h.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return false;for(var r=0;r<t.length;r++)try{t[r].error(e);}catch(e){}return true},h.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock();},t.exports=h;},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,r){var i=e("../compressions"),n=e("./ZipFileWorker");r.generateWorker=function(e,t,r){var s=new n(t.streamFiles,r,t.platform,t.encodeFileName),o=0;try{e.forEach((function(e,r){o++;var n=function(e,t){var r=e||t,n=i[r];if(!n)throw new Error(r+" is not a valid compression method !");return n}(r.options.compression,t.compression),a=r.options.compressionOptions||t.compressionOptions||{},l=r.dir,u=r.date;r._compressWorker(n,a).withStreamInfo("file",{name:e,dir:l,date:u,comment:r.comment||"",unixPermissions:r.unixPermissions,dosPermissions:r.dosPermissions}).pipe(s);})),s.entriesCount=o;}catch(e){s.error(e);}return s};},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,r){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,r){var i=e("./utils"),n=e("./external"),s=e("./utf8"),o=e("./zipEntries"),a=e("./stream/Crc32Probe"),l=e("./nodejsUtils");function u(e){return new n.Promise((function(t,r){var i=e.decompressed.getContentWorker().pipe(new a);i.on("error",(function(e){r(e);})).on("end",(function(){i.streamInfo.crc32!==e.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):t();})).resume();}))}t.exports=function(e,t){var r=this;return t=i.extend(t||{},{base64:false,checkCRC32:false,optimizedBinaryString:false,createFolders:false,decodeFileName:s.utf8decode}),l.isNode&&l.isStream(e)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",e,true,t.optimizedBinaryString,t.base64).then((function(e){var r=new o(t);return r.load(e),r})).then((function(e){var r=[n.Promise.resolve(e)],i=e.files;if(t.checkCRC32)for(var s=0;s<i.length;s++)r.push(u(i[s]));return n.Promise.all(r)})).then((function(e){for(var n=e.shift(),s=n.files,o=0;o<s.length;o++){var a=s[o],l=a.fileNameStr,u=i.resolve(a.fileNameStr);r.file(u,a.decompressed,{binary:true,optimizedBinaryString:true,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders}),a.dir||(r.file(u).unsafeOriginalName=l);}return n.zipComment.length&&(r.comment=n.zipComment),r}))};},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,r){var i=e("../utils"),n=e("../stream/GenericWorker");function s(e,t){n.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=false,this._bindStream(t);}i.inherits(s,n),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=true:t.end();}));},s.prototype.pause=function(){return !!n.prototype.pause.call(this)&&(this._stream.pause(),true)},s.prototype.resume=function(){return !!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),true)},t.exports=s;},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,r){var i=e("readable-stream").Readable;function n(e,t,r){i.call(this,t),this._helper=e;var n=this;e.on("data",(function(e,t){n.push(e)||n._helper.pause(),r&&r(t);})).on("error",(function(e){n.emit("error",e);})).on("end",(function(){n.push(null);}));}e("../utils").inherits(n,i),n.prototype._read=function(){this._helper.resume();},t.exports=n;},{"../utils":32,"readable-stream":16}],14:[function(e,t,r){t.exports={isNode:void 0!==T,newBufferFrom:function(e,t){if(T.from&&T.from!==Uint8Array.from)return T.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new T(e,t)},allocBuffer:function(e){if(T.alloc)return T.alloc(e);var t=new T(e);return t.fill(0),t},isBuffer:function(e){return ce(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}};},{}],15:[function(e,t,r){function i(e,t,r){var i,n=s.getTypeOf(t),a=s.extend(r||{},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=true),a.dosPermissions&&16&a.dosPermissions&&(a.dir=true),a.dir&&(e=g(e)),a.createFolders&&(i=p(e))&&m.call(this,i,true);var c="string"===n&&false===a.binary&&false===a.base64;r&&void 0!==r.binary||(a.binary=!c),(t instanceof u&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=false,a.binary=true,t="",a.compression="STORE",n="string");var _=null;_=t instanceof u||t instanceof o?t:f.isNode&&f.isStream(t)?new d(e,t):s.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var y=new h(e,_,a);this.files[e]=y;}var n=e("./utf8"),s=e("./utils"),o=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),l=e("./defaults"),u=e("./compressedObject"),h=e("./zipObject"),c=e("./generate"),f=e("./nodejsUtils"),d=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):""},g=function(e){return "/"!==e.slice(-1)&&(e+="/"),e},m=function(e,t){return t=void 0!==t?t:l.createFolders,e=g(e),this.files[e]||i.call(this,e,null,{dir:true,createFolders:t}),this.files[e]};function _(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,r,i;for(t in this.files)i=this.files[t],(r=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(r,i);},filter:function(e){var t=[];return this.forEach((function(r,i){e(r,i)&&t.push(i);})),t},file:function(e,t,r){if(1!==arguments.length)return e=this.root+e,i.call(this,e,t,r),this;if(_(e)){var n=e;return this.filter((function(e,t){return !t.dir&&n.test(e)}))}var s=this.files[this.root+e];return s&&!s.dir?s:null},folder:function(e){if(!e)return this;if(_(e))return this.filter((function(t,r){return r.dir&&e.test(t)}));var t=this.root+e,r=m.call(this,t),i=this.clone();return i.root=r.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 r=this.filter((function(t,r){return r.name.slice(0,e.length)===e})),i=0;i<r.length;i++)delete this.files[r[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,r={};try{if((r=s.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),"binarystring"===r.type&&(r.type="string"),!r.type)throw new Error("No output type specified.");s.checkSupport(r.type),"darwin"!==r.platform&&"freebsd"!==r.platform&&"linux"!==r.platform&&"sunos"!==r.platform||(r.platform="UNIX"),"win32"===r.platform&&(r.platform="DOS");var i=r.comment||this.comment||"";t=c.generateWorker(this,r,i);}catch(e){(t=new o("error")).error(e);}return new a(t,r.type||"string",r.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,r){t.exports=e("stream");},{stream:void 0}],17:[function(e,t,r){var i=e("./DataReader");function n(e){i.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t];}e("../utils").inherits(n,i),n.prototype.byteAt=function(e){return this.data[this.zero+e]},n.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2),n=e.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===t&&this.data[s+1]===r&&this.data[s+2]===i&&this.data[s+3]===n)return s-this.zero;return -1},n.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2),n=e.charCodeAt(3),s=this.readData(4);return t===s[0]&&r===s[1]&&i===s[2]&&n===s[3]},n.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=n;},{"../utils":32,"./DataReader":18}],18:[function(e,t,r){var i=e("../utils");function n(e){this.data=e,this.length=e.length,this.index=0,this.zero=0;}n.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,r=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},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=n;},{"../utils":32}],19:[function(e,t,r){var i=e("./Uint8ArrayReader");function n(e){i.call(this,e);}e("../utils").inherits(n,i),n.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=n;},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){var i=e("./DataReader");function n(e){i.call(this,e);}e("../utils").inherits(n,i),n.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},n.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},n.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},n.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=n;},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){var i=e("./ArrayReader");function n(e){i.call(this,e);}e("../utils").inherits(n,i),n.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=n;},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){var i=e("../utils"),n=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||n.uint8array?"nodebuffer"===t?new a(e):n.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,r){r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b";},{}],24:[function(e,t,r){var i=e("./GenericWorker"),n=e("../utils");function s(e){i.call(this,"ConvertWorker to "+e),this.destType=e;}n.inherits(s,i),s.prototype.processChunk=function(e){this.push({data:n.transformTo(this.destType,e.data),meta:e.meta});},t.exports=s;},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){var i=e("./GenericWorker"),n=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=n(e.data,this.streamInfo.crc32||0),this.push(e);},t.exports=s;},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){var i=e("../utils"),n=e("./GenericWorker");function s(e){n.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0);}i.inherits(s,n),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length;}n.prototype.processChunk.call(this,e);},t.exports=s;},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){var i=e("../utils"),n=e("./GenericWorker");function s(e){n.call(this,"DataWorker");var t=this;this.dataIsReady=false,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=false,e.then((function(e){t.dataIsReady=true,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,n),s.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null;},s.prototype.resume=function(){return !!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=true,i.delay(this._tickAndRepeat,[],this)),true)},s.prototype._tickAndRepeat=function(){this._tickScheduled=false,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=true));},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return false;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,r){function i(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=true,this.isFinished=false,this.isLocked=false,this._listeners={data:[],end:[],error:[]},this.previous=null;}i.prototype={push:function(e){this.emit("data",e);},end:function(){if(this.isFinished)return false;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0;}catch(e){this.emit("error",e);}return true},error:function(e){return !this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=true,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),true)},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 r=0;r<this._listeners[e].length;r++)this._listeners[e][r].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=true,this.previous&&this.previous.pause(),true)},resume:function(){if(!this.isPaused||this.isFinished)return false;var e=this.isPaused=false;return this.generatedError&&(this.error(this.generatedError),e=true),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=true,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,r){var i=e("../utils"),n=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 h(e,t){return new l.Promise((function(r,n){var s=[],a=e._internalType,l=e._outputType,u=e._mimeType;e.on("data",(function(e,r){s.push(e),t&&t(r);})).on("error",(function(e){s=[],n(e);})).on("end",(function(){try{var e=function(e,t,r){switch(e){case "blob":return i.newBlob(i.transformTo("arraybuffer",t),r);case "base64":return o.encode(t);default:return i.transformTo(e,t)}}(l,function(e,t){var r,i=0,n=null,s=0;for(r=0;r<t.length;r++)s+=t[r].length;switch(e){case "string":return t.join("");case "array":return Array.prototype.concat.apply([],t);case "uint8array":for(n=new Uint8Array(s),r=0;r<t.length;r++)n.set(t[r],i),i+=t[r].length;return n;case "nodebuffer":return T.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(a,s),u);r(e);}catch(e){n(e);}s=[];})).resume();}))}function c(e,t,r){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=r,i.checkSupport(o),this._worker=e.pipe(new n(o)),e.lock();}catch(e){this._worker=new s("error"),this._worker.error(e);}}c.prototype={accumulate:function(e){return h(this,e)},on:function(e,t){var r=this;return "data"===e?this._worker.on(e,(function(e){t.call(r,e.data,e.meta);})):this._worker.on(e,(function(){i.delay(t,arguments,r);})),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,r){if(r.base64=true,r.array=true,r.string=true,r.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,r.nodebuffer=void 0!==T,r.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)r.blob=false;else {var i=new ArrayBuffer(0);try{r.blob=0===new Blob([i],{type:"application/zip"}).size;}catch(e){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(i),r.blob=0===n.getBlob("application/zip").size;}catch(e){r.blob=false;}}}try{r.nodestream=!!e("readable-stream").Readable;}catch(e){r.nodestream=false;}},{"readable-stream":16}],31:[function(e,t,r){for(var i=e("./utils"),n=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 h(){o.call(this,"utf-8 encode");}a[254]=a[254]=1,r.utf8encode=function(e){return n.nodebuffer?s.newBufferFrom(e,"utf-8"):function(e){var t,r,i,s,o,a=e.length,l=0;for(s=0;s<a;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(i-56320),s++),l+=r<128?1:r<2048?2:r<65536?3:4;for(t=n.uint8array?new Uint8Array(l):new Array(l),s=o=0;o<l;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(i-56320),s++),r<128?t[o++]=r:(r<2048?t[o++]=192|r>>>6:(r<65536?t[o++]=224|r>>>12:(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63),t[o++]=128|r>>>6&63),t[o++]=128|63&r);return t}(e)},r.utf8decode=function(e){return n.nodebuffer?i.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,r,n,s,o=e.length,l=new Array(2*o);for(t=r=0;t<o;)if((n=e[t++])<128)l[r++]=n;else if(4<(s=a[n]))l[r++]=65533,t+=s-1;else {for(n&=2===s?31:3===s?15:7;1<s&&t<o;)n=n<<6|63&e[t++],s--;1<s?l[r++]=65533:n<65536?l[r++]=n:(n-=65536,l[r++]=55296|n>>10&1023,l[r++]=56320|1023&n);}return l.length!==r&&(l.subarray?l=l.subarray(0,r):l.length=r),i.applyFromCharCode(l)}(e=i.transformTo(n.uint8array?"uint8array":"array",e))},i.inherits(u,o),u.prototype.processChunk=function(e){var t=i.transformTo(n.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(n.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 r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0||0===r?t:r+a[e[r]]>t?r:t}(t),l=t;o!==t.length&&(n.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:r.utf8decode(l),meta:e.meta});},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null);},r.Utf8DecodeWorker=u,i.inherits(h,o),h.prototype.processChunk=function(e){this.push({data:r.utf8encode(e.data),meta:e.meta});},r.Utf8EncodeWorker=h;},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){var i=e("./support"),n=e("./base64"),s=e("./nodejsUtils"),o=e("./external");function a(e){return e}function l(e,t){for(var r=0;r<e.length;++r)t[r]=255&e.charCodeAt(r);return t}e("setimmediate"),r.newBlob=function(e,t){r.checkSupport("blob");try{return new Blob([e],{type:t})}catch(r){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,r){var i=[],n=0,s=e.length;if(s<=r)return String.fromCharCode.apply(null,e);for(;n<s;)"array"===t||"nodebuffer"===t?i.push(String.fromCharCode.apply(null,e.slice(n,Math.min(n+r,s)))):i.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+r,s)))),n+=r;return i.join("")},stringifyByChar:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return false}}(),nodebuffer:function(){try{return i.nodebuffer&&1===String.fromCharCode.apply(null,s.allocBuffer(1)).length}catch(e){return false}}()}};function h(e){var t=65536,i=r.getTypeOf(e),n=true;if("uint8array"===i?n=u.applyCanBeUsed.uint8array:"nodebuffer"===i&&(n=u.applyCanBeUsed.nodebuffer),n)for(;1<t;)try{return u.stringifyByChunk(e,i,t)}catch(e){t=Math.floor(t/2);}return u.stringifyByChar(e)}function c(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}r.applyFromCharCode=h;var f={};f.string={string:a,array:function(e){return l(e,new Array(e.length))},arraybuffer:function(e){return f.string.uint8array(e).buffer},uint8array:function(e){return l(e,new Uint8Array(e.length))},nodebuffer:function(e){return l(e,s.allocBuffer(e.length))}},f.array={string:h,array:a,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(e)}},f.arraybuffer={string:function(e){return h(new Uint8Array(e))},array:function(e){return c(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))}},f.uint8array={string:h,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:a,nodebuffer:function(e){return s.newBufferFrom(e)}},f.nodebuffer={string:h,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return f.nodebuffer.uint8array(e).buffer},uint8array:function(e){return c(e,new Uint8Array(e.length))},nodebuffer:a},r.transformTo=function(e,t){if(t=t||"",!e)return t;r.checkSupport(e);var i=r.getTypeOf(t);return f[i][e](t)},r.resolve=function(e){for(var t=e.split("/"),r=[],i=0;i<t.length;i++){var n=t[i];"."===n||""===n&&0!==i&&i!==t.length-1||(".."===n?r.pop():r.push(n));}return r.join("/")},r.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},r.checkSupport=function(e){if(!i[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(e){var t,r,i="";for(r=0;r<(e||"").length;r++)i+="\\x"+((t=e.charCodeAt(r))<16?"0":"")+t.toString(16).toUpperCase();return i},r.delay=function(e,t,r){setImmediate((function(){e.apply(r||null,t||[]);}));},r.inherits=function(e,t){function r(){}r.prototype=t.prototype,e.prototype=new r;},r.extend=function(){var e,t,r={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===r[t]&&(r[t]=arguments[e][t]);return r},r.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,r){var i=new FileReader;i.onload=function(e){t(e.target.result);},i.onerror=function(e){r(e.target.error);},i.readAsArrayBuffer(e);})):e})).then((function(t){var h=r.getTypeOf(t);return h?("arraybuffer"===h?t=r.transformTo("uint8array",t):"string"===h&&(u?t=n.decode(t):s&&true!==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,r){var i=e("./reader/readerFor"),n=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 ("+n.pretty(t)+", expected "+n.pretty(e)+")")}},isSignature:function(e,t){var r=this.reader.index;this.reader.setIndex(e);var i=this.reader.readString(4)===t;return this.reader.setIndex(r),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",r=n.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(r);},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,r,i=this.zip64EndOfCentralSize-44;0<i;)e=this.reader.readInt(2),t=this.reader.readInt(4),r=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:r};},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===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=true,(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 r=this.centralDirOffset+this.centralDirSize;this.zip64&&(r+=20,r+=12+this.zip64EndOfCentralSize);var i=t-r;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,r){var i=e("./reader/readerFor"),n=e("./utils"),s=e("./compressedObject"),o=e("./crc32"),a=e("./utf8"),l=e("./compressions"),u=e("./support");function h(e,t){this.options=e,this.loadOptions=t;}h.prototype={isEncrypted:function(){return !(1&~this.bitFlag)},useUTF8:function(){return !(2048&~this.bitFlag)},readLocalPart:function(e){var t,r;if(e.skip(22),this.fileNameLength=e.readInt(2),r=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(r),-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 "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.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=true);},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=i(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4));}},readExtraFields:function(e){var t,r,i,n=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<n;)t=e.readInt(2),r=e.readInt(2),i=e.readData(r),this.extraFields[t]={id:t,length:r,value:i};e.setIndex(n);},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 r=n.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r);}var i=this.findExtraFieldUnicodeComment();if(null!==i)this.fileCommentStr=i;else {var s=n.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=h;},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,r){function i(e,t,r){this.name=e,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=t,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions};}var n=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,r="string";try{if(!e)throw new Error("No output type specified.");var i="string"===(r=e.toLowerCase())||"text"===r;"binarystring"!==r&&"text"!==r||(r="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 n(t,r,"")},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 r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new o.Utf8EncodeWorker)),a.createWorkerFrom(r,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"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},c=0;c<u.length;c++)i.prototype[u[c]]=h;t.exports=i;},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,r){(function(e){var r,i,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var s=0,o=new n(h),a=e.document.createTextNode("");o.observe(a,{characterData:true}),r=function(){a.data=s=++s%2;};}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){h(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null;},e.document.documentElement.appendChild(t);}:function(){setTimeout(h,0);};else {var l=new e.MessageChannel;l.port1.onmessage=h,r=function(){l.port2.postMessage(0);};}var u=[];function h(){var e,t;i=true;for(var r=u.length;r;){for(t=u,u=[],e=-1;++e<r;)t[e]();r=u.length;}i=false;}t.exports=function(e){1!==u.push(e)||i||r();};}).call(this,void 0!==d?d:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});},{}],37:[function(e,t,r){var i=e("immediate");function n(){}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!==n&&d(this,e);}function h(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected);}function c(e,t,r){i((function(){var i;try{i=t(r);}catch(i){return s.reject(e,i)}i===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,i);}));}function f(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments);}}function d(e,t){var r=false;function i(t){r||(r=true,s.reject(e,t));}function n(t){r||(r=true,s.resolve(e,t));}var o=p((function(){t(n,i);}));"error"===o.status&&i(o.value);}function p(e,t){var r={};try{r.value=e(t),r.status="success";}catch(e){r.status="error",r.value=e;}return r}(t.exports=u).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then((function(r){return t.resolve(e()).then((function(){return r}))}),(function(r){return t.resolve(e()).then((function(){throw r}))}))},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 r=new this.constructor(n);return this.state!==l?c(r,this.state===a?e:t,this.outcome):this.queue.push(new h(r,e,t)),r},h.prototype.callFulfilled=function(e){s.resolve(this.promise,e);},h.prototype.otherCallFulfilled=function(e){c(this.promise,this.onFulfilled,e);},h.prototype.callRejected=function(e){s.reject(this.promise,e);},h.prototype.otherCallRejected=function(e){c(this.promise,this.onRejected,e);},s.resolve=function(e,t){var r=p(f,t);if("error"===r.status)return s.reject(e,r.value);var i=r.value;if(i)d(e,i);else {e.state=a,e.outcome=t;for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callFulfilled(t);}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var r=-1,i=e.queue.length;++r<i;)e.queue[r].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:s.resolve(new this(n),e)},u.reject=function(e){var t=new this(n);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 r=e.length,i=false;if(!r)return this.resolve([]);for(var o=new Array(r),a=0,l=-1,u=new this(n);++l<r;)h(e[l],l);return u;function h(e,n){t.resolve(e).then((function(e){o[n]=e,++a!==r||i||(i=true,s.resolve(u,o));}),(function(e){i||(i=true,s.reject(u,e));}));}},u.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,i=false;if(!r)return this.resolve([]);for(var o,a=-1,l=new this(n);++a<r;)o=e[a],t.resolve(o).then((function(e){i||(i=true,s.resolve(l,e));}),(function(e){i||(i=true,s.reject(l,e));}));return l};},{immediate:36}],38:[function(e,t,r){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,r){var i=e("./zlib/deflate"),n=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/messages"),a=e("./zlib/zstream"),l=Object.prototype.toString,u=0,h=-1,c=0,f=8;function d(e){if(!(this instanceof d))return new d(e);this.options=n.assign({level:h,method:f,chunkSize:16384,windowBits:15,memLevel:8,strategy:c,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=false,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var r=i.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==u)throw new Error(o[r]);if(t.header&&i.deflateSetHeader(this.strm,t.header),t.dictionary){var p;if(p="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(r=i.deflateSetDictionary(this.strm,p))!==u)throw new Error(o[r]);this._dict_set=true;}}function p(e,t){var r=new d(t);if(r.push(e,true),r.err)throw r.msg||o[r.err];return r.result}d.prototype.push=function(e,t){var r,o,a=this.strm,h=this.options.chunkSize;if(this.ended)return false;o=t===~~t?t:true===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 n.Buf8(h),a.next_out=0,a.avail_out=h),1!==(r=i.deflate(a,o))&&r!==u)return this.onEnd(r),!(this.ended=true);0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)));}while((0<a.avail_in||0===a.avail_out)&&1!==r);return 4===o?(r=i.deflateEnd(this.strm),this.onEnd(r),this.ended=true,r===u):2!==o||(this.onEnd(u),!(a.avail_out=0))},d.prototype.onData=function(e){this.chunks.push(e);},d.prototype.onEnd=function(e){e===u&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg;},r.Deflate=d,r.deflate=p,r.deflateRaw=function(e,t){return (t=t||{}).raw=true,p(e,t)},r.gzip=function(e,t){return (t=t||{}).gzip=true,p(e,t)};},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,r){var i=e("./zlib/inflate"),n=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),l=e("./zlib/zstream"),u=e("./zlib/gzheader"),h=Object.prototype.toString;function c(e){if(!(this instanceof c))return new c(e);this.options=n.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=false,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var r=i.inflateInit2(this.strm,t.windowBits);if(r!==o.Z_OK)throw new Error(a[r]);this.header=new u,i.inflateGetHeader(this.strm,this.header);}function f(e,t){var r=new c(t);if(r.push(e,true),r.err)throw r.msg||a[r.err];return r.result}c.prototype.push=function(e,t){var r,a,l,u,c,f,d=this.strm,p=this.options.chunkSize,g=this.options.dictionary,m=false;if(this.ended)return false;a=t===~~t?t:true===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?d.input=s.binstring2buf(e):"[object ArrayBuffer]"===h.call(e)?d.input=new Uint8Array(e):d.input=e,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new n.Buf8(p),d.next_out=0,d.avail_out=p),(r=i.inflate(d,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&g&&(f="string"==typeof g?s.string2buf(g):"[object ArrayBuffer]"===h.call(g)?new Uint8Array(g):g,r=i.inflateSetDictionary(this.strm,f)),r===o.Z_BUF_ERROR&&true===m&&(r=o.Z_OK,m=false),r!==o.Z_STREAM_END&&r!==o.Z_OK)return this.onEnd(r),!(this.ended=true);d.next_out&&(0!==d.avail_out&&r!==o.Z_STREAM_END&&(0!==d.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(l=s.utf8border(d.output,d.next_out),u=d.next_out-l,c=s.buf2string(d.output,l),d.next_out=u,d.avail_out=p-u,u&&n.arraySet(d.output,d.output,l,u,0),this.onData(c)):this.onData(n.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(m=true);}while((0<d.avail_in||0===d.avail_out)&&r!==o.Z_STREAM_END);return r===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(r=i.inflateEnd(this.strm),this.onEnd(r),this.ended=true,r===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(d.avail_out=0))},c.prototype.onData=function(e){this.chunks.push(e);},c.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg;},r.Inflate=c,r.inflate=f,r.inflateRaw=function(e,t){return (t=t||{}).raw=true,f(e,t)},r.ungzip=f;},{"./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,r){var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;r.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var i in r)r.hasOwnProperty(i)&&(e[i]=r[i]);}}return e},r.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,i,n){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+i),n);else for(var s=0;s<i;s++)e[n+s]=t[r+s];},flattenChunks:function(e){var t,r,i,n,s,o;for(t=i=0,r=e.length;t<r;t++)i+=e[t].length;for(o=new Uint8Array(i),t=n=0,r=e.length;t<r;t++)s=e[t],o.set(s,n),n+=s.length;return o}},s={arraySet:function(e,t,r,i,n){for(var s=0;s<i;s++)e[n+s]=t[r+s];},flattenChunks:function(e){return [].concat.apply([],e)}};r.setTyped=function(e){e?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,n)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,s));},r.setTyped(i);},{}],42:[function(e,t,r){var i=e("./common"),n=true,s=true;try{String.fromCharCode.apply(null,[0]);}catch(e){n=false;}try{String.fromCharCode.apply(null,new Uint8Array(1));}catch(e){s=false;}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&&n))return String.fromCharCode.apply(null,i.shrinkBuf(e,t));for(var r="",o=0;o<t;o++)r+=String.fromCharCode(e[o]);return r}o[254]=o[254]=1,r.string2buf=function(e){var t,r,n,s,o,a=e.length,l=0;for(s=0;s<a;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(n-56320),s++),l+=r<128?1:r<2048?2:r<65536?3:4;for(t=new i.Buf8(l),s=o=0;o<l;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(n-56320),s++),r<128?t[o++]=r:(r<2048?t[o++]=192|r>>>6:(r<65536?t[o++]=224|r>>>12:(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63),t[o++]=128|r>>>6&63),t[o++]=128|63&r);return t},r.buf2binstring=function(e){return l(e,e.length)},r.binstring2buf=function(e){for(var t=new i.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},r.buf2string=function(e,t){var r,i,n,s,a=t||e.length,u=new Array(2*a);for(r=i=0;r<a;)if((n=e[r++])<128)u[i++]=n;else if(4<(s=o[n]))u[i++]=65533,r+=s-1;else {for(n&=2===s?31:3===s?15:7;1<s&&r<a;)n=n<<6|63&e[r++],s--;1<s?u[i++]=65533:n<65536?u[i++]=n:(n-=65536,u[i++]=55296|n>>10&1023,u[i++]=56320|1023&n);}return l(u,i)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0||0===r?t:r+o[e[r]]>t?r:t};},{"./common":41}],43:[function(e,t,r){t.exports=function(e,t,r,i){for(var n=65535&e,s=e>>>16&65535,o=0;0!==r;){for(r-=o=2e3<r?2e3:r;s=s+(n=n+t[i++]|0)|0,--o;);n%=65521,s%=65521;}return n|s<<16};},{}],44:[function(e,t,r){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,r){var i=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e;}return t}();t.exports=function(e,t,r,n){var s=i,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^s[255&(e^t[a])];return ~e};},{}],46:[function(e,t,r){var i,n=e("../utils/common"),s=e("./trees"),o=e("./adler32"),a=e("./crc32"),l=e("./messages"),u=0,h=4,c=0,f=-2,d=-1,p=4,g=2,m=8,_=9,y=286,b=30,v=19,w=2*y+1,k=15,x=3,S=258,A=S+x+1,E=42,C=113,T=1,z=2,O=3,R=4;function I(e,t){return e.msg=l[t],t}function F(e){return (e<<1)-(4<e?9:0)}function B(e){for(var t=e.length;0<=--t;)e[t]=0;}function L(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(n.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0));}function P(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,L(e.strm);}function D(e,t){e.pending_buf[e.pending++]=t;}function U(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t;}function N(e,t){var r,i,n=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-A?e.strstart-(e.w_size-A):0,u=e.window,h=e.w_mask,c=e.prev,f=e.strstart+S,d=u[s+o-1],p=u[s+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+o]===p&&u[r+o-1]===d&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&s<f);if(i=S-(f-s),s=f-S,o<i){if(e.match_start=t,a<=(o=i))break;d=u[s+o-1],p=u[s+o];}}}while((t=c[t&h])>l&&0!=--n);return o<=e.lookahead?o:e.lookahead}function j(e){var t,r,i,s,l,u,h,c,f,d,p=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=p+(p-A)){for(n.arraySet(e.window,e.window,p,p,0),e.match_start-=p,e.strstart-=p,e.block_start-=p,t=r=e.hash_size;i=e.head[--t],e.head[t]=p<=i?i-p:0,--r;);for(t=r=p;i=e.prev[--t],e.prev[t]=p<=i?i-p:0,--r;);s+=p;}if(0===e.strm.avail_in)break;if(u=e.strm,h=e.window,c=e.strstart+e.lookahead,d=void 0,(f=s)<(d=u.avail_in)&&(d=f),r=0===d?0:(u.avail_in-=d,n.arraySet(h,u.input,u.next_in,d,c),1===u.state.wrap?u.adler=o(u.adler,h,d,c):2===u.state.wrap&&(u.adler=a(u.adler,h,d,c)),u.next_in+=d,u.total_in+=d,d),e.lookahead+=r,e.lookahead+e.insert>=x)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+x-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<x)););}while(e.lookahead<A&&0!==e.strm.avail_in)}function M(e,t){for(var r,i;;){if(e.lookahead<A){if(j(e),e.lookahead<A&&t===u)return T;if(0===e.lookahead)break}if(r=0,e.lookahead>=x&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+x-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-A&&(e.match_length=N(e,r)),e.match_length>=x)if(i=s._tr_tally(e,e.strstart-e.match_start,e.match_length-x),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=x){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+x-1])&e.hash_mask,r=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&&(P(e,false),0===e.strm.avail_out))return T}return e.insert=e.strstart<x-1?e.strstart:x-1,t===h?(P(e,true),0===e.strm.avail_out?O:R):e.last_lit&&(P(e,false),0===e.strm.avail_out)?T:z}function Z(e,t){for(var r,i,n;;){if(e.lookahead<A){if(j(e),e.lookahead<A&&t===u)return T;if(0===e.lookahead)break}if(r=0,e.lookahead>=x&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+x-1])&e.hash_mask,r=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=x-1,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-A&&(e.match_length=N(e,r),e.match_length<=5&&(1===e.strategy||e.match_length===x&&4096<e.strstart-e.match_start)&&(e.match_length=x-1)),e.prev_length>=x&&e.match_length<=e.prev_length){for(n=e.strstart+e.lookahead-x,i=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-x),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+x-1])&e.hash_mask,r=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=x-1,e.strstart++,i&&(P(e,false),0===e.strm.avail_out))return T}else if(e.match_available){if((i=s._tr_tally(e,0,e.window[e.strstart-1]))&&P(e,false),e.strstart++,e.lookahead--,0===e.strm.avail_out)return T}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<x-1?e.strstart:x-1,t===h?(P(e,true),0===e.strm.avail_out?O:R):e.last_lit&&(P(e,false),0===e.strm.avail_out)?T:z}function W(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n;}function Y(){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=m,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 n.Buf16(2*w),this.dyn_dtree=new n.Buf16(2*(2*b+1)),this.bl_tree=new n.Buf16(2*(2*v+1)),B(this.dyn_ltree),B(this.dyn_dtree),B(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(k+1),this.heap=new n.Buf16(2*y+1),B(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(2*y+1),B(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 q(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=g,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?E:C,e.adler=2===t.wrap?0:1,t.last_flush=u,s._tr_init(t),c):I(e,f)}function V(e){var t=q(e);return t===c&&function(e){e.window_size=2*e.w_size,B(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=x-1,e.match_available=0,e.ins_h=0;}(e.state),t}function G(e,t,r,i,s,o){if(!e)return f;var a=1;if(t===d&&(t=6),i<0?(a=0,i=-i):15<i&&(a=2,i-=16),s<1||_<s||r!==m||i<8||15<i||t<0||9<t||o<0||p<o)return I(e,f);8===i&&(i=9);var l=new Y;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+x-1)/x),l.window=new n.Buf8(2*l.w_size),l.head=new n.Buf16(l.hash_size),l.prev=new n.Buf16(l.w_size),l.lit_bufsize=1<<s+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new n.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=r,V(e)}i=[new W(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(j(e),0===e.lookahead&&t===u)return T;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+r;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,P(e,false),0===e.strm.avail_out))return T;if(e.strstart-e.block_start>=e.w_size-A&&(P(e,false),0===e.strm.avail_out))return T}return e.insert=0,t===h?(P(e,true),0===e.strm.avail_out?O:R):(e.strstart>e.block_start&&(P(e,false),e.strm.avail_out),T)})),new W(4,4,8,4,M),new W(4,5,16,8,M),new W(4,6,32,32,M),new W(4,4,16,16,Z),new W(8,16,32,32,Z),new W(8,16,128,128,Z),new W(8,32,128,256,Z),new W(32,128,258,1024,Z),new W(32,258,258,4096,Z)],r.deflateInit=function(e,t){return G(e,t,m,15,8,0)},r.deflateInit2=G,r.deflateReset=V,r.deflateResetKeep=q,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?f:(e.state.gzhead=t,c):f},r.deflate=function(e,t){var r,n,o,l;if(!e||!e.state||5<t||t<0)return e?I(e,f):f;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&t!==h)return I(e,0===e.avail_out?-5:f);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===E)if(2===n.wrap)e.adler=0,D(n,31),D(n,139),D(n,8),n.gzhead?(D(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),D(n,255&n.gzhead.time),D(n,n.gzhead.time>>8&255),D(n,n.gzhead.time>>16&255),D(n,n.gzhead.time>>24&255),D(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),D(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(D(n,255&n.gzhead.extra.length),D(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=a(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(D(n,0),D(n,0),D(n,0),D(n,0),D(n,0),D(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),D(n,3),n.status=C);else {var d=m+(n.w_bits-8<<4)<<8;d|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(d|=32),d+=31-d%31,n.status=C,U(n,d),0!==n.strstart&&(U(n,e.adler>>>16),U(n,65535&e.adler)),e.adler=1;}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),L(e),o=n.pending,n.pending!==n.pending_buf_size));)D(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73);}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),L(e),o=n.pending,n.pending===n.pending_buf_size)){l=1;break}l=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,D(n,l);}while(0!==l);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===l&&(n.gzindex=0,n.status=91);}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),L(e),o=n.pending,n.pending===n.pending_buf_size)){l=1;break}l=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,D(n,l);}while(0!==l);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===l&&(n.status=103);}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&L(e),n.pending+2<=n.pending_buf_size&&(D(n,255&e.adler),D(n,e.adler>>8&255),e.adler=0,n.status=C)):n.status=C),0!==n.pending){if(L(e),0===e.avail_out)return n.last_flush=-1,c}else if(0===e.avail_in&&F(t)<=F(r)&&t!==h)return I(e,-5);if(666===n.status&&0!==e.avail_in)return I(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var p=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(j(e),0===e.lookahead)){if(t===u)return T;break}if(e.match_length=0,r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(P(e,false),0===e.strm.avail_out))return T}return e.insert=0,t===h?(P(e,true),0===e.strm.avail_out?O:R):e.last_lit&&(P(e,false),0===e.strm.avail_out)?T:z}(n,t):3===n.strategy?function(e,t){for(var r,i,n,o,a=e.window;;){if(e.lookahead<=S){if(j(e),e.lookahead<=S&&t===u)return T;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=x&&0<e.strstart&&(i=a[n=e.strstart-1])===a[++n]&&i===a[++n]&&i===a[++n]){o=e.strstart+S;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<o);e.match_length=S-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead);}if(e.match_length>=x?(r=s._tr_tally(e,1,e.match_length-x),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(P(e,false),0===e.strm.avail_out))return T}return e.insert=0,t===h?(P(e,true),0===e.strm.avail_out?O:R):e.last_lit&&(P(e,false),0===e.strm.avail_out)?T:z}(n,t):i[n.level].func(n,t);if(p!==O&&p!==R||(n.status=666),p===T||p===O)return 0===e.avail_out&&(n.last_flush=-1),c;if(p===z&&(1===t?s._tr_align(n):5!==t&&(s._tr_stored_block(n,0,0,false),3===t&&(B(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),L(e),0===e.avail_out))return n.last_flush=-1,c}return t!==h?c:n.wrap<=0?1:(2===n.wrap?(D(n,255&e.adler),D(n,e.adler>>8&255),D(n,e.adler>>16&255),D(n,e.adler>>24&255),D(n,255&e.total_in),D(n,e.total_in>>8&255),D(n,e.total_in>>16&255),D(n,e.total_in>>24&255)):(U(n,e.adler>>>16),U(n,65535&e.adler)),L(e),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?c:1)},r.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==E&&69!==t&&73!==t&&91!==t&&103!==t&&t!==C&&666!==t?I(e,f):(e.state=null,t===C?I(e,-3):c):f},r.deflateSetDictionary=function(e,t){var r,i,s,a,l,u,h,d,p=t.length;if(!e||!e.state)return f;if(2===(a=(r=e.state).wrap)||1===a&&r.status!==E||r.lookahead)return f;for(1===a&&(e.adler=o(e.adler,t,p,0)),r.wrap=0,p>=r.w_size&&(0===a&&(B(r.head),r.strstart=0,r.block_start=0,r.insert=0),d=new n.Buf8(r.w_size),n.arraySet(d,t,p-r.w_size,r.w_size,0),t=d,p=r.w_size),l=e.avail_in,u=e.next_in,h=e.input,e.avail_in=p,e.next_in=0,e.input=t,j(r);r.lookahead>=x;){for(i=r.strstart,s=r.lookahead-(x-1);r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+x-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++,--s;);r.strstart=i,r.lookahead=x-1,j(r);}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=x-1,r.match_available=0,e.next_in=u,e.input=h,e.avail_in=l,r.wrap=a,c},r.deflateInfo="pako deflate (from Nodeca project)";},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,r){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=false;};},{}],48:[function(e,t,r){t.exports=function(e,t){var r,i,n,s,o,a,l,u,h,c,f,d,p,g,m,_,y,b,v,w,k,x,S,A,E;r=e.state,i=e.next_in,A=e.input,n=i+(e.avail_in-5),s=e.next_out,E=e.output,o=s-(t-e.avail_out),a=s+(e.avail_out-257),l=r.dmax,u=r.wsize,h=r.whave,c=r.wnext,f=r.window,d=r.hold,p=r.bits,g=r.lencode,m=r.distcode,_=(1<<r.lenbits)-1,y=(1<<r.distbits)-1;e:do{p<15&&(d+=A[i++]<<p,p+=8,d+=A[i++]<<p,p+=8),b=g[d&_];t:for(;;){if(d>>>=v=b>>>24,p-=v,0==(v=b>>>16&255))E[s++]=65535&b;else {if(!(16&v)){if(!(64&v)){b=g[(65535&b)+(d&(1<<v)-1)];continue t}if(32&v){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}w=65535&b,(v&=15)&&(p<v&&(d+=A[i++]<<p,p+=8),w+=d&(1<<v)-1,d>>>=v,p-=v),p<15&&(d+=A[i++]<<p,p+=8,d+=A[i++]<<p,p+=8),b=m[d&y];r:for(;;){if(d>>>=v=b>>>24,p-=v,!(16&(v=b>>>16&255))){if(!(64&v)){b=m[(65535&b)+(d&(1<<v)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(k=65535&b,p<(v&=15)&&(d+=A[i++]<<p,(p+=8)<v&&(d+=A[i++]<<p,p+=8)),l<(k+=d&(1<<v)-1)){e.msg="invalid distance too far back",r.mode=30;break e}if(d>>>=v,p-=v,(v=s-o)<k){if(h<(v=k-v)&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(S=f,(x=0)===c){if(x+=u-v,v<w){for(w-=v;E[s++]=f[x++],--v;);x=s-k,S=E;}}else if(c<v){if(x+=u+c-v,(v-=c)<w){for(w-=v;E[s++]=f[x++],--v;);if(x=0,c<w){for(w-=v=c;E[s++]=f[x++],--v;);x=s-k,S=E;}}}else if(x+=c-v,v<w){for(w-=v;E[s++]=f[x++],--v;);x=s-k,S=E;}for(;2<w;)E[s++]=S[x++],E[s++]=S[x++],E[s++]=S[x++],w-=3;w&&(E[s++]=S[x++],1<w&&(E[s++]=S[x++]));}else {for(x=s-k;E[s++]=E[x++],E[s++]=E[x++],E[s++]=E[x++],2<(w-=3););w&&(E[s++]=E[x++],1<w&&(E[s++]=E[x++]));}break}}break}}while(i<n&&s<a);i-=w=p>>3,d&=(1<<(p-=w<<3))-1,e.next_in=i,e.next_out=s,e.avail_in=i<n?n-i+5:5-(i-n),e.avail_out=s<a?a-s+257:257-(s-a),r.hold=d,r.bits=p;};},{}],49:[function(e,t,r){var i=e("../utils/common"),n=e("./adler32"),s=e("./crc32"),o=e("./inffast"),a=e("./inftrees"),l=1,u=2,h=0,c=-2,f=1,d=852,p=592;function g(e){return (e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function m(){this.mode=0,this.last=false,this.wrap=0,this.havedict=false,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 _(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=f,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(d),t.distcode=t.distdyn=new i.Buf32(p),t.sane=1,t.back=-1,h):c}function y(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,_(e)):c}function b(e,t){var r,i;return e&&e.state?(i=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?c:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,y(e))):c}function v(e,t){var r,i;return e?(i=new m,(e.state=i).window=null,(r=b(e,t))!==h&&(e.state=null),r):c}var w,k,x=true;function S(e){if(x){var t;for(w=new i.Buf32(512),k=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(l,e.lens,0,288,w,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(u,e.lens,0,32,k,0,e.work,{bits:5}),x=false;}e.lencode=w,e.lenbits=9,e.distcode=k,e.distbits=5;}function A(e,t,r,n){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)),n>=o.wsize?(i.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(n<(s=o.wsize-o.wnext)&&(s=n),i.arraySet(o.window,t,r-n,s,o.wnext),(n-=s)?(i.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0}r.inflateReset=y,r.inflateReset2=b,r.inflateResetKeep=_,r.inflateInit=function(e){return v(e,15)},r.inflateInit2=v,r.inflate=function(e,t){var r,d,p,m,_,y,b,v,w,k,x,E,C,T,z,O,R,I,F,B,L,P,D,U,N=0,j=new i.Buf8(4),M=[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 c;12===(r=e.state).mode&&(r.mode=13),_=e.next_out,p=e.output,b=e.avail_out,m=e.next_in,d=e.input,y=e.avail_in,v=r.hold,w=r.bits,k=y,x=b,P=h;e:for(;;)switch(r.mode){case f:if(0===r.wrap){r.mode=13;break}for(;w<16;){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}if(2&r.wrap&&35615===v){j[r.check=0]=255&v,j[1]=v>>>8&255,r.check=s(r.check,j,2,0),w=v=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=false),!(1&r.wrap)||(((255&v)<<8)+(v>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&v)){e.msg="unknown compression method",r.mode=30;break}if(w-=4,L=8+(15&(v>>>=4)),0===r.wbits)r.wbits=L;else if(L>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<<L,e.adler=r.check=1,r.mode=512&v?10:12,w=v=0;break;case 2:for(;w<16;){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}if(r.flags=v,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=v>>8&1),512&r.flags&&(j[0]=255&v,j[1]=v>>>8&255,r.check=s(r.check,j,2,0)),w=v=0,r.mode=3;case 3:for(;w<32;){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}r.head&&(r.head.time=v),512&r.flags&&(j[0]=255&v,j[1]=v>>>8&255,j[2]=v>>>16&255,j[3]=v>>>24&255,r.check=s(r.check,j,4,0)),w=v=0,r.mode=4;case 4:for(;w<16;){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}r.head&&(r.head.xflags=255&v,r.head.os=v>>8),512&r.flags&&(j[0]=255&v,j[1]=v>>>8&255,r.check=s(r.check,j,2,0)),w=v=0,r.mode=5;case 5:if(1024&r.flags){for(;w<16;){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}r.length=v,r.head&&(r.head.extra_len=v),512&r.flags&&(j[0]=255&v,j[1]=v>>>8&255,r.check=s(r.check,j,2,0)),w=v=0;}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(y<(E=r.length)&&(E=y),E&&(r.head&&(L=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),i.arraySet(r.head.extra,d,m,E,L)),512&r.flags&&(r.check=s(r.check,d,E,m)),y-=E,m+=E,r.length-=E),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===y)break e;for(E=0;L=d[m+E++],r.head&&L&&r.length<65536&&(r.head.name+=String.fromCharCode(L)),L&&E<y;);if(512&r.flags&&(r.check=s(r.check,d,E,m)),y-=E,m+=E,L)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===y)break e;for(E=0;L=d[m+E++],r.head&&L&&r.length<65536&&(r.head.comment+=String.fromCharCode(L)),L&&E<y;);if(512&r.flags&&(r.check=s(r.check,d,E,m)),y-=E,m+=E,L)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;w<16;){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}if(v!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}w=v=0;}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=true),e.adler=r.check=0,r.mode=12;break;case 10:for(;w<32;){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}e.adler=r.check=g(v),w=v=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=_,e.avail_out=b,e.next_in=m,e.avail_in=y,r.hold=v,r.bits=w,2;e.adler=r.check=1,r.mode=12;case 12:if(5===t||6===t)break e;case 13:if(r.last){v>>>=7&w,w-=7&w,r.mode=27;break}for(;w<3;){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}switch(r.last=1&v,w-=1,3&(v>>>=1)){case 0:r.mode=14;break;case 1:if(S(r),r.mode=20,6!==t)break;v>>>=2,w-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30;}v>>>=2,w-=2;break;case 14:for(v>>>=7&w,w-=7&w;w<32;){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}if((65535&v)!=(v>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&v,w=v=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(E=r.length){if(y<E&&(E=y),b<E&&(E=b),0===E)break e;i.arraySet(p,d,m,E,_),y-=E,m+=E,b-=E,_+=E,r.length-=E;break}r.mode=12;break;case 17:for(;w<14;){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}if(r.nlen=257+(31&v),v>>>=5,w-=5,r.ndist=1+(31&v),v>>>=5,w-=5,r.ncode=4+(15&v),v>>>=4,w-=4,286<r.nlen||30<r.ndist){e.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;w<3;){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}r.lens[M[r.have++]]=7&v,v>>>=3,w-=3;}for(;r.have<19;)r.lens[M[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,D={bits:r.lenbits},P=a(0,r.lens,0,19,r.lencode,0,r.work,D),r.lenbits=D.bits,P){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;O=(N=r.lencode[v&(1<<r.lenbits)-1])>>>16&255,R=65535&N,!((z=N>>>24)<=w);){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}if(R<16)v>>>=z,w-=z,r.lens[r.have++]=R;else {if(16===R){for(U=z+2;w<U;){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}if(v>>>=z,w-=z,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}L=r.lens[r.have-1],E=3+(3&v),v>>>=2,w-=2;}else if(17===R){for(U=z+3;w<U;){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}w-=z,L=0,E=3+(7&(v>>>=z)),v>>>=3,w-=3;}else {for(U=z+7;w<U;){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}w-=z,L=0,E=11+(127&(v>>>=z)),v>>>=7,w-=7;}if(r.have+E>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;E--;)r.lens[r.have++]=L;}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,D={bits:r.lenbits},P=a(l,r.lens,0,r.nlen,r.lencode,0,r.work,D),r.lenbits=D.bits,P){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,D={bits:r.distbits},P=a(u,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,D),r.distbits=D.bits,P){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=y&&258<=b){e.next_out=_,e.avail_out=b,e.next_in=m,e.avail_in=y,r.hold=v,r.bits=w,o(e,x),_=e.next_out,p=e.output,b=e.avail_out,m=e.next_in,d=e.input,y=e.avail_in,v=r.hold,w=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;O=(N=r.lencode[v&(1<<r.lenbits)-1])>>>16&255,R=65535&N,!((z=N>>>24)<=w);){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}if(O&&!(240&O)){for(I=z,F=O,B=R;O=(N=r.lencode[B+((v&(1<<I+F)-1)>>I)])>>>16&255,R=65535&N,!(I+(z=N>>>24)<=w);){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}v>>>=I,w-=I,r.back+=I;}if(v>>>=z,w-=z,r.back+=z,r.length=R,0===O){r.mode=26;break}if(32&O){r.back=-1,r.mode=12;break}if(64&O){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&O,r.mode=22;case 22:if(r.extra){for(U=r.extra;w<U;){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}r.length+=v&(1<<r.extra)-1,v>>>=r.extra,w-=r.extra,r.back+=r.extra;}r.was=r.length,r.mode=23;case 23:for(;O=(N=r.distcode[v&(1<<r.distbits)-1])>>>16&255,R=65535&N,!((z=N>>>24)<=w);){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}if(!(240&O)){for(I=z,F=O,B=R;O=(N=r.distcode[B+((v&(1<<I+F)-1)>>I)])>>>16&255,R=65535&N,!(I+(z=N>>>24)<=w);){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}v>>>=I,w-=I,r.back+=I;}if(v>>>=z,w-=z,r.back+=z,64&O){e.msg="invalid distance code",r.mode=30;break}r.offset=R,r.extra=15&O,r.mode=24;case 24:if(r.extra){for(U=r.extra;w<U;){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}r.offset+=v&(1<<r.extra)-1,v>>>=r.extra,w-=r.extra,r.back+=r.extra;}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===b)break e;if(E=x-b,r.offset>E){if((E=r.offset-E)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}C=E>r.wnext?(E-=r.wnext,r.wsize-E):r.wnext-E,E>r.length&&(E=r.length),T=r.window;}else T=p,C=_-r.offset,E=r.length;for(b<E&&(E=b),b-=E,r.length-=E;p[_++]=T[C++],--E;);0===r.length&&(r.mode=21);break;case 26:if(0===b)break e;p[_++]=r.length,b--,r.mode=21;break;case 27:if(r.wrap){for(;w<32;){if(0===y)break e;y--,v|=d[m++]<<w,w+=8;}if(x-=b,e.total_out+=x,r.total+=x,x&&(e.adler=r.check=r.flags?s(r.check,p,x,_-x):n(r.check,p,x,_-x)),x=b,(r.flags?v:g(v))!==r.check){e.msg="incorrect data check",r.mode=30;break}w=v=0;}r.mode=28;case 28:if(r.wrap&&r.flags){for(;w<32;){if(0===y)break e;y--,v+=d[m++]<<w,w+=8;}if(v!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}w=v=0;}r.mode=29;case 29:P=1;break e;case 30:P=-3;break e;case 31:return -4;default:return c}return e.next_out=_,e.avail_out=b,e.next_in=m,e.avail_in=y,r.hold=v,r.bits=w,(r.wsize||x!==e.avail_out&&r.mode<30&&(r.mode<27||4!==t))&&A(e,e.output,e.next_out,x-e.avail_out)?(r.mode=31,-4):(k-=e.avail_in,x-=e.avail_out,e.total_in+=k,e.total_out+=x,r.total+=x,r.wrap&&x&&(e.adler=r.check=r.flags?s(r.check,p,x,e.next_out-x):n(r.check,p,x,e.next_out-x)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0==k&&0===x||4===t)&&P===h&&(P=-5),P)},r.inflateEnd=function(e){if(!e||!e.state)return c;var t=e.state;return t.window&&(t.window=null),e.state=null,h},r.inflateGetHeader=function(e,t){var r;return e&&e.state&&2&(r=e.state).wrap?((r.head=t).done=false,h):c},r.inflateSetDictionary=function(e,t){var r,i=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?c:11===r.mode&&n(1,t,i,0)!==r.check?-3:A(e,t,i,i)?(r.mode=31,-4):(r.havedict=1,h):c},r.inflateInfo="pako inflate (from Nodeca project)";},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,r){var i=e("../utils/common"),n=[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,r,l,u,h,c,f){var d,p,g,m,_,y,b,v,w,k=f.bits,x=0,S=0,A=0,E=0,C=0,T=0,z=0,O=0,R=0,I=0,F=null,B=0,L=new i.Buf16(16),P=new i.Buf16(16),D=null,U=0;for(x=0;x<=15;x++)L[x]=0;for(S=0;S<l;S++)L[t[r+S]]++;for(C=k,E=15;1<=E&&0===L[E];E--);if(E<C&&(C=E),0===E)return u[h++]=20971520,u[h++]=20971520,f.bits=1,0;for(A=1;A<E&&0===L[A];A++);for(C<A&&(C=A),x=O=1;x<=15;x++)if(O<<=1,(O-=L[x])<0)return -1;if(0<O&&(0===e||1!==E))return -1;for(P[1]=0,x=1;x<15;x++)P[x+1]=P[x]+L[x];for(S=0;S<l;S++)0!==t[r+S]&&(c[P[t[r+S]]++]=S);if(y=0===e?(F=D=c,19):1===e?(F=n,B-=257,D=s,U-=257,256):(F=o,D=a,-1),x=A,_=h,z=S=I=0,g=-1,m=(R=1<<(T=C))-1,1===e&&852<R||2===e&&592<R)return 1;for(;;){for(b=x-z,w=c[S]<y?(v=0,c[S]):c[S]>y?(v=D[U+c[S]],F[B+c[S]]):(v=96,0),d=1<<x-z,A=p=1<<T;u[_+(I>>z)+(p-=d)]=b<<24|v<<16|w,0!==p;);for(d=1<<x-1;I&d;)d>>=1;if(0!==d?(I&=d-1,I+=d):I=0,S++,0==--L[x]){if(x===E)break;x=t[r+c[S]];}if(C<x&&(I&m)!==g){for(0===z&&(z=C),_+=A,O=1<<(T=x-z);T+z<E&&!((O-=L[T+z])<=0);)T++,O<<=1;if(R+=1<<T,1===e&&852<R||2===e&&592<R)return 1;u[g=I&m]=C<<24|T<<16|_-h;}}return 0!==I&&(u[_+I]=x-z<<24|64<<16),f.bits=C,0};},{"../utils/common":41}],51:[function(e,t,r){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,r){var i=e("../utils/common"),n=0,s=1;function o(e){for(var t=e.length;0<=--t;)e[t]=0;}var a=0,l=29,u=256,h=u+1+l,c=30,f=19,d=2*h+1,p=15,g=16,m=7,_=256,y=16,b=17,v=18,w=[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],k=[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],x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],A=new Array(2*(h+2));o(A);var E=new Array(2*c);o(E);var C=new Array(512);o(C);var T=new Array(256);o(T);var z=new Array(l);o(z);var O,R,I,F=new Array(c);function B(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length;}function L(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t;}function P(e){return e<256?C[e]:C[256+(e>>>7)]}function D(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255;}function U(e,t,r){e.bi_valid>g-r?(e.bi_buf|=t<<e.bi_valid&65535,D(e,e.bi_buf),e.bi_buf=t>>g-e.bi_valid,e.bi_valid+=r-g):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r);}function N(e,t,r){U(e,r[2*t],r[2*t+1]);}function j(e,t){for(var r=0;r|=1&e,e>>>=1,r<<=1,0<--t;);return r>>>1}function M(e,t,r){var i,n,s=new Array(p+1),o=0;for(i=1;i<=p;i++)s[i]=o=o+r[i-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=j(s[a]++,a));}}function Z(e){var t;for(t=0;t<h;t++)e.dyn_ltree[2*t]=0;for(t=0;t<c;t++)e.dyn_dtree[2*t]=0;for(t=0;t<f;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*_]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0;}function W(e){8<e.bi_valid?D(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 Y(e,t,r,i){var n=2*t,s=2*r;return e[n]<e[s]||e[n]===e[s]&&i[t]<=i[r]}function q(e,t,r){for(var i=e.heap[r],n=r<<1;n<=e.heap_len&&(n<e.heap_len&&Y(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!Y(t,i,e.heap[n],e.depth));)e.heap[r]=e.heap[n],r=n,n<<=1;e.heap[r]=i;}function V(e,t,r){var i,n,s,o,a=0;if(0!==e.last_lit)for(;i=e.pending_buf[e.d_buf+2*a]<<8|e.pending_buf[e.d_buf+2*a+1],n=e.pending_buf[e.l_buf+a],a++,0===i?N(e,n,t):(N(e,(s=T[n])+u+1,t),0!==(o=w[s])&&U(e,n-=z[s],o),N(e,s=P(--i),r),0!==(o=k[s])&&U(e,i-=F[s],o)),a<e.last_lit;);N(e,_,t);}function G(e,t){var r,i,n,s=t.dyn_tree,o=t.stat_desc.static_tree,a=t.stat_desc.has_stree,l=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=d,r=0;r<l;r++)0!==s[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):s[2*r+1]=0;for(;e.heap_len<2;)s[2*(n=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[n]=0,e.opt_len--,a&&(e.static_len-=o[2*n+1]);for(t.max_code=u,r=e.heap_len>>1;1<=r;r--)q(e,s,r);for(n=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],q(e,s,1),i=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=i,s[2*n]=s[2*r]+s[2*i],e.depth[n]=(e.depth[r]>=e.depth[i]?e.depth[r]:e.depth[i])+1,s[2*r+1]=s[2*i+1]=n,e.heap[1]=n++,q(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,i,n,s,o,a,l=t.dyn_tree,u=t.max_code,h=t.stat_desc.static_tree,c=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,g=t.stat_desc.extra_base,m=t.stat_desc.max_length,_=0;for(s=0;s<=p;s++)e.bl_count[s]=0;for(l[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<d;r++)m<(s=l[2*l[2*(i=e.heap[r])+1]+1]+1)&&(s=m,_++),l[2*i+1]=s,u<i||(e.bl_count[s]++,o=0,g<=i&&(o=f[i-g]),a=l[2*i],e.opt_len+=a*(s+o),c&&(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;)u<(n=e.heap[--r])||(l[2*n+1]!==s&&(e.opt_len+=(s-l[2*n+1])*l[2*n],l[2*n+1]=s),i--);}}(e,t),M(s,u,e.bl_count);}function H(e,t,r){var i,n,s=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=o,o=t[2*(i+1)+1],++a<l&&n===o||(a<u?e.bl_tree[2*n]+=a:0!==n?(n!==s&&e.bl_tree[2*n]++,e.bl_tree[2*y]++):a<=10?e.bl_tree[2*b]++:e.bl_tree[2*v]++,s=n,u=(a=0)===o?(l=138,3):n===o?(l=6,3):(l=7,4));}function $(e,t,r){var i,n,s=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),i=0;i<=r;i++)if(n=o,o=t[2*(i+1)+1],!(++a<l&&n===o)){if(a<u)for(;N(e,n,e.bl_tree),0!=--a;);else 0!==n?(n!==s&&(N(e,n,e.bl_tree),a--),N(e,y,e.bl_tree),U(e,a-3,2)):a<=10?(N(e,b,e.bl_tree),U(e,a-3,3)):(N(e,v,e.bl_tree),U(e,a-11,7));s=n,u=(a=0)===o?(l=138,3):n===o?(l=6,3):(l=7,4);}}o(F);var K=false;function J(e,t,r,n){U(e,(a<<1)+(n?1:0),3),function(e,t,r){W(e),D(e,r),D(e,~r),i.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r;}(e,t,r);}r._tr_init=function(e){K||(function(){var e,t,r,i,n,s=new Array(p+1);for(i=r=0;i<l-1;i++)for(z[i]=r,e=0;e<1<<w[i];e++)T[r++]=i;for(T[r-1]=i,i=n=0;i<16;i++)for(F[i]=n,e=0;e<1<<k[i];e++)C[n++]=i;for(n>>=7;i<c;i++)for(F[i]=n<<7,e=0;e<1<<k[i]-7;e++)C[256+n++]=i;for(t=0;t<=p;t++)s[t]=0;for(e=0;e<=143;)A[2*e+1]=8,e++,s[8]++;for(;e<=255;)A[2*e+1]=9,e++,s[9]++;for(;e<=279;)A[2*e+1]=7,e++,s[7]++;for(;e<=287;)A[2*e+1]=8,e++,s[8]++;for(M(A,h+1,s),e=0;e<c;e++)E[2*e+1]=5,E[2*e]=j(e,5);O=new B(A,w,u+1,h,p),R=new B(E,k,0,c,p),I=new B(new Array(0),x,0,f,m);}(),K=true),e.l_desc=new L(e.dyn_ltree,O),e.d_desc=new L(e.dyn_dtree,R),e.bl_desc=new L(e.bl_tree,I),e.bi_buf=0,e.bi_valid=0,Z(e);},r._tr_stored_block=J,r._tr_flush_block=function(e,t,r,i){var o,a,l=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return n;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return s;for(t=32;t<u;t++)if(0!==e.dyn_ltree[2*t])return s;return n}(e)),G(e,e.l_desc),G(e,e.d_desc),l=function(e){var t;for(H(e,e.dyn_ltree,e.l_desc.max_code),H(e,e.dyn_dtree,e.d_desc.max_code),G(e,e.bl_desc),t=f-1;3<=t&&0===e.bl_tree[2*S[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),o=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=o&&(o=a)):o=a=r+5,r+4<=o&&-1!==t?J(e,t,r,i):4===e.strategy||a===o?(U(e,2+(i?1:0),3),V(e,A,E)):(U(e,4+(i?1:0),3),function(e,t,r,i){var n;for(U(e,t-257,5),U(e,r-1,5),U(e,i-4,4),n=0;n<i;n++)U(e,e.bl_tree[2*S[n]+1],3);$(e,e.dyn_ltree,t-1),$(e,e.dyn_dtree,r-1);}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,l+1),V(e,e.dyn_ltree,e.dyn_dtree)),Z(e),i&&W(e);},r._tr_tally=function(e,t,r){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&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(T[r]+u+1)]++,e.dyn_dtree[2*P(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){U(e,2,3),N(e,_,A),function(e){16===e.bi_valid?(D(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,r){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,r){(function(e){!function(e,t){if(!e.setImmediate){var r,i,n,s,o=1,a={},l=false,u=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,r="[object process]"==={}.toString.call(e.process)?function(e){!function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];ve.push(new Ae(e,t)),1!==ve.length||we||ye(Se);}((function(){f(e);}));}:function(){if(e.postMessage&&!e.importScripts){var t=true,r=e.onmessage;return e.onmessage=function(){t=false;},e.postMessage("","*"),e.onmessage=r,t}}()?(s="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",d,false):e.attachEvent("onmessage",d),function(t){e.postMessage(s+t,"*");}):e.MessageChannel?((n=new MessageChannel).port1.onmessage=function(e){f(e.data);},function(e){n.port2.postMessage(e);}):u&&"onreadystatechange"in u.createElement("script")?(i=u.documentElement,function(e){var t=u.createElement("script");t.onreadystatechange=function(){f(e),t.onreadystatechange=null,i.removeChild(t),t=null;},i.appendChild(t);}):function(e){setTimeout(f,0,e);},h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),i=0;i<t.length;i++)t[i]=arguments[i+1];var n={callback:e,args:t};return a[o]=n,r(o),o++},h.clearImmediate=c;}function c(e){delete a[e];}function f(e){if(l)setTimeout(f,0,e);else {var r=a[e];if(r){l=true;try{!function(e){var r=e.callback,i=e.args;switch(i.length){case 0:r();break;case 1:r(i[0]);break;case 2:r(i[0],i[1]);break;case 3:r(i[0],i[1],i[2]);break;default:r.apply(t,i);}}(r);}finally{c(e),l=false;}}}}function d(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&f(+t.data.slice(s.length));}}("undefined"==typeof self?void 0===e?this:e:self);}).call(this,void 0!==d?d:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});},{}]},{},[10])(10)),ze.exports),ht=e.getDefaultExportFromCjs(ut),ct={},ft={},dt={};function pt(){if(Oe)return dt;function e(e){return null==e}return Oe=1,dt.isNothing=e,dt.isObject=function(e){return "object"==typeof e&&null!==e},dt.toArray=function(t){return Array.isArray(t)?t:e(t)?[]:[t]},dt.repeat=function(e,t){var r,i="";for(r=0;r<t;r+=1)i+=e;return i},dt.isNegativeZero=function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},dt.extend=function(e,t){var r,i,n,s;if(t)for(r=0,i=(s=Object.keys(t)).length;r<i;r+=1)e[n=s[r]]=t[n];return e},dt}function gt(){if(Ie)return Re;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 Ie=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},Re=e}function mt(){if(Pe)return Le;Pe=1;var e=gt(),t=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],r=["scalar","sequence","mapping"];return Le=function(i,n){if(n=n||{},Object.keys(n).forEach((function(r){if(-1===t.indexOf(r))throw new e('Unknown option "'+r+'" is met in definition of "'+i+'" YAML type.')})),this.tag=i,this.kind=n.kind||null,this.resolve=n.resolve||function(){return true},this.construct=n.construct||function(e){return e},this.instanceOf=n.instanceOf||null,this.predicate=n.predicate||null,this.represent=n.represent||null,this.defaultStyle=n.defaultStyle||null,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(r){e[r].forEach((function(e){t[String(e)]=r;}));})),t}(n.styleAliases||null),-1===r.indexOf(this.kind))throw new e('Unknown kind "'+this.kind+'" is specified for "'+i+'" YAML type.')},Le}function _t(){if(Ue)return De;Ue=1;var e=pt(),t=gt(),r=mt();function i(e,t,r){var n=[];return e.include.forEach((function(e){r=i(e,t,r);})),e[t].forEach((function(e){r.forEach((function(t,r){t.tag===e.tag&&n.push(r);})),r.push(e);})),r.filter((function(e,t){return -1===n.indexOf(t)}))}function n(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,r={};function i(e){r[e.tag]=e;}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(i);return r}(this.compiledImplicit,this.compiledExplicit);}return n.DEFAULT=null,n.create=function(){var i,s;switch(arguments.length){case 1:i=n.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 n})))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 r})))throw new t("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new n({include:i,explicit:s})},De=n}function yt(){if(je)return Ne;je=1;var e=mt();return Ne=new e("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})}function bt(){if(Ze)return Me;Ze=1;var e=mt();return Me=new e("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})}function vt(){if(Ye)return We;Ye=1;var e=mt();return We=new e("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})}function wt(){if(Ve)return qe;Ve=1;var e=_t();return qe=new e({explicit:[yt(),bt(),vt()]})}function kt(){if(He)return Ge;He=1;var e=mt();return Ge=new e("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return true;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 xt(){if(Ke)return $e;Ke=1;var e=mt();return $e=new e("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return false;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 St(){if(Xe)return Je;Xe=1;var e=pt(),t=mt();function r(e){return 48<=e&&e<=55}function i(e){return 48<=e&&e<=57}return Je=new t("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return false;var t,n,s=e.length,o=0,a=false;if(!s)return false;if("-"!==(t=e[o])&&"+"!==t||(t=e[++o]),"0"===t){if(o+1===s)return true;if("b"===(t=e[++o])){for(o++;o<s;o++)if("_"!==(t=e[o])){if("0"!==t&&"1"!==t)return false;a=true;}return a}if("x"===t){for(o++;o<s;o++)if("_"!==(t=e[o])){if(!(48<=(n=e.charCodeAt(o))&&n<=57||65<=n&&n<=70||97<=n&&n<=102))return false;a=true;}return a}for(;o<s;o++)if("_"!==(t=e[o])){if(!r(e.charCodeAt(o)))return false;a=true;}return a}for(;o<s;o++)if("_"!==(t=e[o])){if(":"===t)break;if(!i(e.charCodeAt(o)))return false;a=true;}return !!a&&(":"!==t||/^(:[0-5]?[0-9])+$/.test(e.slice(o)))},construct:function(e){var t,r,i=e,n=1,s=[];return -1!==i.indexOf("_")&&(i=i.replace(/_/g,"")),"-"!==(t=i[0])&&"+"!==t||("-"===t&&(n=-1),t=(i=i.slice(1))[0]),"0"===i?0:"0"===t?"b"===i[1]?n*parseInt(i.slice(2),2):"x"===i[1]?n*parseInt(i,16):n*parseInt(i,8):-1!==i.indexOf(":")?(i.split(":").forEach((function(e){s.unshift(parseInt(e,10));})),i=0,r=1,s.forEach((function(e){i+=e*r,r*=60;})),n*i):n*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"]}}),Je}function At(){if(et)return Qe;et=1;var e=pt(),t=mt(),r=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))$");var i=/^[-+]?[0-9]+e/;return Qe=new t("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!!r.test(e)},construct:function(e){var t,r,i,n;return r="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,n=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===r?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach((function(e){n.unshift(parseFloat(e,10));})),t=0,i=1,n.forEach((function(e){t+=e*i,i*=60;})),r*t):r*parseFloat(t,10)},predicate:function(t){return "[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||e.isNegativeZero(t))},represent:function(t,r){var n;if(isNaN(t))switch(r){case "lowercase":return ".nan";case "uppercase":return ".NAN";case "camelcase":return ".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(r){case "lowercase":return ".inf";case "uppercase":return ".INF";case "camelcase":return ".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(r){case "lowercase":return "-.inf";case "uppercase":return "-.INF";case "camelcase":return "-.Inf"}else if(e.isNegativeZero(t))return "-0.0";return n=t.toString(10),i.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})}function Et(){if(rt)return tt;rt=1;var e=_t();return tt=new e({include:[wt()],implicit:[kt(),xt(),St(),At()]})}function Ct(){if(nt)return it;nt=1;var e=_t();return it=new e({include:[Et()]})}function Tt(){if(ot)return st;ot=1;var e=mt(),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 st=new e("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&null!==t.exec(e)},construct:function(e){var r,i,n,s,o,a,l,u,h=0,c=null;if(null===(r=t.exec(e)))throw new Error("Date resolve error");if(i=+r[1],n=+r[2]-1,s=+r[3],!r[4])return new Date(Date.UTC(i,n,s));if(o=+r[4],a=+r[5],l=+r[6],r[7]){for(h=r[7].slice(0,3);h.length<3;)h+="0";h=+h;}return r[9]&&(c=6e4*(60*+r[10]+ +(r[11]||0)),"-"===r[9]&&(c=-c)),u=new Date(Date.UTC(i,n,s,o,a,l,h)),c&&u.setTime(u.getTime()-c),u},instanceOf:Date,represent:function(e){return e.toISOString()}})}function zt(){if(lt)return at;lt=1;var e=mt();return at=new e("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return "<<"===e||null===e}})}var Ot,Rt,It,Ft,Bt,Lt,Pt,Dt,Ut,Nt,jt,Mt,Zt,Wt,Yt,qt,Vt,Gt,Ht,$t,Kt,Jt,Xt=e.getAugmentedNamespace(de);function Qt(){if(Rt)return Ot;Rt=1;var e=Xt.Buffer,t=mt(),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";return Ot=new t("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return false;var t,i,n=0,s=e.length,o=r;for(i=0;i<s;i++)if(!((t=o.indexOf(e.charAt(i)))>64)){if(t<0)return false;n+=6;}return n%8==0},construct:function(t){var i,n,s=t.replace(/[\r\n=]/g,""),o=s.length,a=r,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===(n=o%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===n?(u.push(l>>10&255),u.push(l>>2&255)):12===n&&u.push(l>>4&255),e?new e(u):u},predicate:function(t){return e&&e.isBuffer(t)},represent:function(e){var t,i,n="",s=0,o=e.length,a=r;for(t=0;t<o;t++)t%3==0&&t&&(n+=a[s>>18&63],n+=a[s>>12&63],n+=a[s>>6&63],n+=a[63&s]),s=(s<<8)+e[t];return 0===(i=o%3)?(n+=a[s>>18&63],n+=a[s>>12&63],n+=a[s>>6&63],n+=a[63&s]):2===i?(n+=a[s>>10&63],n+=a[s>>4&63],n+=a[s<<2&63],n+=a[64]):1===i&&(n+=a[s>>2&63],n+=a[s<<4&63],n+=a[64],n+=a[64]),n}}),Ot}function er(){if(Ft)return It;Ft=1;var e=mt(),t=Object.prototype.hasOwnProperty,r=Object.prototype.toString;return It=new e("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return true;var i,n,s,o,a,l=[],u=e;for(i=0,n=u.length;i<n;i+=1){if(s=u[i],a=false,"[object Object]"!==r.call(s))return false;for(o in s)if(t.call(s,o)){if(a)return false;a=true;}if(!a)return false;if(-1!==l.indexOf(o))return false;l.push(o);}return true},construct:function(e){return null!==e?e:[]}}),It}function tr(){if(Lt)return Bt;Lt=1;var e=mt(),t=Object.prototype.toString;return Bt=new e("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return true;var r,i,n,s,o,a=e;for(o=new Array(a.length),r=0,i=a.length;r<i;r+=1){if(n=a[r],"[object Object]"!==t.call(n))return false;if(1!==(s=Object.keys(n)).length)return false;o[r]=[s[0],n[s[0]]];}return true},construct:function(e){if(null===e)return [];var t,r,i,n,s,o=e;for(s=new Array(o.length),t=0,r=o.length;t<r;t+=1)i=o[t],n=Object.keys(i),s[t]=[n[0],i[n[0]]];return s}}),Bt}function rr(){if(Dt)return Pt;Dt=1;var e=mt(),t=Object.prototype.hasOwnProperty;return Pt=new e("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return true;var r,i=e;for(r in i)if(t.call(i,r)&&null!==i[r])return false;return true},construct:function(e){return null!==e?e:{}}})}function ir(){if(Nt)return Ut;Nt=1;var e=_t();return Ut=new e({include:[Ct()],implicit:[Tt(),zt()],explicit:[Qt(),er(),tr(),rr()]})}function nr(){if(Mt)return jt;Mt=1;var e=mt();return jt=new e("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:function(){return true},construct:function(){},predicate:function(e){return void 0===e},represent:function(){return ""}})}function sr(){if(Wt)return Zt;Wt=1;var e=mt();return Zt=new e("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:function(e){if(null===e)return false;if(0===e.length)return false;var t=e,r=/\/([gim]*)$/.exec(e),i="";if("/"===t[0]){if(r&&(i=r[1]),i.length>3)return false;if("/"!==t[t.length-i.length-1])return false}return true},construct:function(e){var t=e,r=/\/([gim]*)$/.exec(e),i="";return "/"===t[0]&&(r&&(i=r[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 or(){if(qt)return Yt;var e;qt=1;try{e=Ce("esprima");}catch(t){"undefined"!=typeof window&&(e=window.esprima);}var t=mt();return Yt=new t("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(t){if(null===t)return false;try{var r="("+t+")",i=e.parse(r,{range:!0});return "Program"===i.type&&1===i.body.length&&"ExpressionStatement"===i.body[0].type&&"FunctionExpression"===i.body[0].expression.type}catch(e){return false}},construct:function(t){var r,i="("+t+")",n=e.parse(i,{range:true}),s=[];if("Program"!==n.type||1!==n.body.length||"ExpressionStatement"!==n.body[0].type||"FunctionExpression"!==n.body[0].expression.type)throw new Error("Failed to resolve function");return n.body[0].expression.params.forEach((function(e){s.push(e.name);})),r=n.body[0].expression.body.range,new Function(s,i.slice(r[0]+1,r[1]-1))},predicate:function(e){return "[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})}function ar(){if(Gt)return Vt;Gt=1;var e=_t();return Vt=e.DEFAULT=new e({include:[ir()],explicit:[nr(),sr(),or()]})}function lr(){if(Ht)return ft;Ht=1;var e=pt(),t=gt(),r=function(){if(Be)return Fe;Be=1;var e=pt();function t(e,t,r,i,n){this.name=e,this.buffer=t,this.position=r,this.line=i,this.column=n;}return t.prototype.getSnippet=function(t,r){var i,n,s,o,a;if(!this.buffer)return null;for(t=t||4,r=r||75,i="",n=this.position;n>0&&-1==="\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(n-1));)if(n-=1,this.position-n>r/2-1){i=" ... ",n+=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>r/2-1){s=" ... ",o-=5;break}return a=this.buffer.slice(n,o),e.repeat(" ",t)+i+a+s+"\n"+e.repeat(" ",t+this.position-n+i.length)+"^"},t.prototype.toString=function(e){var t,r="";return this.name&&(r+='in "'+this.name+'" '),r+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(r+=":\n"+t),r},Fe=t}(),i=ir(),n=ar(),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,h=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function c(e){return 10===e||13===e}function f(e){return 9===e||32===e}function d(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 g(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function m(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 _(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var y=new Array(256),b=new Array(256),v=0;v<256;v++)y[v]=m(v)?1:0,b[v]=m(v);function w(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||n,this.onWarning=t.onWarning||null,this.legacy=t.legacy||false,this.json=t.json||false,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 k(e,i){return new t(i,new r(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function x(e,t){throw k(e,t)}function S(e,t){e.onWarning&&e.onWarning.call(null,k(e,t));}var A={YAML:function(e,t,r){var i,n,s;null!==e.version&&x(e,"duplication of %YAML directive"),1!==r.length&&x(e,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(r[0]))&&x(e,"ill-formed argument of the YAML directive"),n=parseInt(i[1],10),s=parseInt(i[2],10),1!==n&&x(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=s<2,1!==s&&2!==s&&S(e,"unsupported YAML version of the document");},TAG:function(e,t,r){var i,n;2!==r.length&&x(e,"TAG directive accepts exactly two arguments"),i=r[0],n=r[1],u.test(i)||x(e,"ill-formed tag handle (first argument) of the TAG directive"),s.call(e.tagMap,i)&&x(e,'there is a previously declared suffix for "'+i+'" tag handle'),h.test(n)||x(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[i]=n;}};function E(e,t,r,i){var n,s,a,l;if(t<r){if(l=e.input.slice(t,r),i)for(n=0,s=l.length;n<s;n+=1)9===(a=l.charCodeAt(n))||32<=a&&a<=1114111||x(e,"expected valid JSON character");else o.test(l)&&x(e,"the stream contains non-printable characters");e.result+=l;}}function C(t,r,i,n){var o,a,l,u;for(e.isObject(i)||x(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(r,a)||(r[a]=i[a],n[a]=true);}function T(e,t,r,i,n,o){var a,l;if(n=String(n),null===t&&(t={}),"tag:yaml.org,2002:merge"===i)if(Array.isArray(o))for(a=0,l=o.length;a<l;a+=1)C(e,t,o[a],r);else C(e,t,o,r);else e.json||s.call(r,n)||!s.call(t,n)||x(e,"duplicated mapping key"),t[n]=o,delete r[n];return t}function z(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):x(e,"a line break is expected"),e.line+=1,e.lineStart=e.position;}function O(e,t,r){for(var i=0,n=e.input.charCodeAt(e.position);0!==n;){for(;f(n);)n=e.input.charCodeAt(++e.position);if(t&&35===n)do{n=e.input.charCodeAt(++e.position);}while(10!==n&&13!==n&&0!==n);if(!c(n))break;for(z(e),n=e.input.charCodeAt(e.position),i++,e.lineIndent=0;32===n;)e.lineIndent++,n=e.input.charCodeAt(++e.position);}return -1!==r&&0!==i&&e.lineIndent<r&&S(e,"deficient indentation"),i}function R(e){var t,r=e.position;return !(45!==(t=e.input.charCodeAt(r))&&46!==t||t!==e.input.charCodeAt(r+1)||t!==e.input.charCodeAt(r+2)||(r+=3,0!==(t=e.input.charCodeAt(r))&&!d(t)))}function I(t,r){1===r?t.result+=" ":r>1&&(t.result+=e.repeat("\n",r-1));}function F(e,t){var r,i,n=e.tag,s=e.anchor,o=[],a=false;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),i=e.input.charCodeAt(e.position);0!==i&&45===i&&d(e.input.charCodeAt(e.position+1));)if(a=true,e.position++,O(e,true,-1)&&e.lineIndent<=t)o.push(null),i=e.input.charCodeAt(e.position);else if(r=e.line,P(e,t,3,false,true),o.push(e.result),O(e,true,-1),i=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&0!==i)x(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return !!a&&(e.tag=n,e.anchor=s,e.kind="sequence",e.result=o,true)}function B(e){var t,r,i,n,o=false,a=false;if(33!==(n=e.input.charCodeAt(e.position)))return false;if(null!==e.tag&&x(e,"duplication of a tag property"),60===(n=e.input.charCodeAt(++e.position))?(o=true,n=e.input.charCodeAt(++e.position)):33===n?(a=true,r="!!",n=e.input.charCodeAt(++e.position)):r="!",t=e.position,o){do{n=e.input.charCodeAt(++e.position);}while(0!==n&&62!==n);e.position<e.length?(i=e.input.slice(t,e.position),n=e.input.charCodeAt(++e.position)):x(e,"unexpected end of the stream within a verbatim tag");}else {for(;0!==n&&!d(n);)33===n&&(a?x(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(t-1,e.position+1),u.test(r)||x(e,"named tag handle cannot contain such characters"),a=true,t=e.position+1)),n=e.input.charCodeAt(++e.position);i=e.input.slice(t,e.position),l.test(i)&&x(e,"tag suffix cannot contain flow indicator characters");}return i&&!h.test(i)&&x(e,"tag name cannot contain such characters: "+i),o?e.tag=i:s.call(e.tagMap,r)?e.tag=e.tagMap[r]+i:"!"===r?e.tag="!"+i:"!!"===r?e.tag="tag:yaml.org,2002:"+i:x(e,'undeclared tag handle "'+r+'"'),true}function L(e){var t,r;if(38!==(r=e.input.charCodeAt(e.position)))return false;for(null!==e.anchor&&x(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!d(r)&&!p(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&x(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),true}function P(t,r,i,n,o){var a,l,u,h,m,v,w,k,S=1,A=false,C=false;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,n&&O(t,true,-1)&&(A=true,t.lineIndent>r?S=1:t.lineIndent===r?S=0:t.lineIndent<r&&(S=-1)),1===S)for(;B(t)||L(t);)O(t,true,-1)?(A=true,u=a,t.lineIndent>r?S=1:t.lineIndent===r?S=0:t.lineIndent<r&&(S=-1)):u=false;if(u&&(u=A||o),1!==S&&4!==i||(w=1===i||2===i?r:r+1,k=t.position-t.lineStart,1===S?u&&(F(t,k)||function(e,t,r){var i,n,s,o,a=e.tag,l=e.anchor,u={},h={},c=null,p=null,g=null,m=false,_=false;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||!d(i)){if(!P(e,r,2,false,true))break;if(e.line===s){for(o=e.input.charCodeAt(e.position);f(o);)o=e.input.charCodeAt(++e.position);if(58===o)d(o=e.input.charCodeAt(++e.position))||x(e,"a whitespace character is expected after the key-value separator within a block mapping"),m&&(T(e,u,h,c,p,null),c=p=g=null),_=true,m=false,n=false,c=e.tag,p=e.result;else {if(!_)return e.tag=a,e.anchor=l,true;x(e,"can not read an implicit mapping pair; a colon is missed");}}else {if(!_)return e.tag=a,e.anchor=l,true;x(e,"can not read a block mapping entry; a multiline key may not be an implicit key");}}else 63===o?(m&&(T(e,u,h,c,p,null),c=p=g=null),_=true,m=true,n=true):m?(m=false,n=true):x(e,"incomplete explicit mapping pair; a key node is missed"),e.position+=1,o=i;if((e.line===s||e.lineIndent>t)&&(P(e,t,4,true,n)&&(m?p=e.result:g=e.result),m||(T(e,u,h,c,p,g),c=p=g=null),O(e,true,-1),o=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==o)x(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return m&&T(e,u,h,c,p,null),_&&(e.tag=a,e.anchor=l,e.kind="mapping",e.result=u),_}(t,k,w))||function(e,t){var r,i,n,s,o,a,l,u,h,c,f=true,p=e.tag,g=e.anchor,m={};if(91===(c=e.input.charCodeAt(e.position)))n=93,a=false,i=[];else {if(123!==c)return false;n=125,a=true,i={};}for(null!==e.anchor&&(e.anchorMap[e.anchor]=i),c=e.input.charCodeAt(++e.position);0!==c;){if(O(e,true,t),(c=e.input.charCodeAt(e.position))===n)return e.position++,e.tag=p,e.anchor=g,e.kind=a?"mapping":"sequence",e.result=i,true;f||x(e,"missed comma between flow collection entries"),h=null,s=o=false,63===c&&d(e.input.charCodeAt(e.position+1))&&(s=o=true,e.position++,O(e,true,t)),r=e.line,P(e,t,1,false,true),u=e.tag,l=e.result,O(e,true,t),c=e.input.charCodeAt(e.position),!o&&e.line!==r||58!==c||(s=true,c=e.input.charCodeAt(++e.position),O(e,true,t),P(e,t,1,false,true),h=e.result),a?T(e,i,m,u,l,h):s?i.push(T(e,null,m,u,l,h)):i.push(l),O(e,true,t),44===(c=e.input.charCodeAt(e.position))?(f=true,c=e.input.charCodeAt(++e.position)):f=false;}x(e,"unexpected end of the stream within a flow collection");}(t,w)?C=true:(l&&function(t,r){var i,n,s,o,a,l=1,u=false,h=r,d=0,p=false;if(124===(o=t.input.charCodeAt(t.position)))n=false;else {if(62!==o)return false;n=true;}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:x(t,"repeat of a chomping mode identifier");else {if(!((s=48<=(a=o)&&a<=57?a-48:-1)>=0))break;0===s?x(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?x(t,"repeat of an indentation width identifier"):(h=r+s-1,u=true);}if(f(o)){do{o=t.input.charCodeAt(++t.position);}while(f(o));if(35===o)do{o=t.input.charCodeAt(++t.position);}while(!c(o)&&0!==o)}for(;0!==o;){for(z(t),t.lineIndent=0,o=t.input.charCodeAt(t.position);(!u||t.lineIndent<h)&&32===o;)t.lineIndent++,o=t.input.charCodeAt(++t.position);if(!u&&t.lineIndent>h&&(h=t.lineIndent),c(o))d++;else {if(t.lineIndent<h){3===l?t.result+=e.repeat("\n",d):1===l&&u&&(t.result+="\n");break}for(n?f(o)?(p=true,t.result+=e.repeat("\n",d+1)):p?(p=false,t.result+=e.repeat("\n",d+1)):0===d?u&&(t.result+=" "):t.result+=e.repeat("\n",d):t.result+=u?e.repeat("\n",d+1):e.repeat("\n",d),u=true,d=0,i=t.position;!c(o)&&0!==o;)o=t.input.charCodeAt(++t.position);E(t,i,t.position,false);}}return true}(t,w)||function(e,t){var r,i,n;if(39!==(r=e.input.charCodeAt(e.position)))return false;for(e.kind="scalar",e.result="",e.position++,i=n=e.position;0!==(r=e.input.charCodeAt(e.position));)if(39===r){if(E(e,i,e.position,true),39!==(r=e.input.charCodeAt(++e.position)))return true;i=n=e.position,e.position++;}else c(r)?(E(e,i,n,true),I(e,O(e,false,t)),i=n=e.position):e.position===e.lineStart&&R(e)?x(e,"unexpected end of the document within a single quoted scalar"):(e.position++,n=e.position);x(e,"unexpected end of the stream within a single quoted scalar");}(t,w)||function(e,t){var r,i,n,s,o,a,l;if(34!==(a=e.input.charCodeAt(e.position)))return false;for(e.kind="scalar",e.result="",e.position++,r=i=e.position;0!==(a=e.input.charCodeAt(e.position));){if(34===a)return E(e,r,e.position,true),e.position++,true;if(92===a){if(E(e,r,e.position,true),c(a=e.input.charCodeAt(++e.position)))O(e,false,t);else if(a<256&&y[a])e.result+=b[a],e.position++;else if((o=120===(l=a)?2:117===l?4:85===l?8:0)>0){for(n=o,s=0;n>0;n--)(o=g(a=e.input.charCodeAt(++e.position)))>=0?s=(s<<4)+o:x(e,"expected hexadecimal character");e.result+=_(s),e.position++;}else x(e,"unknown escape sequence");r=i=e.position;}else c(a)?(E(e,r,i,true),I(e,O(e,false,t)),r=i=e.position):e.position===e.lineStart&&R(e)?x(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position);}x(e,"unexpected end of the stream within a double quoted scalar");}(t,w)?C=true:!function(e){var t,r,i;if(42!==(i=e.input.charCodeAt(e.position)))return false;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!d(i)&&!p(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&x(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(r)||x(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],O(e,true,-1),true}(t)?function(e,t,r){var i,n,s,o,a,l,u,h,g=e.kind,m=e.result;if(d(h=e.input.charCodeAt(e.position))||p(h)||35===h||38===h||42===h||33===h||124===h||62===h||39===h||34===h||37===h||64===h||96===h)return false;if((63===h||45===h)&&(d(i=e.input.charCodeAt(e.position+1))||r&&p(i)))return false;for(e.kind="scalar",e.result="",n=s=e.position,o=false;0!==h;){if(58===h){if(d(i=e.input.charCodeAt(e.position+1))||r&&p(i))break}else if(35===h){if(d(e.input.charCodeAt(e.position-1)))break}else {if(e.position===e.lineStart&&R(e)||r&&p(h))break;if(c(h)){if(a=e.line,l=e.lineStart,u=e.lineIndent,O(e,false,-1),e.lineIndent>=t){o=true,h=e.input.charCodeAt(e.position);continue}e.position=s,e.line=a,e.lineStart=l,e.lineIndent=u;break}}o&&(E(e,n,s,false),I(e,e.line-a),n=s=e.position,o=false),f(h)||(s=e.position+1),h=e.input.charCodeAt(++e.position);}return E(e,n,s,false),!!e.result||(e.kind=g,e.result=m,false)}(t,w,1===i)&&(C=true,null===t.tag&&(t.tag="?")):(C=true,null===t.tag&&null===t.anchor||x(t,"alias node should not have any properties")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===S&&(C=u&&F(t,k))),null!==t.tag&&"!"!==t.tag)if("?"===t.tag){for(h=0,m=t.implicitTypes.length;h<m;h+=1)if((v=t.implicitTypes[h]).resolve(t.result)){t.result=v.construct(t.result),t.tag=v.tag,null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);break}}else s.call(t.typeMap,t.tag)?(v=t.typeMap[t.tag],null!==t.result&&v.kind!==t.kind&&x(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+v.kind+'", not "'+t.kind+'"'),v.resolve(t.result)?(t.result=v.construct(t.result),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):x(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")):x(t,"unknown tag !<"+t.tag+">");return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||C}function D(e){var t,r,i,n,o=e.position,l=false;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(n=e.input.charCodeAt(e.position))&&(O(e,true,-1),n=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==n));){for(l=true,n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!d(n);)n=e.input.charCodeAt(++e.position);for(i=[],(r=e.input.slice(t,e.position)).length<1&&x(e,"directive name must not be less than one character in length");0!==n;){for(;f(n);)n=e.input.charCodeAt(++e.position);if(35===n){do{n=e.input.charCodeAt(++e.position);}while(0!==n&&!c(n));break}if(c(n))break;for(t=e.position;0!==n&&!d(n);)n=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position));}0!==n&&z(e),s.call(A,r)?A[r](e,r,i):S(e,'unknown document directive "'+r+'"');}O(e,true,-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,O(e,true,-1)):l&&x(e,"directives end mark is expected"),P(e,e.lineIndent-1,4,false,true),O(e,true,-1),e.checkLineBreaks&&a.test(e.input.slice(o,e.position))&&S(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,O(e,true,-1)):e.position<e.length-1&&x(e,"end of the stream or a document separator is expected");}function U(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 r=new w(e,t);for(r.input+="\0";32===r.input.charCodeAt(r.position);)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)D(r);return r.documents}function N(e,t,r){var i,n,s=U(e,r);for(i=0,n=s.length;i<n;i+=1)t(s[i]);}function j(e,r){var i=U(e,r);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 ft.loadAll=N,ft.load=j,ft.safeLoadAll=function(t,r,n){N(t,r,e.extend({schema:i},n));},ft.safeLoad=function(t,r){return j(t,e.extend({schema:i},r))},ft}var ur=function(){if(Jt)return Kt;Jt=1;var e=function(){if($t)return ct;$t=1;var e=lr();function t(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}return ct.Type=mt(),ct.Schema=_t(),ct.FAILSAFE_SCHEMA=wt(),ct.JSON_SCHEMA=Et(),ct.CORE_SCHEMA=Ct(),ct.DEFAULT_SAFE_SCHEMA=ir(),ct.DEFAULT_FULL_SCHEMA=ar(),ct.load=e.load,ct.loadAll=e.loadAll,ct.safeLoad=e.safeLoad,ct.safeLoadAll=e.safeLoadAll,ct.YAMLException=gt(),ct.MINIMAL_SCHEMA=wt(),ct.SAFE_SCHEMA=ir(),ct.DEFAULT_SCHEMA=ar(),ct.scan=t("scan"),ct.parse=t("parse"),ct.compose=t("compose"),ct.addConstructor=t("addConstructor"),ct}();return Kt=e}(),hr=e.getDefaultExportFromCjs(ur);class cr{constructor(t,r,i=null){this.url=t,!r||e.isRelativeURL(r)&&!e.isRelativeURL(this.url)?this.path=e.pathForURL(this.url):this.path=r,this.path_for_parent=r||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 dr(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 false}}class fr extends cr{constructor(e,t,r){super(e,t,r),this.zip=null,this.files={},this.root=null,this.path="";}isContainer(){return true}async load(){if(this.zip=new ht,"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(),dr(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=[],r=[];this.zip.forEach(((e,i)=>{i.dir||(t.push(e),r.push(i.async("arraybuffer")));}));const i=await Promise.all(r);for(let r=0;r<i.length;r++){let n=t[r],s=n.split("/").length-1;this.files[n]={data:i[r],type:e.extensionForURL(n),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 dr(t){return new Promise(((r,i)=>{"string"==typeof t?e.Utils.io(t).then((({body:e})=>{try{r(function(e){return hr.safeLoad(e,{json:!0})}(e));}catch(e){i(e);}}),i):(t=Object.assign({},t),r(t));}))}const pr={async loadScene(t,{path:r,type:i}={}){const n=[],s={},o=await this.loadSceneRecursive({url:t,path:r,type:i},null,s,n),{config:a,bundle:l}=this.finalize(o);if(!a)throw n[0];return n.length>0&&n.forEach((t=>{const r=`Failed to import scene: ${t.url}`;e.log("error",r,t),this.trigger("error",{type:"scene_import",message:r,error:t,url:t.url});})),{config:a,bundle:l,texture_nodes:s}},async loadSceneRecursive({url:t,path:r,type:i},n,s={},o=[]){if(!t)return {};const a=function(t,r,i,n=null){return null!=n&&"zip"===n||"string"==typeof t&&!e.isLocalURL(t)&&"zip"===e.extensionForURL(t)?new fr(t,r,i):new cr(t,r,i)}(t,r,n,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 r=[];t.import.forEach((t=>{"object"==typeof t&&(t=e.createObjectURL(new Blob([JSON.stringify(t)]))),r.push(a.resourceFor(t));})),delete t.import;const i=r.map((e=>this.loadSceneRecursive(e,a,s,o))),n=(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(...n,t),{config:t,bundle:a,texture_nodes:s}}catch(e){return e.url=t,o.push(e),{}}},normalize(e,t,r={}){return this.normalizeDataSources(e,t),this.normalizeFonts(e,t),this.normalizeTextures(e,t),this.collectTextures(e,t,r),{config:e,bundle:t,texture_nodes:r}},normalizeDataSources(e,t){e.sources=e.sources||{};for(const r in e.sources)this.normalizeDataSource(e.sources[r],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 r in e.scripts)e.scripts[r]=t.urlFor(e.scripts[r]);}return e},normalizeFonts(e,t){e.fonts=e.fonts||{};const r=Object.values(e.fonts).filter((e=>"external"!==e));for(const e of r){(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 r in e.textures){const i=e.textures[r];i.url&&(i.url=t.urlFor(i.url));}},collectTextures(t,r,i){if(t.styles)for(const e in t.styles){const n=t.styles[e],s=n.texture;if("string"==typeof s&&!t.textures[s]){const t=["styles",e,"texture"];this.addTextureNode(t,r,i);}n.material&&["emission","ambient","diffuse","specular","normal"].forEach((s=>{const o=null!=n.material[s]&&n.material[s].texture;if("string"==typeof o&&!t.textures[o]){const t=["styles",e,"material",s,"texture"];this.addTextureNode(t,r,i);}}));}if(t.styles)for(const n in t.styles){const s=t.styles[n];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",n,"shaders","uniforms",...o];this.addTextureNode(e,r,i);}}));}if(t.layers){const n=[t.layers],s=[["layers"]];for(;n.length>0;){const o=n.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 n in e){if(e[n].texture){const s=e[n].texture;if("string"==typeof s&&!t.textures[s]){const e=[...a,l,"draw",n,"texture"];this.addTextureNode(e,r,i);}}if(e[n].outline&&e[n].outline.texture){const s=e[n].outline.texture;if("string"==typeof s&&!t.textures[s]){const e=[...a,l,"draw",n,"outline","texture"];this.addTextureNode(e,r,i);}}}}else {if(e.isReserved(l))continue;n.push(o[l]),s.push([...a,l]);}}}},addTextureNode(e,t,r){r[JSON.stringify(e)]={path:e,bundle:t};},hoistTextureNodes(e,t,r={}){for(const{path:i,bundle:o}of Object.values(r)){const r=n(e,i);if("string"==typeof r&&null==e.textures[r])if(h(e,i)){const i=t.urlFor(r);e.textures[r]={url:i};}else {const t=o.urlFor(r);e.textures[t]={url:t},s(e,i,t);}}},applyGlobalProperties(e){if(!e.global||0===Object.keys(e.global).length)return e;return f(c(e.global),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=>false===e.lights[t].visible)))&&(e.lights.default_light={type:"directional"}),{config:e,bundle:t}):{}};e.subscribeMixin(pr);class gr{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 r=0;for(;r<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;r++;}}getDescendants(t,r=0){let i=[];if(r<this.max_proxy_descendant_depth){let n=e.TileID.children(t,this.children_cache);if(!n)return;n.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,r+1)));}));}return i}}let mr={},_r={};async function yr(t,r,i=false){_r=mr,mr={};let n=function(t,r){let i={};t.forEach((t=>{const n=e.Geo.unitsPerMeter(t.coords.z),s=Math.pow(2,r-t.style_z),o=n*s,a=e.Geo.metersPerPixel(r),l=Object.assign({},t.meshes,t.pending_label_meshes);for(let r in l){l[r].forEach((r=>{if(r.labels)for(let s in r.labels){if(t.isProxy()&&!_r[s])continue;const l=r.labels[s].container.label,u=r.labels[s].container.linked,h=r.labels[s].ranges;let c={};if(c.discard=br.bind(c),c.build_id=t.build_id,Object.assign(c,l),c.layout=Object.assign({},l.layout),c.layout.repeat_scale=.75,c.layout.repeat_distance=c.layout.repeat_distance||0,c.layout.repeat_distance/=o,c.position=[c.position[0]/n+t.min.x,c.position[1]/n+t.min.y],c.unit_scale=a,"point"===c.type)e.LabelPoint.prototype.updateBBoxes.call(c);else if("straight"===c.type)e.LabelLineStraight.prototype.updateBBoxes.call(c,c.position,c.size,c.angle,c.angle,c.offset);else if(l.obbs){const r=l.obbs.map((r=>{let{x:i,y:s,a:a,w:l,h:u}=r;return i=i/n+t.min.x,s=s/n+t.min.y,l/=o,u/=o,new e.OBB(i,s,a,l,u)}));c.obbs=r,c.aabbs=r.map((e=>e.getExtent()));}i[s]={label:c,linked:u,ranges:h,mesh:r};}}));}}));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,r);e.Collision.startTile("main",{apply_repeat_groups:true,return_hidden:true}),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(n,"main","main");let l=[];return a.forEach((e=>{let t=0;true!==e.show||i&&e.label.breach&&!_r[e.label.id]||(t=1),t&&(mr[e.label.id]=true);let r=true;e.ranges.forEach((i=>{if(!r)return;let n=e.mesh;if(!n.valid)return;let s=n.vertex_layout.offset.a_shape,o=n.vertex_layout.stride;for(let e=0;e<i[1];e++){if(n.vertex_data[i[0]+e*o+s+6]===t)return void(r=false);n.vertex_data[i[0]+e*o+s+6]=t;} -1===l.indexOf(n)&&l.push(n);}));})),l.forEach((e=>e.upload())),t.forEach((e=>e.swapPendingLabels())),{labels:a,containers:n}}function br(t,r=null){if(this.obb)return e.Label.prototype.occluded.call(this,t,r);if(this.obbs)for(let i=0;i<this.obbs.length;i++){let n={aabb:this.aabbs[i],obb:this.obbs[i]};if(e.Label.prototype.occluded.call(n,t,r))return true}return false}class vr{constructor({scene:t}){this.scene=t,this.tiles={},this.pyramid=new gr,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 r=this.tiles[t];null!=r&&r.destroy(),this.forgetTile(r.key),this.scene.requestRedraw();}forEachTile(e){for(let t in this.tiles)e(this.tiles[t]);}removeTiles(e){let t=[];for(let r in this.tiles){e(this.tiles[r])&&t.push(r);}for(let e=0;e<t.length;e++){let r=t[e];this.removeTile(r);}}updateTilesForView(){this.visible_coords={};let e=this.view.findVisibleTileCoordinates();for(let t=0;t<e.length;t++){const r=e[t];this.queueCoordinate(r),this.visible_coords[r.key]=r;}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 r=this.renderable_tiles.filter((e=>e.valid)).filter((e=>e.built));return 0===r.length?Promise.resolve({}):(r.sort(((e,t)=>e.build_id<t.build_id?-1:e.build_id>t.build_id?1:0)),this.collision.zoom===wr(this.view.zoom,this.collision.zoom_steps)&&this.collision.tile_keys===JSON.stringify(r.map((e=>e.key)))&&this.collision.mesh_set===kr(r)?Promise.resolve({}):(this.collision.task||(this.collision.zoom=wr(this.view.zoom,this.collision.zoom_steps),this.collision.tile_keys=JSON.stringify(r.map((e=>e.key))),this.collision.mesh_set=kr(r),this.collision.task={type:"tileManagerUpdateLabels",run:async function(i){const n=await yr(r,t.collision.zoom,t.isLoadingVisibleTiles());t.scene.requestRedraw(),t.collision.task=null,e.Task.finish(i,n),t.updateTileStates();},immediate:true},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=false;this.forEachTile((t=>{if(t.visible&&!t.labeled){const r=this.pyramid.getAncestor(t);if(r)r.setProxyFor(t),e=true;else {const r=this.pyramid.getDescendants(t);for(let i=0;i<r.length;i++)r[i].setProxyFor(t),e=true;}}})),e||(this.view.zoom_direction=0);}updateVisibility(t){if(t.visible=false,t.style_z===this.view.tile_zoom)if(this.visible_coords[t.coords.key])t.visible=true;else for(let r in this.visible_coords)if(e.TileID.isDescendant(t.coords,this.visible_coords[r])){t.visible=true;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,r)=>{let i=this.view.center.meters,n=e.Geo.metersPerTile(t.z)/2,s=e.Geo.metersForTile(t);s.x+=n,s.y-=n;let o=e.Geo.metersForTile(r);o.x+=n,o.y-=n;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,r.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 r in this.scene.sources){let i=this.scene.sources[r];if(!i.builds_geometry_tiles||!i.includesTile(t,this.view.tile_zoom))continue;let n=e.TileID.normalizedKey(t,i,this.view.tile_zoom);if(n&&!this.hasTile(n)){e.log("trace",`load tile ${n}, distance from view center: ${t.center_dist}`);let r=new e.Tile({source:i,coords:t,workers:this.scene.workers,style_z:this.view.baseZoom(t.z),view:this.view});this.keepTile(r),this.buildTile(r);}}}buildTile(e,t){this.tileBuildStart(e.key),this.updateVisibility(e),e.build(this.scene.generation,t);}buildTileStylesCompleted({tile:t,progress:r}){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);}r.done&&(t.built=true),t.buildMeshes(this.scene.styles,r),this.updateTileStates(),this.scene.requestRedraw();}r.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]=true,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 r=[];for(var i in this.tiles)null==this.tiles[i].debug[e]||"function"==typeof t&&true!==t(this.tiles[i])||r.push(this.tiles[i].debug[e]);return r}getDebugSum(e,t){var r=0;for(var i in this.tiles)null==this.tiles[i].debug[e]||"function"==typeof t&&true!==t(this.tiles[i])||(r+=this.tiles[i].debug[e]);return r}getDebugAverage(e,t){return this.getDebugSum(e,t)/Object.keys(this.tiles).length}}function wr(e,t,r=2){return (Math.floor(e*t)/t).toFixed(r)}function kr(e){return JSON.stringify(Object.entries(e).map((([,e])=>Object.entries(e.meshes).map((([,e])=>e.map((e=>e.created_at)))))))}class xr{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 Sr{constructor(e){this.defaults={},this.defaults.culling=true,this.defaults.culling_face=e.BACK,this.defaults.blending=false,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=true,this.defaults.depth_test=true,e.depthFunc(e.LESS),this.culling=new xr({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 xr({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 xr({depth_write:this.defaults.depth_write},(t=>{e.depthMask(t.depth_write);})),this.depth_test=new xr({depth_test:this.defaults.depth_test},(t=>{t.depth_test?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);}));}}class Ar{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,r=this.canvas.height,i=new Uint8Array(t*r*4);this.gl.readPixels(0,0,t,r,this.gl.RGBA,this.gl.UNSIGNED_BYTE,i);let n=this.queue_screenshot.background;n=n&&"transparent"!==n?e.StyleParser.parseColor(n).slice(0,3).map((e=>255*e)):null;let s=new Uint8ClampedArray(t*r*4);for(let e=0;e<r;e++)for(let o=0;o<t;o++){let a=4*((r-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,n&&(u/=255,s[l+0]=s[l+0]*u+n[0]*(1-u),s[l+1]=s[l+1]*u+n[1]*(1-u),s[l+2]=s[l+2]*u+n[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=r,this.screenshot_context=this.screenshot_context||o.getContext("2d");let a=this.screenshot_context,l=new ImageData(s,t,r);a.putImageData(l,0,0);const u=o.toDataURL("image/png"),h=atob(u.slice(22)),c=new Uint8Array(h.length);for(let e=0;e<h.length;++e)c[e]=h.charCodeAt(e);const f=new Blob([c],{type:"image/png"});this.queue_screenshot.resolve({url:u,blob:f,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"),false;if(this.video_capture)return e.log("warn","Video capture already in progress, call Scene.stopVideoCapture() first"),false;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=r=>{if(r.data.size>0&&t.chunks.push(r.data),t.resolve){let r=new Blob(t.chunks,{type:t.options.mimeType}),i=e.createObjectURL(r);if(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:r,type:"webm"});}},t.media_recorder.start();}catch(t){return this.video_capture=null,e.log("error","Scene video capture failed",t),false}return true}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 Er(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i);}return r}function Cr(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?Er(Object(i),true).forEach((function(r){e._defineProperty(t,r,i[r]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Er(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e));}));}return t}class Tr{constructor(t,r){var i;r=r||{},e.subscribeMixin(this),this.id=Tr.id++,this.initialized=false,this.initializing=null,this.sources={},this.view=new e.View(this,r),this.tile_manager=new vr({scene:this}),this.num_workers=r.numWorkers||2,true===r.disableVertexArrayObjects&&(e.VertexArrayObject.disabled=true),e.Utils.use_high_density_display=void 0===r.highDensityDisplay||r.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=true,r.preUpdate&&this.subscribe({pre_update:r.preUpdate}),r.postUpdate&&this.subscribe({post_update:r.postUpdate}),this.render_loop=!r.disableRenderLoop,this.render_loop_active=false,this.render_loop_stop=false,this.render_count=0,this.last_render_count=0,this.render_count_changed=false,this.frame=0,this.last_main_render=-1,this.last_selection_render=-1,this.media_capture=new Ar,this.selection=null,this.selection_feature_count=0,this.fetching_selection_map=null,this.prev_textures=null,this.introspection=true===r.introspection,this.times={},this.resetTime(),this.container=r.container,this.canvas=null,this.contextOptions=r.webGLContextOptions,this.lights=null,this.background=null,this.createListeners(),this.updating=0,this.generation=Tr.generation,this.last_complete_generation=Tr.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,r={}){let n=[],s=()=>{let o=+new Date;i.rebuild(r).then((()=>{if(n.push(+new Date-o),n.length<t)s();else {let r=~~(n.reduce(((e,t)=>e+t))/n.length);e.log("info",`Profiled rebuild ${t} times: ${r} avg (${Math.min(...n)} min, ${Math.max(...n)} max)`);}}));};s();},geometryCountByStyle(){let e={};return i.tile_manager.getRenderableTiles().forEach((t=>{for(let r in t.meshes)e[r]=e[r]||0,t.meshes[r].forEach((t=>{e[r]+=t.geometry_count;}));})),e},geometryCountByBaseStyle(){let e=i.debug.geometryCountByStyle(),t={};for(let r in e){let n=i.styles[r].baseStyle();t[n]=t[n]||0,t[n]+=e[r];}return t},geometryCountTotal(){const e=i.debug.geometryCountByStyle();return Object.keys(e).reduce(((t,r)=>e[r]+t),0)},geometrySizeByStyle(){let e={};return i.tile_manager.getRenderableTiles().forEach((t=>{for(let r in t.meshes)e[r]=e[r]||0,t.meshes[r].forEach((t=>{e[r]+=t.buffer_size;}));})),e},geometrySizeByBaseStyle(){let e=i.debug.geometrySizeByStyle(),t={};for(let r in e){let n=i.styles[r].baseStyle();t[n]=t[n]||0,t[n]+=e[r];}return t},geometrySizeTotal(){const e=i.debug.geometrySizeByStyle();return Object.keys(e).reduce(((t,r)=>e[r]+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=r.logLevel||"warn",e.log.setLevel(this.log_level),e.log.reset();}static create(e,t={}){return new Tr(e,t)}load(t=null,r={}){var i=this;return this.initializing||(e.log.reset(),this.updating++,this.initialized=false,this.view_complete=false,this.times.frame=null,this.times.build=null,(r="string"==typeof r?{base_path:r}:r).blocking=void 0===r.blocking||r.blocking,false!==this.render_loop&&this.setupRenderLoop(),this.createCanvas(),this.prev_textures=this.config&&Object.keys(this.config.textures),this.initializing=this.loadScene(t,r).then((async function({texture_nodes:t}){await i.createWorkers(),i.destroyFeatureSelection(),e.WorkerBroker.postMessage(i.workers,"self.clearFunctionStringCache");const n="object"==typeof i.config_source||i.hasSubscribersFor("load"),s=i.updateConfig({texture_nodes:t,serialize_funcs:n,normalize:false,loading:true,fade_in:true});true===r.blocking&&await s,i.freePreviousTextures(),i.updating--,i.initializing=null,i.initialized=true,i.last_valid_config_source=i.config_source,i.last_valid_options={base_path:r.base_path,file_type:r.file_type},i.requestRedraw();})).catch((t=>{let r,i;if(this.initializing=null,this.updating=0,"YAMLException"===t.name?(r="yaml",i="Error parsing scene YAML"):i="Error initializing scene",this.trigger("error",{type:r,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=false,this.render_loop_stop=true,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=r.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 Sr(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 r=this.config.sources[e];if(r.scripts)for(let e in r.scripts) -1===t.indexOf(r.scripts[e])&&t.push(r.scripts[e]);}return this.external_scripts=t,!(this.external_scripts.length===e.length&&this.external_scripts.every(((t,r)=>t===e[r])))}createWorkers(){return this.updateExternalScripts()&&this.destroyWorkers(),this.workers?Promise.resolve():this.makeWorkers()}makeWorkers(){let t=!!this.gl.getExtension("OES_element_index_uint"),r=[];this.workers=[];for(let i=0;i<this.num_workers;i++){let n=new Worker(Tangram.workerURL);this.workers[i]=n,e.WorkerBroker.addWorker(n),e.log("debug",`Scene.makeWorkers: initializing worker ${i}`);let s=i;r.push(e.WorkerBroker.postMessage(n,"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(r).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=true,this.view.setViewportSize(t,i),this.gl&&r.resize(this.gl,t,i,e.Utils.device_pixel_ratio));}requestRedraw(){this.dirty=true;}immediateRedraw(){this.dirty=true,this.update();}renderLoop(){this.render_loop_active=true,this.update(),e.Task.setState({user_moving_view:this.view.user_input_active}),e.Task.processAll(),this.render_loop_stop?(this.render_loop_stop=false,this.render_loop_active=false):window.requestAnimationFrame(this.renderLoop.bind(this));}setupRenderLoop(){this.render_loop_active||setTimeout((()=>{this.renderLoop();}),0);}update(){let t=this.dirty,r=!!this.selection&&this.selection.hasPendingRequests();var i=!(false===t&&false===r||false===this.initialized||this.updating>0||false===this.ready());return this.trigger("pre_update",i),this.view.update(),!!i&&(this.dirty=false,this.updateDevicePixelRatio(),this.render({main:t,selection:r}),this.updateViewComplete(),this.media_capture.completeScreenshot(),this.trigger("post_update",i),(true===this.animated||this.view.isAnimating())&&(this.dirty=true),this.frame++,e.log("trace","Scene.render()"),true)}render({main:t,selection:r}){var i=this.gl;if(this.updateBackground(),Object.keys(this.lights).forEach((e=>this.lights[e].update())),this.render_count_changed=false,t&&(this.render_count=this.renderPass(),this.last_main_render=this.frame,this.render_count!==this.last_render_count&&(this.render_count_changed=true,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),r){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:false}),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 true}renderPass(t="program",{allow_blend:r}={}){r=null==r||r,this.clearFrame();let i,n=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:r&&l.blend});this.setRenderState(t);}const u=r&&l.blend;if("translucent"===u)this.gl.colorMask(false,false,false,false),this.renderStyle(l.name,t,o),this.gl.colorMask(true,true,true,true),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),n+=this.renderStyle(l.name,t,o),this.gl.disable(this.gl.STENCIL_TEST),this.gl.depthFunc(this.gl.LESS);else if("opaque"!==u&&true===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 r=0;r<e.length;r++)this.gl.stencilFunc(this.gl.GEQUAL,e.length-r,255),n+=this.renderStyle(l.name,t,o,e[r]);this.gl.disable(this.gl.STENCIL_TEST);}else n+=this.renderStyle(l.name,t,o);}else n+=this.renderStyle(l.name,t,o);i=l.blend;}return n}renderStyle(e,t,r,i=null){let n,s=this.styles[e],o=true,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===r))]})).filter((e=>e)),u=Math.max(...l.map((([,e])=>Math.max(...e.map((e=>e.variant.mesh_order))))));for(let r=0;r<u+1;r++)for(let[i,u]of l){let l=true;if(!i.shouldProxyForStyle(e))continue;const h=u.filter((e=>e.variant.mesh_order===r));if(0!==h.length){if(true===o&&(o=false,n=this.setupStyle(s,t),!n))return 0;h.forEach((e=>{ true===l&&(l=false,this.view.setupTile(i,n)),s.render(e)&&this.requestRedraw(),a+=e.geometry_count;}));}}return a}setupStyle(e,t){let r;try{if(r=e.getProgram(t),!r)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})}r.use(),e.setup(),r.uniform("1f","u_time",this.animated?(+new Date-this.start_time)/1e3:0),this.view.setupProgram(r);for(let e in this.lights)this.lights[e].setupProgram(r);return r}clearFrame(){this.initialized&&(this.render_states.depth_write.set({depth_write:true}),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:r,blend:i}={}){if(!this.initialized)return;let n=this.render_states;e=false!==e&&n.defaults.depth_test,t=false!==t&&n.defaults.depth_write,r=false!==r&&n.defaults.culling,i=null!=i?i:n.defaults.blending;let s=this.gl;n.depth_test.set({depth_test:e}),n.depth_write.set({depth_write:t}),n.culling.set({cull:r,face:n.defaults.culling_face}),i?"opaque"===i?n.blending.set({blend:false}):"overlay"===i||"inlay"===i||"translucent"===i?n.blending.set({blend:true,src:s.SRC_ALPHA,dst:s.ONE_MINUS_SRC_ALPHA,src_alpha:s.ONE,dst_alpha:s.ONE_MINUS_SRC_ALPHA}):"add"===i?n.blending.set({blend:true,src:s.ONE,dst:s.ONE}):"multiply"===i&&n.blending.set({blend:true,src:s.ZERO,dst:s.SRC_COLOR}):n.blending.set({blend:false});}getFeatureAt(t,{radius:r}={}){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 r=r>0?{x:r/this.view.size.css.width,y:r/this.view.size.css.height}:null,this.selection.getFeatureAt(i,{radius:r}).then((e=>Object.assign(e,{pixel:t}))).catch((e=>Promise.resolve({error:e})))}async queryFeatures({filter:t,unique:r=true,group_by:i=null,visible:n=null,geometry:s=false}={}){if(!this.initialized)return [];t=e.Utils.serializeWithFunctions(t);const o=true===(r="string"==typeof r?[r]:r)||Array.isArray(r)&&r.indexOf("$id")>-1,a=r&&(t=>{const i=Array.isArray(r)?e.sliceObject(t.properties,r):t.properties,n=o?t.id:null;return s?JSON.stringify({geometry:t.geometry,properties:i,id:n}):JSON.stringify({properties:i,id:n})}),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)),h=await e.WorkerBroker.postMessage(this.workers,"self.queryFeatures",{filter:t,visible:n,geometry:s,tile_keys:u}),c=[],f={},d={};return h.forEach((e=>e.forEach((e=>{if(a){const t=a(e);if(f[t])return;f[t]=true;}if(l){const t=l(e.properties);d[t]=d[t]||[],d[t].push(e);}else c.push(e);})))),l?d:c}rebuild({initial:t=false,new_generation:r=true,sources:i=null,serialize_funcs:n,profile:s=false,fade_in:o=false}={}){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(false));let u={initial:t,new_generation:r,sources:i,serialize_funcs:n,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"),r){this.generation=++Tr.generation;for(let e in this.styles)this.styles[e].setGeneration(this.generation);}this.syncConfigToWorker({serialize_funcs:n}),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(true));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:r,file_type:i}={}){this.config_source=t||this.config_source,"string"==typeof this.config_source?this.base_path=e.pathForURL(r||this.config_source):this.base_path=e.pathForURL(r),this.config_path=this.base_path;const{config:n,bundle:s,texture_nodes:o}=await pr.loadScene(this.config_source,{path:this.base_path,type:i});return this.config=n,this.config_bundle=s,{texture_nodes:o}}setDataSource(t,r){if(!t||!r||!r.type||!r.url&&!r.data)return void e.log("error","No name provided or not a valid config:",t,r);let i=null==this.config.sources[t],n=this.config.sources[t]=Object.assign({},r);return n.data&&"object"==typeof n.data&&(n.url=e.createObjectURL(new Blob([JSON.stringify(n.data)],{type:"application/json"})),delete n.data),i?this.updateConfig({rebuild:{sources:[t]}}):this.rebuild({sources:[t]})}createDataSources(t=false){const r=[],i=Object.keys(this.sources);let n=0;for(var s in this.config.sources){const i=this.config.sources[s],o=this.sources[s];try{const t=Cr(Cr({},i),{},{name:s,id:n++});if(this.sources[s]=e.DataSource.create(t,this.sources),!this.sources[s])throw {}}catch(t){delete this.sources[s];const r=`Could not create data source: ${t.message}`;e.log("warn",`Scene: ${r}`,i),this.trigger("warning",{type:"sources",source:i,message:r});}(t||e.DataSource.tileLayoutChanged(this.sources[s],o))&&r.push(s);}i.forEach((e=>{this.config.sources[e]||(delete this.sources[e],r.push(e));})),r.length>0&&this.tile_manager.removeTiles((e=>r.indexOf(e.source.name)>-1));for(let e in this.config.layers){let t=this.config.layers[e];false!==t.enabled&&t.data&&this.sources[t.data.source]&&(this.sources[t.data.source].builds_geometry_tiles=true);}}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=true;}get animated(){return false!==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=false);for(let t in this.config.lights){if(!this.config.lights[t]||"object"!=typeof this.config.lights[t])continue;let r=this.config.lights[t];r.name=t.replace("-","_"),r.visible=false!==r.visible,r.visible&&(this.lights[r.name]=e.Light.create(this.view,r));}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,r=this.background.computed_color=e.StyleParser.evalCachedColorProperty(this.background.color,{zoom:this.view.tile_zoom});t&&!r.some(((e,r)=>t[r]!==e))||(1===r[3]?this.canvas.style.backgroundColor=`rgba(${r.map((e=>Math.floor(255*e))).join(", ")})`:this.canvas.style.backgroundColor="transparent",this.gl.clearColor(...r));}setIntrospection(e){return e!==this.introspection?(this.introspection=null!=e&&e,this.updating++,this.updateConfig({normalize:false}).then((()=>this.updating--))):Promise.resolve()}updateConfig({loading:t=false,rebuild:r=true,serialize_funcs:i,texture_nodes:n={},normalize:s=true,fade_in:o=false}={}){this.generation=++Tr.generation,this.updating++,this.config=pr.applyGlobalProperties(this.config),s&&pr.normalize(this.config,this.config_bundle,n),pr.hoistTextureNodes(this.config,this.config_bundle,n),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=r?this.rebuild(Object.assign({initial:t,new_generation:false,serialize_funcs:i,fade_in:o},"object"==typeof r&&r)):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=true}={}){let r=t?e.Utils.serializeWithFunctions(this.config):JSON.stringify(this.config);return e.WorkerBroker.postMessage(this.workers,"self.updateConfig",{config:r,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=true,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))},pr.subscribe(this.listeners.scene_loader);}destroyListeners(){this.unsubscribeAll(),this.view.unsubscribe(this.listeners.view),e.Texture.unsubscribe(this.listeners.texture),pr.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:true!==this.view_complete}),this.view_complete=true);}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 zr;Tr.id=0,Tr.generation=0;const Or={map:{},scrollWheelZoom:{},doubleClickZoom:{}};var Rr={leafletLayer:function(t){return function(t){if(void 0!==zr)return new zr(t);if(e.Thread.is_main){let r,i=t.leaflet||window.L,n=i.GridLayer?i.GridLayer:i.TileLayer,s=n===i.GridLayer?"1.x":"0.7.x",o={};return n===i.TileLayer&&(o._addTile=function(){},o._removeTile=function(){},o._reset=function(){n.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=false;},createScene(){this.scene=Tr.create(this.options.scene,{numWorkers:this.options.numWorkers,preUpdate:this.options.preUpdate,postUpdate:this.options.postUpdate,continuousZoom:"1.x"===zr.leafletVersion,wrapView:true!==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(),n.prototype.onAdd.apply(this,arguments),this.hooks.resize=()=>{this._updating_tangram=true,this.updateSize(),this._updating_tangram=false;},t.on("resize",this.hooks.resize),this.hooks.move=()=>{if(!this._updating_tangram){this._updating_tangram=true,this.scene.view.setPanning(true);var r=t.getCenter();r.zoom=Math.max(Math.min(t.getZoom(),t.getMaxZoom()||e.Geo.default_view_max_zoom),t.getMinZoom()),this.scene.view.setView(r),this._mapLayerCount>1&&this.scene.immediateRedraw(),this._updating_tangram=false;}},t.on("move",this.hooks.move),this.hooks.moveend=()=>{this.scene.view.setPanning(false),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:true}),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:false}).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=true,this.updateSize(),this.updateView(),this.reverseTransform(),this._updating_tangram=false,this.fire("init");})).catch((e=>{this.fire("error",e);}));},onRemove(e){n.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,r=document.createElement("div");if(r.setAttribute("data-tile-key",t),r.style.width="256px",r.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",r.appendChild(i),r.style.borderStyle="solid",r.style.borderColor="white",r.style.borderWidth="1px";}return r},modifyScrollWheelBehavior(e){if(this.scene.view.continuous_zoom&&e.scrollWheelZoom&&false!==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=(n=function(e){e._moveEnd(true),e.fire("viewreset");},s=2*e.options.wheelDebounceTime,function(){var e=this,t=arguments;clearTimeout(o),o=setTimeout((function(){o=null,n.apply(e,t);}),s);});Or.scrollWheelZoom._performZoom||(Or.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 n=this._delta/(4*this._map.options.wheelPxPerZoomLevel);this._delta=0,i+n>=this._map.getMaxZoom()?n=this._map.getMaxZoom()-i:i+n<=this._map.getMinZoom()&&(n=this._map.getMinZoom()-i),n&&("center"===e.options.scrollWheelZoom?r(t,e.getCenter(),i+n):r(t,this._lastMousePos,i+n),l(e));}else Or.scrollWheelZoom._performZoom.call(this);},a&&e.scrollWheelZoom.enable();}var n,s,o;},modifyZoomBehavior(e){if(this.scene.view.continuous_zoom&&false!==this.options.modifyZoomBehavior){var t=this;const n=function(t,n,s){e._stop();var o=e._zoom;n=i.latLng(n),s=void 0===s?o:s,s=Math.min(s,e.getMaxZoom());var a=Date.now(),l=75;function u(){var h=(Date.now()-a)/l;h<=1?(e._flyToFrame=i.Util.requestAnimFrame(u,e),r(t,n,o+(s-o)*h)):r(t,n,s)._moveEnd(true);}return e._moveStart(true),u.call(e),e};if(e.doubleClickZoom){const r=e.doubleClickZoom.enabled();e.doubleClickZoom.disable(),Or.doubleClickZoom._onDoubleClick||(Or.doubleClickZoom._onDoubleClick=e.doubleClickZoom._onDoubleClick),e.doubleClickZoom._onDoubleClick=function(e){if(this._map===t._map){var r=this._map,i=r.getZoom(),s=r.options.zoomDelta,o=e.originalEvent.shiftKey?i-s:i+s;"center"===r.options.doubleClickZoom?n(t,r.getCenter(),o):n(t,r.containerPointToLatLng(e.containerPoint),o);}else Or.doubleClickZoom._onDoubleClick.call(this,e);},r&&e.doubleClickZoom.enable();}e._zoomAnimated&&(Or.map._animateZoom||(Or.map._animateZoom=e._animateZoom),e._animateZoom=function(e,r,s,o){this===t._map?(s&&(this._animatingZoom=true,this._animateToCenter=e,this._animateToZoom=r,n(t,e,r)),setTimeout(i.Util.bind(this._onZoomTransitionEnd,this),250)):Or.map._animateZoom.call(this,e,r,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=true;this.hooks.visibilitychange=()=>{e&&(e=false,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=true,this._map.setView([this.scene.view.center.lat,this.scene.view.center.lng],this.scene.view.zoom,{animate:false}),this._updating_tangram=false);},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 r=Object.assign({},t,{leaflet_event:e});this._selection_events.click(r);}));},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 r=Object.assign({},t,{leaflet_event:e});this._selection_events.hover(r);}));},e.on("mousemove",this.hooks.mousemove),this.hooks.mouseout=e=>{"function"==typeof this._selection_events.hover&&this._selection_events.hover({changed:true,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||{});}}),r=function(e,t,r){var n=e._map,s=e.scene,o=n.getZoomScale(r),a=n.getSize().divideBy(2),l=(t instanceof i.Point?t:n.latLngToContainerPoint(t)).subtract(a).multiplyBy(1-1/o),u=n.containerPointToLatLng(a.add(l));return s&&s.view.markUserInput(),n._move(u,r,{flyTo:true})},"function"!=typeof(zr=n.extend(o)).remove&&(zr.prototype.remove=function(){this._map&&this._map.removeLayer(this),this.fire("remove");}),zr.layerBaseClass=n,zr.leafletVersion=s,new zr(t)}}(t)},debug:{log:e.log,yaml:hr,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:Tr,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 Rr}));
|
|
36
|
+
|
|
37
|
+
// Loads each of the chunks produced by the first Rollup pass.
|
|
38
|
+
// The custom AMD define() in intro.js will combined the shared
|
|
39
|
+
// and worker chunks into a worker bundle that can be instantiated
|
|
40
|
+
// via blob URL.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
// This allows the rollup ESM build to work within a <script type="module"> tag
|
|
44
|
+
// Script modules can't expose exports
|
|
45
|
+
try {
|
|
46
|
+
Tangram.debug.ESM = true; // mark build as ES module
|
|
47
|
+
Tangram.debug.SHA = 'd0b887d09a3645aad91a18bd3bd0362d74627da3';
|
|
48
|
+
if (true === true && typeof window === 'object') {
|
|
49
|
+
window.Tangram = Tangram;
|
|
50
|
+
}
|
|
51
|
+
} catch(e) {}
|
|
52
|
+
//# sourceMappingURL=tangram.min.js.map
|