zhihao-ui-react 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +103 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6565 -0
- package/dist/style.css +2 -0
- package/package.json +97 -0
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# zhihao-react-ui
|
|
2
|
+
|
|
3
|
+
## Getting started
|
|
4
|
+
|
|
5
|
+
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
|
6
|
+
|
|
7
|
+
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
|
8
|
+
|
|
9
|
+
## Add your files
|
|
10
|
+
|
|
11
|
+
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
|
|
12
|
+
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
cd existing_repo
|
|
16
|
+
git remote add origin http://192.168.110.213/common/zhihao-react-ui.git
|
|
17
|
+
git branch -M main
|
|
18
|
+
git push -uf origin main
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Integrate with your tools
|
|
22
|
+
|
|
23
|
+
- [ ] [Set up project integrations](http://192.168.110.213/common/zhihao-react-ui/-/settings/integrations)
|
|
24
|
+
|
|
25
|
+
## Collaborate with your team
|
|
26
|
+
|
|
27
|
+
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
|
28
|
+
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
|
29
|
+
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
|
30
|
+
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
|
31
|
+
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
|
32
|
+
|
|
33
|
+
## Test and Deploy
|
|
34
|
+
|
|
35
|
+
Use the built-in continuous integration in GitLab.
|
|
36
|
+
|
|
37
|
+
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
|
|
38
|
+
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
|
39
|
+
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
|
40
|
+
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
|
41
|
+
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
# Editing this README
|
|
46
|
+
|
|
47
|
+
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
|
48
|
+
|
|
49
|
+
## Suggestions for a good README
|
|
50
|
+
|
|
51
|
+
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
|
52
|
+
|
|
53
|
+
## Name
|
|
54
|
+
|
|
55
|
+
Choose a self-explaining name for your project.
|
|
56
|
+
|
|
57
|
+
## Description
|
|
58
|
+
|
|
59
|
+
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
|
60
|
+
|
|
61
|
+
## Badges
|
|
62
|
+
|
|
63
|
+
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
|
64
|
+
|
|
65
|
+
## Visuals
|
|
66
|
+
|
|
67
|
+
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
|
68
|
+
|
|
69
|
+
## Installation
|
|
70
|
+
|
|
71
|
+
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
|
72
|
+
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
|
76
|
+
|
|
77
|
+
## Support
|
|
78
|
+
|
|
79
|
+
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
|
80
|
+
|
|
81
|
+
## Roadmap
|
|
82
|
+
|
|
83
|
+
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
|
84
|
+
|
|
85
|
+
## Contributing
|
|
86
|
+
|
|
87
|
+
State if you are open to contributions and what your requirements are for accepting them.
|
|
88
|
+
|
|
89
|
+
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
|
90
|
+
|
|
91
|
+
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
|
92
|
+
|
|
93
|
+
## Authors and acknowledgment
|
|
94
|
+
|
|
95
|
+
Show your appreciation to those who have contributed to the project.
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
For open source projects, say how it is licensed.
|
|
100
|
+
|
|
101
|
+
## Project status
|
|
102
|
+
|
|
103
|
+
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("antd"),l=require("classnames");l=s(l,1);let u=require("react/jsx-runtime"),d=require("react"),f=require("@ant-design/icons"),p=require("ol"),m=require("plyr");m=s(m,1);let h=require("mpegts.js");h=s(h,1);let g=require("dayjs");g=s(g,1);var _=`--`;function v({danger:e,plain:t,type:n}){return e?`danger`:n===`text`?`text`:n===`link`?`link`:n===`primary`&&t?`primary-outline`:n===`primary`?`primary`:`default`}function y({autoInsertSpace:e=!1,children:t,className:n,p16:r=!1,plain:i=!1,size:a=`middle`,type:o=`default`,...s}){let d=a===`extraSmall`?`small`:a,f=a===`extraSmall`?`extra-small`:a,p=v({danger:s.danger,plain:i,type:o});return(0,u.jsx)(c.Button,{...s,autoInsertSpace:e,className:(0,l.default)(`zh-button`,`zh-button--variant-${p}`,`zh-button--size-${f}`,r&&`zh-button--p16`,n),size:d,type:i?`default`:o,children:t})}function b({children:e,className:t,template:n=``,...r}){return(0,u.jsx)(`fieldset`,{...r,className:(0,l.default)(`zh-button-group`,n===`operation-fix-button`&&`operation-fix-button`,t),children:e})}var x=[],S=c.Cascader;function C(e,t=!0){let n=[];function r(e,i=``){let a=i&&t?`${i}/${e.label}`:e.label;n.push({...e,label:a}),e.children?.forEach(e=>r(e,a))}return e.forEach(e=>r(e)),n}function w(e){let t=new Map;return e.forEach(e=>t.set(e.value,e)),Array.from(t.values())}var T=(0,d.forwardRef)(function({changeOnSelect:e,className:t,forceSearch:n=!0,handleOptionsFunction:r,initialOptions:i=x,initialValue:a,multiple:o=!1,noDataText:s=`暂无数据`,onChange:c,pageSize:l=10,placeholder:f=`输入关键字搜索名称`,requestFunction:p,value:m,...h},g){let[_,v]=(0,d.useState)(m??a),[y,b]=(0,d.useState)(i),[T,E]=(0,d.useState)(()=>C(i)),[D,O]=(0,d.useState)(1),[k,A]=(0,d.useState)(!1),j=(0,d.useCallback)(e=>{let t=e??_;return o?T.filter(e=>(t||[]).includes(e.value)):T.find(e=>e.value===t)},[o,T,_]),M=(0,d.useCallback)(async e=>{if(!n&&!e)return;let t=(await p(D,l,e)).list?.map(r)??[],i=k?t:w(t);A(!1),b(i),E(C(i))},[n,r,D,l,p,k]),N=(0,d.useCallback)(()=>{v(a),O(1),b(i),E(C(i))},[i,a]),P=(0,d.useCallback)(e=>{let t=Array.isArray(e)?e.at(-1):e;v(t),c?.(t,j(t))},[j,c]),ee=(0,d.useCallback)(e=>{e&&M()},[M]);(0,d.useImperativeHandle)(g,()=>({get cascderOptions(){return y},get options(){return T},getSelectedOption:j,handleRequestParamsChanged:A,remoteMethod:M,reset:N}),[y,j,T,M,N]);let te=(0,d.useMemo)(()=>{if(_!=null)return Array.isArray(_)?_:[_]},[_]);return(0,u.jsx)(S,{...h,allowClear:h.allowClear??!0,changeOnSelect:e,className:t,multiple:o,notFoundContent:s,onChange:P,onDropdownVisibleChange:ee,options:y,placeholder:f,value:te})});function E(e){return e.toString().padStart(2,`0`)}function D(e,t=!1){if(!e)return;let n=e instanceof Date?e:new Date(e);if(!Number.isNaN(n.getTime()))return`${`${n.getFullYear()}-${E(n.getMonth()+1)}-${E(n.getDate())}`}T${t?`23:59:59`:`00:00:00`}`}function O(e){return Array.isArray(e)?[D(e[0])??``,D(e[1],!0)??``]:D(e??void 0)}function k(e){return Array.isArray(e)&&e.length>=2?[e[0],e[1]]:void 0}function A(e){return e.getTime()>Date.now()}function j({className:e,disabledDate:t,disabledDateAfterToday:n=!1,onChange:r,type:i=`date`,value:a,...o}){let s=(0,d.useCallback)((e,t)=>{let n=k(t);r?.(n?O(n):void 0)},[r]),f=(0,d.useCallback)((e,t)=>{let n=Array.isArray(t)?t[0]:t;r?.(O(n))},[r]),p={className:(0,l.default)(`zh-date-picker`,e),disabledDate:n?e=>A(new Date(String(e))):t};return i===`daterange`?(0,u.jsx)(c.DatePicker.RangePicker,{...o,...p,onChange:s}):(0,u.jsx)(c.DatePicker,{...o,...p,onChange:f})}var M={lg:4,md:2,sm:2,xl:4,xs:1},N=(0,d.createContext)({breakPoint:`xl`,cols:4,gap:16});function P(e){return e<768?`xs`:e<992?`sm`:e<1200?`md`:e<1920?`lg`:`xl`}function ee(){let[e,t]=(0,d.useState)(()=>typeof window>`u`?`xl`:P(window.innerWidth));return(0,d.useEffect)(()=>{let e=()=>t(P(window.innerWidth));return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function te(e,t){return typeof e==`number`?e:e[t]}function ne(e){return Array.isArray(e)?{columnGap:e[0],css:`${e[1]}px ${e[0]}px`}:{columnGap:e,css:`${e}px`}}function re(e,t){return{offset:e[t]?.offset??e.offset??0,span:e[t]?.span??e.span??1}}function ie(e){return(0,d.isValidElement)(e)?e.type.displayName===`GridItem`:!1}function ae(e,t,n,r){let i=d.Children.toArray(e),a=i.find(e=>ie(e)&&e.props.suffix),o=a&&ie(a)?re(a.props,t).offset+re(a.props,t).span:0,s=r*n-o,c=0,l=-1;return i.forEach((e,n)=>{if(!ie(e)||e.props.suffix||l!==-1)return;let{offset:r,span:i}=re(e.props,t);c+=r+i,c>s&&(l=n)}),l===-1?i:i.map((e,t)=>!ie(e)||e.props.suffix||t<l?e:(0,d.cloneElement)(e,{hidden:!0}))}function oe({children:e,className:t,collapsed:n=!1,collapsedRows:r=1,cols:i=M,gap:a=16,style:o,...s}){let c=ee(),f=te(i,c),p=ne(a),m=n?ae(e,c,f,r):e,h=(0,d.useMemo)(()=>({breakPoint:c,cols:f,gap:p.columnGap}),[c,f,p.columnGap]),g=(0,d.useMemo)(()=>({display:`grid`,gridGap:p.css,gridTemplateColumns:`repeat(${f}, minmax(0, 1fr))`,...o}),[f,p.css,o]);return(0,u.jsx)(N.Provider,{value:h,children:(0,u.jsx)(`div`,{...s,className:(0,l.default)(`zh-grid`,t),style:g,children:m})})}function F({children:e,className:t,hidden:n=!1,offset:r=0,span:i=1,style:a,suffix:o=!1,...s}){let c=(0,d.useContext)(N),f=re({...s,offset:r,span:i,suffix:o},c.breakPoint),p=Math.min(f.span+f.offset,c.cols),m=(0,d.useMemo)(()=>{let e=o?{gridColumnEnd:`span ${f.span+f.offset}`,gridColumnStart:c.cols-f.span-f.offset+1}:{gridColumn:`span ${p} / span ${p}`};return f.offset!==0&&(e.marginLeft=`calc(((100% + ${c.gap}px) / ${f.span+f.offset}) * ${f.offset})`),n&&(e.display=`none`),e},[p,n,c.cols,c.gap,f.offset,f.span,o]),h=(0,d.useMemo)(()=>({...m,...a}),[m,a]);return(0,u.jsx)(`div`,{...s,className:(0,l.default)(`zh-grid-item`,t),hidden:n,style:h,children:e})}F.displayName=`GridItem`;function se({children:e,className:t,...n}){return(0,u.jsx)(`div`,{...n,className:(0,l.default)(`zh-multi-grid`,t),children:e})}var ce=(0,d.createContext)({infoDirection:`horizontal`,labelWidth:`70px`});function le({children:e,cols:t=4,contentWidth:n,gap:r=16,infoDirection:i=`horizontal`,labelWidth:a=`70px`,...o}){let s=(0,d.useMemo)(()=>({contentWidth:n,infoDirection:i,labelWidth:a}),[n,i,a]);return(0,u.jsx)(ce.Provider,{value:s,children:(0,u.jsx)(oe,{...o,cols:t,gap:r,children:e})})}function ue(e){if(!(e==null||e===``))return typeof e==`number`||!Number.isNaN(Number(e))?`${e}px`:String(e)}function de(e,t){return e==null||e===``?t:e}function fe(e,t){if(!t)return e;let n=e.lastIndexOf(`.`);return`${t}${n===-1?``:e.slice(n)}`}function pe(e){return typeof e==`function`?e():e}function me({children:e,className:t,colon:n=!1,defaultValue:r=`--`,fetchFileById:i,fileId:a,infoDirection:o,label:s,labelClassName:p,labelRender:m,labelWidth:h,onClick:g,rewriteFileName:_,showFileName:v=!0,span:y=1,value:b,valueClassName:x,valueNode:S,valueRender:C,...w}){let T=(0,d.useContext)(ce),E=o??T.infoDirection,D=h??T.labelWidth,[O,k]=(0,d.useState)(),A=de(b,r),j=!!(g&&b),M=!!(!b&&a),N=(0,d.useMemo)(()=>({width:E===`horizontal`?ue(D):void 0}),[E,D]),P=(0,d.useCallback)(e=>{e.preventDefault(),g?.(b??void 0)},[g,b]);(0,d.useEffect)(()=>{let e=!0;if(!(!M||!a||!i))return i(a).then(t=>{e&&k(t)}),()=>{e=!1}},[i,a,M]);let ee=O?.name?fe(O.name,_):``;return(0,u.jsx)(F,{label:s,span:y,children:(0,u.jsxs)(`div`,{...w,className:(0,l.default)(`zh-base-item`,E,t),children:[(0,u.jsx)(`div`,{className:(0,l.default)(`zh-base-item-label`,E,p),style:N,children:m?pe(m):`${s??``}${n?`:`:``}`}),(0,u.jsx)(`div`,{className:(0,l.default)(`zh-base-item-value`,x),children:e??S??(j?(0,u.jsx)(c.Typography.Link,{href:`#`,className:`zh-base-item--value--link`,onClick:P,children:b}):null)??(M?(0,u.jsxs)(`div`,{className:`zh-base-item--value--file`,children:[v?(0,u.jsxs)(`span`,{className:`zh-base-item--file-name`,children:[(0,u.jsx)(f.FileOutlined,{className:`zh-base-item--file-icon`}),ee]}):null,(0,u.jsx)(c.Typography.Link,{className:(0,l.default)(v&&`ml-8`),href:O?.path,target:`_blank`,children:`查看/下载`})]}):null)??(C?pe(C):null)??A})]})})}var he=[];function ge(e){return(0,u.jsxs)(`div`,{className:`detail-header__info-pair`,children:[(0,u.jsx)(`div`,{className:`detail-header__info-label`,children:e.label}),(0,u.jsx)(`div`,{className:`detail-header__info-value`,children:e.value??`--`})]},`${e.label}-${e.value??`empty`}`)}function _e({children:e,className:t,extraInfo:n,leftInfos:r=he,menu:i,rightInfos:a=he,rightInfosNode:o,stateDesc:s,stateMeta:c,title:d,...f}){let p=s??c?.intro;return(0,u.jsxs)(`div`,{...f,className:(0,l.default)(`zh-detail-header-card`,t),children:[i?(0,u.jsx)(`div`,{className:`zh-detail-header-menu`,children:i}):null,(0,u.jsxs)(`div`,{className:`zh-detail-header`,children:[(0,u.jsxs)(`div`,{className:`zh-detail-header__left`,children:[(0,u.jsx)(`div`,{className:`zh-detail-header__title`,children:d}),n,r.map(ge)]}),e,o??(0,u.jsxs)(`div`,{className:`zh-detail-header__right`,children:[a.map(ge),p?(0,u.jsx)(`div`,{className:(0,l.default)(`zh-detail-header__state`,c?.state),children:p}):null]})]})]})}function ve(e){return e==null||e===``?`--`:e}function ye({className:e,ellipsis:t=!1,tip:n,title:r,value:i,valueNode:a,...o}){return(0,u.jsxs)(`div`,{...o,className:(0,l.default)(`zh-info-pair`,e),children:[(0,u.jsxs)(`div`,{className:`zh-info-pair__title`,children:[r,n?(0,u.jsx)(`div`,{className:`zh-info-pair__tip`,children:n}):null]}),(0,u.jsx)(`div`,{className:(0,l.default)(`zh-info-pair__value`,t&&`ellipsis`),children:a??ve(i)})]})}function be(e){return(0,u.jsx)(ye,{...e,className:[`zh-detail-sub-title`,e.className].filter(Boolean).join(` `)})}var xe={extraLarge:`920px`,large:`800px`,middle:`600px`,small:`400px`};function I({cancelButtonText:e=`取消`,children:t,className:n,closeOnClickModal:r=!1,confirmButtonDisabled:i=!1,confirmButtonText:a=`确定`,footerNode:o,headerNode:s,modelValue:f,onClose:p,onOpenChange:m,onSubmit:h,open:g,size:_=`middle`,subTitle:v,title:b,width:x,...S}){let C=g??f??!0,w=x??xe[_],T=(0,d.useCallback)(()=>{m?.(!1),p?.()},[p,m]),E=(0,d.useCallback)(()=>h?.(),[h]),D=(0,d.useMemo)(()=>s??(b||v?(0,u.jsxs)(`div`,{className:`zh-dialog__header`,children:[b?(0,u.jsx)(`div`,{className:`zh-dialog__title`,children:b}):null,v?(0,u.jsx)(`div`,{className:`zh-dialog__sub-title`,children:v}):null]}):null),[s,v,b]),O=(0,d.useMemo)(()=>o??(0,u.jsxs)(`div`,{className:`zh-dialog__footer`,children:[(0,u.jsx)(y,{"aria-label":e,onClick:T,children:e}),(0,u.jsx)(y,{"aria-label":a,disabled:i,onClick:E,type:`primary`,children:a})]}),[e,i,a,o,T,E]),k=(0,d.useMemo)(()=>({closable:r}),[r]);return(0,u.jsx)(c.Modal,{...S,centered:!0,className:(0,l.default)(`zh-dialog`,n),footer:O,mask:k,onCancel:T,open:C,title:D,width:w,children:t})}var L=function(e){return e.AUTOCOMPLETE=`autocomplete`,e.FORMAT=`format`,e.INDEX=`index`,e.SELECTION=`selection`,e.TEXT=`text`,e}({}),Se=`$ZH_DIV$`,Ce=[],we=0;function Te(){return we+=1,`key_${Date.now()}_${we}_${Math.random().toString(36).slice(2,11)}`}function Ee(e){return e.map(e=>({...e}))}function De(e,t,n){let r=t.isSameData?n[0]||{}:e;if(t.formatter){let e=t.type===L.FORMAT?t.formatter(r):t.formatter(String(r[t.prop]??``));return t.showFormatter?t.showFormatter(e):e}return r[t.prop]||`--`}var Oe=(0,d.forwardRef)(function({addColumnText:e=`增列`,addRowText:t=`增行`,beforeAddRow:n,canOnlyEditNewlyColumnHeader:r=!1,columns:i=Ce,customAddColumn:a=!0,customAddRow:o=!0,data:s,defaultMinWidth:l=120,isEdit:p=!1,maxColLength:m=10,maxRowLength:h=50,onChange:g,operationNode:_,operationOption:v,rawData:y,rowKey:b=`id`,slots:x},S){let[C,w]=(0,d.useState)(()=>Ee(y??s??[])),[T,E]=(0,d.useState)(i),D=(0,d.useMemo)(()=>({addColumnText:e,addRowText:t,customAddColumn:a,customAddRow:o,isShow:!0,width:150,...v}),[e,t,a,o,v]),O=(0,d.useCallback)(e=>{w(e),g?.(e)},[g]),k=(0,d.useCallback)((e,t,n)=>{O(C.map((r,i)=>i===e?{...r,[t]:n}:r))},[C,O]),A=(0,d.useCallback)((e,t)=>{E(n=>n.map((n,r)=>r===e?{...n,label:t}:n))},[]),j=(0,d.useCallback)((e,t)=>{E(t=>t.filter((t,n)=>n!==e)),O(C.map(e=>{let n={...e};return delete n[t.prop],n}))},[C,O]),M=(0,d.useCallback)(()=>{if(C.length===h){c.message.warning(`最多添加${h}行`);return}let e={[b]:Te()};if(n){let t=n(C);e={...t,[b]:t[b]??Te()}}O([...C,e])},[n,C,h,b,O]),N=(0,d.useCallback)(()=>{if(T.filter(e=>e.isAdd).length>=m){c.message.warning(`最多添加${m}列`);return}let e=String(Date.now());E(t=>[...t,{headerMaxlength:15,isAdd:!0,isEditHeader:!0,isNewlyColumn:!0,label:``,maxlength:15,minWidth:150,prop:e}])},[T,m]),P=(0,d.useCallback)(e=>O(C.filter((t,n)=>n!==e)),[C,O]),ee=(0,d.useCallback)((e,t,n)=>e.slot&&x?.[e.slot]?x[e.slot]({$index:n,row:t}):e.type===L.AUTOCOMPLETE?(0,u.jsx)(c.AutoComplete,{onChange:t=>k(n,e.prop,t),options:(e.completeList??[]).map(e=>({value:e})),placeholder:e.placeholder??`请输入`,value:String(t[e.prop]??``)}):e.type===L.FORMAT&&e.formatter?(0,u.jsx)(`span`,{children:De(t,e,C)}):(0,u.jsx)(c.Input,{maxLength:e.maxlength??20,onChange:t=>k(n,e.prop,t.target.value),placeholder:e.placeholder??`请输入`,showCount:e.showWordLimit,value:String(t[e.prop]??``)}),[C,x,k]),te=(0,d.useMemo)(()=>{let e=T.map((e,t)=>({align:e.align,dataIndex:e.prop,fixed:e.fixed,key:e.key??e.prop,render:(t,n,r)=>p&&e.type!==L.TEXT&&!n.disabled?ee(e,n,r):e.slot&&x?.[e.slot]?x[e.slot]({$index:r,row:n}):De(n,e,C),title:()=>e.headerRender?e.headerRender({$index:t,column:e}):p&&e.isEditHeader&&(r&&e.isNewlyColumn||!r)?(0,u.jsxs)(`div`,{className:`zh-diy-data-table__header-edit`,children:[(0,u.jsx)(c.Input,{maxLength:e.headerMaxlength??20,onChange:e=>A(t,e.target.value),placeholder:`请输入表头`,value:e.label}),e.isAdd?(0,u.jsx)(c.Button,{"aria-label":`删除列`,icon:(0,u.jsx)(f.CloseOutlined,{}),onClick:()=>j(t,e),type:`text`}):null]}):(0,u.jsx)(`span`,{className:e.required?`is-required-label`:void 0,children:e.label}),width:e.width??e.minWidth??l}));return!p||D.isShow===!1?e:[...e,{fixed:`right`,key:`operation`,render:(e,t,n)=>(0,u.jsx)(`div`,{className:`zh-diy-data-table__operation`,children:_?.({$index:n,row:t})??(C.length>1&&!t.disabled?(0,u.jsx)(c.Button,{"aria-label":`删除行`,icon:(0,u.jsx)(f.CloseOutlined,{}),onClick:()=>P(n),type:`text`}):null)}),title:()=>(0,u.jsxs)(`div`,{className:`zh-diy-data-table__operation-header`,children:[D.customAddRow?(0,u.jsx)(c.Button,{"aria-label":D.addRowText,icon:(0,u.jsx)(f.PlusOutlined,{}),onClick:M,type:`link`,children:D.addRowText}):null,D.customAddColumn?(0,u.jsx)(c.Button,{"aria-label":D.addColumnText,icon:(0,u.jsx)(f.PlusOutlined,{}),onClick:N,type:`link`,children:D.addColumnText}):null]}),width:D.width}]},[N,M,r,T,C,l,j,P,D,p,_,ee,x,A]),ne=(0,d.useCallback)(async(e=!0)=>{if(e){let e=new Set;for(let t of T){if(t.required&&C.some(e=>!e[t.prop])){c.message.warning(t.requiredMessage||`${t.label}不能为空`);return}if(t.label){if(e.has(t.label)){c.message.warning(`所有列的表头不可重复`);return}e.add(t.label)}}}let t=Ee(C);return t.forEach((e,n)=>{T.forEach((r,i)=>{if(r.isSameData&&n!==0&&(e[r.prop]=t[0][r.prop]),!(r.varidate&&r.varidate(e[r.prop],e,n)!==!0)){if(r.isAdd){let t=e[r.prop];delete e[r.prop],e[`${r.label}${Se}${i}`]=t}r.formatter&&r.type===L.FORMAT&&(e[r.prop]=r.formatter(e))}})}),{columns:T,data:t}},[T,C]);return(0,d.useImperativeHandle)(S,()=>({formRef:null,getColumns:()=>T,getData:ne,initData:(e,t)=>{let n=Ee(e.length?e:[{[b]:Te()}]);n.forEach(e=>{e[b]||(e[b]=Te())}),O(n),E(t.filter(e=>e.type!==L.INDEX&&e.type!==L.SELECTION))},onAddColumn:N,onAddRow:M,resetColumns:(e,t=!1)=>{E(n=>t?e:[...e,...n.filter(e=>e.isAdd)])},updateColumn:(e,t)=>{E(n=>n.map((n,r)=>r===e?t:n))}}),[N,M,T,ne,b,O]),(0,u.jsx)(c.Form,{className:`zh-diy-data-table`,children:(0,u.jsx)(c.Table,{className:`zh-diy-data-table__table`,columns:te,dataSource:C,pagination:!1,rowKey:b})})});function ke(e){return e==null||e===``?`--`:e}function Ae({className:e,ellipsis:t=!1,tip:n,title:r,value:i,valueNode:a,...o}){return(0,u.jsxs)(`div`,{...o,className:(0,l.default)(`zh-edit-info-pair`,e),children:[(0,u.jsxs)(`div`,{className:`zh-edit-info-pair__title`,children:[r,n?(0,u.jsx)(`div`,{className:`zh-edit-info-pair__tip`,children:n}):null]}),(0,u.jsx)(`div`,{className:(0,l.default)(`zh-edit-info-pair__value`,t&&`ellipsis`),children:a??ke(i)})]})}var je=(0,u.jsx)(f.CloseOutlined,{});function Me({canDelete:e=!1,className:t,downLoadUrl:n=``,fileId:r=0,fileName:i=`--`,onDeleteFile:a,title:o=``,...s}){let p=(0,d.useCallback)(()=>{e&&a?.(r)},[e,r,a]);return(0,u.jsxs)(`div`,{...s,className:(0,l.default)(`zh-file-wrapper`,t),children:[o?(0,u.jsx)(`div`,{className:`zh-file-wrapper__header`,children:o}):null,(0,u.jsxs)(`div`,{className:`zh-file-wrapper__main`,children:[(0,u.jsxs)(`div`,{className:`zh-file-wrapper__file`,children:[(0,u.jsx)(`div`,{className:`zh-file-wrapper__file-type`,children:(0,u.jsx)(f.FileOutlined,{})}),(0,u.jsx)(`div`,{className:`zh-file-wrapper__file-name`,children:i})]}),(0,u.jsx)(c.Typography.Link,{className:`zh-file-wrapper__download`,download:`download`,href:n,children:`查看/下载`}),e?(0,u.jsx)(c.Button,{"aria-label":`删除文件`,className:`zh-file-wrapper__delete`,icon:je,onClick:p,type:`text`}):null]})]})}function Ne(e,t,n){if(e===``)return e;let r=Number(e);return Number.isNaN(r)?e:n!==void 0&&r>=Number(n)?String(n):t!==void 0&&r<=Number(t)?String(t):e}function Pe({className:e,max:t,min:n,onBlur:r,onChange:i,size:a=`default`,value:o,...s}){let f=a==="default"?`middle`:a,p=(0,d.useCallback)(e=>{let a=Ne(e.target.value,n,t);a!==e.target.value&&i?.(a),r?.(e)},[t,n,r,i]),m=(0,d.useCallback)(e=>i?.(e.target.value),[i]);return(0,u.jsx)(`div`,{className:(0,l.default)(`zh-input`,e),"data-testid":`zh-input`,children:(0,u.jsx)(c.Input,{...s,onBlur:p,onChange:m,size:f,value:o})})}function Fe(e,{integer:t=0,maxLength:n=0,precision:r=0}={}){let i=e?.toString()??``;if(r===0)i=i.replace(/[^\d]/g,``),i=i.replace(/^0\d+/g,`0`),t!==0&&(i=i.slice(0,t));else{i=i.replace(/[^\-\d.]/g,``),i=i.replace(/^[^\-\d]/g,``),i=i.replace(/\.{2}/g,`.`),i=i.replace(/^0(\d+)/g,`$1`);let[e=``,n]=i.split(`.`),a=t===0?e:e.slice(0,t);i=n===void 0?a:`${a}.${n.slice(0,r)}`}return n!==0&&(i=i.slice(0,n)),i===``?``:i.includes(`.`)?i:Number(i)}function Ie({className:e,integer:t,max:n,maxLength:r,min:i,onBlur:a,onChange:o,precision:s,value:f,...p}){let m=(0,d.useCallback)(e=>{o?.(Fe(e,{integer:t,maxLength:r,precision:s}))},[t,r,o,s]),h=(0,d.useCallback)(e=>{f!==``&&f!==void 0&&(n!==void 0&&Number(f)>Number(n)&&o?.(String(n)),i!==void 0&&Number(f)<Number(i)&&o?.(String(i))),a?.(e)},[n,i,a,o,f]),g=(0,d.useCallback)(e=>m(e.target.value),[m]);return(0,u.jsx)(`div`,{className:(0,l.default)(`zh-input-number`,e),children:(0,u.jsx)(c.Input,{...p,onBlur:h,onChange:g,value:f})})}function Le({className:e,spinProps:t,...n}){return(0,u.jsx)(`output`,{...n,"aria-label":`loading`,className:(0,l.default)(`zh-loading`,e),children:(0,u.jsx)(`div`,{className:`zh-loading__wrap`,children:(0,u.jsx)(c.Spin,{...t})})})}function Re(e,t){return e>t?1:e<t?-1:0}function ze(e,t,n){if(e[0]<=t)return 0;let r=e.length;if(t<=e[r-1])return r-1;if(typeof n==`function`){for(let i=1;i<r;++i){let r=e[i];if(r===t)return i;if(r<t)return n(t,e[i-1],r)>0?i-1:i}return r-1}if(n>0){for(let n=1;n<r;++n)if(e[n]<t)return n-1;return r-1}if(n<0){for(let n=1;n<r;++n)if(e[n]<=t)return n;return r-1}for(let n=1;n<r;++n){if(e[n]==t)return n;if(e[n]<t)return e[n-1]-t<t-e[n]?n-1:n}return r-1}function Be(e,t){let n=Array.isArray(t)?t:[t],r=n.length;for(let t=0;t<r;t++)e[e.length]=n[t]}function Ve(e,t){let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function He(e,t,n){let r=t||Re;return e.every(function(t,i){if(i===0)return!0;let a=r(e[i-1],t);return!(a>0||n&&a===0)})}var Ue=`ol-hidden`,We=`ol-unselectable`,Ge=`ol-control`,Ke=`ol-collapsed`;new RegExp([`^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)`,`(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)`,`(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)`,`(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?`,`(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))`,`(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))`,`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(``),`i`);var qe=typeof navigator<`u`&&navigator.userAgent!==void 0?navigator.userAgent.toLowerCase():``;qe.includes(`safari`)&&!qe.includes(`chrom`)&&(qe.includes(`version/15.4`)||/cpu (os|iphone os) 15_4 like mac os x/.test(qe)),qe.includes(`webkit`)&&qe.includes(`edge`),qe.includes(`macintosh`);var Je=typeof WorkerGlobalScope<`u`&&typeof OffscreenCanvas<`u`&&self instanceof WorkerGlobalScope,Ye=typeof Image<`u`&&Image.prototype.decode;(function(){let e=!1;try{let t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener(`_`,null,t),window.removeEventListener(`_`,null,t)}catch{}return e})();function Xe(e,t,n,r){let i;return i=n&&n.length?n.shift():Je?new class extends OffscreenCanvas{style={}}(e??300,t??150):document.createElement(`canvas`),e&&(i.width=e),t&&(i.height=t),i.getContext(`2d`,r)}var Ze;function Qe(){return Ze||=Xe(1,1),Ze}function $e(e){let t=e.canvas;t.width=1,t.height=1,e.clearRect(0,0,1,1)}function et(e,t){let n=t.parentNode;n&&n.replaceChild(e,t)}function tt(e){for(;e.lastChild;)e.lastChild.remove()}function nt(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){let t=this.childNodes.indexOf(e);if(t===-1)throw Error(`Node to remove was not found`);return this.childNodes.splice(t,1),e},insertBefore:function(e,t){let n=this.childNodes.indexOf(t);if(n===-1)throw Error(`Reference node not found`);return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t===`firstElementChild`?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function rt(e){return typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas}var R={CHANGE:`change`,ERROR:`error`,BLUR:`blur`,CLEAR:`clear`,CONTEXTMENU:`contextmenu`,CLICK:`click`,DBLCLICK:`dblclick`,DRAGENTER:`dragenter`,DRAGOVER:`dragover`,DROP:`drop`,FOCUS:`focus`,KEYDOWN:`keydown`,KEYPRESS:`keypress`,LOAD:`load`,RESIZE:`resize`,TOUCHMOVE:`touchmove`,WHEEL:`wheel`};function it(){}function at(e){let t,n,r;return function(){let i=Array.prototype.slice.call(arguments);return(!n||this!==r||!Ve(i,n))&&(r=this,n=i,t=e.apply(this,arguments)),t}}function ot(e){function t(){let t;try{t=e()}catch(e){return Promise.reject(e)}return t instanceof Promise?t:Promise.resolve(t)}return t()}var st={POSTRENDER:`postrender`,MOVESTART:`movestart`,MOVEEND:`moveend`,LOADSTART:`loadstart`,LOADEND:`loadend`},ct={PROPERTYCHANGE:`propertychange`};function lt(e){for(let t in e)delete e[t]}function ut(e){let t;for(t in e)return!1;return!t}function dt(e,t,n,r,i){if(i){let i=n;n=function(a){return e.removeEventListener(t,n),i.call(r??this,a)}}else r&&r!==e&&(n=n.bind(r));let a={target:e,type:t,listener:n};return e.addEventListener(t,n),a}function ft(e,t,n,r){return dt(e,t,n,r,!0)}function z(e){e&&e.target&&(e.target.removeEventListener(e.type,e.listener),lt(e))}var pt=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},mt=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},ht=class extends pt{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let n=this.listeners_||={},r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){let t=typeof e==`string`,n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;let i=t?new mt(e):e;i.target||=this.eventTarget_||this;let a=this.dispatching_||={},o=this.pendingRemovals_||={};n in a||(a[n]=0,o[n]=0),++a[n];let s;for(let e=0,t=r.length;e<t;++e)if(s=`handleEvent`in r[e]?r[e].handleEvent(i):r[e].call(this,i),s===!1||i.propagationStopped){s=!1;break}if(--a[n]===0){let e=o[n];for(delete o[n];e--;)this.removeEventListener(n,it);delete a[n]}return s}disposeInternal(){this.listeners_&<(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;let n=this.listeners_[e];if(!n)return;let r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=it,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},gt=class extends ht{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(R.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=Array(n);for(let i=0;i<n;++i)r[i]=dt(this,e[i],t);return r}return dt(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){let r=e.length;n=Array(r);for(let i=0;i<r;++i)n[i]=ft(this,e[i],t)}else n=ft(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)_t(n);else if(Array.isArray(e))for(let n=0,r=e.length;n<r;++n)this.removeEventListener(e[n],t);else this.removeEventListener(e,t)}};gt.prototype.on,gt.prototype.once,gt.prototype.un;function _t(e){if(Array.isArray(e))for(let t=0,n=e.length;t<n;++t)z(e[t]);else z(e)}function B(){throw Error(`Unimplemented abstract method.`)}var vt=0;function V(e){return e.ol_uid||=String(++vt)}var yt=class extends mt{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},bt=class extends gt{constructor(e){super(),this.on,this.once,this.un,V(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new yt(n,e,t)),n=ct.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new yt(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){let r=this.values_||={};if(n)r[e]=t;else{let n=r[e];r[e]=t,n!==t&&this.notify(e,n)}}setProperties(e,t){for(let n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||={},e.values_)}unset(e,t){if(this.values_&&e in this.values_){let n=this.values_[e];delete this.values_[e],ut(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},xt=class extends bt{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents=`auto`),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let e=0,t=this.listenerKeys.length;e<t;++e)z(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=e,e){let t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==it&&this.listenerKeys.push(dt(e,st.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e==`string`?document.getElementById(e):e}},St=class extends xt{constructor(e){e||={},super({element:document.createElement(`div`),render:e.render,target:e.target}),this.ulElement_=document.createElement(`ul`),this.collapsed_=e.collapsed===void 0?!0:e.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible===void 0?!0:e.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className===void 0?`ol-attribution`:e.className,n=e.tipLabel===void 0?`Attributions`:e.tipLabel,r=e.expandClassName===void 0?t+`-expand`:e.expandClassName,i=e.collapseLabel===void 0?`›`:e.collapseLabel,a=e.collapseClassName===void 0?t+`-collapse`:e.collapseClassName;typeof i==`string`?(this.collapseLabel_=document.createElement(`span`),this.collapseLabel_.textContent=i,this.collapseLabel_.className=a):this.collapseLabel_=i;let o=e.label===void 0?`i`:e.label;typeof o==`string`?(this.label_=document.createElement(`span`),this.label_.textContent=o,this.label_.className=r):this.label_=o;let s=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement(`button`),this.toggleButton_.setAttribute(`type`,`button`),this.toggleButton_.setAttribute(`aria-expanded`,String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(s),this.toggleButton_.addEventListener(R.CLICK,this.handleClick_.bind(this),!1);let c=t+` `+We+` `+Ge+(this.collapsed_&&this.collapsible_?` `+Ke:``)+(this.collapsible_?``:` ol-uncollapsible`),l=this.element;l.className=c,l.appendChild(this.toggleButton_),l.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){let t=this.getMap().getAllLayers(),n=new Set(t.flatMap(t=>t.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(e=>n.add(e)):n.add(this.attributions_)),!this.overrideCollapsible_){let e=!t.some(e=>e.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(e)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&=(this.element.style.display=`none`,!1);return}let t=await Promise.all(this.collectSourceAttributions_(e).map(e=>ot(()=>e))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?``:`none`,this.renderedVisible_=n),!Ve(t,this.renderedAttributions_)){tt(this.ulElement_);for(let e=0,n=t.length;e<n;++e){let n=document.createElement(`li`);n.innerHTML=t[e],this.ulElement_.appendChild(n)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Ke),this.collapsed_?et(this.collapseLabel_,this.label_):et(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute(`aria-expanded`,String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle(`ol-uncollapsible`),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}},Ct={ADD:`add`,REMOVE:`remove`},wt={LENGTH:`length`},Tt=class extends mt{constructor(e,t,n){super(e),this.element=t,this.index=n}},Et=class extends bt{constructor(e,t){if(super(),this.on,this.once,this.un,t||={},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let e=1,t=this.array_.length;e<t;++e)this.assertUnique_(this.array_[e],e);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(wt.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw Error(`Index out of bounds: `+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new Tt(Ct.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Tt(Ct.REMOVE,t,e)),t}setAt(e,t){if(e>=this.getLength()){this.insertAt(e,t);return}if(e<0)throw Error(`Index out of bounds: `+e);this.unique_&&this.assertUnique_(t,e);let n=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Tt(Ct.REMOVE,n,e)),this.dispatchEvent(new Tt(Ct.ADD,t,e))}updateLength_(){this.set(wt.LENGTH,this.array_.length)}assertUnique_(e,t){let n=this.array_;for(let r=0,i=n.length;r<i;++r)if(n[r]===e&&r!==t)throw Error(`Duplicate item added to a unique collection`)}};function Dt(e){return e**3}function Ot(e){return 1-Dt(1-e)}function kt(e){return 3*e*e-2*e*e*e}var At=class extends xt{constructor(e){e||={},super({element:document.createElement(`div`),render:e.render,target:e.target});let t=e.className===void 0?`ol-rotate`:e.className,n=e.label===void 0?`⇧`:e.label,r=e.compassClassName===void 0?`ol-compass`:e.compassClassName;this.label_=null,typeof n==`string`?(this.label_=document.createElement(`span`),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));let i=e.tipLabel?e.tipLabel:`Reset rotation`,a=document.createElement(`button`);a.className=t+`-reset`,a.setAttribute(`type`,`button`),a.title=i,a.appendChild(this.label_),a.addEventListener(R.CLICK,this.handleClick_.bind(this),!1);let o=t+` `+We+` `+Ge,s=this.element;s.className=o,s.appendChild(a),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration===void 0?250:e.duration,this.autoHide_=e.autoHide===void 0?!0:e.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Ue)}handleClick_(e){e.preventDefault(),this.callResetNorth_===void 0?this.resetNorth_():this.callResetNorth_()}resetNorth_(){let e=this.getMap().getView();if(!e)return;let t=e.getRotation();t!==void 0&&(this.duration_>0&&t%(2*Math.PI)!=0?e.animate({rotation:0,duration:this.duration_,easing:Ot}):e.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let e=`rotate(`+n+`rad)`;if(this.autoHide_){let e=this.element.classList.contains(Ue);!e&&n===0?this.element.classList.add(Ue):e&&n!==0&&this.element.classList.remove(Ue)}this.label_.style.transform=e}this.rotation_=n}},jt=class extends xt{constructor(e){e||={},super({element:document.createElement(`div`),target:e.target});let t=e.className===void 0?`ol-zoom`:e.className,n=e.delta===void 0?1:e.delta,r=e.zoomInClassName===void 0?t+`-in`:e.zoomInClassName,i=e.zoomOutClassName===void 0?t+`-out`:e.zoomOutClassName,a=e.zoomInLabel===void 0?`+`:e.zoomInLabel,o=e.zoomOutLabel===void 0?`–`:e.zoomOutLabel,s=e.zoomInTipLabel===void 0?`Zoom in`:e.zoomInTipLabel,c=e.zoomOutTipLabel===void 0?`Zoom out`:e.zoomOutTipLabel,l=document.createElement(`button`);l.className=r,l.setAttribute(`type`,`button`),l.title=s,l.appendChild(typeof a==`string`?document.createTextNode(a):a),l.addEventListener(R.CLICK,this.handleClick_.bind(this,n),!1);let u=document.createElement(`button`);u.className=i,u.setAttribute(`type`,`button`),u.title=c,u.appendChild(typeof o==`string`?document.createTextNode(o):o),u.addEventListener(R.CLICK,this.handleClick_.bind(this,-n),!1);let d=t+` `+We+` `+Ge,f=this.element;f.className=d,f.appendChild(l),f.appendChild(u),this.duration_=e.duration===void 0?250:e.duration}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let t=this.getMap().getView();if(!t)return;let n=t.getZoom();if(n!==void 0){let r=t.getConstrainedZoom(n+e);this.duration_>0?(t.getAnimating()&&t.cancelAnimations(),t.animate({zoom:r,duration:this.duration_,easing:Ot})):t.setZoom(r)}}};function Mt(e){e||={};let t=new Et;return(e.zoom===void 0||e.zoom)&&t.push(new jt(e.zoomOptions)),(e.rotate===void 0||e.rotate)&&t.push(new At(e.rotateOptions)),(e.attribution===void 0||e.attribution)&&t.push(new St(e.attributionOptions)),t}var H={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Nt(e){let t=zt();for(let n=0,r=e.length;n<r;++n)Kt(t,e[n]);return t}function Pt(e,t,n){return Bt(Math.min.apply(null,e),Math.min.apply(null,t),Math.max.apply(null,e),Math.max.apply(null,t),n)}function Ft(e,t,n){let r,i;return r=t<e[0]?e[0]-t:e[2]<t?t-e[2]:0,i=n<e[1]?e[1]-n:e[3]<n?n-e[3]:0,r*r+i*i}function It(e,t){return Lt(e,t[0],t[1])}function Lt(e,t,n){return e[0]<=t&&t<=e[2]&&e[1]<=n&&n<=e[3]}function Rt(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=t[0],s=t[1],c=H.UNKNOWN;return o<n?c|=H.LEFT:o>i&&(c|=H.RIGHT),s<r?c|=H.BELOW:s>a&&(c|=H.ABOVE),c===H.UNKNOWN&&(c=H.INTERSECTING),c}function zt(){return[1/0,1/0,-1/0,-1/0]}function Bt(e,t,n,r,i){return i?(i[0]=e,i[1]=t,i[2]=n,i[3]=r,i):[e,t,n,r]}function Vt(e){return Bt(1/0,1/0,-1/0,-1/0,e)}function Ht(e,t){let n=e[0],r=e[1];return Bt(n,r,n,r,t)}function Ut(e,t,n,r,i){return qt(Vt(i),e,t,n,r)}function Wt(e,t){return e[0]==t[0]&&e[2]==t[2]&&e[1]==t[1]&&e[3]==t[3]}function Gt(e,t){return t[0]<e[0]&&(e[0]=t[0]),t[2]>e[2]&&(e[2]=t[2]),t[1]<e[1]&&(e[1]=t[1]),t[3]>e[3]&&(e[3]=t[3]),e}function Kt(e,t){t[0]<e[0]&&(e[0]=t[0]),t[0]>e[2]&&(e[2]=t[0]),t[1]<e[1]&&(e[1]=t[1]),t[1]>e[3]&&(e[3]=t[1])}function qt(e,t,n,r,i){for(;n<r;n+=i)Jt(e,t[n],t[n+1]);return e}function Jt(e,t,n){e[0]=Math.min(e[0],t),e[1]=Math.min(e[1],n),e[2]=Math.max(e[2],t),e[3]=Math.max(e[3],n)}function Yt(e,t){let n;return n=t(Zt(e)),n||(n=t(Qt(e)),n)||(n=t(on(e)),n)||(n=t(an(e)),n)?n:!1}function Xt(e){let t=0;return cn(e)||(t=W(e)*U(e)),t}function Zt(e){return[e[0],e[1]]}function Qt(e){return[e[2],e[1]]}function $t(e){return[(e[0]+e[2])/2,(e[1]+e[3])/2]}function en(e,t){let n;if(t===`bottom-left`)n=Zt(e);else if(t===`bottom-right`)n=Qt(e);else if(t===`top-left`)n=an(e);else if(t===`top-right`)n=on(e);else throw Error(`Invalid corner`);return n}function tn(e,t,n,r,i){let[a,o,s,c,l,u,d,f]=nn(e,t,n,r);return Bt(Math.min(a,s,l,d),Math.min(o,c,u,f),Math.max(a,s,l,d),Math.max(o,c,u,f),i)}function nn(e,t,n,r){let i=t*r[0]/2,a=t*r[1]/2,o=Math.cos(n),s=Math.sin(n),c=i*o,l=i*s,u=a*o,d=a*s,f=e[0],p=e[1];return[f-c+d,p-l-u,f-c-d,p-l+u,f+c-d,p+l+u,f+c+d,p+l-u,f-c+d,p-l-u]}function U(e){return e[3]-e[1]}function rn(e,t,n){let r=n||zt();return sn(e,t)?(e[0]>t[0]?r[0]=e[0]:r[0]=t[0],e[1]>t[1]?r[1]=e[1]:r[1]=t[1],e[2]<t[2]?r[2]=e[2]:r[2]=t[2],e[3]<t[3]?r[3]=e[3]:r[3]=t[3]):Vt(r),r}function an(e){return[e[0],e[3]]}function on(e){return[e[2],e[3]]}function W(e){return e[2]-e[0]}function sn(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function cn(e){return e[2]<e[0]||e[3]<e[1]}function ln(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e}function un(e,t,n){let r=!1,i=Rt(e,t),a=Rt(e,n);if(i===H.INTERSECTING||a===H.INTERSECTING)r=!0;else{let o=e[0],s=e[1],c=e[2],l=e[3],u=t[0],d=t[1],f=n[0],p=n[1],m=(p-d)/(f-u),h,g;a&H.ABOVE&&!(i&H.ABOVE)&&(h=f-(p-l)/m,r=h>=o&&h<=c),!r&&a&H.RIGHT&&!(i&H.RIGHT)&&(g=p-(f-c)*m,r=g>=s&&g<=l),!r&&a&H.BELOW&&!(i&H.BELOW)&&(h=f-(p-s)/m,r=h>=o&&h<=c),!r&&a&H.LEFT&&!(i&H.LEFT)&&(g=p-(f-o)*m,r=g>=s&&g<=l)}return r}function dn(e,t,n,r){if(cn(e))return Vt(n);let i=[];if(r>1){let t=e[2]-e[0],n=e[3]-e[1];for(let a=0;a<r;++a)i.push(e[0]+t*a/r,e[1],e[2],e[1]+n*a/r,e[2]-t*a/r,e[3],e[0],e[3]-n*a/r)}else i=[e[0],e[1],e[2],e[1],e[2],e[3],e[0],e[3]];t(i,i,2);let a=[],o=[];for(let e=0,t=i.length;e<t;e+=2)a.push(i[e]),o.push(i[e+1]);return Pt(a,o,n)}function fn(e,t){let n=t.getExtent(),r=$t(e);if(t.canWrapX()&&(r[0]<n[0]||r[0]>=n[2])){let t=W(n),i=Math.floor((r[0]-n[0])/t)*t;e[0]-=i,e[2]-=i}return e}function pn(e,t,n){if(t.canWrapX()){let r=t.getExtent();if(!isFinite(e[0])||!isFinite(e[2]))return[[r[0],e[1],r[2],e[3]]];fn(e,t);let i=W(r);if(W(e)>i&&!n)return[[r[0],e[1],r[2],e[3]]];if(e[0]<r[0])return[[e[0]+i,e[1],r[2],e[3]],[r[0],e[1],e[2],e[3]]];if(e[2]>r[2])return[[e[0],e[1],r[2],e[3]],[r[0],e[1],e[2]-i,e[3]]]}return[e]}function G(e,t,n){return Math.min(Math.max(e,t),n)}function mn(e,t,n,r,i,a){let o=i-n,s=a-r;if(o!==0||s!==0){let c=((e-n)*o+(t-r)*s)/(o*o+s*s);c>1?(n=i,r=a):c>0&&(n+=o*c,r+=s*c)}return hn(e,t,n,r)}function hn(e,t,n,r){let i=n-e,a=r-t;return i*i+a*a}function gn(e){let t=e.length;for(let n=0;n<t;n++){let r=n,i=Math.abs(e[n][n]);for(let a=n+1;a<t;a++){let t=Math.abs(e[a][n]);t>i&&(i=t,r=a)}if(i===0)return null;let a=e[r];e[r]=e[n],e[n]=a;for(let r=n+1;r<t;r++){let i=-e[r][n]/e[n][n];for(let a=n;a<t+1;a++)n==a?e[r][a]=0:e[r][a]+=i*e[n][a]}}let n=Array(t);for(let r=t-1;r>=0;r--){n[r]=e[r][t]/e[r][r];for(let i=r-1;i>=0;i--)e[i][t]-=e[i][r]*n[r]}return n}function _n(e){return e*180/Math.PI}function vn(e){return e*Math.PI/180}function yn(e,t){let n=e%t;return n*t<0?n+t:n}function bn(e,t,n){return e+n*(t-e)}function xn(e,t){let n=10**t;return Math.round(e*n)/n}function Sn(e,t){return Math.floor(xn(e,t))}function Cn(e,t){return Math.ceil(xn(e,t))}function wn(e,t,n){if(e>=t&&e<n)return e;let r=n-t;return((e-t)%r+r)%r+t}function Tn(e,t){return e[0]+=+t[0],e[1]+=+t[1],e}function En(e,t){let n=!0;for(let r=e.length-1;r>=0;--r)if(e[r]!=t[r]){n=!1;break}return n}function Dn(e,t){let n=Math.cos(t),r=Math.sin(t),i=e[0]*n-e[1]*r,a=e[1]*n+e[0]*r;return e[0]=i,e[1]=a,e}var On={info:1,warn:2,error:3,none:4},kn=On.info;function An(...e){kn>On.warn||console.warn(...e)}var jn={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},Mn=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent===void 0?null:e.extent,this.worldExtent_=e.worldExtent===void 0?null:e.worldExtent,this.axisOrientation_=e.axisOrientation===void 0?`enu`:e.axisOrientation,this.global_=e.global===void 0?!1:e.global,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||jn[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},Nn=6378137,Pn=Math.PI*Nn,Fn=[-Pn,-Pn,Pn,Pn],In=[-180,-85,180,85],Ln=Nn*Math.log(Math.tan(Math.PI/2)),Rn=class extends Mn{constructor(e){super({code:e,units:`m`,extent:Fn,global:!0,worldExtent:In,getPointResolution:function(e,t){return e/Math.cosh(t[1]/Nn)}})}},zn=[new Rn(`EPSG:3857`),new Rn(`EPSG:102100`),new Rn(`EPSG:102113`),new Rn(`EPSG:900913`),new Rn(`http://www.opengis.net/def/crs/EPSG/0/3857`),new Rn(`http://www.opengis.net/gml/srs/epsg.xml#3857`)];function Bn(e,t,n,r){let i=e.length;n=n>1?n:2,r??=n,t===void 0&&(t=n>2?e.slice():Array(i));for(let n=0;n<i;n+=r){t[n]=Pn*e[n]/180;let r=Nn*Math.log(Math.tan(Math.PI*(+e[n+1]+90)/360));r>Ln?r=Ln:r<-Ln&&(r=-Ln),t[n+1]=r}return t}function Vn(e,t,n,r){let i=e.length;n=n>1?n:2,r??=n,t===void 0&&(t=n>2?e.slice():Array(i));for(let n=0;n<i;n+=r)t[n]=180*e[n]/Pn,t[n+1]=360*Math.atan(Math.exp(e[n+1]/Nn))/Math.PI-90;return t}var Hn=6378137,Un=[-180,-90,180,90],Wn=Math.PI*Hn/180,Gn=class extends Mn{constructor(e,t){super({code:e,units:`degrees`,extent:Un,axisOrientation:t,global:!0,metersPerUnit:Wn,worldExtent:Un})}},Kn=[new Gn(`CRS:84`),new Gn(`EPSG:4326`,`neu`),new Gn(`urn:ogc:def:crs:OGC:1.3:CRS84`),new Gn(`urn:ogc:def:crs:OGC:2:84`),new Gn(`http://www.opengis.net/def/crs/OGC/1.3/CRS84`),new Gn(`http://www.opengis.net/gml/srs/epsg.xml#4326`,`neu`),new Gn(`http://www.opengis.net/def/crs/EPSG/0/4326`,`neu`)],qn={};function Jn(e){return qn[e]||qn[e.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,`EPSG:$3`)]||null}function Yn(e,t){qn[e]=t}var Xn={};function Zn(e,t,n){let r=e.getCode(),i=t.getCode();r in Xn||(Xn[r]={}),Xn[r][i]=n}function Qn(e,t){return e in Xn&&t in Xn[e]?Xn[e][t]:null}var $n=.9996,K=.00669438,er=K*K,tr=er*K,nr=K/(1-K),rr=Math.sqrt(1-K),ir=(1-rr)/(1+rr),ar=ir*ir,or=ar*ir,sr=or*ir,cr=sr*ir,lr=1-K/4-3*er/64-5*tr/256,ur=.002514607064228144,dr=26390466021299826e-22,fr=35*tr/3072,pr=3/2*ir-27/32*or+269/512*cr,mr=21/16*ar-55/32*sr,hr=151/96*or-417/128*cr,gr=1097/512*sr,_r=6378137;function vr(e,t,n){let r=e-5e5,i=(n.north?t:t-1e7)/$n/(_r*lr),a=i+pr*Math.sin(2*i)+mr*Math.sin(4*i)+hr*Math.sin(6*i)+gr*Math.sin(8*i),o=Math.sin(a),s=o*o,c=Math.cos(a),l=o/c,u=l*l,d=u*u,f=1-K*s,p=_r/Math.sqrt(1-K*s),m=(1-K)/f,h=nr*c**2,g=h*h,_=r/(p*$n),v=_*_,y=v*_,b=y*_,x=b*_,S=x*_,C=a-l/m*(v/2-b/24*(5+3*u+10*h-4*g-9*nr))+S/720*(61+90*u+298*h+45*d-252*nr-3*g),w=(_-y/6*(1+2*u+h)+x/120*(5-2*h+28*u-3*g+8*nr+24*d))/c;return w=wn(w+vn(wr(n.number)),-Math.PI,Math.PI),[_n(w),_n(C)]}var yr=-80,br=84,xr=-180,Sr=180;function Cr(e,t,n){e=wn(e,xr,Sr),t<yr?t=yr:t>br&&(t=br);let r=vn(t),i=Math.sin(r),a=Math.cos(r),o=i/a,s=o*o,c=s*s,l=vn(e),u=vn(wr(n.number)),d=_r/Math.sqrt(1-K*i**2),f=nr*a**2,p=a*wn(l-u,-Math.PI,Math.PI),m=p*p,h=m*p,g=h*p,_=g*p,v=_*p,y=_r*(lr*r-ur*Math.sin(2*r)+dr*Math.sin(4*r)-fr*Math.sin(6*r)),b=$n*d*(p+h/6*(1-s+f)+_/120*(5-18*s+c+72*f-58*nr))+5e5,x=$n*(y+d*o*(m/2+g/24*(5-s+9*f+4*f**2)+v/720*(61-58*s+c+600*f-330*nr)));return n.north||(x+=1e7),[b,x]}function wr(e){return(e-1)*6-180+3}var Tr=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Er(e){let t=0;for(let n of Tr){let r=e.match(n);if(r){t=parseInt(r[1]);break}}if(!t)return null;let n=0,r=!1;return t>32700&&t<32761?n=t-32700:t>32600&&t<32661&&(r=!0,n=t-32600),n?{number:n,north:r}:null}function Dr(e,t){return function(n,r,i,a){let o=n.length;i=i>1?i:2,a??=i,r||=i>2?n.slice():Array(o);for(let i=0;i<o;i+=a){let a=n[i],o=n[i+1],s=e(a,o,t);r[i]=s[0],r[i+1]=s[1]}return r}}function Or(e){return Er(e)?new Mn({code:e,units:`m`}):null}function kr(e){let t=Er(e.getCode());return t?{forward:Dr(Cr,t),inverse:Dr(vr,t)}:null}function Ar(e,t,n){n||=6371008.8;let r=vn(e[1]),i=vn(t[1]),a=(i-r)/2,o=vn(t[0]-e[0])/2,s=Math.sin(a)*Math.sin(a)+Math.sin(o)*Math.sin(o)*Math.cos(r)*Math.cos(i);return 2*n*Math.atan2(Math.sqrt(s),Math.sqrt(1-s))}var jr=[kr],Mr=[Or],Nr=!0;function Pr(e){Nr=!(e===void 0||e)}function Fr(e,t){if(t!==void 0){for(let n=0,r=e.length;n<r;++n)t[n]=e[n];t=t}else t=e.slice();return t}function Ir(e){Yn(e.getCode(),e),Zn(e,e,Fr)}function Lr(e){e.forEach(Ir)}function q(e){if(typeof e!=`string`)return e;let t=Jn(e);if(t)return t;for(let t of Mr){let n=t(e);if(n)return n}return null}function Rr(e,t,n,r){e=q(e);let i,a=e.getPointResolutionFunc();if(a){if(i=a(t,n),r&&r!==e.getUnits()){let t=e.getMetersPerUnit();t&&(i=i*t/jn[r])}}else{let a=e.getUnits();if(a==`degrees`&&!r||r==`degrees`)i=t;else{let o=Kr(e,q(`EPSG:4326`));if(!o&&a!==`degrees`)i=t*e.getMetersPerUnit();else{let e=[n[0]-t/2,n[1],n[0]+t/2,n[1],n[0],n[1]-t/2,n[0],n[1]+t/2];e=o(e,e,2),i=(Ar(e.slice(0,2),e.slice(2,4))+Ar(e.slice(4,6),e.slice(6,8)))/2}let s=r?jn[r]:e.getMetersPerUnit();s!==void 0&&(i/=s)}}return i}function zr(e){Lr(e),e.forEach(function(t){e.forEach(function(e){t!==e&&Zn(t,e,Fr)})})}function Br(e,t,n,r){e.forEach(function(e){t.forEach(function(t){Zn(e,t,n),Zn(t,e,r)})})}function Vr(e,t){return e?typeof e==`string`?q(e):e:q(t)}function Hr(e){return(function(t,n,r,i){let a=t.length;r=r===void 0?2:r,i??=r,n=n===void 0?Array(a):n;for(let o=0;o<a;o+=i){let a=e(t.slice(o,o+r)),s=a.length;for(let e=0,r=i;e<r;++e)n[o+e]=e>=s?t[o+e]:a[e]}return n})}function Ur(e,t){return Pr(),Yr(e,`EPSG:4326`,t===void 0?`EPSG:3857`:t)}function Wr(e,t){let n=Yr(e,t===void 0?`EPSG:3857`:t,`EPSG:4326`),r=n[0];return(r<-180||r>180)&&(n[0]=yn(r+180,360)-180),n}function Gr(e,t){if(e===t)return!0;let n=e.getUnits()===t.getUnits();return(e.getCode()===t.getCode()||Kr(e,t)===Fr)&&n}function Kr(e,t){let n=e.getCode(),r=t.getCode(),i=Qn(n,r);if(i)return i;let a=null,o=null;for(let n of jr)a||=n(e),o||=n(t);if(!a&&!o)return null;let s=`EPSG:4326`;if(!o){let e=Qn(s,r);e&&(i=qr(a.inverse,e))}else if(a)i=qr(a.inverse,o.forward);else{let e=Qn(n,s);e&&(i=qr(e,o.forward))}return i&&(Ir(e),Ir(t),Zn(e,t,i)),i}function qr(e,t){return function(n,r,i,a){return r=e(n,r,i,a),t(r,r,i,a)}}function Jr(e,t){return Kr(q(e),q(t))}function Yr(e,t,n){let r=Jr(t,n);if(!r){let e=q(t).getCode(),r=q(n).getCode();throw Error(`No transform available between ${e} and ${r}`)}return r(e,void 0,e.length)}function Xr(e,t,n,r){return dn(e,Jr(t,n),void 0,r)}var J=null;function Zr(){return J}function Qr(e,t){return J?Yr(e,t,J):e}function $r(e,t){return J?Yr(e,J,t):(Nr&&!En(e,[0,0])&&e[0]>=-180&&e[0]<=180&&e[1]>=-90&&e[1]<=90&&(Nr=!1,An(`Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.`)),e)}function ei(e,t){return J?Xr(e,t,J):e}function ti(e,t){return J?Xr(e,J,t):e}function ni(){zr(zn),zr(Kn),Br(Kn,zn,Bn,Vn)}ni();var Y={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function X(e,t){if(!e)throw Error(t)}var ri={ANIMATING:0,INTERACTING:1},Z={CENTER:`center`,RESOLUTION:`resolution`,ROTATION:`rotation`};function ii(e,t,n){return(function(r,i,a,o,s){if(!r)return;if(!i&&!t)return r;let c=t?0:a[0]*i,l=t?0:a[1]*i,u=s?s[0]:0,d=s?s[1]:0,f=e[0]+c/2+u,p=e[2]-c/2+u,m=e[1]+l/2+d,h=e[3]-l/2+d;f>p&&(f=(p+f)/2,p=f),m>h&&(m=(h+m)/2,h=m);let g=G(r[0],f,p),_=G(r[1],m,h);if(o&&n&&i){let e=30*i;g+=-e*Math.log(1+Math.max(0,f-r[0])/e)+e*Math.log(1+Math.max(0,r[0]-p)/e),_+=-e*Math.log(1+Math.max(0,m-r[1])/e)+e*Math.log(1+Math.max(0,r[1]-h)/e)}return[g,_]})}function ai(e){return e}function oi(){return[1,0,0,1,0,0]}function Q(e,t){let n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function si(e,t,n,r,i,a,o,s){let c=Math.sin(a),l=Math.cos(a);return e[0]=r*l,e[1]=i*c,e[2]=-r*c,e[3]=i*l,e[4]=o*r*l-s*r*c+t,e[5]=o*i*c+s*i*l+n,e}function ci(e,t){let n=li(t);X(n!==0,`Transformation matrix cannot be inverted`);let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];return e[0]=o/n,e[1]=-i/n,e[2]=-a/n,e[3]=r/n,e[4]=(a*c-o*s)/n,e[5]=-(r*c-i*s)/n,e}function li(e){return e[0]*e[3]-e[1]*e[2]}var ui=[1e5,1e5,1e5,1e5,2,2];function di(e){return`matrix(`+e.join(`, `)+`)`}function fi(e){return e.substring(7,e.length-1).split(`,`).map(parseFloat)}function pi(e,t){let n=fi(e),r=fi(t);for(let e=0;e<6;++e)if(Math.round((n[e]-r[e])*ui[e])!==0)return!1;return!0}function mi(e,t,n,r,i,a,o){a||=[],o||=2;let s=0;for(let c=t;c<n;c+=r){let t=e[c],n=e[c+1];a[s++]=i[0]*t+i[2]*n+i[4],a[s++]=i[1]*t+i[3]*n+i[5];for(let t=2;t<o;t++)a[s++]=e[c+t]}return a&&a.length!=s&&(a.length=s),a}function hi(e,t,n,r,i,a,o){o||=[];let s=Math.cos(i),c=Math.sin(i),l=a[0],u=a[1],d=0;for(let i=t;i<n;i+=r){let t=e[i]-l,n=e[i+1]-u;o[d++]=l+t*s-n*c,o[d++]=u+t*c+n*s;for(let t=i+2;t<i+r;++t)o[d++]=e[t]}return o&&o.length!=d&&(o.length=d),o}function gi(e,t,n,r,i,a,o,s){s||=[];let c=o[0],l=o[1],u=0;for(let o=t;o<n;o+=r){let t=e[o]-c,n=e[o+1]-l;s[u++]=c+i*t,s[u++]=l+a*n;for(let t=o+2;t<o+r;++t)s[u++]=e[t]}return s&&s.length!=u&&(s.length=u),s}function _i(e,t,n,r,i,a,o){o||=[];let s=0;for(let c=t;c<n;c+=r){o[s++]=e[c]+i,o[s++]=e[c+1]+a;for(let t=c+2;t<c+r;++t)o[s++]=e[t]}return o&&o.length!=s&&(o.length=s),o}var vi=oi(),yi=[NaN,NaN],bi=class extends bt{constructor(){super(),this.extent_=zt(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=at((e,t,n)=>{if(!n)return this.getSimplifiedGeometry(t);let r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return B()}closestPointXY(e,t,n,r){return B()}containsXY(e,t){return this.closestPointXY(e,t,yi,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t||=[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return B()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Vt(e),this.extentRevision_=this.getRevision()}return ln(this.extent_,e)}rotate(e,t){B()}scale(e,t,n){B()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return B()}getType(){return B()}applyTransform(e){B()}intersectsExtent(e){return B()}translate(e,t){B()}transform(e,t){let n=q(e),r=n.getUnits()==`tile-pixels`?function(e,r,i){let a=n.getExtent(),o=n.getWorldExtent(),s=U(o)/U(a);si(vi,o[0],o[3],s,-s,0,0,0);let c=mi(e,0,e.length,i,vi,r),l=Jr(n,t);return l?l(c,c,i):c}:Jr(n,t);return this.applyTransform(r),this}},xi=class extends bi{constructor(){super(),this.layout=`XY`,this.stride=2,this.flatCoordinates}computeExtent(e){return Ut(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return B()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=Ci(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){B()}setLayout(e,t,n){let r;if(e)r=Ci(e);else{for(let e=0;e<n;++e){if(t.length===0){this.layout=`XY`,this.stride=2;return}t=t[0]}r=t.length,e=Si(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith(`XYZ`)?3:2,this.stride),this.changed())}rotate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();hi(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||=$t(this.getExtent());let r=this.getFlatCoordinates();if(r){let i=this.getStride();gi(r,0,r.length,i,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();_i(n,0,n.length,r,e,t,n),this.changed()}}};function Si(e){let t;return e==2?t=`XY`:e==3?t=`XYZ`:e==4&&(t=`XYZM`),t}function Ci(e){let t;return e==`XY`?t=2:e==`XYZ`||e==`XYM`?t=3:e==`XYZM`&&(t=4),t}function wi(e,t,n,r){let i=0,a=e[n-r],o=e[n-r+1],s=0,c=0;for(;t<n;t+=r){let n=e[t]-a,r=e[t+1]-o;i+=c*n-s*r,s=n,c=r}return i/2}function Ti(e,t,n,r){let i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a];i+=wi(e,t,o,r),t=o}return i}function Ei(e,t,n,r,i,a,o){let s=e[t],c=e[t+1],l=e[n]-s,u=e[n+1]-c,d;if(l===0&&u===0)d=t;else{let f=((i-s)*l+(a-c)*u)/(l*l+u*u);if(f>1)d=n;else if(f>0){for(let i=0;i<r;++i)o[i]=bn(e[t+i],e[n+i],f);o.length=r;return}else d=t}for(let t=0;t<r;++t)o[t]=e[d+t];o.length=r}function Di(e,t,n,r,i){let a=e[t],o=e[t+1];for(t+=r;t<n;t+=r){let n=e[t],r=e[t+1],s=hn(a,o,n,r);s>i&&(i=s),a=n,o=r}return i}function Oi(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];i=Di(e,t,o,r,i),t=o}return i}function ki(e,t,n,r,i,a,o,s,c,l,u){if(t==n)return l;let d,f;if(i===0){if(f=hn(o,s,e[t],e[t+1]),f<l){for(d=0;d<r;++d)c[d]=e[t+d];return c.length=r,f}return l}u||=[NaN,NaN];let p=t+r;for(;p<n;)if(Ei(e,p-r,p,r,o,s,u),f=hn(o,s,u[0],u[1]),f<l){for(l=f,d=0;d<r;++d)c[d]=u[d];c.length=r,p+=r}else p+=r*Math.max((Math.sqrt(f)-Math.sqrt(l))/i|0,1);if(a&&(Ei(e,n-r,t,r,o,s,u),f=hn(o,s,u[0],u[1]),f<l)){for(l=f,d=0;d<r;++d)c[d]=u[d];c.length=r}return l}function Ai(e,t,n,r,i,a,o,s,c,l,u){u||=[NaN,NaN];for(let d=0,f=n.length;d<f;++d){let f=n[d];l=ki(e,t,f,r,i,a,o,s,c,l,u),t=f}return l}function ji(e,t,n,r){for(let r=0,i=n.length;r<i;++r)e[t++]=n[r];return t}function Mi(e,t,n,r){for(let i=0,a=n.length;i<a;++i){let a=n[i];for(let n=0;n<r;++n)e[t++]=a[n]}return t}function Ni(e,t,n,r,i){i||=[];let a=0;for(let o=0,s=n.length;o<s;++o){let s=Mi(e,t,n[o],r);i[a++]=s,t=s}return i.length=a,i}function Pi(e,t,n,r,i){i=i===void 0?[]:i;let a=0;for(let o=t;o<n;o+=r)i[a++]=e.slice(o,o+r);return i.length=a,i}function Fi(e,t,n,r,i){i=i===void 0?[]:i;let a=0;for(let o=0,s=n.length;o<s;++o){let s=n[o];i[a++]=Pi(e,t,s,r,i[a]),t=s}return i.length=a,i}function Ii(e,t,n,r,i,a,o){let s=(n-t)/r;if(s<3){for(;t<n;t+=r)a[o++]=e[t],a[o++]=e[t+1];return o}let c=Array(s);c[0]=1,c[s-1]=1;let l=[t,n-r],u=0;for(;l.length>0;){let n=l.pop(),a=l.pop(),o=0,s=e[a],d=e[a+1],f=e[n],p=e[n+1];for(let t=a+r;t<n;t+=r){let n=e[t],r=e[t+1],i=mn(n,r,s,d,f,p);i>o&&(u=t,o=i)}o>i&&(c[(u-t)/r]=1,a+r<u&&l.push(a,u),u+r<n&&l.push(u,n))}for(let n=0;n<s;++n)c[n]&&(a[o++]=e[t+n*r],a[o++]=e[t+n*r+1]);return o}function Li(e,t){return t*Math.round(e/t)}function Ri(e,t,n,r,i,a,o){if(t==n)return o;let s=Li(e[t],i),c=Li(e[t+1],i);t+=r,a[o++]=s,a[o++]=c;let l,u;do if(l=Li(e[t],i),u=Li(e[t+1],i),t+=r,t==n)return a[o++]=l,a[o++]=u,o;while(l==s&&u==c);for(;t<n;){let n=Li(e[t],i),d=Li(e[t+1],i);if(t+=r,n==l&&d==u)continue;let f=l-s,p=u-c,m=n-s,h=d-c;if(f*h==p*m&&(f<0&&m<f||f==m||f>0&&m>f)&&(p<0&&h<p||p==h||p>0&&h>p)){l=n,u=d;continue}a[o++]=l,a[o++]=u,s=l,c=u,l=n,u=d}return a[o++]=l,a[o++]=u,o}function zi(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c<l;++c){let l=n[c];o=Ri(e,t,l,r,i,a,o),s.push(o),t=l}return o}var Bi=class e extends xi{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new e(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,r){return r<Ft(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Di(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ki(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return wi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Pi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){let n=[];return n.length=Ii(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,n,0),new e(n,`XY`)}getType(){return`LinearRing`}intersectsExtent(e){return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||=[],this.flatCoordinates.length=Mi(this.flatCoordinates,0,e,this.stride),this.changed()}},Vi=class e extends xi{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){let t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,n,r){let i=this.flatCoordinates,a=hn(e,t,i[0],i[1]);if(a<r){let e=this.stride;for(let t=0;t<e;++t)n[t]=i[t];return n.length=e,a}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return Ht(this.flatCoordinates,e)}getType(){return`Point`}intersectsExtent(e){return Lt(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||=[],this.flatCoordinates.length=ji(this.flatCoordinates,0,e,this.stride),this.changed()}};function Hi(e,t,n,r,i){return!Yt(i,function(i){return!Ui(e,t,n,r,i[0],i[1])})}function Ui(e,t,n,r,i,a){let o=0,s=e[n-r],c=e[n-r+1];for(;t<n;t+=r){let n=e[t],r=e[t+1];c<=a?r>a&&(n-s)*(a-c)-(i-s)*(r-c)>0&&o++:r<=a&&(n-s)*(a-c)-(i-s)*(r-c)<0&&o--,s=n,c=r}return o!==0}function Wi(e,t,n,r,i,a){if(n.length===0||!Ui(e,t,n[0],r,i,a))return!1;for(let t=1,o=n.length;t<o;++t)if(Ui(e,n[t-1],n[t],r,i,a))return!1;return!0}function Gi(e,t,n,r,i,a,o){let s,c,l,u,d,f,p,m=i[a+1],h=[];for(let i=0,a=n.length;i<a;++i){let a=n[i];for(u=e[a-r],f=e[a-r+1],s=t;s<a;s+=r)d=e[s],p=e[s+1],(m<=f&&p<=m||f<=m&&m<=p)&&(l=(m-f)/(p-f)*(d-u)+u,h.push(l)),u=d,f=p}let g=NaN,_=-1/0;for(h.sort(Re),u=h[0],s=1,c=h.length;s<c;++s){d=h[s];let i=Math.abs(d-u);i>_&&(l=(u+d)/2,Wi(e,t,n,r,l,m)&&(g=l,_=i)),u=d}return isNaN(g)&&(g=i[a]),o?(o.push(g,m,_),o):[g,m,_]}function Ki(e,t,n,r,i){let a;for(t+=r;t<n;t+=r)if(a=i(e.slice(t-r,t),e.slice(t,t+r)),a)return a;return!1}function qi(e,t,n,r,i,a){return a??=qt(zt(),e,t,n,r),sn(i,a)?a[0]>=i[0]&&a[2]<=i[2]||a[1]>=i[1]&&a[3]<=i[3]?!0:Ki(e,t,n,r,function(e,t){return un(i,e,t)}):!1}function Ji(e,t,n,r,i){return!!(qi(e,t,n,r,i)||Ui(e,t,n,r,i[0],i[1])||Ui(e,t,n,r,i[0],i[3])||Ui(e,t,n,r,i[2],i[1])||Ui(e,t,n,r,i[2],i[3]))}function Yi(e,t,n,r,i){if(!Ji(e,t,n[0],r,i))return!1;if(n.length===1)return!0;for(let t=1,a=n.length;t<a;++t)if(Hi(e,n[t-1],n[t],r,i)&&!qi(e,n[t-1],n[t],r,i))return!1;return!0}function Xi(e,t,n,r){for(;t<n-r;){for(let i=0;i<r;++i){let a=e[t+i];e[t+i]=e[n-r+i],e[n-r+i]=a}t+=r,n-=r}}function Zi(e,t,n,r){let i=0,a=e[n-r],o=e[n-r+1];for(;t<n;t+=r){let n=e[t],r=e[t+1];i+=(n-a)*(r+o),a=n,o=r}return i===0?void 0:i>0}function Qi(e,t,n,r,i){i=i===void 0?!1:i;for(let a=0,o=n.length;a<o;++a){let o=n[a],s=Zi(e,t,o,r);if(a===0){if(i&&s||!i&&!s)return!1}else if(i&&!s||!i&&s)return!1;t=o}return!0}function $i(e,t,n,r,i){i=i===void 0?!1:i;for(let a=0,o=n.length;a<o;++a){let o=n[a],s=Zi(e,t,o,r);(a===0?i&&s||!i&&!s:i&&!s||!i&&s)&&Xi(e,t,o,r),t=o}return t}var ea=class e extends xi{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?Be(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let t=new e(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(e,t,n,r){return r<Ft(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Oi(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ai(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Wi(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return Ti(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e===void 0?t=this.flatCoordinates:(t=this.getOrientedFlatCoordinates().slice(),$i(t,0,this.ends_,this.stride,e)),Fi(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=$t(this.getExtent());this.flatInteriorPoint_=Gi(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Vi(this.getFlatInteriorPoint(),`XYM`)}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new Bi(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){let e=this.layout,t=this.flatCoordinates,n=this.ends_,r=[],i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a],s=new Bi(t.slice(i,o),e);r.push(s),i=o}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;Qi(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=$i(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let n=[],r=[];return n.length=zi(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),n,0,r),new e(n,`XY`,r)}getType(){return`Polygon`}intersectsExtent(e){return Yi(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||=[];let n=Ni(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}};function ta(e){if(cn(e))throw Error(`Cannot create polygon from empty extent`);let t=e[0],n=e[1],r=e[2],i=e[3],a=[t,n,t,i,r,i,r,n,t,n];return new ea(a,`XY`,[a.length])}function na(e,t,n,r){let i=W(t)/n[0],a=U(t)/n[1];return r?Math.min(e,Math.max(i,a)):Math.min(e,Math.min(i,a))}function ra(e,t,n){let r=Math.min(e,t);return r*=Math.log(1+50*Math.max(0,e/t-1))/50+1,n&&(r=Math.max(r,n),r/=Math.log(1+50*Math.max(0,n/e-1))/50+1),G(r,n/2,t*2)}function ia(e,t,n,r){return t=t===void 0?!0:t,(function(i,a,o,s){if(i!==void 0){let c=e[0],l=e[e.length-1],u=n?na(c,n,o,r):c;if(s)return t?ra(i,u,l):G(i,l,u);let d=Math.floor(ze(e,Math.min(u,i),a));return e[d]>u&&d<e.length-1?e[d+1]:e[d]}})}function aa(e,t,n,r,i,a){return r=r===void 0?!0:r,n=n===void 0?0:n,(function(o,s,c,l){if(o!==void 0){let u=i?na(t,i,c,a):t;if(l)return r?ra(o,u,n):G(o,n,u);let d=1e-9,f=Math.ceil(Math.log(t/u)/Math.log(e)-d),p=-s*(.5-d)+.5,m=Math.floor(Math.log(t/Math.min(u,o))/Math.log(e)+p);return G(t/e**+Math.max(f,m),n,u)}})}function oa(e,t,n,r,i){return n=n===void 0?!0:n,(function(a,o,s,c){if(a!==void 0){let o=r?na(e,r,s,i):e;return!n||!c?G(a,t,o):ra(a,o,t)}})}function sa(e){if(e!==void 0)return 0}function ca(e){if(e!==void 0)return e}function la(e){let t=2*Math.PI/e;return(function(e,n){if(n)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e})}function ua(e){let t=e===void 0?vn(5):e;return(function(e,n){return n||e===void 0?e:Math.abs(e)<=t?0:e})}var da=0,fa=class extends bt{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Vr(e.projection,`EPSG:3857`),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&Pr(),e.center&&=$r(e.center,this.projection_),e.extent&&=ti(e.extent,this.projection_),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let e in Z)delete t[e];this.setProperties(t,!0);let n=ha(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom;let r=ma(e),i=n.constraint,a=ga(e);this.constraints_={center:r,resolution:i,rotation:a},this.setRotation(e.rotation===void 0?0:e.rotation),this.setCenterInternal(e.center===void 0?null:e.center),e.resolution===void 0?e.zoom!==void 0&&this.setZoom(e.zoom):this.setResolution(e.resolution)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;let n=this.getCenterInternal();if(n){let r=e||[0,0,0,0];t||=[0,0,0,0];let i=this.getResolution(),a=i/2*(r[3]-t[3]+t[1]-r[1]),o=i/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+a,n[1]-o])}}getUpdatedOptions_(e){let t=this.getProperties();return t.resolution===void 0?t.zoom=this.getZoom():t.resolution=this.getResolution(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let t=Array(arguments.length);for(let e=0;e<t.length;++e){let n=arguments[e];n.center&&(n=Object.assign({},n),n.center=$r(n.center,this.getProjection())),n.anchor&&(n=Object.assign({},n),n.anchor=$r(n.anchor,this.getProjection())),t[e]=n}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]==`function`&&(n=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){let e=arguments[r];e.center&&this.setCenterInternal(e.center),e.zoom===void 0?e.resolution&&this.setResolution(e.resolution):this.setZoom(e.zoom),e.rotation!==void 0&&this.setRotation(e.rotation)}if(r===t){n&&pa(n,!0);return}let i=Date.now(),a=this.targetCenter_.slice(),o=this.targetResolution_,s=this.targetRotation_,c=[];for(;r<t;++r){let e=arguments[r],t={start:i,complete:!1,anchor:e.anchor,duration:e.duration===void 0?1e3:e.duration,easing:e.easing||kt,callback:n};if(e.center&&(t.sourceCenter=a,t.targetCenter=e.center.slice(),a=t.targetCenter),e.zoom===void 0?e.resolution&&(t.sourceResolution=o,t.targetResolution=e.resolution,o=t.targetResolution):(t.sourceResolution=o,t.targetResolution=this.getResolutionForZoom(e.zoom),o=t.targetResolution),e.rotation!==void 0){t.sourceRotation=s;let n=yn(e.rotation-s+Math.PI,2*Math.PI)-Math.PI;t.targetRotation=s+n,s=t.targetRotation}_a(t)?t.complete=!0:i+=t.duration,c.push(t)}this.animations_.push(c),this.setHint(ri.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[ri.ANIMATING]>0}getInteracting(){return this.hints_[ri.INTERACTING]>0}cancelAnimations(){this.setHint(ri.ANIMATING,-this.hints_[ri.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let n=this.animations_[t];if(n[0].callback&&pa(n[0].callback,!1),!e)for(let t=0,r=n.length;t<r;++t){let r=n[t];if(!r.complete){e=r.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let e=Date.now(),t=!1;for(let n=this.animations_.length-1;n>=0;--n){let r=this.animations_[n],i=!0;for(let n=0,a=r.length;n<a;++n){let a=r[n];if(a.complete)continue;let o=e-a.start,s=a.duration>0?o/a.duration:1;s>=1?(a.complete=!0,s=1):i=!1;let c=a.easing(s);if(a.sourceCenter){let e=a.sourceCenter[0],t=a.sourceCenter[1],n=a.targetCenter[0],r=a.targetCenter[1];this.nextCenter_=a.targetCenter;let i=e+c*(n-e),o=t+c*(r-t);this.targetCenter_=[i,o]}if(a.sourceResolution&&a.targetResolution){let e=c===1?a.targetResolution:a.sourceResolution+c*(a.targetResolution-a.sourceResolution);if(a.anchor){let t=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(e,0,t,!0);this.targetCenter_=this.calculateCenterZoom(n,a.anchor)}this.nextResolution_=a.targetResolution,this.targetResolution_=e,this.applyTargetState_(!0)}if(a.sourceRotation!==void 0&&a.targetRotation!==void 0){let e=c===1?yn(a.targetRotation+Math.PI,2*Math.PI)-Math.PI:a.sourceRotation+c*(a.targetRotation-a.sourceRotation);if(a.anchor){let t=this.constraints_.rotation(e,!0);this.targetCenter_=this.calculateCenterRotate(t,a.anchor)}this.nextRotation_=a.targetRotation,this.targetRotation_=e}if(this.applyTargetState_(!0),t=!0,!a.complete)break}if(i){this.animations_[n]=null,this.setHint(ri.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let e=r[0].callback;e&&pa(e,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],Dn(n,e-this.getRotation()),Tn(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),i=this.getResolution();return r!==void 0&&i!==void 0&&(n=[t[0]-e*(t[0]-r[0])/i,t[1]-e*(t[1]-r[1])/i]),n}getViewportSize_(e){let t=this.viewportSize_;if(e){let n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&Qr(e,this.getProjection())}getCenterInternal(){return this.get(Z.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get(`constrainResolution`)}getHints(e){return e===void 0?this.hints_.slice():(e[0]=this.hints_[0],e[1]=this.hints_[1],e)}calculateExtent(e){return ei(this.calculateExtentInternal(e),this.getProjection())}calculateExtentInternal(e){e||=this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();X(t,`The view center is not defined`);let n=this.getResolution();X(n!==void 0,`The view resolution is not defined`);let r=this.getRotation();return X(r!==void 0,`The view rotation is not defined`),tn(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Z.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(ti(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t||=this.getViewportSizeMinusPadding_();let n=W(e)/t[0],r=U(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e||=2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(n){return t/e**+(n*r)})}getRotation(){return this.get(Z.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,i=Math.log(n/r)/t;return(function(e){return Math.log(n/e)/t/i})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),i=this.padding_;if(i){let e=this.getViewportSizeMinusPadding_();r=va(r,this.getViewportSize_(),[e[0]/2+i[3],e[1]/2+i[0]],t,n)}return{center:r.slice(0),projection:e===void 0?null:e,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){let i=ze(this.resolutions_,e,1);t=i,n=this.resolutions_[i],r=i==this.resolutions_.length-1?2:n/this.resolutions_[i+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=G(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/n**+G(e-t,0,1)}return this.maxResolution_/this.zoomFactor_**+(e-this.minZoom_)}fit(e,t){let n;if(X(Array.isArray(e)||typeof e.getSimplifiedGeometry==`function`,"Invalid extent or geometry provided as `geometry`"),Array.isArray(e))X(!cn(e),"Cannot fit empty extent provided as `geometry`"),n=ta(ti(e,this.getProjection()));else if(e.getType()===`Circle`){let t=ti(e.getExtent(),this.getProjection());n=ta(t),n.rotate(this.getRotation(),$t(t))}else{let t=Zr();n=t?e.clone().transform(t,this.getProjection()):e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),i=e.getFlatCoordinates(),a=e.getStride(),o=1/0,s=1/0,c=-1/0,l=-1/0;for(let e=0,t=i.length;e<t;e+=a){let t=i[e]*n-i[e+1]*r,a=i[e]*r+i[e+1]*n;o=Math.min(o,t),s=Math.min(s,a),c=Math.max(c,t),l=Math.max(l,a)}return[o,s,c,l]}fitInternal(e,t){t||={};let n=t.size;n||=this.getViewportSizeMinusPadding_();let r=t.padding===void 0?[0,0,0,0]:t.padding,i=t.nearest===void 0?!1:t.nearest,a;a=t.minResolution===void 0?t.maxZoom===void 0?0:this.getResolutionForZoom(t.maxZoom):t.minResolution;let o=this.rotatedExtentForGeometry(e),s=this.getResolutionForExtentInternal(o,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);s=isNaN(s)?a:Math.max(s,a),s=this.getConstrainedResolution(s,+!i);let c=this.getRotation(),l=Math.sin(c),u=Math.cos(c),d=$t(o);d[0]+=(r[1]-r[3])/2*s,d[1]+=(r[0]-r[2])/2*s;let f=d[0]*u-d[1]*l,p=d[1]*u+d[0]*l,m=this.getConstrainedCenter([f,p],s),h=t.callback?t.callback:it;t.duration===void 0?(this.targetResolution_=s,this.targetCenter_=m,this.applyTargetState_(!1,!0),pa(h,!0)):this.animateInternal({resolution:s,center:m,duration:t.duration,easing:t.easing},h)}centerOn(e,t,n){this.centerOnInternal($r(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(va(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,r){let i,a=this.padding_;if(a&&e){let o=this.getViewportSizeMinusPadding_(-n),s=va(e,r,[o[0]/2+a[3],o[1]/2+a[0]],t,n);i=[e[0]-s[0],e[1]-s[1]]}return i}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){let t=Qr(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){let t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t&&=$r(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(i,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(this.zoomFactor_**+-e,t)}adjustRotation(e,t){t&&=$r(t,this.getProjection()),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&$r(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){let n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),i=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,0,i,n),o=this.constraints_.center(this.targetCenter_,a,i,n,this.calculateCenterShift(this.targetCenter_,a,r,i));this.get(Z.ROTATION)!==r&&this.set(Z.ROTATION,r),this.get(Z.RESOLUTION)!==a&&(this.set(Z.RESOLUTION,a),this.set(`zoom`,this.getZoom(),!0)),(!o||!this.get(Z.CENTER)||!En(this.get(Z.CENTER),o))&&this.set(Z.CENTER,o),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e===void 0?200:e;let r=t||0,i=this.constraints_.rotation(this.targetRotation_),a=this.getViewportSize_(i),o=this.constraints_.resolution(this.targetResolution_,r,a),s=this.constraints_.center(this.targetCenter_,o,a,!1,this.calculateCenterShift(this.targetCenter_,o,i,a));if(e===0&&!this.cancelAnchor_){this.targetResolution_=o,this.targetRotation_=i,this.targetCenter_=s,this.applyTargetState_();return}n||=e===0?this.cancelAnchor_:void 0,this.cancelAnchor_=void 0,(this.getResolution()!==o||this.getRotation()!==i||!this.getCenterInternal()||!En(this.getCenterInternal(),s))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:i,center:s,resolution:o,duration:e,easing:Ot,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(ri.INTERACTING,1)}endInteraction(e,t,n){n&&=$r(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(ri.INTERACTING,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){let n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){let n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t||=0;let n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}};function pa(e,t){setTimeout(function(){e(t)},0)}function ma(e){if(e.extent!==void 0){let t=e.smoothExtentConstraint===void 0?!0:e.smoothExtentConstraint;return ii(e.extent,e.constrainOnlyCenter,t)}let t=Vr(e.projection,`EPSG:3857`);if(e.multiWorld!==!0&&t.isGlobal()){let e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,ii(e,!1,!1)}return ai}function ha(e){let t,n,r,i=e.minZoom===void 0?da:e.minZoom,a=e.maxZoom===void 0?28:e.maxZoom,o=e.zoomFactor===void 0?2:e.zoomFactor,s=e.multiWorld===void 0?!1:e.multiWorld,c=e.smoothResolutionConstraint===void 0?!0:e.smoothResolutionConstraint,l=e.showFullExtent===void 0?!1:e.showFullExtent,u=Vr(e.projection,`EPSG:3857`),d=u.getExtent(),f=e.constrainOnlyCenter,p=e.extent;if(!s&&!p&&u.isGlobal()&&(f=!1,p=d),e.resolutions!==void 0){let o=e.resolutions;n=o[i],r=o[a]===void 0?o[o.length-1]:o[a],t=e.constrainResolution?ia(o,c,!f&&p,l):oa(n,r,c,!f&&p,l)}else{let s=(d?Math.max(W(d),U(d)):360*jn.degrees/u.getMetersPerUnit())/256/2**da,m=s/2**(28-da);n=e.maxResolution,n===void 0?n=s/o**+i:i=0,r=e.minResolution,r===void 0&&(r=e.maxZoom===void 0?m:e.maxResolution===void 0?s/o**+a:n/o**+a),a=i+Math.floor(Math.log(n/r)/Math.log(o)),r=n/o**+(a-i),t=e.constrainResolution?aa(o,n,r,c,!f&&p,l):oa(n,r,c,!f&&p,l)}return{constraint:t,maxResolution:n,minResolution:r,minZoom:i,zoomFactor:o}}function ga(e){if(e.enableRotation===void 0||e.enableRotation){let t=e.constrainRotation;return t===void 0||t===!0?ua():t===!1?ca:typeof t==`number`?la(t):ca}return sa}function _a(e){return!(e.sourceCenter&&e.targetCenter&&!En(e.sourceCenter,e.targetCenter)||e.sourceResolution!==e.targetResolution||e.sourceRotation!==e.targetRotation)}function va(e,t,n,r,i){let a=Math.cos(-i),o=Math.sin(-i),s=e[0]*a-e[1]*o,c=e[1]*a+e[0]*o;return s+=(t[0]/2-n[0])*r,c+=(n[1]-t[1]/2)*r,o=-o,[s*a-c*o,c*a+s*o]}var $={OPACITY:`opacity`,VISIBLE:`visible`,EXTENT:`extent`,Z_INDEX:`zIndex`,MAX_RESOLUTION:`maxResolution`,MIN_RESOLUTION:`minResolution`,MAX_ZOOM:`maxZoom`,MIN_ZOOM:`minZoom`,SOURCE:`source`,MAP:`map`},ya=class extends bt{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties==`object`&&(delete t.properties,Object.assign(t,e.properties)),t[$.OPACITY]=e.opacity===void 0?1:e.opacity,X(typeof t[$.OPACITY]==`number`,`Layer opacity must be a number`),t[$.VISIBLE]=e.visible===void 0?!0:e.visible,t[$.Z_INDEX]=e.zIndex,t[$.MAX_RESOLUTION]=e.maxResolution===void 0?1/0:e.maxResolution,t[$.MIN_RESOLUTION]=e.minResolution===void 0?0:e.minResolution,t[$.MIN_ZOOM]=e.minZoom===void 0?-1/0:e.minZoom,t[$.MAX_ZOOM]=e.maxZoom===void 0?1/0:e.maxZoom,this.className_=t.className===void 0?`ol-layer`:t.className,delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=G(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return B()}getLayerStatesArray(e){return B()}getExtent(){return this.get($.EXTENT)}getMaxResolution(){return this.get($.MAX_RESOLUTION)}getMinResolution(){return this.get($.MIN_RESOLUTION)}getMinZoom(){return this.get($.MIN_ZOOM)}getMaxZoom(){return this.get($.MAX_ZOOM)}getOpacity(){return this.get($.OPACITY)}getSourceState(){return B()}getVisible(){return this.get($.VISIBLE)}getZIndex(){return this.get($.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set($.EXTENT,e)}setMaxResolution(e){this.set($.MAX_RESOLUTION,e)}setMinResolution(e){this.set($.MIN_RESOLUTION,e)}setMaxZoom(e){this.set($.MAX_ZOOM,e)}setMinZoom(e){this.set($.MIN_ZOOM,e)}setOpacity(e){X(typeof e==`number`,`Layer opacity must be a number`),this.set($.OPACITY,e)}setVisible(e){this.set($.VISIBLE,e)}setZIndex(e){this.set($.Z_INDEX,e)}disposeInternal(){this.state_&&=(this.state_.layer=null,null),super.disposeInternal()}},ba={PRERENDER:`prerender`,POSTRENDER:`postrender`,PRECOMPOSE:`precompose`,POSTCOMPOSE:`postcompose`,RENDERCOMPLETE:`rendercomplete`},xa=class extends ya{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener($.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e||=[],e.push(this),e}getLayerStatesArray(e){return e||=[],e.push(this.getLayerState()),e}getSource(){return this.get($.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():`undefined`}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!==`ready`)&&(this.sourceReady_=!0,this.dispatchEvent(`sourceready`))}handleSourcePropertyChange_(){this.sourceChangeKey_&&=(z(this.sourceChangeKey_),null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=dt(e,R.CHANGE,this.handleSourceChange_,this),e.getState()===`ready`&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent(`sourceready`)},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),t=e instanceof fa?{viewState:e.getState(),extent:e.calculateExtent()}:e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;if(t.layerStatesArray){if(r=t.layerStatesArray.find(e=>e.layer===this),!r)return!1}else r=this.getLayerState();let i=this.getExtent();return Sa(r,t.viewState)&&(!i||sn(i,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=t(e instanceof fa?e.getViewStateAndExtent():e);return Array.isArray(n)||(n=[n]),n}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set($.MAP,e)}getMapInternal(){return this.get($.MAP)}setMap(e){this.mapPrecomposeKey_&&=(z(this.mapPrecomposeKey_),null),e||this.changed(),this.mapRenderKey_&&=(z(this.mapRenderKey_),null),e&&(this.mapPrecomposeKey_=dt(e,ba.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=dt(this,R.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);X(!t.some(e=>e.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set($.SOURCE,e)}getRenderer(){return this.renderer_||=this.createRenderer(),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function Sa(e,t){if(!e.visible)return!1;let n=t.resolution;if(n<e.minResolution||n>=e.maxResolution)return!1;let r=t.zoom;return r>e.minZoom&&r<=e.maxZoom}var Ca=[NaN,NaN,NaN,0],wa;function Ta(){return wa||=Xe(1,1,void 0,{willReadFrequently:!0,desynchronized:!0}),wa}var Ea=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Da=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Oa=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,ka=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Aa(e,t){return e.endsWith(`%`)?Number(e.substring(0,e.length-1))/t:Number(e)}function ja(e){throw Error(`failed to parse "`+e+`" as color`)}function Ma(e){if(e.toLowerCase().startsWith(`rgb`)){let t=e.match(Da)||e.match(Ea)||e.match(Oa);if(t){let e=t[4],n=100/255;return[G(Aa(t[1],n)+.5|0,0,255),G(Aa(t[2],n)+.5|0,0,255),G(Aa(t[3],n)+.5|0,0,255),e===void 0?1:G(Aa(e,100),0,1)]}ja(e)}if(e.startsWith(`#`)){if(ka.test(e)){let t=e.substring(1),n=t.length<=4?1:2,r=[0,0,0,255];for(let e=0,i=t.length;e<i;e+=n){let i=parseInt(t.substring(e,e+n),16);n===1&&(i+=i<<4),r[e/n]=i}return r[3]/=255,r}ja(e)}let t=Ta();t.fillStyle=`#abcdef`;let n=t.fillStyle;t.fillStyle=e,t.fillStyle===n&&(t.fillStyle=`#fedcba`,n=t.fillStyle,t.fillStyle=e,t.fillStyle===n&&ja(e));let r=t.fillStyle;if(r.startsWith(`#`)||r.startsWith(`rgba`))return Ma(r);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);let i=Array.from(t.getImageData(0,0,1,1).data);return i[3]=xn(i[3]/255,3),i}var Na=1024,Pa={},Fa=0;function Ia(e){if(e===`none`)return Ca;if(Pa.hasOwnProperty(e))return Pa[e];if(Fa>=Na){let e=0;for(let t in Pa)e++&3||(delete Pa[t],--Fa)}let t=Ma(e);t.length!==4&&ja(e);for(let n of t)isNaN(n)&&ja(e);return Pa[e]=t,++Fa,t}function La(e){return Array.isArray(e)?e:Ia(e)}function Ra(e,t,n){return n===void 0&&(n=[0,0]),n[0]=e[0]*t+.5|0,n[1]=e[1]*t+.5|0,n}function za(e,t){return Array.isArray(e)?e:(t===void 0?t=[e,e]:(t[0]=e,t[1]=e),t)}var Ba={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Va(e,t,n){let r=e,i=!0,a=!1,o=!1,s=[ft(r,R.LOAD,function(){o=!0,a||t()})];return r.src&&Ye?(a=!0,r.decode().then(function(){i&&t()}).catch(function(e){i&&(o?t():n())})):s.push(ft(r,R.ERROR,n)),function(){i=!1,s.forEach(z)}}var Ha=class extends mt{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},Ua=`units`,Wa=[1,2,5],Ga=25.4/.28,Ka=class extends xt{constructor(e){e||={};let t=document.createElement(`div`);t.style.pointerEvents=`none`,super({element:t,render:e.render,target:e.target}),this.on,this.once,this.un;let n=e.className===void 0?e.bar?`ol-scale-bar`:`ol-scale-line`:e.className;this.innerElement_=document.createElement(`div`),this.innerElement_.className=n+`-inner`,this.element.className=n+` `+We,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=e.minWidth===void 0?64:e.minWidth,this.maxWidth_=e.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_=``,this.addChangeListener(Ua,this.handleUnitsChanged_),this.setUnits(e.units||`metric`),this.scaleBar_=e.bar||!1,this.scaleBarSteps_=e.steps||4,this.scaleBarText_=e.text||!1,this.dpi_=e.dpi||void 0}getUnits(){return this.get(Ua)}handleUnitsChanged_(){this.updateElement_()}setUnits(e){this.set(Ua,e)}setDpi(e){this.dpi_=e}updateElement_(){let e=this.viewState_;if(!e){this.renderedVisible_&&=(this.element.style.display=`none`,!1);return}let t=e.center,n=e.projection,r=this.getUnits(),i=r==`degrees`?`degrees`:`m`,a=Rr(n,e.resolution,t,i),o=this.minWidth_*(this.dpi_||Ga)/Ga,s=this.maxWidth_===void 0?void 0:this.maxWidth_*(this.dpi_||Ga)/Ga,c=o*a,l=``;if(r==`degrees`){let e=jn.degrees;c*=e,c<e/60?(l=`″`,a*=3600):c<e?(l=`′`,a*=60):l=`°`}else if(r==`imperial`)c<.9144?(l=`in`,a/=.0254):c<1609.344?(l=`ft`,a/=.3048):(l=`mi`,a/=1609.344);else if(r==`nautical`)a/=1852,l=`NM`;else if(r==`metric`)c<1e-6?(l=`nm`,a*=1e9):c<.001?(l=`μm`,a*=1e6):c<1?(l=`mm`,a*=1e3):c<1e3?l=`m`:(l=`km`,a/=1e3);else if(r==`us`)c<.9144?(l=`in`,a*=39.37):c<1609.344?(l=`ft`,a/=.30480061):(l=`mi`,a/=1609.3472);else throw Error(`Invalid units`);let u=3*Math.floor(Math.log(o*a)/Math.log(10)),d,f,p,m=0,h,g;for(;;){p=Math.floor(u/3);let e=10**p;if(d=Wa[(u%3+3)%3]*e,f=Math.round(d/a),isNaN(f)){this.element.style.display=`none`,this.renderedVisible_=!1;return}if(s!==void 0&&f>=s){d=m,f=h,p=g;break}else if(f>=o)break;m=d,h=f,g=p,++u}let _=this.scaleBar_?this.createScaleBar(f,d,l):d.toFixed(p<0?-p:0)+` `+l;this.renderedHTML_!=_&&(this.innerElement_.innerHTML=_,this.renderedHTML_=_),this.renderedWidth_!=f&&(this.innerElement_.style.width=f+`px`,this.renderedWidth_=f),this.renderedVisible_||=(this.element.style.display=``,!0)}createScaleBar(e,t,n){let r=this.getScaleForResolution(),i=r<1?Math.round(1/r).toLocaleString()+` : 1`:`1 : `+Math.round(r).toLocaleString(),a=this.scaleBarSteps_,o=e/a,s=[this.createMarker(`absolute`)];for(let r=0;r<a;++r){let i=r%2==0?`ol-scale-singlebar-odd`:`ol-scale-singlebar-even`;s.push(`<div><div class="ol-scale-singlebar ${i}" style="width: ${o}px;"></div>`+this.createMarker(`relative`)+(r%2==0||a===2?this.createStepText(r,e,!1,t,n):``)+`</div>`)}return s.push(this.createStepText(a,e,!0,t,n)),(this.scaleBarText_?`<div class="ol-scale-text" style="width: ${e}px;">`+i+`</div>`:``)+s.join(``)}createMarker(e){return`<div class="ol-scale-step-marker" style="position: ${e}; top: ${e===`absolute`?3:-10}px;"></div>`}createStepText(e,t,n,r,i){let a=(e===0?0:Math.round(r/this.scaleBarSteps_*e*100)/100)+(e===0?``:` `+i),o=e===0?-3:t/this.scaleBarSteps_*-1,s=e===0?0:t/this.scaleBarSteps_*2;return`<div class="ol-scale-step-text" style="margin-left: ${o}px;text-align: ${e===0?`left`:`center`};min-width: ${s}px;left: ${n?t+`px`:`unset`};">`+a+`</div>`}getScaleForResolution(){let e=Rr(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,`m`),t=this.dpi_||Ga;return 1e3/25.4*e*t}render(e){let t=e.frameState;t?this.viewState_=t.viewState:this.viewState_=null,this.updateElement_()}},qa=class extends ht{constructor(e,t,n){super(),n||={},this.tileCoord=e,this.state=t,this.key=``,this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(R.CHANGE)}release(){this.setState(Y.EMPTY)}getKey(){return this.key+`/`+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==Y.EMPTY){if(this.state!==Y.ERROR&&this.state>e)throw Error(`Tile load sequence violation`);this.state=e,this.changed()}}load(){B()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;let r=t-n+1e3/60;return r>=this.transition_?1:Dt(r/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}};function Ja(e){return e instanceof Image||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageBitmap?e:null}var Ya=Error(`disposed`),Xa=[256,256],Za=class extends qa{constructor(e){let t=Y.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;let e=Ja(this.data_);return e?[e.width,e.height]:Xa}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==Y.IDLE&&this.state!==Y.ERROR)return;this.state=Y.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=Y.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=Y.ERROR,e.changed()})}disposeInternal(){this.controller_&&=(this.controller_.abort(Ya),null),super.disposeInternal()}},Qa=class extends qa{constructor(e,t,n,r,i,a){super(e,t,a),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=n,this.key=n,this.image_,Je?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=i}getImage(){return this.image_}setImage(e){this.image_=e,this.state=Y.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=Y.ERROR,this.unlistenImage_(),this.image_=$a(),this.changed()}handleImageLoad_(){if(Je)this.state=Y.LOADED;else{let e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=Y.LOADED:this.state=Y.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==Y.ERROR&&(this.state=Y.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==Y.IDLE&&(this.state=Y.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Va(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&=(this.unlisten_(),null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function $a(){let e=Xe(1,1);return e.fillStyle=`rgba(0,0,0,0)`,e.fillRect(0,0,1,1),e.canvas}var eo=class{constructor(e,t,n,r){this.minX=e,this.maxX=t,this.minY=n,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}};function to(e,t,n,r,i){return i===void 0?new eo(e,t,n,r):(i.minX=e,i.maxX=t,i.minY=n,i.maxY=r,i)}var no,ro=[];function io(e,t,n,r,i){e.beginPath(),e.moveTo(0,0),e.lineTo(t,n),e.lineTo(r,i),e.closePath(),e.save(),e.clip(),e.fillRect(0,0,Math.max(t,r)+1,Math.max(n,i)),e.restore()}function ao(e,t){return Math.abs(e[t*4]-210)>2||Math.abs(e[t*4+3]-.75*255)>2}function oo(){if(no===void 0){let e=Xe(6,6,ro);e.globalCompositeOperation=`lighter`,e.fillStyle=`rgba(210, 0, 0, 0.75)`,io(e,4,5,4,0),io(e,4,5,0,5);let t=e.getImageData(0,0,3,3).data;no=ao(t,0)||ao(t,4)||ao(t,8),$e(e),ro.push(e.canvas)}return no}function so(e,t,n,r){let i=Yr(n,t,e),a=Rr(t,r,n),o=t.getMetersPerUnit();o!==void 0&&(a*=o);let s=e.getMetersPerUnit();s!==void 0&&(a/=s);let c=e.getExtent();if(!c||It(c,i)){let t=Rr(e,a,i)/a;isFinite(t)&&t>0&&(a/=t)}return a}function co(e,t,n,r){let i=so(e,t,$t(n),r);return(!isFinite(i)||i<=0)&&Yt(n,function(n){return i=so(e,t,n,r),isFinite(i)&&i>0}),i}function lo(e,t,n,r,i,a,o,s,c,l,u,d,f,p){let m=Xe(Math.round(n*e),Math.round(n*t),ro);if(d||(m.imageSmoothingEnabled=!1),c.length===0)return m.canvas;m.scale(n,n);function h(e){return Math.round(e*n)/n}m.globalCompositeOperation=`lighter`;let g=zt();c.forEach(function(e,t,n){Gt(g,e.extent)});let _,v=n/r,y=(d?1:1+2**-24)/v;if(!f||c.length!==1||l!==0){if(_=Xe(Math.round(W(g)*v),Math.round(U(g)*v),ro),d||(_.imageSmoothingEnabled=!1),i&&p){let e=(i[0]-g[0])*v,t=-(i[3]-g[3])*v,n=W(i)*v,r=U(i)*v;_.rect(e,t,n,r),_.clip()}c.forEach(function(e,t,n){if(e.image.width>0&&e.image.height>0){if(e.clipExtent){_.save();let t=(e.clipExtent[0]-g[0])*v,n=-(e.clipExtent[3]-g[3])*v,r=W(e.clipExtent)*v,i=U(e.clipExtent)*v;_.rect(d?t:Math.round(t),d?n:Math.round(n),d?r:Math.round(t+r)-Math.round(t),d?i:Math.round(n+i)-Math.round(n)),_.clip()}let t=(e.extent[0]-g[0])*v,n=-(e.extent[3]-g[3])*v,r=W(e.extent)*v,i=U(e.extent)*v;_.drawImage(e.image,l,l,e.image.width-2*l,e.image.height-2*l,d?t:Math.round(t),d?n:Math.round(n),d?r:Math.round(t+r)-Math.round(t),d?i:Math.round(n+i)-Math.round(n)),e.clipExtent&&_.restore()}})}let b=an(o);return s.getTriangles().forEach(function(e,t,n){let r=e.source,i=e.target,o=r[0][0],s=r[0][1],l=r[1][0],u=r[1][1],f=r[2][0],p=r[2][1],v=h((i[0][0]-b[0])/a),x=h(-(i[0][1]-b[1])/a),S=h((i[1][0]-b[0])/a),C=h(-(i[1][1]-b[1])/a),w=h((i[2][0]-b[0])/a),T=h(-(i[2][1]-b[1])/a),E=o,D=s;o=0,s=0,l-=E,u-=D,f-=E,p-=D;let O=gn([[l,u,0,0,S-v],[f,p,0,0,w-v],[0,0,l,u,C-x],[0,0,f,p,T-x]]);if(!O)return;if(m.save(),m.beginPath(),oo()||!d){m.moveTo(S,C);let e=v-S,t=x-C;for(let n=0;n<4;n++)m.lineTo(S+h((n+1)*e/4),C+h(n*t/3)),n!=3&&m.lineTo(S+h((n+1)*e/4),C+h((n+1)*t/3));m.lineTo(w,T)}else m.moveTo(S,C),m.lineTo(v,x),m.lineTo(w,T);m.clip(),m.transform(O[0],O[2],O[1],O[3],v,x),m.translate(g[0]-E,g[3]-D);let k;if(_)k=_.canvas,m.scale(y,-y);else{let e=c[0],t=e.extent;k=e.image,m.scale(W(t)/k.width,-U(t)/k.height)}m.drawImage(k,0,0),m.restore()}),_&&($e(_),ro.push(_.canvas)),u&&(m.save(),m.globalCompositeOperation=`source-over`,m.strokeStyle=`black`,m.lineWidth=1,s.getTriangles().forEach(function(e,t,n){let r=e.target,i=(r[0][0]-b[0])/a,o=-(r[0][1]-b[1])/a,s=(r[1][0]-b[0])/a,c=-(r[1][1]-b[1])/a,l=(r[2][0]-b[0])/a,u=-(r[2][1]-b[1])/a;m.beginPath(),m.moveTo(s,c),m.lineTo(i,o),m.lineTo(l,u),m.closePath(),m.stroke()}),m.restore()),m.canvas}var uo=10,fo=.25,po=class{constructor(e,t,n,r,i,a,o){this.sourceProj_=e,this.targetProj_=t;let s={},c=o?Hr(e=>Q(o,Yr(e,this.targetProj_,this.sourceProj_))):Jr(this.targetProj_,this.sourceProj_);this.transformInv_=function(e){let t=e[0]+`/`+e[1];return s[t]||(s[t]=c(e)),s[t]},this.maxSourceExtent_=r,this.errorThresholdSquared_=i*i,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&W(r)>=W(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?W(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?W(this.targetProj_.getExtent()):null;let l=an(n),u=on(n),d=Qt(n),f=Zt(n),p=this.transformInv_(l),m=this.transformInv_(u),h=this.transformInv_(d),g=this.transformInv_(f),_=uo+(a?Math.max(0,Math.ceil(Math.log2(Xt(n)/(a*a*256*256)))):0);if(this.addQuad_(l,u,d,f,p,m,h,g,_),this.wrapsXInSource_){let e=1/0;this.triangles_.forEach(function(t,n,r){e=Math.min(e,t.source[0][0],t.source[1][0],t.source[2][0])}),this.triangles_.forEach(t=>{if(Math.max(t.source[0][0],t.source[1][0],t.source[2][0])-e>this.sourceWorldWidth_/2){let n=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];n[0][0]-e>this.sourceWorldWidth_/2&&(n[0][0]-=this.sourceWorldWidth_),n[1][0]-e>this.sourceWorldWidth_/2&&(n[1][0]-=this.sourceWorldWidth_),n[2][0]-e>this.sourceWorldWidth_/2&&(n[2][0]-=this.sourceWorldWidth_);let r=Math.min(n[0][0],n[1][0],n[2][0]);Math.max(n[0][0],n[1][0],n[2][0])-r<this.sourceWorldWidth_/2&&(t.source=n)}})}s={}}addTriangle_(e,t,n,r,i,a){this.triangles_.push({source:[r,i,a],target:[e,t,n]})}addQuad_(e,t,n,r,i,a,o,s,c){let l=Nt([i,a,o,s]),u=this.sourceWorldWidth_?W(l)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1,p=!1;if(c>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(p=W(Nt([e,t,n,r]))/this.targetWorldWidth_>fo||p),!f&&this.sourceProj_.isGlobal()&&u&&(p=u>fo||p)),!p&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!sn(l,this.maxSourceExtent_))return;let m=0;if(!p&&(!isFinite(i[0])||!isFinite(i[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(s[0])||!isFinite(s[1]))){if(c>0)p=!0;else if(m=(!isFinite(i[0])||!isFinite(i[1])?8:0)+(!isFinite(a[0])||!isFinite(a[1])?4:0)+(!isFinite(o[0])||!isFinite(o[1])?2:0)+ +(!isFinite(s[0])||!isFinite(s[1])),m!=1&&m!=2&&m!=4&&m!=8)return}if(c>0){if(!p){let t=[(e[0]+n[0])/2,(e[1]+n[1])/2],r=this.transformInv_(t),a;a=f?(yn(i[0],d)+yn(o[0],d))/2-yn(r[0],d):(i[0]+o[0])/2-r[0];let s=(i[1]+o[1])/2-r[1];p=a*a+s*s>this.errorThresholdSquared_}if(p){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){let l=[(t[0]+n[0])/2,(t[1]+n[1])/2],u=this.transformInv_(l),d=[(r[0]+e[0])/2,(r[1]+e[1])/2],f=this.transformInv_(d);this.addQuad_(e,t,l,d,i,a,u,f,c-1),this.addQuad_(d,l,n,r,f,u,o,s,c-1)}else{let l=[(e[0]+t[0])/2,(e[1]+t[1])/2],u=this.transformInv_(l),d=[(n[0]+r[0])/2,(n[1]+r[1])/2],f=this.transformInv_(d);this.addQuad_(e,l,d,r,i,u,f,s,c-1),this.addQuad_(l,t,n,d,u,a,o,f,c-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}m&11||this.addTriangle_(e,n,r,i,o,s),m&14||this.addTriangle_(e,n,t,i,o,a),m&&(m&13||this.addTriangle_(t,r,e,a,s,i),m&7||this.addTriangle_(t,r,n,a,s,o))}calculateSourceExtent(){let e=zt();return this.triangles_.forEach(function(t,n,r){let i=t.source;Kt(e,i[0]),Kt(e,i[1]),Kt(e,i[2])}),e}getTriangles(){return this.triangles_}},mo=.5,ho=class extends qa{constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(i,Y.IDLE,d),this.renderEdges_=u===void 0?!1:u,this.pixelRatio_=o,this.gutter_=s,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=a||i,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;let f=r.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent(),m=this.sourceTileGrid_.getExtent(),h=p?rn(f,p):f;if(Xt(h)===0){this.state=Y.EMPTY;return}let g=e.getExtent();g&&(m=m?rn(m,g):g);let _=r.getResolution(this.wrappedTileCoord_[0]),v=co(e,n,h,_);if(!isFinite(v)||v<=0){this.state=Y.EMPTY;return}let y=l===void 0?mo:l;if(this.triangulation_=new po(e,n,h,m,v*y,_),this.triangulation_.getTriangles().length===0){this.state=Y.EMPTY;return}this.sourceZ_=t.getZForResolution(v);let b=this.triangulation_.calculateSourceExtent();if(m&&(e.canWrapX()?(b[1]=G(b[1],m[1],m[3]),b[3]=G(b[3],m[1],m[3])):b=rn(b,m)),!Xt(b))this.state=Y.EMPTY;else{let n=0,r=0;e.canWrapX()&&(n=W(g),r=Math.floor((b[0]-g[0])/n)),pn(b.slice(),e,!0).forEach(e=>{let i=t.getTileRangeForExtentAndZ(e,this.sourceZ_);for(let e=i.minX;e<=i.maxX;e++)for(let t=i.minY;t<=i.maxY;t++){let i=r*n;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,e,t,o),offset:i})}++r}),this.sourceTiles_.length===0&&(this.state=Y.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==Y.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;let i=this.clipExtent_?.slice();i&&(i[0]+=t.offset,i[2]+=t.offset),e.push({extent:r,clipExtent:i,image:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=Y.ERROR;else{let t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r=typeof n==`number`?n:n[0],i=typeof n==`number`?n:n[1],a=this.targetTileGrid_.getResolution(t),o=this.sourceTileGrid_.getResolution(this.sourceZ_),s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=lo(r,i,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),a,s,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=Y.LOADED}this.changed()}load(){for(let e of this.sourceTiles_)e.tile=e.getTile();if(this.state==Y.IDLE){this.state=Y.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{let n=t.getState();if(n==Y.IDLE||n==Y.LOADING){e++;let n=dt(t,R.CHANGE,r=>{let i=t.getState();(i==Y.LOADED||i==Y.ERROR||i==Y.EMPTY)&&(z(n),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(n)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e},t,n){e.getState()==Y.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(z),this.sourcesListenerKeys_=null}release(){this.canvas_&&=($e(this.canvas_.getContext(`2d`)),ro.push(this.canvas_),null),this.sourceTiles_.length=0,super.release()}},go=class{constructor(e){this.highWaterMark=e===void 0?2048:e,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let e=this.pop();e instanceof pt&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return X(n!==void 0,`Tried to get a value for a key that does not exist in the cache`),n===this.newest_?n.value_:(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n,n.value_)}remove(e){let t=this.entries_[e];return X(t!==void 0,`Tried to get a value for a key that does not exist in the cache`),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){X(!(e in this.entries_),`Tried to set a value for a key that is used already`);let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}};function _o(e,t,n,r){return r===void 0?[e,t,n]:(r[0]=e,r[1]=t,r[2]=n,r)}function vo(e,t,n){return e+`/`+t+`/`+n}function yo(e,t,n,r,i){return`${V(e)},${t},${vo(n,r,i)}`}function bo(e){return xo(e[0],e[1],e[2])}function xo(e,t,n){return(t<<e)+n}function So(e,t){let n=e[0],r=e[1],i=e[2];if(t.getMinZoom()>n||n>t.getMaxZoom())return!1;let a=t.getFullTileRange(n);return a?a.containsXY(r,i):!0}var Co=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(Qe(),{get:(e,t)=>{if(typeof Qe()[t]==`function`)return this.push_(t),this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){let t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>(this.push_(e),this);pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;n<r;++n){let r=t[n];if(typeof r==`function`){r(e);continue}let i=t[++n];if(typeof e[r]==`function`)e[r](...i);else{if(typeof i==`function`){e[r]=i(e);continue}e[r]=i}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},wo=5,To=class extends gt{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=[],this.maxStaleKeys=wo}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(e){return B()}getData(e){return null}prepareFrame(e){return B()}renderFrame(e,t){return B()}forEachFeatureAtCoordinate(e,t,n,r,i){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Ba.LOADED||t.getState()===Ba.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Ba.LOADED&&t!=Ba.ERROR&&e.addEventListener(R.CHANGE,this.boundHandleImageChange_),t==Ba.IDLE&&(e.load(),t=e.getState()),t==Ba.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()===`ready`&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},Eo=null;function Do(){Eo=Xe(1,1,void 0,{willReadFrequently:!0})}var Oo=class extends To{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=oi(),this.pixelTransform=oi(),this.inversePixelTransform=oi(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){Eo||Do(),Eo.clearRect(0,0,1,1);let r;try{Eo.drawImage(e,t,n,1,1,0,0,1,1),r=Eo.getImageData(0,0,1,1).data}catch{return Eo=null,null}return r}getBackground(e){let t=this.getLayer().getBackground();return typeof t==`function`&&(t=t(e.viewState.resolution)),t||void 0}useContainer(e,t,n){let r=this.getLayer().getClassName(),i,a;if(e&&e.className===r&&(!n||e&&e.style.backgroundColor&&Ve(La(e.style.backgroundColor),La(n)))){let t=e.firstElementChild;rt(t)&&(a=t.getContext(`2d`))}if(a&&pi(a.canvas.style.transform,t)?(this.container=e,this.context=a,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){i=Je?nt():document.createElement(`div`),i.className=r;let e=i.style;e.position=`absolute`,e.width=`100%`,e.height=`100%`,a=Xe();let t=a.canvas;i.appendChild(t),e=t.style,e.position=`absolute`,e.left=`0`,e.transformOrigin=`top left`,this.container=i,this.context=a}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=an(n),i=on(n),a=Qt(n),o=Zt(n);Q(t.coordinateToPixelTransform,r),Q(t.coordinateToPixelTransform,i),Q(t.coordinateToPixelTransform,a),Q(t.coordinateToPixelTransform,o);let s=this.inversePixelTransform;Q(s,r),Q(s,i),Q(s,a),Q(s,o),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(i[0]),Math.round(i[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,i=e.viewState.rotation,a=e.pixelRatio,o=Math.round(W(n)/r*a),s=Math.round(U(n)/r*a);si(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/a,1/a,i,-o/2,-s/2),ci(this.inversePixelTransform,this.pixelTransform);let c=di(this.pixelTransform);if(this.useContainer(t,c,this.getBackground(e)),!this.containerReused){let e=this.context.canvas;e.width!=o||e.height!=s?(e.width=o,e.height=s):this.context.clearRect(0,0,o,s),c!==e.style.transform&&(e.style.transform=c)}}dispatchRenderEvent_(e,t,n){let r=this.getLayer();if(r.hasListener(e)){let i=new Ha(e,this.inversePixelTransform,n,t);r.dispatchEvent(i)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(ba.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(ba.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new Co),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(ba.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(ba.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,i,a,o){let s=i/2,c=a/2,l=r/t,u=-l,d=-e[0]+o,f=-e[1];return si(this.tempTransform,s,c,l,u,-n,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}};function ko(e,t,n){if(!(n in e))return e[n]=new Set([t]),!0;let r=e[n],i=r.has(t);return i||r.add(t),!i}function Ao(e,t,n){let r=e[n];return r?r.delete(t):!1}function jo(e,t){let n=e.layerStatesArray[e.layerIndex];n.extent&&(t=rn(t,ti(n.extent,e.viewState.projection)));let r=n.layer.getRenderSource();if(!r.getWrapX()){let n=r.getTileGridForProjection(e.viewState.projection).getExtent();n&&(t=rn(t,n))}return t}var Mo=class extends Oo{constructor(e,t){super(e),t||={},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=zt(),this.tempTileRange_=new eo(0,0,0,0),this.tempTileCoord_=_o(0,0,0);let n=t.cacheSize===void 0?512:t.cacheSize;this.tileCache_=new go(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||=new go(512),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let i=this.tileCache_,a=this.getLayer().getSource(),o=yo(a,a.getKey(),e,t,n),s;if(i.containsKey(o))s=i.get(o);else{let c=r.viewState.projection,l=a.getProjection();if(s=a.getTile(e,t,n,r.pixelRatio,c,!l||Gr(l,c)?void 0:this.getSourceTileCache()),!s)return null;i.set(o,s)}return s}getTile(e,t,n,r){return this.getOrCreateTile(e,t,n,r)||null}getData(e){let t=this.frameState;if(!t)return null;let n=this.getLayer(),r=Q(t.pixelToCoordinateTransform,e.slice()),i=n.getExtent();if(i&&!It(i,r))return null;let a=t.viewState,o=n.getRenderSource(),s=o.getTileGridForProjection(a.projection),c=o.getTilePixelRatio(t.pixelRatio);for(let e=s.getZForResolution(a.resolution);e>=s.getMinZoom();--e){let n=s.getTileCoordForCoordAndZ(r,e),i=this.getTile(e,n[1],n[2],t);if(!i||i.getState()!==Y.LOADED)continue;let l=s.getOrigin(e),u=za(s.getTileSize(e)),d=s.getResolution(e),f;if(i instanceof Qa||i instanceof ho)f=i.getImage();else if(i instanceof Za){if(f=Ja(i.getData()),!f)continue}else continue;let p=Math.floor(c*((r[0]-l[0])/d-n[1]*u[0])),m=Math.floor(c*((l[1]-r[1])/d-n[2]*u[1])),h=Math.round(c*o.getGutterForProjection(a.projection));return this.getImageData(f,p+h,m+h)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;let t=this.getLayer().getSource();if(!t)return!1;let n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,i){let a=e.viewState,o=this.getLayer(),s=o.getRenderSource(),c=s.getTileGridForProjection(a.projection),l=V(s);l in e.wantedTiles||(e.wantedTiles[l]={});let u=e.wantedTiles[l],d=o.getMapInternal(),f=Math.max(n-i,c.getMinZoom(),c.getZForResolution(Math.min(o.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):c.getResolution(0)),s.zDirection)),p=a.rotation,m=p?nn(a.center,a.resolution,p,e.size):void 0;for(let i=n;i>=f;--i){let n=c.getTileRangeForExtentAndZ(t,i,this.tempTileRange_),a=c.getResolution(i);for(let t=n.minX;t<=n.maxX;++t)for(let o=n.minY;o<=n.maxY;++o){if(p&&!c.tileCoordIntersectsViewport([i,t,o],m))continue;let n=this.getTile(i,t,o,e);if(!n||!ko(r,n,i))continue;let s=n.getKey();if(u[s]=!0,n.getState()===Y.IDLE&&!e.tileQueue.isKeyQueued(s)){let r=_o(i,t,o,this.tempTileCoord_);e.tileQueue.enqueue([n,l,c.getTileCoordCenter(r),a])}}}}findStaleTile_(e,t){let n=this.tileCache_,r=e[0],i=e[1],a=e[2],o=this.getStaleKeys();for(let e=0;e<o.length;++e){let s=yo(this.getLayer().getSource(),o[e],r,i,a);if(n.containsKey(s)){let e=n.peek(s);if(e.getState()===Y.LOADED)return e.endTransition(V(this)),ko(t,e,r),!0}}return!1}findAltTiles_(e,t,n,r){let i=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!i)return!1;let a=!0,o=this.tileCache_,s=this.getLayer().getRenderSource(),c=s.getKey();for(let e=i.minX;e<=i.maxX;++e)for(let t=i.minY;t<=i.maxY;++t){let i=yo(s,c,n,e,t),l=!1;if(o.containsKey(i)){let e=o.peek(i);e.getState()===Y.LOADED&&(ko(r,e,n),l=!0)}l||(a=!1)}return a}renderFrame(e,t){this.renderComplete=!0;let n=e.layerStatesArray[e.layerIndex],r=e.viewState,i=r.projection,a=r.resolution,o=r.center,s=e.pixelRatio,c=this.getLayer(),l=c.getSource(),u=l.getTileGridForProjection(i),d=u.getZForResolution(a,l.zDirection),f=u.getResolution(d),p=l.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==p&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=p):this.renderedSourceKey_=p;let m=e.extent,h=l.getTilePixelRatio(s);this.prepareContainer(e,t);let g=this.context.canvas.width,_=this.context.canvas.height;this.layerExtent=n.extent?ti(n.extent,i):null,this.layerExtent&&(m=rn(m,this.layerExtent));let v=f*g/2/h,y=f*_/2/h,b=[o[0]-v,o[1]-y,o[0]+v,o[1]+y],x={};this.renderedTiles.length=0;let S=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let t=u.getZForResolution(r.nextResolution,l.zDirection),n=jo(e,e.nextExtent);this.enqueueTiles(e,n,t,x,S)}let C=jo(e,m);if(this.enqueueTiles(e,C,d,x,0),S>0&&setTimeout(()=>{this.enqueueTiles(e,C,d-1,x,S-1)},0),!(d in x))return this.container;let w=V(this),T=e.time;for(let t of x[d]){let n=t.getState();if(n===Y.EMPTY)continue;let r=t.tileCoord;if(n===Y.LOADED&&t.getAlpha(w,T)===1){t.endTransition(w);continue}if(n!==Y.ERROR&&(this.renderComplete=!1),this.findStaleTile_(r,x)){Ao(x,t,d),e.animate=!0;continue}if(this.findAltTiles_(u,r,d+1,x))continue;let i=u.getMinZoom();for(let e=d-1;e>=i&&!this.findAltTiles_(u,r,e,x);--e);}let E=f/a*s/h,D=this.getRenderContext(e);si(this.tempTransform,g/2,_/2,E,E,0,-g/2,-_/2),this.layerExtent&&this.clipUnrotated(D,e,this.layerExtent),l.getInterpolate()||(D.imageSmoothingEnabled=!1),this.preRender(D,e);let O=Object.keys(x).map(Number);O.sort(Re);let k,A=[],j=[];for(let t=O.length-1;t>=0;--t){let n=O[t],r=l.getTilePixelSize(n,s,i),a=u.getResolution(n)/f,o=r[0]*a*E,c=r[1]*a*E,d=u.getTileCoordForCoordAndZ(an(b),n),p=u.getTileCoordExtent(d),m=Q(this.tempTransform,[h*(p[0]-b[0])/f,h*(b[3]-p[3])/f]),g=h*l.getGutterForProjection(i);for(let t of x[n]){if(t.getState()!==Y.LOADED)continue;let r=t.tileCoord,i=d[1]-r[1],a=Math.round(m[0]-(i-1)*o),s=d[2]-r[2],u=Math.round(m[1]-(s-1)*c),f=Math.round(m[0]-i*o),p=Math.round(m[1]-s*c),h=a-f,_=u-p,v=O.length===1,y=!1;k=[f,p,f+h,p,f+h,p+_,f,p+_];for(let e=0,t=A.length;e<t;++e)if(!v&&n<j[e]){let t=A[e];sn([f,p,f+h,p+_],[t[0],t[3],t[4],t[7]])&&(y||=(D.save(),!0),D.beginPath(),D.moveTo(k[0],k[1]),D.lineTo(k[2],k[3]),D.lineTo(k[4],k[5]),D.lineTo(k[6],k[7]),D.moveTo(t[6],t[7]),D.lineTo(t[4],t[5]),D.lineTo(t[2],t[3]),D.lineTo(t[0],t[1]),D.clip())}A.push(k),j.push(n),this.drawTile(t,e,f,p,h,_,g,v),y&&D.restore(),this.renderedTiles.unshift(t),this.updateUsedTiles(e.usedTiles,l,t)}}return this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!Wt(this.renderedExtent_,b),this.renderedExtent_=b,this.renderedPixelRatio=s,this.postRender(this.context,e),this.layerExtent&&D.restore(),D.imageSmoothingEnabled=!0,this.renderComplete&&e.postRenderFunctions.push((e,t)=>{let n=V(l),r=t.wantedTiles[n],i=r?Object.keys(r).length:0;this.updateCacheSize(i),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()}),this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,i,a,o,s){let c;if(e instanceof Za){if(c=Ja(e.getData()),!c)throw Error(`Rendering array data is not yet supported`)}else c=this.getTileImage(e);if(!c)return;let l=this.getRenderContext(t),u=V(this),d=t.layerStatesArray[t.layerIndex],f=d.opacity*(s?e.getAlpha(u,t.time):1),p=f!==l.globalAlpha;p&&(l.save(),l.globalAlpha=f),l.drawImage(c,o,o,c.width-2*o,c.height-2*o,n,r,i,a),p&&l.restore(),f===d.opacity?s&&e.endTransition(u):t.animate=!0}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=V(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},No={PRELOAD:`preload`,USE_INTERIM_TILES_ON_ERROR:`useInterimTilesOnError`},Po=class extends xa{constructor(e){e||={};let t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(e.preload===void 0?0:e.preload),this.setUseInterimTilesOnError(e.useInterimTilesOnError===void 0?!0:e.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(No.PRELOAD)}setPreload(e){this.set(No.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(No.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(No.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},Fo=class extends Po{constructor(e){super(e)}createRenderer(){return new Mo(this,{cacheSize:this.getCacheSize()})}},Io=[0,0,0],Lo=5,Ro=class{constructor(e){this.minZoom=e.minZoom===void 0?0:e.minZoom,this.resolutions_=e.resolutions,X(He(this.resolutions_,(e,t)=>t-e,!0),"`resolutions` must be sorted in descending order");let t;if(!e.origins){for(let e=0,n=this.resolutions_.length-1;e<n;++e)if(!t)t=this.resolutions_[e]/this.resolutions_[e+1];else if(this.resolutions_[e]/this.resolutions_[e+1]!==t){t=void 0;break}}this.zoomFactor_=t,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin===void 0?null:e.origin,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,X(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));let n=e.extent;n!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=an(n)),X(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,X(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize===void 0?this.tileSizes_?null:256:e.tileSize,X(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=n===void 0?null:n,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.sizes===void 0?n&&this.calculateTileRanges_(n):this.fullTileRanges_=e.sizes.map((e,t)=>{let r=new eo(Math.min(0,e[0]),Math.max(e[0]-1,-1),Math.min(0,e[1]),Math.max(e[1]-1,-1));if(n){let e=this.getTileRangeForExtentAndZ(n,t);r.minX=Math.max(e.minX,r.minX),r.maxX=Math.min(e.maxX,r.maxX),r.minY=Math.max(e.minY,r.minY),r.maxY=Math.min(e.maxY,r.maxY)}return r})}forEachTileCoord(e,t,n){let r=this.getTileRangeForExtentAndZ(e,t);for(let e=r.minX,i=r.maxX;e<=i;++e)for(let i=r.minY,a=r.maxY;i<=a;++i)n([t,e,i])}forEachTileCoordParentTileRange(e,t,n,r){let i,a,o,s=null,c=e[0]-1;for(this.zoomFactor_===2?(a=e[1],o=e[2]):s=this.getTileCoordExtent(e,r);c>=this.minZoom;){if(a!==void 0&&o!==void 0?(a=Math.floor(a/2),o=Math.floor(o/2),i=to(a,a,o,o,n)):i=this.getTileRangeForExtentAndZ(s,c,n),t(c,i))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){let n=e[1]*2,r=e[2]*2;return to(n,n+1,r,r+1,t)}let r=this.getTileCoordExtent(e,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,n){if(t>this.maxZoom||t<this.minZoom)return null;let r=e[0],i=e[1],a=e[2];if(t===r)return to(i,a,i,a,n);if(this.zoomFactor_){let e=this.zoomFactor_**+(t-r),o=Math.floor(i*e),s=Math.floor(a*e);return t<r?to(o,o,s,s,n):to(o,Math.floor(e*(i+1))-1,s,Math.floor(e*(a+1))-1,n)}let o=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,Io);let r=Io[1],i=Io[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Io);let a=Io[1],o=Io[2];return to(r,a,i,o,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=za(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*r[0]*n,t[1]-(e[2]+.5)*r[1]*n]}getTileCoordExtent(e,t){let n=this.getOrigin(e[0]),r=this.getResolution(e[0]),i=za(this.getTileSize(e[0]),this.tmpSize_),a=n[0]+e[1]*i[0]*r,o=n[1]-(e[2]+1)*i[1]*r;return Bt(a,o,a+i[0]*r,o+i[1]*r,t)}getTileCoordForCoordAndResolution(e,t,n){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,n)}getTileCoordForXYAndResolution_(e,t,n,r,i){let a=this.getZForResolution(n),o=n/this.getResolution(a),s=this.getOrigin(a),c=za(this.getTileSize(a),this.tmpSize_),l=o*(e-s[0])/n/c[0],u=o*(s[1]-t)/n/c[1];return r?(l=Cn(l,Lo)-1,u=Cn(u,Lo)-1):(l=Sn(l,Lo),u=Sn(u,Lo)),_o(a,l,u,i)}getTileCoordForXYAndZ_(e,t,n,r,i){let a=this.getOrigin(n),o=this.getResolution(n),s=za(this.getTileSize(n),this.tmpSize_),c=(e-a[0])/o/s[0],l=(a[1]-t)/o/s[1];return r?(c=Cn(c,Lo)-1,l=Cn(l,Lo)-1):(c=Sn(c,Lo),l=Sn(l,Lo)),_o(n,c,l,i)}getTileCoordForCoordAndZ(e,t,n){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,n)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){return G(ze(this.resolutions_,e,t||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return Ji(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){let t=this.resolutions_.length,n=Array(t);for(let r=this.minZoom;r<t;++r)n[r]=this.getTileRangeForExtentAndZ(e,r);this.fullTileRanges_=n}};function zo(e){let t=e.getDefaultTileGrid();return t||(t=Wo(e),e.setDefaultTileGrid(t)),t}function Bo(e,t,n){let r=t[0],i=e.getTileCoordCenter(t),a=Go(n);if(!It(a,i)){let t=W(a),n=Math.ceil((a[0]-i[0])/t);return i[0]+=t*n,e.getTileCoordForCoordAndZ(i,r)}return t}function Vo(e,t,n,r){r=r===void 0?`top-left`:r;let i=Uo(e,t,n);return new Ro({extent:e,origin:en(e,r),resolutions:i,tileSize:n})}function Ho(e){let t=e||{},n=t.extent||q(`EPSG:3857`).getExtent();return new Ro({extent:n,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Uo(n,t.maxZoom,t.tileSize,t.maxResolution)})}function Uo(e,t,n,r){t=t===void 0?42:t,n=za(n===void 0?256:n);let i=U(e),a=W(e);r=r>0?r:Math.max(a/n[0],i/n[1]);let o=t+1,s=Array(o);for(let e=0;e<o;++e)s[e]=r/2**e;return s}function Wo(e,t,n,r){return Vo(Go(e),t,n,r)}function Go(e){e=q(e);let t=e.getExtent();if(!t){let n=180*jn.degrees/e.getMetersPerUnit();t=Bt(-n,-n,n,n)}return t}var Ko=/\{z\}/g,qo=/\{x\}/g,Jo=/\{y\}/g,Yo=/\{-y\}/g;function Xo(e,t,n,r,i){return e.replace(Ko,t.toString()).replace(qo,n.toString()).replace(Jo,r.toString()).replace(Yo,function(){if(i===void 0)throw Error(`If the URL template has a {-y} placeholder, the grid extent must be known`);return(i-r).toString()})}function Zo(e){let t=[],n=/\{([a-z])-([a-z])\}/.exec(e);if(n){let r=n[1].charCodeAt(0),i=n[2].charCodeAt(0),a;for(a=r;a<=i;++a)t.push(e.replace(n[0],String.fromCharCode(a)));return t}if(n=/\{(\d+)-(\d+)\}/.exec(e),n){let r=parseInt(n[2],10);for(let i=parseInt(n[1],10);i<=r;i++)t.push(e.replace(n[0],i.toString()));return t}return t.push(e),t}function Qo(e,t){return(function(n,r,i){if(!n)return;let a,o=n[0];if(t){let e=t.getFullTileRange(o);e&&(a=e.getHeight()-1)}return Xo(e,o,n[1],n[2],a)})}function $o(e,t){let n=e.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Qo(e[i],t);return es(r)}function es(e){return e.length===1?e[0]:(function(t,n,r){if(t)return e[yn(bo(t),e.length)](t,n,r)})}var ts=class extends bt{constructor(e){super(),this.projection=q(e.projection),this.attributions_=ns(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=e.state===void 0?`ready`:e.state,this.wrapX_=e.wrapX===void 0?!1:e.wrapX,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;let t=this;this.viewPromise_=new Promise(function(e,n){t.viewResolver=e,t.viewRejector=n})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=ns(e),this.changed()}setState(e){this.state_=e,this.changed()}};function ns(e){return e?typeof e==`function`?e:(Array.isArray(e)||(e=[e]),t=>e):null}var rs=class extends ts{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio===void 0?1:e.tilePixelRatio,this.tileGrid=e.tileGrid===void 0?null:e.tileGrid,this.tileGrid&&za(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tmpSize=[0,0],this.key_=e.key||V(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){let t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,i,a){return B()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:zo(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),i=this.getTilePixelRatio(t),a=za(r.getTileSize(e),this.tmpSize);return i==1?a:Ra(a,i,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){let n=t===void 0?this.getProjection():t,r=t===void 0&&this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(e=Bo(r,e,n)),So(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},is=class extends mt{constructor(e,t){super(e),this.tile=t}},as={TILELOADSTART:`tileloadstart`,TILELOADEND:`tileloadend`,TILELOADERROR:`tileloaderror`},os=class e extends rs{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===e.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){let t=e.target,n=V(t),r=t.getState(),i;r==Y.LOADING?(this.tileLoadingKeys_[n]=!0,i=as.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],i=r==Y.ERROR?as.TILELOADERROR:r==Y.LOADED?as.TILELOADEND:void 0),i!=null&&this.dispatchEvent(new is(i,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,t===void 0?this.changed():this.setKey(t)}setUrl(e){let t=Zo(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`
|
|
2
|
+
`);this.generateTileUrlFunction_?this.setTileUrlFunction($o(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},ss=class extends os{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:cs,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate===void 0?!0:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin===void 0?null:e.crossOrigin,this.referrerPolicy=e.referrerPolicy,this.tileClass=e.tileClass===void 0?Qa:e.tileClass,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!Gr(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=`:disable-interpolation`),e}getTileGridForProjection(e){let t=this.getProjection();if(this.tileGrid&&(!t||Gr(t,e)))return this.tileGrid;let n=V(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=zo(e)),this.tileGridForProjection[n]}createTile_(e,t,n,r,i,a){let o=[e,t,n],s=this.getTileCoordForTileUrlFunction(o,i),c=s?this.tileUrlFunction(s,r,i):void 0,l=new this.tileClass(o,c===void 0?Y.EMPTY:Y.IDLE,c===void 0?``:c,{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return l.key=a,l.addEventListener(R.CHANGE,this.handleTileChange.bind(this)),l}getTile(e,t,n,r,i,a){let o=this.getProjection();if(!o||!i||Gr(o,i))return this.getTileInternal(e,t,n,r,o||i);let s=[e,t,n],c=this.getKey(),l=new ho(o,this.getTileGridForProjection(o),i,this.getTileGridForProjection(i),s,this.getTileCoordForTileUrlFunction(s,i),this.getTilePixelRatio(r),this.getGutter(),(e,t,n,r)=>this.getTileInternal(e,t,n,r,o,a),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return l.key=c,l}getTileInternal(e,t,n,r,i,a){let o=this.getKey(),s=yo(this,o,e,t,n);if(a&&a.containsKey(s))return a.get(s);let c=this.createTile_(e,t,n,r,i,o);return a?.set(s,c),c}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){let n=q(e);if(n){let e=V(n);e in this.tileGridForProjection||(this.tileGridForProjection[e]=t)}}};function cs(e,t){if(Je){let n=e.getCrossOrigin(),r=`same-origin`,i=`same-origin`;n===`anonymous`||n===``?(r=`cors`,i=`omit`):n===`use-credentials`&&(r=`cors`,i=`include`);let a={mode:r,credentials:i,referrerPolicy:e.getReferrerPolicy()};fetch(t,a).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.blob()}).then(e=>createImageBitmap(e)).then(t=>{let n=e.getImage();n.width=t.width,n.height=t.height,n.getContext(`2d`).drawImage(t,0,0),t.close?.(),n.dispatchEvent(new Event(`load`))}).catch(()=>{e.getImage().dispatchEvent(new Event(`error`))});return}e.getImage().src=t}var ls=class extends ss{constructor(e){e||={};let t=e.projection===void 0?`EPSG:3857`:e.projection,n=e.tileGrid===void 0?Ho({extent:Go(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize}):e.tileGrid;super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX===void 0?!0:e.wrapX,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter===void 0?0:e.gutter}getGutter(){return this.gutter_}},us=`a6e8f78974f2581f2ca00485b40c948f`,ds=`https://static.zhihaoscm.cn/`,fs={default:13,findShip:13,findShipMin:10,findTruck:14,markerPosition:14,max:18,min:3,scaleNum:.555,shipGreenDotMax:11,shipModelMax:18,shipModelMin:13,shipTriggleMin:16,truckDefault:14,truckStatistics:8},ps={data:`EPSG:4326`,mercator:`EPSG:3857`},ms=[114.84,30.52],hs={greenTile:`${ds}/map/tile/{z}/{x}/{y}.png`,satelliteImgTile:`https://t0.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${us}`,satelliteImgTileMark:`https://t0.tianditu.gov.cn/cia_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${us}`,vectorTile:`https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${us}`,vectorTileMark:`https://t0.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${us}`};function gs(e){return{greenMark:new Fo({className:`greenTile`,source:new ls({url:hs.greenTile}),visible:e.showGreenLayer,zIndex:2}),satelliteImgTile:new Fo({className:`satellite`,preload:1,source:new ls({url:hs.satelliteImgTile}),visible:e.layerType===`satellite`,zIndex:0}),satelliteImgTileMark:new Fo({className:`satellite`,preload:1,source:new ls({url:hs.satelliteImgTileMark}),visible:e.layerType===`satellite`,zIndex:1}),vectorTile:new Fo({className:`vector`,preload:1,source:new ls({url:hs.vectorTile}),visible:e.layerType===`vector`,zIndex:0}),vectorTileMark:new Fo({className:`vector`,preload:1,source:new ls({url:hs.vectorTileMark}),visible:e.layerType===`vector`,zIndex:1})}}function _s(e){return Object.fromEntries(e.map(e=>[e,()=>void 0]))}function vs(e,t,n=64){return Array.from({length:n},(r,i)=>{let a=i/n*Math.PI*2;return[e[0]+Math.cos(a)*t,e[1]+Math.sin(a)*t]})}var ys=(0,d.forwardRef)(function({center:e=ms,className:t,copyrightImgUrl:n,layerType:r=`vector`,mapMoveEnd:i,scaleLineUnit:a=`metric`,showGreenLayer:o=!1,showScale:s=!0,zoom:m=fs.default,...h},g){let _=(0,d.useRef)(null),v=(0,d.useRef)(void 0),y=(0,d.useRef)(void 0),b=(0,d.useRef)(void 0),x=(0,d.useRef)(!0),S=(0,d.useRef)(`close`),C=(0,d.useRef)(`m`),w=(0,d.useRef)(`close`),T=(0,d.useRef)(r),E=(0,d.useCallback)(e=>{let t=y.current;t&&(t.vectorTile.setVisible(e===`vector`),t.vectorTileMark.setVisible(e===`vector`),t.satelliteImgTile.setVisible(e===`satellite`),t.satelliteImgTileMark.setVisible(e===`satellite`),T.current=e)},[]),D=(0,d.useCallback)(()=>v.current?.getView(),[]),O=(0,d.useCallback)(()=>D()?.getZoom(),[D]),k=(0,d.useCallback)(e=>{D()?.setZoom(e),i?.(e)},[D,i]),A=(0,d.useCallback)((e,t)=>{D()?.setCenter(Ur([e,t]))},[D]),j=(0,d.useCallback)((e,t,n,r=1e3)=>{D()?.animate({center:Ur([e,t]),duration:r,easing:e=>.5*(1-Math.cos(Math.PI*e)),zoom:n})},[D]),M=(0,d.useCallback)(()=>{let e=D()?.getCenter();return e?Wr(e):void 0},[D]),N=(0,d.useCallback)(()=>{let e=v.current,t=D();if(!e||!t)return;let n=e.getSize();if(!n)return;let r=t.calculateExtent(n),i=Yr([r[0],r[1]],ps.mercator,ps.data),a=Yr([r[2],r[3]],ps.mercator,ps.data);return[i[0],i[1],a[0],a[1]]},[D]),P=(0,d.useMemo)(()=>({carTrack:_s([`location`,`remove`,`renderTrack`,`setCenter`,`closeTrack`,`playTrack`]),port:_s([`render`,`clear`,`selected`,`setRed`,`clearRed`,`clearNonRed`]),position:_s([`render`,`selected`,`clearSelected`,`clear`,`renderHtml`,`removeHtml`]),ship:_s([`render`,`selected`,`filter`,`blinking`,`clear`,`setLableStatus`]),track:_s([`render`,`remove`,`play`,`setCenter`,`close`,`getLength`]),wharf:_s([`createWharfLine`,`createWharfLines`,`createWharfPolygon`,`createWharfPolygons`,`createWharfPoint`,`createWharfPoints`,`removeWharfLayer`,`selected`,`clearAllHighlight`])}),[]);return(0,d.useEffect)(()=>{let t=_.current;if(!t)return;let n=gs({layerType:r,showGreenLayer:o});y.current=n;let i=new p.Map({controls:Mt({zoom:!1}),layers:[n.vectorTile,n.vectorTileMark,n.satelliteImgTile,n.satelliteImgTileMark,n.greenMark],target:t,view:new p.View({center:Ur(e),constrainResolution:!0,enableRotation:!1,maxZoom:fs.max,minZoom:fs.min,multiWorld:!0,zoom:m})});return v.current=i,s&&(b.current=new Ka({units:a}),i.addControl(b.current)),()=>{b.current&&i.removeControl(b.current),i.setTarget(void 0),v.current=void 0,y.current=void 0}},[e,r,a,o,s,m]),(0,d.useEffect)(()=>{E(r)},[r,E]),(0,d.useEffect)(()=>{y.current?.greenMark.setVisible(o)},[o]),(0,d.useImperativeHandle)(g,()=>({...P,config:{MAP_DEFAULT_CENTER:ms,MAP_ZOOM:fs,projection:ps},drawLine:{close:()=>{S.current=`close`},deleteLine:()=>void 0,getState:()=>S.current,open:()=>{S.current=`open`},setUnit:e=>{C.current=e}},drawPolygon:{close:()=>{w.current=`close`},open:()=>{w.current=`open`},reset:()=>{w.current=`close`}},flyTo:j,getCenter:M,getInstall:()=>v.current,getMapClick:()=>x.current,getSize:()=>v.current?.getSize(),getView:D,getZoom:O,layer:{getGreenTileVisible:()=>y.current?.greenMark.getVisible(),getShowLayerType:()=>T.current,setGreenTileVisible:e=>y.current?.greenMark.setVisible(e),setShowLayerType:E},setCenter:A,setMapClick:e=>{x.current=e},setZoom:k,utils:{calculateCirclePoints:vs,convertSixHundredThousandToLatLng:(e,t)=>[e/6e5,t/6e5],getCalculateExtent:N}}),[j,N,M,D,O,P,A,E,k]),(0,u.jsxs)(`div`,{...h,className:(0,l.default)(`zh-map-box`,t),children:[(0,u.jsx)(`div`,{ref:_,className:`zh-map`}),(0,u.jsxs)(`div`,{className:`zh-map__zoom-control`,children:[(0,u.jsx)(c.Button,{"aria-label":`放大地图`,icon:(0,u.jsx)(f.PlusOutlined,{}),onClick:()=>k((O()??m)+1)}),(0,u.jsx)(c.Button,{"aria-label":`缩小地图`,icon:(0,u.jsx)(f.MinusOutlined,{}),onClick:()=>k((O()??m)-1)})]}),n?(0,u.jsx)(`div`,{className:`map-copyright`,children:(0,u.jsx)(`img`,{alt:`copyright`,src:n})}):null]})}),bs={},xs={display:`none`},Ss={cancelButtonText:`取消`,center:!1,closeOnClickModal:!1,closeOnPressEscape:!1,confirmButtonText:`确定`,draggable:!1,roundButton:!1,showCancelButton:!0,showClose:!0,showConfirmButton:!0,type:``};function Cs(e,t){return t?e:{...e,style:{...e?.style,...xs}}}function ws(e,t){return e.className??e.customClass??t}function Ts(e,t,n,r){let i={...Ss,...n};return{cancelButtonProps:Cs(i.cancelButtonProps,!!i.showCancelButton),cancelText:i.cancelButtonText,centered:i.center,className:ws(i,r),closable:i.showClose,content:e,keyboard:i.closeOnPressEscape,maskClosable:i.closeOnClickModal,okButtonProps:Cs(i.confirmButtonProps,!!i.showConfirmButton),okText:i.confirmButtonText,title:t,...i.modalProps}}function Es(e,t,n=bs){let r=Ts(e,t,n,`zh-message-box zh-message-confirm`);return new Promise((e,t)=>{c.Modal.confirm({...r,onCancel:async()=>{await n.onCancel?.(),t(`cancel`)},onOk:async()=>{await n.onOk?.(),e(`confirm`)}})})}function Ds(e,t,n=bs){let r=Ts(e,t,n,`zh-message-box zh-message-alert`);return new Promise(e=>{c.Modal.info({...r,cancelButtonProps:void 0,onOk:async()=>{await n.onOk?.(),e(`confirm`)}})})}function Os(e,t,n=bs){let r=n.inputValue??``,i=(0,d.createElement)(d.Fragment,null,(0,d.createElement)(`div`,{className:`zh-message-box__message`},e),(0,d.createElement)(c.Input,{className:`zh-message-box__input`,defaultValue:r,onChange:e=>{r=e.target.value,n.onInputChange?.(r)},placeholder:n.inputPlaceholder})),a=Ts(e,t,n,`zh-message-box zh-message-prompt`);return new Promise((e,t)=>{c.Modal.confirm({...a,content:i,onCancel:async()=>{await n.onCancel?.(),t(`cancel`)},onOk:async()=>{await n.onOk?.(),e({value:r})}})})}var ks={alert:Ds,confirm:Es,prompt:Os},As=Es,js=Ds,Ms=Os;function Ns(e){return typeof e==`number`?!0:!Number.isNaN(Number.parseFloat(e))}function Ps(e){let t=[`角`,`分`],n=[`零`,`壹`,`贰`,`叁`,`肆`,`伍`,`陆`,`柒`,`捌`,`玖`],r=[[`元`,`万`,`亿`],[``,`拾`,`佰`,`仟`]],i=e<0?`负`:``,a=Math.abs(e),o=``;for(let e=0;e<t.length;e+=1)o+=`${n[Math.floor(a*10*10**e)%10]}${t[e]}`.replace(/零./,``);o||=`整`,a=Math.floor(a);for(let e=0;e<r[0].length&&a>0;e+=1){let t=``;for(let e=0;e<r[1].length&&a>0;e+=1)t=n[a%10]+r[1][e]+t,a=Math.floor(a/10);o=t.replace(/(零.)*零$/,``).replace(/^$/,`零`)+r[0][e]+o}return i+o.replace(/(零.)*零元/,`元`).replace(/(零.)+/g,`零`).replace(/^整$/,`零元整`)}function Fs({className:e,onBlur:t,onFocus:n,showTooltip:r=!0,value:i,...a}){let[o,s]=(0,d.useState)(!1),f=(0,d.useMemo)(()=>!i||!Ns(i)||Number(i)<1e3?``:Ps(Number(i)),[i]),p=r&&o&&f?f:``,m=(0,d.useCallback)(e=>{s(!1),t?.(e)},[t]),h=(0,d.useCallback)(e=>{s(!0),n?.(e)},[n]);return(0,u.jsx)(c.Tooltip,{open:!!p,placement:`top`,title:p,children:(0,u.jsx)(`div`,{className:(0,l.default)(`zh-money-input`,e),"data-testid":`zh-money-input`,"data-upper-amount":p||void 0,children:(0,u.jsx)(Ie,{...a,className:`zh-money-input__number`,onBlur:m,onFocus:h,value:i})})})}function Is({className:e,dataSource:t,extendNode:n,...r}){return(0,u.jsxs)(`div`,{...r,className:(0,l.default)(`zh-page-head`,e),children:[(0,u.jsxs)(`div`,{className:`zh-page-head__left`,children:[(0,u.jsx)(`span`,{className:`zh-page-head__name`,children:t.name}),t.no===void 0?null:(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`span`,{className:`zh-page-head__label zh-page-head__label--no`,children:`编号`}),(0,u.jsx)(`span`,{className:`zh-page-head__value`,children:t.no})]})]}),(0,u.jsxs)(`div`,{className:`zh-page-head__other`,children:[n??(0,u.jsxs)(u.Fragment,{children:[t.extendLabel?(0,u.jsx)(`span`,{className:`zh-page-head__label`,children:t.extendLabel}):null,t.extendValue===void 0?null:(0,u.jsx)(`span`,{className:`zh-page-head__value zh-page-head__value--extend`,children:t.extendValue})]}),t.status?(0,u.jsx)(`span`,{className:`zh-page-head__status`,children:t.status}):null]})]})}function Ls(e,t,n=`--`){let r=t.split(`.`).reduce((e,t)=>e?.[t],e);return r==null||r===``?n:r}function Rs(e){return e.split(`.`).at(-1)??e}function zs(e,t,n,r){for(let i of e){if(i[n]===t)return i;if(Array.isArray(i[r])){let e=zs(i[r],t,n,r);if(e)return e}}}function Bs(e,t,n,r){let i=n?.value??`value`,a=n?.label??`label`,o=n?.children??`children`,s=Array.isArray(t)?zs(t,e,i,o):void 0;return r===`tag`?s?.tagType??``:s?s[a]:`--`}function Vs(e){return Array.isArray(e)?e.length?e.join(` / `):`--`:e??`--`}function Hs(e){let t={};return Object.entries(e).forEach(([e,n])=>{(n||n===!1||n===0)&&(t[e]=n)}),t}var Us={page:1,size:10,total:0},Ws={},Gs=e=>e;function Ks(e){let t=[];function n(e){e.forEach(e=>{e._children?.length&&n(e._children),t.push({...e,isFilterEnum:e.isFilterEnum??!0,isShow:e.isShow??!0})})}return n(e),t}function qs(e){let t={};return Ks(e).forEach(e=>{if(!e.search)return;let n=e.search.key??Rs(String(e.prop));e.search.defaultValue!==void 0&&e.search.defaultValue!==null&&(t[n]=e.search.defaultValue)}),t}function Js(e){return Array.isArray(e)?e:[]}function Ys(e){let t=Ks(e).filter(e=>e.search?.el||e.search?.render).filter(e=>e.search?.isShow!==!1);return t.sort((e,t)=>(e.search?.order??0)-(t.search?.order??0)),t}function Xs(e,t,n,r){let i=e.search,a=i.key??Rs(String(e.prop)),o=t[a],s=Js(e.enum),l=i.props?.placeholder??(i.el?.includes(`input`)?`请输入`:`请选择`),d={allowClear:i.props?.allowClear??i.props?.clearable??!0,placeholder:l,style:{minWidth:i.width&&typeof i.width==`number`?i.width:120},value:o,...i.props},f=e=>n(a,e?.target?e.target.value:e);if(i.render)return i.render({clearable:d.allowClear,data:s,modelValue:o,options:s,placeholder:l,searchParam:t,setModelValue:e=>n(a,e)});switch(i.el){case`input-number`:return(0,u.jsx)(c.InputNumber,{...d,onChange:f});case`select`:case`select-v2`:case`tree-select`:return(0,u.jsx)(c.Select,{...d,onChange:f,children:s.map(e=>(0,u.jsx)(c.Select.Option,{value:e.value,children:e.label},String(e.value)))});case`cascader`:return(0,u.jsx)(c.Cascader,{...d,options:s,onChange:f});case`date-picker`:case`time-picker`:case`time-select`:return(0,u.jsx)(c.DatePicker,{...d,onChange:f});case`switch`:return(0,u.jsx)(c.Switch,{checked:!!o,onChange:f});case`slider`:return(0,u.jsx)(c.Slider,{...d,onChange:f});default:return(0,u.jsx)(c.Input,{...d,onChange:f,onPressEnter:r})}}function Zs(e,t,n){let r={$index:n,column:e,row:t},i=e.prop?Ls(t,e.prop):`--`,a=Js(e.enum),o=a.length&&e.isFilterEnum!==!1?Bs(i,a,e.fieldNames):Vs(i);return e.render?e.render(r):e.tag?(0,u.jsx)(c.Tag,{color:Bs(i,a,e.fieldNames,`tag`),children:o}):e.click&&o!==`--`?(0,u.jsx)(c.Typography.Link,{onClick:()=>e.click?.(t,n),children:o}):o}function Qs(e){return e.filter(e=>e.isShow!==!1).filter(e=>e.type!==`selection`).map((e,t)=>e.type===`index`?{align:e.align,dataIndex:`__index`,fixed:e.fixed,key:`index-${t}`,render:(e,t,n)=>n+1,title:e.label??`序号`,width:e.width??80}:e.type===`radio`?{key:`radio-${t}`,render:()=>(0,u.jsx)(c.Radio,{}),title:e.label,width:e.width??55}:{align:e.align,children:e._children?Qs(e._children):void 0,dataIndex:e.prop,fixed:e.fixed,key:String(e.prop??t),render:(t,n,r)=>Zs(e,n,r),sorter:e.sorter??(e.sortable?!0:void 0),title:e.headerRender?n=>e.headerRender?.({$index:t,column:e}):e.label,width:e.width})}var $s=(0,d.forwardRef)(function({beforeReset:e,border:t=!1,className:n,columns:r,customColumn:i=!1,data:a,dataCallback:o,emptyNode:s,handleParam:p=Gs,headerTip:m,initParam:h=Ws,isShowResetBtn:g=!0,isShowSearch:_=!0,isShowSearchBtn:v=!0,maxHeight:y,onReset:b,onSearch:x,onSortChange:S,pagination:C=!0,requestApi:w,requestAuto:T=!0,requestError:E,rowKey:D=`id`,searchBarBottom:O,searchClearSelection:k=!0,selectChangeCallback:A,tableHeader:j,title:M,zhPaginationLeft:N,...P},ee){let te=(0,d.useMemo)(()=>qs(r),[r]),[ne,re]=(0,d.useState)(te),[ie]=(0,d.useState)(te),[ae,oe]=(0,d.useState)([]),[F,se]=(0,d.useState)(Us),[ce,le]=(0,d.useState)(!1),[ue,de]=(0,d.useState)([]),[fe,pe]=(0,d.useState)([]),me=(0,d.useRef)(!1),he=(0,d.useMemo)(()=>Ks(r),[r]),ge=(0,d.useMemo)(()=>Ys(r),[r]),_e=he.some(e=>e.type===`selection`&&e.isShow!==!1),ve=a??ae,ye=(0,d.useMemo)(()=>a?C?a.slice((F.page-1)*F.size,F.page*F.size):a:ve,[ve,a,F.page,F.size,C]),be=(0,d.useMemo)(()=>fe.map(e=>Ls(e,D,void 0)),[D,fe]),xe=(0,d.useCallback)((e,t)=>{re(n=>({...n,[e]:t}))},[]),I=(0,d.useCallback)(async e=>{if(!w)return;let t=e?.pageable??F,n=e?.searchParam??ne;le(!0);try{let e=await w(p({...h,...Hs(n),...C?{page:t.page,size:t.size}:{}}));o&&(e=await o(e)),oe(C?e.list??[]:e),C&&se({page:e.currentPage??t.page,size:e.pageSize??t.size,total:e.total??0})}catch(e){E?.(e)}finally{le(!1)}},[o,p,h,F,C,w,E,ne]),L=(0,d.useCallback)(()=>{k&&(pe([]),de([]));let e={...F,page:1};se(e),I({pageable:e}),x?.()},[I,x,F,k]),Se=(0,d.useCallback)(()=>{e?.();let t={...ie},n={...F,page:1};re(t),se(n),pe([]),de([]),b?.(),I({pageable:n,searchParam:t})},[e,I,b,F,ie]),Ce=(0,d.useCallback)(e=>{let t={...F,page:1,size:e};se(t),I({pageable:t})},[I,F]),we=(0,d.useCallback)(e=>{let t={...F,page:e};se(t),I({pageable:t})},[I,F]),Te=(0,d.useCallback)(()=>{pe([]),de([]),A?.([])},[A]),Ee=(0,d.useCallback)(e=>{se(t=>({...t,total:e}))},[]),De=_e?{onChange:(e,t)=>{de(e),pe(t),A?.(t)},selectedRowKeys:ue}:void 0,Oe=(e,t,n)=>{let r=Array.isArray(n)?n[0]:n,i={column:r.column,order:r.order?{ascend:`ascending`,descend:`descending`}[r.order]:null,prop:String(r.field??``)};S?.(i)};return(0,d.useEffect)(()=>{a&&se(e=>({...e,total:a.length}))},[a]),(0,d.useEffect)(()=>{a||!T||me.current||(me.current=!0,I())},[a,I,T]),(0,d.useImperativeHandle)(ee,()=>({clearSelection:Te,getTableList:I,handleCurrentChange:we,handleSizeChange:Ce,get isSelected(){return fe.length>0},get pageable(){return F},reset:Se,search:L,get searchInitParam(){return ie},get searchParam(){return ne},get selectedList(){return fe},get selectedListIds(){return be},setPageTotal:Ee,get tableData(){return ye}}),[Te,I,we,Ce,F,ye,Se,L,ie,ne,fe,be,Ee]),(0,u.jsxs)(`div`,{className:(0,l.default)(`zh-table`,n),children:[M||m?(0,u.jsxs)(`div`,{className:`zh-table__title-container`,children:[M?(0,u.jsx)(`div`,{className:`zh-table__title`,children:M}):null,m?(0,u.jsx)(`div`,{className:`zh-table__header-tip`,children:m}):null]}):null,(0,u.jsx)(`div`,{className:`zh-table__header-container`,children:_&&ge.length?(0,u.jsxs)(c.Form,{className:`zh-table__search`,layout:`inline`,children:[j?(0,u.jsx)(`div`,{className:`zh-table__table-header`,children:j({isSelected:fe.length>0,selectedList:fe,selectedListIds:be})}):null,ge.map(e=>(0,u.jsx)(c.Form.Item,{label:e.search?.label?`${e.search.label}:`:void 0,tooltip:e.search?.tooltip,children:Xs(e,ne,xe,L)},String(e.search?.key??e.prop))),v?(0,u.jsx)(c.Button,{"aria-label":`搜索`,icon:(0,u.jsx)(f.SearchOutlined,{}),onClick:L,type:`primary`,children:`搜索`}):null,g?(0,u.jsx)(c.Tooltip,{title:`重置`,children:(0,u.jsx)(c.Button,{"aria-label":`重置`,icon:(0,u.jsx)(f.ReloadOutlined,{}),onClick:Se})}):null]}):null}),O,(0,u.jsxs)(`div`,{className:`zh-table__body-container`,children:[i?(0,u.jsx)(c.Tooltip,{title:`自定义列`,children:(0,u.jsx)(c.Button,{"aria-label":`自定义列`,className:`zh-table__col-setting`,icon:(0,u.jsx)(f.SettingOutlined,{}),type:`text`})}):null,(0,u.jsx)(c.Table,{...P,bordered:t,columns:Qs(r),dataSource:ye,loading:ce,locale:{emptyText:s??`暂无数据`},onChange:Oe,pagination:!1,rowKey:D,rowSelection:De,scroll:y?{y}:P.scroll})]}),C&&F.total?(0,u.jsxs)(`div`,{className:`zh-table__pagination`,children:[(0,u.jsx)(`div`,{className:`zh-table__page-total`,children:N?.(F)??`共${F.total}条数据`}),(0,u.jsx)(c.Pagination,{current:F.page,onChange:we,onShowSizeChange:(e,t)=>Ce(t),pageSize:F.size,showSizeChanger:!0,total:F.total})]}):null]})});function ec({children:e,className:t,content:n,placement:r=`top`,...i}){let a=e??(0,u.jsx)(`button`,{"aria-label":String(n),className:`zh-tooltips__trigger`,type:`button`,children:(0,u.jsx)(f.QuestionCircleOutlined,{"aria-hidden":`true`})});return(0,u.jsx)(c.Tooltip,{...i,className:(0,l.default)(`zh-tooltips`,t),placement:r,title:n,children:a})}var tc=h.default.Events,nc=h.default.ErrorTypes,rc=class{config;options;handlers=new globalThis.Map;player=null;videoElement;constructor(e,t={}){this.config=e,this.options=t}attachMediaElement(e){this.videoElement=e}async load(){if(!this.videoElement)throw Error(`Video element is required before player load`);this.player=h.default.createPlayer({hasAudio:this.config.hasAudio,hasVideo:this.config.hasVideo,isLive:this.config.isLive,type:this.config.type,url:this.config.url},{autoCleanupSourceBuffer:this.options.autoCleanupSourceBuffer??!0,deferLoadAfterSourceOpen:this.options.deferLoadAfterSourceOpen??!0,enableStashBuffer:this.options.enableStashBuffer??!0,enableWorker:this.options.enableWorker??!0,lazyLoadMaxDuration:this.options.lazyLoadMaxDuration??180}),this.player.attachMediaElement(this.videoElement),this.player.on(h.default.Events.ERROR,(...e)=>this.emit(String(h.default.Events.ERROR),...e)),this.player.load()}on(e,t){let n=this.handlers.get(e)??new Set;n.add(t),this.handlers.set(e,n)}pause(){this.videoElement?.pause()}async play(){let e=this.player?.play?.();e instanceof Promise&&await e}unload(){this.player?.unload()}destroy(){this.player?.destroy(),this.player=null,this.handlers.clear()}emit(e,...t){this.handlers.get(e)?.forEach(e=>e(...t))}};function ic(e,t){return new rc(e,t)}function ac(e){try{let t=new URL(e,window.location.href).searchParams.get(`audio`);return t?!!Number(t):!0}catch{return!0}}function oc({getLiveUrl:e,onFullscreenChange:t,stopLivePlay:n}){let r=(0,d.useRef)(null),i=(0,d.useRef)(null),a=(0,d.useRef)(null),o=(0,d.useRef)(void 0),s=(0,d.useRef)(``),[l,f]=(0,d.useState)(!0),p=(0,d.useCallback)(()=>{a.current?.unload(),a.current?.destroy(),a.current=null,s.current&&=(n?.(s.current),``)},[n]),h=(0,d.useCallback)(async()=>{let t=i.current;if(!t)return;let{playUrl:n,streamId:r}=await e();s.current=r;let o=ic({hasAudio:ac(n),hasVideo:!0,isLive:!0,type:`flv`,url:n},{autoCleanupSourceBuffer:!0,deferLoadAfterSourceOpen:!0,enableStashBuffer:!0,enableWorker:!0,lazyLoadMaxDuration:180});a.current=o,o.attachMediaElement(t),o.on(String(tc.ERROR),e=>{String(e)===String(nc.NETWORK_ERROR)?c.message.error(`网络错误,请检查网络`):c.message.error(`播放错误,请检查网络`)}),await o.load(),await o.play().catch(()=>void 0),f(!1)},[e]);return(0,d.useEffect)(()=>{h();let e=i.current;return e&&(o.current=new m.default(e,{autoplay:!0,controls:[`play-large`,`play`,`fullscreen`,`mute`],fullscreen:{container:`#live-player-container`,enabled:!0,fallback:!0,iosNative:!1},muted:!0}),o.current.on(`enterfullscreen`,()=>t?.(!0,`#live-player-container`)),o.current.on(`exitfullscreen`,()=>t?.(!1))),()=>{p(),o.current?.destroy()}},[h,t,p]),(0,u.jsxs)(`div`,{ref:r,className:`zh-video-player__stage`,id:`live-player-container`,children:[(0,u.jsx)(`video`,{ref:i,"aria-label":`实时视频`,className:`zh-video-player__media`,children:(0,u.jsx)(`track`,{kind:`captions`})}),l?(0,u.jsx)(Le,{className:`zh-video-player__loading`}):null]})}var sc=`YYYY-MM-DD`,cc=`YYYY-MM-DD HH:mm:ss`,lc=`YYYY-MM-DDT23:59:59`,uc=`YYYY-MM-DDTHH:mm:ss`,dc={background:`transparent`,meddleDate:`#1677ff`,meddleLine:`#1677ff`,moveDate:`transparent`,moveLine:`transparent`,scaleBar:`transparent`,scaleLine:`#b8bfca`},fc=[];function pc(e){if(Array.isArray(e))return e;let t=e?(0,g.default)(e).format(`YYYY-MM-DD`):(0,g.default)().format(`YYYY-MM-DD`);return[`${t} 00:00:00`,`${t} 23:59:59`]}var mc=(0,d.forwardRef)(function({colors:e=dc,height:t=43,isAutoPlay:n=!1,markTime:r=fc,minPxSecond:i=120,onChange:a,onTimeClick:o,startMeddleTime:s,timeRange:c,width:l=`100%`,...f},p){let m=(0,d.useRef)(null),h=(0,d.useRef)(void 0),_=(0,d.useRef)(``),v=(0,d.useMemo)(()=>pc(c),[c]),y=(0,d.useCallback)(()=>{let e=m.current;if(!e)return 1e3;if(typeof l==`number`)return l;let t=e.parentElement?.clientWidth||1e3;return/^(\d|[1-9]\d|100)%$/.test(l)?Math.floor(Number(l.replace(`%`,``))/100*t):Number(l)||t},[l]),b=(0,d.useCallback)(()=>{let n=m.current,a=n?.getContext(`2d`);if(!n||!a)return;let o=y(),c=window.devicePixelRatio||1;n.style.width=`${o}px`,n.style.height=`${t}px`,n.width=Math.round(o*c),n.height=Math.round(t*c),a.setTransform(c,0,0,c,0,0),a.clearRect(0,0,o,t),a.fillStyle=e.scaleBar,a.fillRect(0,0,o,20);let l=(0,g.default)(_.current||s||v[0]),u=Math.min(1440*60/o,i),d=l.valueOf()-u*o*1e3/2;r.forEach(e=>{let t=(0,g.default)(e.beginTime).valueOf(),n=(0,g.default)(e.endTime).valueOf(),r=(t-d)/1e3/u,i=(n-d)/1e3/u;a.fillStyle=e.bgColor,a.fillRect(r,0,i-r,20)}),a.strokeStyle=e.scaleLine,a.fillStyle=e.scaleLine,a.font=`12px serif`;for(let e=0;e<=24;e+=2){let t=e/24*o;a.beginPath(),a.moveTo(t,0),a.lineTo(t,20),a.stroke(),a.fillText((0,g.default)(v[0]).add(e,`hour`).format(e===0?`YYYY-MM-DD`:`HH:mm`),t-16,32)}a.strokeStyle=e.meddleLine,a.fillStyle=e.meddleDate,a.beginPath(),a.moveTo(o/2,0),a.lineTo(o/2,30),a.stroke(),a.fillText(l.format(cc),o/2-50,40)},[e,y,t,r,i,v,s]),x=(0,d.useCallback)(e=>{_.current=(0,g.default)(e).format(cc),b()},[b]),S=(0,d.useCallback)(()=>{h.current&&window.clearInterval(h.current),h.current=void 0,a?.(_.current,`stop`)},[a]),C=(0,d.useCallback)(e=>{e&&(_.current=(0,g.default)(e).format(`YYYY-MM-DD HH:mm:ss`)),_.current||=(0,g.default)(s||v[0]).format(cc),h.current&&window.clearInterval(h.current),h.current=window.setInterval(()=>{_.current=(0,g.default)(_.current).add(1,`second`).format(cc);let e=(0,g.default)(_.current).isAfter((0,g.default)(v[1]))?`end`:`play`;a?.(_.current,e),b(),e===`end`&&S()},1e3)},[b,a,v,s,S]);return(0,d.useEffect)(()=>(_.current=s||(0,g.default)(((0,g.default)(v[0]).valueOf()+(0,g.default)(v[1]).valueOf())/2).format(`YYYY-MM-DD HH:mm:ss`),b(),n&&C(),()=>{h.current&&window.clearInterval(h.current)}),[b,n,C,v,s]),(0,d.useImperativeHandle)(p,()=>({play:C,resize:b,setMeddleTime:x,stop:S}),[b,C,x,S]),(0,u.jsx)(`canvas`,{...f,ref:m,height:t,onClick:e=>{let t=y(),n=e.currentTarget.getBoundingClientRect().left,r=(e.clientX-n)/t,i=(0,g.default)(v[0]).add(r*24*60*60,`second`).format(cc);_.current=i,b(),a?.(i,`start`),o?.(i)},style:{backgroundColor:e.background,cursor:`pointer`}})});function hc(e){try{let t=new URL(e,window.location.href).searchParams.get(`audio`);return t?!!Number(t):!0}catch{return!0}}function gc({getPlaybackUrl:e,onFullscreenChange:t,stopPlayback:n}){let r=(0,d.useRef)(null),i=(0,d.useRef)(null),a=(0,d.useRef)(null),o=(0,d.useRef)(null),s=(0,d.useRef)(void 0),l=(0,d.useRef)(``),[f,p]=(0,d.useState)(!1),[h,_]=(0,d.useState)(!0),[v,y]=(0,d.useState)(()=>(0,g.default)().startOf(`day`).format(cc)),b=(0,d.useMemo)(()=>(0,g.default)(v).format(sc),[v]),x=(0,d.useCallback)(()=>{o.current?.unload(),o.current?.destroy(),o.current=null,l.current&&=(n?.(l.current),``)},[n]),S=(0,d.useCallback)(async()=>{let t=i.current;if(!t)return;_(!0);let n=await e((0,g.default)(v).format(uc),(0,g.default)(v).format(lc));l.current=n.streamId;let r=ic({hasAudio:hc(n.playUrl),hasVideo:!0,isLive:!1,type:`flv`,url:n.playUrl},{autoCleanupSourceBuffer:!0,deferLoadAfterSourceOpen:!0,enableStashBuffer:!0,enableWorker:!0,lazyLoadMaxDuration:180});o.current=r,r.attachMediaElement(t),r.on(String(tc.ERROR),e=>{String(e)===String(nc.NETWORK_ERROR)?c.message.error(`网络错误,请检查网络`):c.message.error(`其他错误,请联系管理员解决`)}),await r.load(),await r.play().catch(()=>void 0),_(!1),a.current?.play(v)},[e,v]);(0,d.useEffect)(()=>{S();let e=i.current;return e&&(s.current=new m.default(e,{autoplay:!0,controls:[`play`,`fullscreen`,`mute`],fullscreen:{container:`#player-container`,enabled:!0,fallback:!0,iosNative:!1},muted:!0}),s.current.on(`enterfullscreen`,()=>{p(!0),t?.(!0,`#player-container`),window.setTimeout(()=>a.current?.resize())}),s.current.on(`exitfullscreen`,()=>{p(!1),t?.(!1)})),()=>{x(),s.current?.destroy()}},[S,t,x]);let C=(0,d.useCallback)(e=>{if(e){if(e.isAfter((0,g.default)())){c.message.warning(`选择的时间不能晚于当前时间`);return}y(e.startOf(`day`).format(cc))}},[]);return(0,u.jsxs)(`div`,{ref:r,className:`zh-video-player__stage`,id:`player-container`,children:[(0,u.jsx)(`video`,{ref:i,"aria-label":`回放视频`,className:`zh-video-player__media`,children:(0,u.jsx)(`track`,{kind:`captions`})}),h?(0,u.jsx)(Le,{className:`zh-video-player__loading`}):null,f?(0,u.jsxs)(`div`,{className:`zh-video-player__footer`,children:[(0,u.jsx)(`div`,{className:`zh-video-player__timeline`,children:(0,u.jsx)(mc,{ref:a,onTimeClick:y,startMeddleTime:v,timeRange:b})}),(0,u.jsx)(c.DatePicker,{allowClear:!1,className:`zh-video-player__date`,disabledDate:e=>e.isAfter((0,g.default)()),onChange:C,value:(0,g.default)(v)})]}):null]})}var _c=async()=>({playUrl:``,streamId:``}),vc=async()=>({playUrl:``,streamId:``});function yc({className:e,getLiveUrl:t=_c,getPlaybackUrl:n=vc,mode:r=`live`,onFullscreenChange:i,stopLivePlay:a,stopPlayback:o,updatePlaybackUrl:s,...c}){return(0,u.jsx)(`div`,{...c,className:(0,l.default)(`zh-video-player`,e),children:r===`live`?(0,u.jsx)(oc,{getLiveUrl:t,onFullscreenChange:i,stopLivePlay:a}):(0,u.jsx)(gc,{getPlaybackUrl:n,onFullscreenChange:i,stopPlayback:o,updatePlaybackUrl:s})})}function bc({defaultValue:e,onChange:t,value:n}){let[r,i]=(0,d.useState)(e),a=n!==void 0;return[a?n:r,(0,d.useCallback)(e=>{a||i(e),t?.(e)},[a,t])]}function xc(e){let t=(0,d.useRef)(e);return t.current=e,t}var Sc=`@zh/theme`;function Cc(e){return e==null?[]:Array.isArray(e)?e:[e]}function wc(e){return e==null}function Tc(e){return wc(e)||e===``}exports.Alert=js,exports.BASE_MAP_LINK=hs,exports.BaseInfo=le,exports.BaseInfoContext=ce,exports.BaseItem=me,exports.Button=y,exports.ButtonGroup=b,exports.CDN_URL=ds,exports.CascaderLoadMore=T,exports.Confirm=As,exports.DATE_PICKER_FORMAT=sc,exports.DEFAULT_TIMELINE_COLORS=dc,exports.DEFAULT_VALUE=_,exports.DIY_DATA_TYPE=L,exports.DatePicker=j,exports.DetailHeader=_e,exports.DetailSubTitle=be,exports.Dialog=I,exports.DiyDataTable=Oe,exports.EditInfoPair=Ae,exports.FileWrapper=Me,exports.Grid=oe,exports.GridItem=F,exports.InfoPair=ye,exports.Input=Pe,exports.InputNumber=Ie,exports.LOG_DATE_FORMAT=cc,exports.LOG_DATE_FORMAT_END=lc,exports.LOG_DATE_FORMAT_T=uc,exports.Loading=Le,exports.MAP_DEFAULT_CENTER=ms,exports.MAP_ZOOM=fs,exports.Map=ys,exports.MessageBox=ks,exports.MoneyInput=Fs,exports.MultiGrid=se,exports.PageHeadPanel=Is,exports.Prompt=Ms,exports.THEME_PACKAGE_NAME=Sc,exports.TIAN_DI_TU_KEY=us,exports.Table=$s,exports.ToolTips=ec,exports.VideoPlayer=yc,exports.digitUppercase=Ps,exports.flattenCascaderOptions=C,exports.formatDatePickerValue=O,exports.isEmptyValue=Tc,exports.isNil=wc,exports.normalizeNumberInput=Fe,exports.projection=ps,exports.toArray=Cc,exports.useControlledState=bc,exports.useLatest=xc,exports.validateNumber=Ns;
|