hive-react-kit 1.12.4 → 1.12.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/utils/postVotes.d.ts +11 -5
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1123,7 +1123,7 @@ ${Qr}`),Cr&&(Ee+=`
|
|
|
1123
1123
|
${Cr}`),Ee},clear:()=>{Wr(""),Kr(null),Bn(0),Dt(null),sr&&URL.revokeObjectURL(sr),Nr(null),nr(null),ne?.(null),dr([])}}),()=>{Ot&&(Ot.current=null)}));const js=Ee=>{Ee.key==="Enter"&&(Ee.metaKey||Ee.ctrlKey)&&(Ee.preventDefault(),Kn()),Ee.key==="Escape"&&o&&o()},to=()=>{Kr(null),Bn(0)},Fs=()=>{sr&&URL.revokeObjectURL(sr),Dt(null),Nr(null)},gl=T.useCallback(()=>{if(!Zr.trim())return null;const Ee=Zr.split(/(```[\s\S]*?```)/g);let Ut=0;return e.jsx("div",{className:"space-y-2",children:Ee.map((mr,aa)=>{if(mr.startsWith("```")&&mr.endsWith("```")){const La=mr.slice(3,-3).replace(/^\w*\n?/,""),Ns=Ut++;return e.jsxs("div",{className:"relative group rounded-lg overflow-hidden",children:[e.jsx("pre",{className:"bg-gray-950 text-[var(--hrk-success)] p-3 rounded-lg text-xs overflow-x-auto font-mono",children:e.jsx("code",{children:La.trim()||" "})}),e.jsx("button",{type:"button",onClick:()=>Sa(La.trim(),Ns),className:"absolute top-2 right-2 p-1.5 rounded-md bg-[var(--hrk-bg-surface)] hover:bg-[var(--hrk-bg-surface-raised)] text-[var(--hrk-text-tertiary)] hover:text-[var(--hrk-text-primary)] transition-colors opacity-0 group-hover:opacity-100",title:"Copy code",children:Br===Ns?e.jsx(Y.Check,{className:"h-3.5 w-3.5 text-[var(--hrk-success)]"}):e.jsx(Y.Copy,{className:"h-3.5 w-3.5"})})]},aa)}const Ta=mr.split(/(`[^`]+`)/g);return e.jsx("span",{children:Ta.map((La,Ns)=>{if(La.startsWith("`")&&La.endsWith("`")){const En=La.slice(1,-1);return e.jsx("code",{className:"bg-[var(--hrk-bg-surface)] text-[var(--hrk-warning)] px-1.5 py-0.5 rounded text-xs font-mono cursor-pointer hover:bg-[var(--hrk-bg-surface-raised)] transition-colors",title:"Click to copy",onClick:()=>navigator.clipboard.writeText(En),children:En},Ns)}return La.trim()?e.jsx("span",{className:"text-[var(--hrk-text-secondary)] text-sm",children:La},Ns):null})},aa)})})},[Zr,Br,Sa]),Tn="p-2 rounded-lg hover:bg-[var(--hrk-bg-surface-raised)] text-[var(--hrk-text-tertiary)] hover:text-[var(--hrk-text-primary)] transition-colors disabled:opacity-50";return e.jsxs("div",{className:`p-4 md:p-6 space-y-3 rounded-[14px] border transition-colors ${zr?"border-[var(--hrk-info)] bg-[var(--hrk-info-soft)]":""}`,style:{backgroundColor:zr?void 0:Re||"var(--hrk-bg-surface-sunken)",borderColor:zr?void 0:Je||"var(--hrk-border-subtle)"},onDragEnter:rn,onDragLeave:ps,onDragOver:Vs,onDrop:Ao,children:[fr&&e.jsx("h3",{className:"text-white font-semibold text-base",children:fr}),!ot&&e.jsxs("div",{className:"flex items-center justify-start space-x-3 text-left",children:[e.jsx("div",{className:"flex-shrink-0",children:l?e.jsx("img",{src:`https://images.hive.blog/u/${l}/avatar`,alt:l,className:"w-10 h-10 rounded-full object-cover border-2 border-[var(--hrk-border-default)]",onError:Ee=>{Ee.target.src=`https://ui-avatars.com/api/?name=${l}&background=random`}}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-[var(--hrk-bg-surface-raised)] flex items-center justify-center",children:e.jsx(Y.User,{className:"w-6 h-6 text-[var(--hrk-text-tertiary)]"})})}),e.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[e.jsx("div",{className:"text-sm text-white font-medium",children:l?`@${l}`:"Anonymous"}),c&&e.jsxs("div",{className:"text-xs text-[var(--hrk-text-tertiary)]",children:["Replying to @",c]})]})]}),er&&Zr.trim()&&e.jsxs("div",{className:"rounded-lg border border-[var(--hrk-border-subtle)] bg-[var(--hrk-bg-surface)]/50 overflow-hidden max-h-[300px] flex flex-col",children:[e.jsxs("div",{className:"px-3 py-2 text-xs uppercase tracking-wide text-[var(--hrk-text-tertiary)] bg-[var(--hrk-bg-surface)] border-b border-[var(--hrk-border-subtle)] flex items-center justify-between shrink-0",children:[e.jsx("span",{children:"Preview"}),(Zr.includes("```")||/`[^`]+`/.test(Zr))&&e.jsx("span",{className:"text-[10px] text-[var(--hrk-text-tertiary)] normal-case",children:"Hover code blocks to copy"})]}),e.jsx("div",{className:"p-3 overflow-y-auto",style:{scrollbarWidth:"thin"},children:or?e.jsx("div",{className:"rendered-body text-white text-sm overflow-x-auto prose prose-invert prose-sm max-w-none",dangerouslySetInnerHTML:{__html:or(Zr)}}):gl()})]}),Qr&&e.jsxs("div",{className:"rounded-lg border border-[var(--hrk-border-subtle)] bg-[var(--hrk-bg-surface)] overflow-hidden",children:[e.jsx("div",{className:"relative",style:{height:"60px",overflow:"hidden"},children:e.jsx("iframe",{src:Qr,title:"Audio preview",className:"w-full border-0 absolute top-0 left-0",style:{height:"200px"},allow:"autoplay; encrypted-media",loading:"lazy"})}),e.jsxs("div",{className:"flex items-center gap-2 border-t border-[var(--hrk-border-subtle)] px-3 py-1.5",children:[e.jsxs("span",{className:"flex-1 truncate text-xs text-[var(--hrk-text-tertiary)]",children:["Audio attached",Da>0?` (${Math.floor(Da/60)}:${String(Da%60).padStart(2,"0")})`:""]}),e.jsx("button",{type:"button",onClick:to,className:"shrink-0 rounded p-1.5 text-[var(--hrk-text-tertiary)] hover:text-[var(--hrk-danger)] hover:bg-[var(--hrk-bg-surface-raised)] transition-colors",title:"Remove audio",children:e.jsx(Y.X,{className:"h-4 w-4"})})]})]}),Cr&&e.jsxs("div",{className:"rounded-lg border border-[var(--hrk-border-subtle)] bg-[var(--hrk-bg-surface)] overflow-hidden",children:[sr?e.jsx("video",{src:sr,controls:!0,playsInline:!0,preload:"metadata",className:"w-full",style:{maxHeight:"200px"}}):e.jsx("div",{className:"h-20 flex items-center justify-center text-[var(--hrk-text-tertiary)] text-xs",children:"Video attached"}),e.jsxs("div",{className:"flex items-center gap-2 border-t border-[var(--hrk-border-subtle)] px-3 py-1.5",children:[e.jsx("span",{className:"flex-1 truncate text-xs text-[var(--hrk-text-tertiary)]",children:"Video attached"}),e.jsx("button",{type:"button",onClick:Fs,className:"shrink-0 rounded p-0.5 text-[var(--hrk-text-tertiary)] hover:text-[var(--hrk-danger)]",title:"Remove video",children:e.jsx(Y.X,{className:"h-3.5 w-3.5"})})]})]}),Pr&&e.jsx("div",{className:"rounded-lg border border-[var(--hrk-border-subtle)] bg-[var(--hrk-bg-surface)] overflow-hidden",children:e.jsxs("div",{className:"px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx(Y.BarChart3,{className:"h-3.5 w-3.5 shrink-0 text-[var(--hrk-info)]"}),e.jsx("span",{className:"flex-1 truncate text-xs font-medium text-white",children:Pr.question}),e.jsx("button",{type:"button",onClick:()=>Or(!0),className:"shrink-0 rounded p-0.5 text-[var(--hrk-text-tertiary)] hover:bg-[var(--hrk-bg-surface-raised)] hover:text-[var(--hrk-text-primary)]",title:"Edit poll",children:e.jsx(Y.Code,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:()=>{nr(null),ne?.(null)},className:"shrink-0 rounded p-0.5 text-[var(--hrk-text-tertiary)] hover:bg-[var(--hrk-bg-surface-raised)] hover:text-[var(--hrk-danger)]",title:"Remove poll",children:e.jsx(Y.X,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:Pr.choices.map((Ee,Ut)=>e.jsx("span",{className:"rounded-full bg-[var(--hrk-bg-surface-raised)] px-2 py-0.5 text-xs text-[var(--hrk-text-secondary)]",children:Ee},Ut))}),e.jsxs("div",{className:"mt-1.5 text-[10px] text-[var(--hrk-text-tertiary)]",children:["Ends ",new Date(Pr.end_time*1e3).toLocaleDateString()," · Max ",Pr.max_choices_voted," choice",Pr.max_choices_voted>1?"s":""]})]})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 border-b border-[var(--hrk-border-subtle)] pb-2",children:[!X&&e.jsx("button",{type:"button",onClick:()=>pr(Ee=>!Ee),className:`${Tn} ${er?"bg-[var(--hrk-bg-surface-raised)] text-[var(--hrk-info)]":""}`,title:er?"Hide preview":"Show preview",disabled:oe,children:er?e.jsx(Y.EyeOff,{className:"h-4 w-4"}):e.jsx(Y.Eye,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-5 bg-[var(--hrk-bg-surface-raised)] mx-1"}),!R&&e.jsx("button",{type:"button",onClick:()=>je("**","**"),className:Tn,title:"Bold",disabled:oe,children:e.jsx(Y.Bold,{className:"h-4 w-4"})}),!O&&e.jsx("button",{type:"button",onClick:()=>je("*","*"),className:Tn,title:"Italic",disabled:oe,children:e.jsx(Y.Italic,{className:"h-4 w-4"})}),!E&&e.jsx("button",{type:"button",onClick:()=>je("[","](url)"),className:Tn,title:"Link",disabled:oe,children:e.jsx(Y.Link,{className:"h-4 w-4"})}),!I&&e.jsx("button",{type:"button",onClick:Qt,className:Tn,title:"Code block",disabled:oe,children:e.jsx(Y.Code,{className:"h-4 w-4"})}),!q&&e.jsx("button",{type:"button",onClick:ra,className:Tn,title:c?`Mention @${c}`:"Mention",disabled:oe,children:e.jsx(Y.AtSign,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-5 bg-[var(--hrk-bg-surface-raised)] mx-1"}),!$&&Ba&&e.jsx(dN,{onImageUploaded:Ee=>ut(``),ecencyToken:g,onSignMessage:b,signingUsername:w,onSigningStateChange:Vr,walletApprovalLabel:it,disabled:oe}),!V&&x&&e.jsx(fN,{onAudioUploaded:(Ee,Ut)=>{Kr(Ee),Bn(Ut)},username:l,threeSpeakApiKey:x,disabled:da||!!Qr}),!U&&x&&e.jsx(hC,{onVideoUploaded:(Ee,Ut,mr,aa)=>{Dt(Ee),aa&&Nr(URL.createObjectURL(aa))},username:l,ecencyToken:g,onSignMessage:b,threeSpeakApiKey:x,disabled:da||!!Cr,allowLandscape:pt}),!z&&e.jsx("button",{type:"button",onClick:()=>pa(!0),className:Tn,title:"Emoji",disabled:oe,children:e.jsx(Y.Smile,{className:"h-4 w-4"})}),!A&&_&&e.jsx("button",{type:"button",onClick:()=>Be(!0),className:`${Tn} text-xs font-bold px-2`,title:"GIF",disabled:oe,children:"GIF"}),!H&&v&&e.jsx("button",{type:"button",onClick:()=>ar(!0),className:Tn,title:"Insert YouTube video",disabled:oe,children:e.jsx("span",{className:"inline-flex h-4 w-[22px] items-center justify-center rounded-sm bg-[#ff0000]",children:e.jsx(Y.Play,{className:"h-2.5 w-2.5 fill-white text-white"})})}),!J&&(g||b&&w)&&e.jsx("button",{type:"button",onClick:()=>St(!0),className:`${Tn} text-xs font-bold px-2`,title:"Meme",disabled:oe,children:"MEME"}),!ee&&(g||b&&w)&&(()=>{const Ee=Qv(ur),Ut=cr.length>=Ee;return e.jsx("button",{type:"button",onClick:()=>ct(!0),className:Tn,title:Ut?`DecentMemes limit reached (${cr.length}/${Ee} for comments)`:`DecentMemes (${cr.length}/${Ee})`,disabled:oe||Ut,children:e.jsx("img",{src:"https://decentmemes.com/svg/DM.svg",alt:"DecentMemes",className:"h-4 w-4",draggable:!1})})})(),!Z&&N&&Ur.length>0&&e.jsx("button",{type:"button",onClick:()=>_a(!0),className:Tn,title:"Insert template",disabled:oe,children:e.jsx(Y.FileText,{className:"h-4 w-4"})}),!W&&e.jsx("button",{type:"button",onClick:()=>Or(!0),className:`${Tn} ${Pr?"text-[var(--hrk-info)]":""}`,title:Pr?"Edit poll":"Create poll",disabled:oe,children:e.jsx(Y.BarChart3,{className:"h-4 w-4"})}),!pe&&e.jsx("button",{type:"button",onClick:Na,className:`${Tn} ${ea?"bg-[var(--hrk-bg-surface-raised)] text-[var(--hrk-info)]":Fr.length>0?"text-[var(--hrk-info)]":""}`,title:ea?"Hide tag editor":`Tags (${xa.length}/${Le})`,disabled:oe,children:e.jsx(Y.Tag,{className:"h-4 w-4"})}),!Ge&&e.jsx("button",{ref:gt,type:"button",onClick:on,className:`${Tn} ${Mt!=="default"?"text-[var(--hrk-info)]":""}`,title:`Rewards: ${Wv[Mt]}`,disabled:oe,children:e.jsx(Y.Coins,{className:"h-4 w-4"})}),!Pe&&e.jsx("button",{type:"button",onClick:()=>ge(!0),className:`${Tn} ${Aa.length>0?"text-[var(--hrk-info)]":""}`,title:Aa.length>0?`Beneficiaries (${Aa.length})`:"Add beneficiaries",disabled:oe,children:e.jsx(Y.Users,{className:"h-4 w-4"})}),xe&&e.jsx("button",{type:"button",onClick:()=>nn(Ee=>!Ee),className:`${Tn} ${Xa?"text-[var(--hrk-info)]":""}`,title:Xa?`Upvote on publish: ${ua(sn)}%`:"Upvote parent on publish",disabled:oe,children:e.jsx(Y.ThumbsUp,{className:"h-4 w-4",fill:Xa?"currentColor":"none"})}),e.jsx("button",{type:"button",onClick:()=>Xt(!0),className:Tn,title:"What does each button do?",children:e.jsx(Y.HelpCircle,{className:"h-4 w-4"})})]}),xe&&Xa&&e.jsxs("div",{className:"rounded-lg border border-[var(--hrk-border-subtle)] bg-[var(--hrk-bg-surface)]/60 px-3 pt-4 pb-2",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-[var(--hrk-text-secondary)]",children:Tr}),e.jsxs("span",{className:"rounded-md bg-[var(--hrk-brand)] px-2 py-0.5 text-[11px] font-semibold text-white",children:[ua(sn),"%"]})]}),e.jsx("input",{type:"range",min:Xe,max:100,step:Xe,value:sn,onChange:Ee=>Za(Ha(Number(Ee.target.value))),disabled:oe,className:"w-full h-2 rounded-lg appearance-none cursor-pointer accent-blue-600 [&::-webkit-slider-runnable-track]:rounded-lg [&::-webkit-slider-runnable-track]:h-2 [&::-moz-range-track]:rounded-lg [&::-moz-range-track]:h-2 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[var(--hrk-brand)] [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-white [&::-webkit-slider-thumb]:-mt-1 [&::-moz-range-thumb]:w-4 [&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:bg-[var(--hrk-brand)] [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-white disabled:opacity-50",style:{background:`linear-gradient(to right, var(--hrk-info) ${sn}%, var(--hrk-border-default) ${sn}%)`}}),e.jsx("div",{className:"mt-1 flex justify-between text-[10px] text-[var(--hrk-text-tertiary)]",children:[1,25,50,75,100].map(Ee=>e.jsx("button",{type:"button",onClick:()=>Za(Ee),disabled:oe,className:`rounded px-1 transition hover:text-[var(--hrk-info)] disabled:opacity-50 ${sn===Ee?"font-bold text-[var(--hrk-info)]":""}`,children:Ee},Ee))})]}),($t||Pt&&da)&&e.jsx("div",{className:"px-1 py-0.5",children:e.jsx("span",{className:"text-sm text-[var(--hrk-warning)] animate-pulse",children:it})}),e.jsxs("div",{className:"relative",children:[zr&&e.jsx("div",{className:"absolute inset-0 z-10 bg-[var(--hrk-info-soft)] border-2 border-dashed border-[var(--hrk-info)] rounded-lg flex items-center justify-center",children:e.jsx("span",{className:"text-[var(--hrk-info)] font-medium text-sm",children:"Drop image to upload"})}),et&&e.jsxs("div",{className:"absolute inset-0 z-10 bg-[var(--hrk-bg-app)]/80 rounded-lg flex flex-col items-center justify-center gap-3 p-4 text-center",children:[$t?e.jsx("span",{className:"text-sm text-[var(--hrk-warning)] animate-pulse",children:it}):e.jsxs("div",{className:"flex items-center gap-2 text-[var(--hrk-info)] text-sm",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-blue-400 border-t-transparent rounded-full animate-spin"}),"Uploading image..."]}),e.jsx("button",{type:"button",onClick:Wa,className:"px-3 py-1 rounded border border-[var(--hrk-border-default)] text-[var(--hrk-text-secondary)] hover:bg-[var(--hrk-bg-surface)] text-xs",children:"Cancel"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("textarea",{ref:hr,value:Zr,onChange:Ee=>{Wr(Ee.target.value),Rt.onValueChange(Ee.target.value,Ee.target.selectionStart??Ee.target.value.length)},onKeyUp:Ee=>{const Ut=Ee.currentTarget;Rt.onValueChange(Ut.value,Ut.selectionStart??Ut.value.length)},onClick:Ee=>{const Ut=Ee.currentTarget;Rt.onValueChange(Ut.value,Ut.selectionStart??Ut.value.length)},onBlur:()=>{window.setTimeout(()=>Rt.dismiss(),100)},onKeyDown:Ee=>{if(Rt.onKeyDown(Ee)){if(Ee.key==="Enter"||Ee.key==="Tab"){const Ut=Rt.apply();Ut&&(Wr(Ut.value),requestAnimationFrame(()=>{const mr=hr.current;mr&&(mr.focus(),mr.setSelectionRange(Ut.caret,Ut.caret))}))}return}js(Ee)},onPaste:ln,placeholder:Ba?`${u}
|
|
1124
1124
|
(Paste or drag & drop images here)`:u,disabled:oe,rows:4,className:"w-full min-h-[100px] max-h-[300px] p-3 border border-[var(--hrk-border-subtle)] rounded-lg resize-y focus:ring-2 focus:ring-[var(--hrk-info)] focus:border-[var(--hrk-info)] bg-[var(--hrk-bg-surface)] text-white placeholder-[var(--hrk-text-tertiary)] transition-colors duration-200 disabled:opacity-50 text-sm font-mono",onInput:Ee=>{const Ut=Ee.target;Ut.style.height="auto",Ut.style.height=Ut.scrollHeight+"px"}}),Rt.active&&e.jsx("div",{className:"absolute z-30",style:wC(hr.current,Rt.match?.end??0),children:e.jsx(_C,{candidates:Rt.candidates,highlightedIndex:Rt.highlightedIndex,onHover:Rt.setHighlightedIndex,onSelect:Ee=>{const Ut=Rt.apply(Ee);Ut&&(Wr(Ut.value),requestAnimationFrame(()=>{const mr=hr.current;mr&&(mr.focus(),mr.setSelectionRange(Ut.caret,Ut.caret))}))}})})]}),!pe&&(xa.length>0||ea)&&e.jsxs("div",{className:"flex flex-col gap-1.5 px-0.5",children:[xa.length>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[Yr.map(Ee=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-[var(--hrk-bg-surface-raised)]/70 px-2 py-0.5 text-[11px] text-[var(--hrk-text-primary)]",title:"Default tag — cannot be removed",children:[e.jsx(Y.Lock,{className:"h-2.5 w-2.5 text-[var(--hrk-text-tertiary)]"}),Ee]},`strip-locked-${Ee}`)),Fr.map(Ee=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-[var(--hrk-brand)]/20 px-2 py-0.5 text-[11px] text-blue-200",children:[Ee,e.jsx("button",{type:"button",onClick:()=>Qa(Ee),className:"rounded-full p-0.5 text-blue-200 hover:bg-[var(--hrk-brand)]/40 hover:text-[var(--hrk-text-primary)] disabled:opacity-50",title:`Remove ${Ee}`,disabled:oe,children:e.jsx(Y.X,{className:"h-2.5 w-2.5"})})]},`strip-user-${Ee}`)),e.jsxs("span",{className:"ml-auto text-[10px] text-[var(--hrk-text-tertiary)]",children:[xa.length,"/",Le]})]}),ea&&e.jsxs("div",{className:"flex gap-1",children:[e.jsx("input",{type:"text",value:Oa,onChange:Ee=>$a(Ee.target.value),onKeyDown:Ee=>{Ee.key==="Enter"||Ee.key===","?(Ee.preventDefault(),oa(Oa),$a("")):Ee.key==="Escape"&&fn(!1)},placeholder:ia>0?"Add a tag (Enter to save)":"Max tags reached",disabled:ia===0||oe,autoFocus:!0,className:"flex-1 rounded border border-[var(--hrk-border-subtle)] bg-[var(--hrk-bg-surface)] px-2 py-1 text-xs text-[var(--hrk-text-primary)] placeholder-[var(--hrk-text-tertiary)] outline-none focus:border-[var(--hrk-info)] disabled:cursor-not-allowed disabled:opacity-50"}),e.jsx("button",{type:"button",onClick:()=>{oa(Oa),$a("")},disabled:ia===0||!Oa.trim()||oe,className:"rounded border border-[var(--hrk-border-subtle)] bg-[var(--hrk-bg-surface)] px-2 py-1 text-xs text-[var(--hrk-text-primary)] hover:bg-[var(--hrk-bg-surface-raised)] disabled:cursor-not-allowed disabled:opacity-50",children:"Add"})]})]}),!Pe&&va.length>0&&e.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1 px-0.5",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[var(--hrk-text-tertiary)] mr-1",children:"Beneficiaries"}),va.map(Ee=>{const Ut=ir.includes(Ee.account),mr=Hr[Ee.account]??`Auto-attached @${Ee.account}`;return e.jsxs("button",{type:"button",onClick:()=>ge(!0),className:`inline-flex items-center gap-1 rounded-full pl-0.5 pr-2 py-0.5 text-[11px] ${Ut?"bg-[var(--hrk-warning-soft)] text-[var(--hrk-warning)] border border-[var(--hrk-warning)]/40":"bg-[var(--hrk-brand)]/20 text-blue-200 border border-[var(--hrk-info)]/30"}`,title:Ut?mr:"Edit beneficiaries",disabled:oe,children:[e.jsx("img",{src:`https://images.hive.blog/u/${Ee.account}/avatar`,alt:`@${Ee.account}`,width:16,height:16,className:"rounded-full bg-[var(--hrk-bg-surface-raised)] border border-[var(--hrk-border-default)] object-cover shrink-0",onError:aa=>{const Ta=aa.target;Ta.dataset.fallback||(Ta.dataset.fallback="1",Ta.src=`https://ui-avatars.com/api/?name=${encodeURIComponent(Ee.account)}&background=random&size=64`)}}),Ut&&e.jsx(Y.Lock,{className:"h-2.5 w-2.5"}),"@",Ee.account," ",e.jsxs("span",{className:"opacity-80",children:[Ee.weight,"%"]})]},`bene-${Ee.account}`)}),e.jsx("button",{type:"button",onClick:()=>ge(!0),className:"ml-1 rounded-full border border-dashed border-[var(--hrk-border-default)] px-2 py-0.5 text-[11px] text-[var(--hrk-text-tertiary)] hover:border-blue-400 hover:text-[var(--hrk-info)]",disabled:oe,title:"Edit beneficiaries",children:"Edit"})]})]}),!De&&e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[e.jsxs("div",{className:"text-xs text-[var(--hrk-text-tertiary)]",children:[navigator.platform?.includes("Mac")?"Cmd":"Ctrl","+Enter to post",Ba&&e.jsx("span",{className:"ml-2",children:"| Paste/drop images"})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[jt&&o&&e.jsx("button",{onClick:o,disabled:oe,className:"px-4 py-2 text-[var(--hrk-text-tertiary)] hover:text-[var(--hrk-text-primary)] transition-colors disabled:opacity-50",children:"Cancel"}),e.jsx("button",{onClick:Kn,disabled:oe||!Zr.trim(),className:"px-6 py-2 bg-[var(--hrk-brand)] hover:bg-[var(--hrk-brand-hover)] disabled:bg-[var(--hrk-bg-surface-raised)] text-white rounded-lg font-medium transition-all disabled:opacity-50 flex items-center space-x-2",children:da?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),e.jsx("span",{children:"Posting..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Y.Send,{className:"w-4 h-4"}),e.jsx("span",{children:Nt})]})})]})]}),e.jsx(hN,{isOpen:_e,onClose:()=>Be(!1),onSelectGif:Ee=>{ut(``),Be(!1)},giphyApiKey:_}),e.jsx(mN,{isOpen:wt,onClose:()=>ar(!1),onSelectVideo:Ee=>{ut(`
|
|
1125
1125
|
${Ee}
|
|
1126
|
-
`),ar(!1)},youtubeApiKey:v}),e.jsx(xN,{isOpen:xt,onClose:()=>St(!1),onSelectMeme:Ee=>{ut(``),St(!1)},ecencyToken:g,onSignMessage:b,signingUsername:w,onSigningStateChange:Vr}),e.jsx(vN,{isOpen:Jr,onClose:()=>ct(!1),onSelectMeme:(Ee,Ut)=>{ut(``),Ut&&dr(mr=>[...mr,Ut]),ct(!1)},ecencyToken:g,onSignMessage:b,signingUsername:w,onSigningStateChange:Vr,appAccount:se,theme:fe}),e.jsx(pN,{isOpen:Lr,onClose:()=>pa(!1),onSelectEmoji:Ee=>{ut(Ee),pa(!1)}}),e.jsx(gN,{isOpen:rr,onClose:()=>_a(!1),onSelectTemplate:ut,templates:Ur,authorFromUrl:c}),e.jsx(_N,{isOpen:Wt,onClose:()=>Or(!1),onSave:Ee=>{nr(Ee),ne?.(Ee)},initialData:Pr}),e.jsx(kN,{isOpen:Pa,onClose:()=>ge(!1),onSave:Ue,initialBeneficiaries:Aa,hasVideo:at,lockedAccounts:ir,lockReasons:Hr,favorites:ue}),e.jsx(yN,{isOpen:Ct,onClose:()=>Xt(!1),title:"Toolbar help",entries:(()=>{const Ee=[];return X||Ee.push({icon:e.jsx(Y.Eye,{className:"h-4 w-4"}),label:"Preview",description:"Toggle the rendered preview of your post above the textarea."}),R||Ee.push({icon:e.jsx(Y.Bold,{className:"h-4 w-4"}),label:"Bold",description:"Wrap the selected text in ** ** for bold."}),O||Ee.push({icon:e.jsx(Y.Italic,{className:"h-4 w-4"}),label:"Italic",description:"Wrap the selected text in * * for italic."}),E||Ee.push({icon:e.jsx(Y.Link,{className:"h-4 w-4"}),label:"Link",description:"Insert a markdown link — `[text](url)` — around the selection."}),I||Ee.push({icon:e.jsx(Y.Code,{className:"h-4 w-4"}),label:"Code",description:"Insert an inline `code` span or a fenced ``` block depending on the selection."}),q||Ee.push({icon:e.jsx(Y.AtSign,{className:"h-4 w-4"}),label:"Mention",description:c?`Insert @${c} at the cursor.`:"Insert @ at the cursor to mention a Hive account."}),!$&&Ba&&Ee.push({icon:e.jsx(Y.Image,{className:"h-4 w-4"}),label:"Image",description:"Upload an image — also works by drag-and-drop or paste into the textarea."}),!V&&x&&Ee.push({icon:e.jsx(Y.Mic,{className:"h-4 w-4"}),label:"Audio",description:"Upload an audio file via 3Speak — embedded as a player when published."}),!U&&x&&Ee.push({icon:e.jsx(Y.Video,{className:"h-4 w-4"}),label:"Video",description:"Upload a video via 3Speak — the 10% threespeakfund beneficiary is auto-attached."}),z||Ee.push({icon:e.jsx(Y.Smile,{className:"h-4 w-4"}),label:"Emoji",description:"Open a searchable emoji picker and insert at the cursor."}),!A&&_&&Ee.push({icon:e.jsx("span",{className:"text-[10px] font-bold",children:"GIF"}),label:"GIF",description:"Search GIPHY and insert an animated GIF inline."}),!H&&v&&Ee.push({icon:e.jsx(Y.Play,{className:"h-3 w-3 fill-current"}),label:"YouTube",description:"Search YouTube and insert a video link — auto-embeds when rendered."}),!J&&(g||b&&w)&&Ee.push({icon:e.jsx("span",{className:"text-[10px] font-bold",children:"MEME"}),label:"Meme",description:"Build a meme on a memegen.link template with Top/Bottom captions and insert as an image."}),!ee&&(g||b&&w)&&Ee.push({icon:e.jsx("img",{src:"https://decentmemes.com/svg/DM.svg",alt:"DM",className:"h-4 w-4"}),label:"DecentMemes",description:`Open the DecentMemes widget — auto-attaches template creator beneficiaries. Limit: ${Qv(ur)} per ${ur}.`}),!Z&&N&&Ur.length>0&&Ee.push({icon:e.jsx(Y.FileText,{className:"h-4 w-4"}),label:"Template",description:"Insert a saved reply/post template, with @author placeholders resolved."}),W||Ee.push({icon:e.jsx(Y.BarChart3,{className:"h-4 w-4"}),label:"Poll",description:"Attach a Hive poll (question + choices + end time) to this post."}),pe||Ee.push({icon:e.jsx(Y.Tag,{className:"h-4 w-4"}),label:"Tags",description:`Edit the tag list — locked defaults stay first, you can add up to ${Le} total.`}),Ge||Ee.push({icon:e.jsx(Y.Coins,{className:"h-4 w-4"}),label:"Reward",description:"Choose reward routing: 50/50 (default), 100% Hive Power, burn, or decline rewards."}),Pe||Ee.push({icon:e.jsx(Y.Users,{className:"h-4 w-4"}),label:"Beneficiaries",description:"Send a share of the post rewards to other Hive accounts. Auto-attached entries (threespeakfund, DecentMemes creators) show a lock icon."}),xe&&Ee.push({icon:e.jsx(Y.ThumbsUp,{className:"h-4 w-4"}),label:"Upvote on publish",description:"Cast your upvote on the parent post the moment this comment broadcasts. Slider controls the weight."}),Ee})()}),Et&&xr&&Mu.createPortal(e.jsx("div",{ref:Tt,style:{position:"fixed",top:xr.top,left:xr.left,width:xr.width},className:"z-[9999] rounded-lg border border-[var(--hrk-border-subtle)] bg-[var(--hrk-bg-app)] py-1 shadow-xl",children:uN.map(Ee=>e.jsxs("button",{type:"button",onClick:()=>Ft(Ee),className:"flex w-full items-center justify-between px-3 py-2 text-left text-sm text-[var(--hrk-text-primary)] hover:bg-[var(--hrk-bg-surface)]",children:[e.jsx("span",{children:Wv[Ee]}),Mt===Ee&&e.jsx(Y.Check,{className:"h-4 w-4 text-[var(--hrk-info)]"})]},Ee))}),document.body)]})},ey=Kv,l7=({parentAuthor:a,parentPermlink:o,onClose:l,onCommentSubmitted:u,currentUser:c,ecencyToken:f,threeSpeakApiKey:h,giphyApiKey:g,templateToken:b,templateApiBaseUrl:w})=>{const[x,_]=T.useState(!1),v=async N=>{if(!(!N.trim()||x)){_(!0);try{await u(a,o,N),l()}catch(C){console.error("Failed to submit reply:",C)}finally{_(!1)}}};return T.useEffect(()=>{const N=C=>{C.key==="Escape"&&l()};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[l]),e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-gray-700 bg-gray-900/50",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"p-2 bg-blue-900 rounded-lg",children:e.jsx(Y.Send,{className:"w-5 h-5 text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-white",children:"Reply to Comment"}),e.jsxs("p",{className:"text-sm text-gray-400",children:["@",a]})]})]}),e.jsx("button",{onClick:l,disabled:x,className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200 disabled:opacity-50",children:e.jsx(Y.X,{className:"w-6 h-6 text-gray-400"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(ey,{onSubmit:v,onCancel:l,currentUser:c,parentAuthor:a,parentPermlink:o,placeholder:`Reply to @${a}...`,ecencyToken:f,threeSpeakApiKey:h,giphyApiKey:g,templateToken:b,templateApiBaseUrl:w})}),e.jsx("div",{className:"p-4 md:p-6 border-t border-gray-700 bg-gray-900/50",children:e.jsxs("div",{className:"flex items-center justify-between text-xs md:text-sm text-gray-400",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("span",{children:"• Markdown supported"}),e.jsx("span",{children:"• Be respectful"})]}),e.jsx("div",{className:"hidden md:block",children:"Press Esc to close"})]})})]})})},u7=({isVisible:a,searchQuery:o,onSearchChange:l,onClose:u})=>{const c=T.useRef(null);T.useEffect(()=>{a&&c.current&&c.current.focus()},[a]);const f=()=>{l(""),u()};return e.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-in-out ${a?"max-h-20 opacity-100":"max-h-0 opacity-0"}`,children:e.jsx("div",{className:"p-4 border-b border-gray-700 bg-gray-900/30",children:e.jsxs("div",{className:"relative",children:[e.jsx(Y.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx("input",{ref:c,type:"text",value:o,onChange:h=>l(h.target.value),placeholder:"Search comments and authors...",className:"w-full pl-10 pr-10 py-2 bg-gray-800 border border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-white placeholder-gray-400 transition-colors duration-200"}),o&&e.jsx("button",{onClick:()=>l(""),className:"absolute right-8 top-1/2 transform -translate-y-1/2 p-1 rounded-full hover:bg-gray-700 transition-colors duration-200",children:e.jsx(Y.X,{className:"w-4 h-4 text-gray-400"})}),e.jsx("button",{onClick:f,className:"absolute right-3 top-1/2 transform -translate-y-1/2 p-1 rounded-full hover:bg-gray-700 transition-colors duration-200",children:e.jsx(Y.X,{className:"w-4 h-4 text-gray-400"})})]})})})},Bj=768;function NN(){const[a,o]=Tw.useState(void 0);return Tw.useEffect(()=>{const l=window.matchMedia(`(max-width: ${Bj-1}px)`),u=()=>{o(window.innerWidth<Bj)};return l.addEventListener("change",u),o(window.innerWidth<Bj),()=>l.removeEventListener("change",u)},[]),!!a}const c7=1,d7=1e6;let Uj=0;function f7(){return Uj=(Uj+1)%Number.MAX_SAFE_INTEGER,Uj.toString()}const Hj=new Map,d6=a=>{if(Hj.has(a))return;const o=setTimeout(()=>{Hj.delete(a),Vv({type:"REMOVE_TOAST",toastId:a})},d7);Hj.set(a,o)},kC=(a,o)=>{switch(o.type){case"ADD_TOAST":return{...a,toasts:[o.toast,...a.toasts].slice(0,c7)};case"UPDATE_TOAST":return{...a,toasts:a.toasts.map(l=>l.id===o.toast.id?{...l,...o.toast}:l)};case"DISMISS_TOAST":{const{toastId:l}=o;return l?d6(l):a.toasts.forEach(u=>{d6(u.id)}),{...a,toasts:a.toasts.map(u=>u.id===l||l===void 0?{...u,open:!1}:u)}}case"REMOVE_TOAST":return o.toastId===void 0?{...a,toasts:[]}:{...a,toasts:a.toasts.filter(l=>l.id!==o.toastId)}}},Sw=[];let Ew={toasts:[]};function Vv(a){Ew=kC(Ew,a),Sw.forEach(o=>{o(Ew)})}function Fl({...a}){const o=f7(),l=c=>Vv({type:"UPDATE_TOAST",toast:{...c,id:o}}),u=()=>Vv({type:"DISMISS_TOAST",toastId:o});return Vv({type:"ADD_TOAST",toast:{...a,id:o,open:!0,onOpenChange:c=>{c||u()}}}),{id:o,dismiss:u,update:l}}function h7(){const[a,o]=Tw.useState(Ew);return Tw.useEffect(()=>(Sw.push(o),()=>{const l=Sw.indexOf(o);l>-1&&Sw.splice(l,1)}),[a]),{...a,toast:Fl,dismiss:l=>Vv({type:"DISMISS_TOAST",toastId:l})}}const m7=new Set(["keychain","peakvault","hiveauth"]);function f6(a){if(a==null)return"";if(typeof a=="string")return a;if(a instanceof Error)return a.message;if(typeof a=="object"){if(typeof a.message=="string")return a.message;if(typeof a.error=="string")return a.error;if(a.data&&typeof a.data.msg=="string")return a.data.msg;try{return JSON.stringify(a)}catch{}}return String(a)}function h6(a){const o=a.toLowerCase();return o==="user_cancel"||o==="[object object]"||o.includes("cancelled")||o.includes("canceled")||o.includes("rejected")?"Image signing was cancelled":o.includes("expired")?"Wallet request expired. Please try again.":o.includes("not installed")?"Wallet extension is not installed":o==="incomplete"?"Wallet request was incomplete":a}function p7(a={}){const{signer:o,user:l,walletSupportedProviders:u=m7}=a;return T.useCallback(async c=>{const f=l?.privatePostingKey;if(f){const b=JSON.parse(c);if(b?.type!=="Buffer"||!Array.isArray(b.data))throw new Error("Unexpected signing payload shape");const w=new Uint8Array(b.data),x=await crypto.subtle.digest("SHA-256",w),_=K6.PrivateKey.fromString(f),v=globalThis.Buffer;if(!v)throw new Error("Buffer polyfill is not available — import buffer in your app entry");return _.sign(v.from(new Uint8Array(x))).toString()}const h=(l?.provider||"").toLowerCase();if(!u.has(h))throw new Error(`Signed image upload is not supported for provider "${h||"unknown"}".`);if(!o)throw new Error("Wallet signer is not ready");let g;try{g=await o.signMessage(c,"posting")}catch(b){throw new Error(h6(f6(b)||"signMessage failed"))}if(!g.success)throw new Error(h6(f6(g.error)||"signMessage failed"));if(!g.result)throw new Error("signMessage returned empty result");return g.result},[o,l,u])}const SN=({author:a,permlink:o,onClose:l,currentUser:u,token:c,onClickCommentUpvote:f,onClickCommentReply:h,onClickUpvoteButton:g,onSubmitComment:b,ecencyToken:w,threeSpeakApiKey:x,giphyApiKey:_,templateToken:v,templateApiBaseUrl:N,showVoteButton:C,parentTags:R,defaultReward:O,defaultBeneficiaries:E,beneficiaryFavorites:$,defaultVotePercent:V,voteWeightStep:U,allowLandscapeVideos:z,awaitingWalletApproval:A})=>{const[H,I]=T.useState([]),[q,Z]=T.useState([]),[J,ee]=T.useState(!0),[se,fe]=T.useState(null),[he,X]=T.useState(null),[W,ne]=T.useState(!1),[be,ve]=T.useState(""),[Le,Ce]=T.useState(!1),[pe,ie]=T.useState(!1),ye=T.useRef({enabled:!1,percent:100}),Ne=T.useRef(E??[]),Ge=T.useCallback(async(xe=!1)=>{xe?ie(!0):ee(!0),fe(null);try{const We=await qn.getCommentsList(a,o,u??"");I(We),Z(We)}catch(We){fe(We instanceof Error?We.message:"Failed to load comments")}finally{ee(!1),ie(!1)}},[a,o]);T.useEffect(()=>{Ge()},[Ge]),T.useEffect(()=>{if(!be.trim())Z(H);else{const xe=H.filter(We=>We.body?.toLowerCase().includes(be.toLowerCase())||We.author.toLowerCase().includes(be.toLowerCase()));Z(xe)}},[be,H]);const me=(xe,We)=>{X({author:xe,permlink:We})},rt=xe=>{xe.target===xe.currentTarget&&l()},Oe=async(xe,We,qe)=>{if(b){try{const{enabled:Xe,percent:pt}=ye.current,Vt=Xe?pt:null;if(await Promise.resolve(b(xe,We,qe,Vt,Ne.current))===!1)return;Ce(!1),ie(!0),setTimeout(async()=>{await Ge(!0),ie(!1)},3e3)}catch(Xe){const pt=Xe instanceof Error?Xe.message:"Failed to post comment";Fl({title:"Error",description:pt}),ie(!1)}return}if(!c){alert("Please login to comment");return}try{await qn.handleComment({author:xe,permlink:We,body:qe,authToken:c}),Ce(!1),ie(!0),setTimeout(async()=>{await Ge(!0),ie(!1)},3e3)}catch(Xe){const pt=Xe instanceof Error?Xe.message:"Failed to post comment";Fl({title:"Error",description:pt}),ie(!1)}},ue=T.useMemo(()=>{if(!u?.trim())return q;const xe=u.toLowerCase();return[...q].sort((We,qe)=>{const Xe=We.author?.toLowerCase()===xe,pt=qe.author?.toLowerCase()===xe;return Xe&&!pt?-1:!Xe&&pt?1:0})},[q,u]),Pe=ue.filter(xe=>xe.parent_author===a&&xe.parent_permlink===o);return J?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4 h-screen",children:e.jsx("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl h-[90vh] flex flex-col",children:e.jsx("div",{className:"flex justify-center items-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Y.Loader2,{className:"w-12 h-12 animate-spin text-blue-500 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-300",children:"Loading comments..."})]})})})}):se?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-40 p-4 h-screen",onClick:rt,children:e.jsx("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-4xl h-[90vh] flex flex-col overflow-hidden",children:e.jsx("div",{className:"flex justify-center items-center h-full",children:e.jsxs("div",{className:"text-center p-6",children:[e.jsx(Y.AlertCircle,{className:"w-16 h-16 text-red-500 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"Failed to load comments"}),e.jsx("p",{className:"text-gray-300 mb-6",children:se}),e.jsx("button",{onClick:()=>Ge(),className:"px-6 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg transition-colors duration-200",children:"Try Again"})]})})})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-40 p-4 h-screen",onClick:rt,children:e.jsxs("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-4xl h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex justify-between items-center p-4 md:p-6 border-b border-gray-700 bg-gray-900/50",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs("h2",{className:"text-lg md:text-xl font-bold text-white",children:["Comments (",H.length,")"]}),pe&&e.jsx(Y.Loader2,{className:"w-5 h-5 animate-spin text-blue-500"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>Ge(!0),disabled:pe,className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200 disabled:opacity-50",title:"Refresh comments",children:e.jsx(Y.RefreshCw,{className:`w-5 h-5 text-gray-400 ${pe?"animate-spin":""}`})}),e.jsx("button",{onClick:()=>ne(!W),className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200",title:"Search comments",children:e.jsx(Y.Search,{className:"w-5 h-5 text-gray-400"})}),e.jsx("button",{onClick:l,className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200",children:e.jsx(Y.X,{className:"w-6 h-6 text-gray-400"})})]})]}),e.jsx(u7,{isVisible:W,searchQuery:be,onSearchChange:ve,onClose:()=>ne(!1)}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[Le&&e.jsx("div",{className:"border-b border-gray-700",children:e.jsx(ey,{onSubmit:xe=>Oe(a,o,xe),onCancel:()=>Ce(!1),currentUser:u,placeholder:"Add a comment...",ecencyToken:w,threeSpeakApiKey:x,giphyApiKey:_,templateToken:v,templateApiBaseUrl:N,showVoteButton:C,onVoteChange:(xe,We)=>{ye.current={enabled:xe,percent:We}},defaultTags:R,defaultReward:O,defaultBeneficiaries:E,beneficiaryFavorites:$,onBeneficiariesChange:xe=>{Ne.current=xe},defaultVotePercent:V,voteWeightStep:U,allowLandscapeVideos:z,awaitingWalletApproval:A})}),Pe.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8 text-center",children:[e.jsx(Y.MessageCirclePlus,{className:"w-16 h-16 text-gray-600 mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:be?"No comments found":"No comments yet"}),e.jsx("p",{className:"text-gray-400 mb-6",children:be?"Try adjusting your search terms":"Be the first to share your thoughts!"}),!be&&u&&e.jsx("button",{onClick:()=>Ce(!0),className:"px-6 py-3 bg-blue-500 hover:bg-blue-600 text-white rounded-lg font-medium transition-colors duration-200",children:"Add Comment"})]}):e.jsx("div",{className:"divide-y divide-gray-700",children:Pe.map(xe=>e.jsx(lN,{comment:xe,allComments:ue,onReply:me,currentUser:u,token:c,searchQuery:be,depth:0,onVotedRefresh:()=>Ge(!0),onClickCommentUpvote:f,onClickCommentReply:h,onClickUpvoteButton:g},xe.permlink))})]}),!Le&&u&&Pe.length>0&&e.jsx("div",{className:"p-4 md:p-6 border-t border-gray-700 bg-gray-900/50",children:e.jsxs("button",{onClick:()=>Ce(!0),className:"w-full md:w-auto px-6 py-3 bg-blue-500 hover:bg-blue-600 text-white rounded-lg font-medium transition-all duration-200 transform hover:scale-[1.02] flex items-center justify-center space-x-2",children:[e.jsx(Y.MessageCirclePlus,{className:"w-5 h-5"}),e.jsx("span",{children:"Add Comment"})]})})]})}),he&&e.jsx(l7,{parentAuthor:he.author,parentPermlink:he.permlink,onClose:()=>X(null),onCommentSubmitted:Oe,currentUser:u,ecencyToken:w,threeSpeakApiKey:x,giphyApiKey:_,templateToken:v,templateApiBaseUrl:N})]})};function ty(a){const o=Number(a.rshares??0);if(Number.isFinite(o)&&o<0)return!0;const l=Number(a.percent??0);return Number.isFinite(l)&&l<0}const Og="sagarkothari88";function hy(a){return a?.length?a.some(o=>o.voter?.toLowerCase()===Og):!1}function my(a,o){if(!a?.length||!o)return!1;const l=o.toLowerCase();return a.some(u=>u.voter?.toLowerCase()===l)}function py(a){let o={};if(typeof a=="string")try{o=JSON.parse(a)}catch{o={}}else a&&typeof a=="object"&&(o=a);return(typeof o.app=="string"?o.app.toLowerCase():"").includes("hivesuite")?!0:o.developer==="sagarkothari88"}function g7(a,o){return typeof o=="number"&&Number.isFinite(o)&&o>0?!0:a?.length?a.some(ty):!1}function x7(a){const o=typeof a=="string"?/Z|[+-]\d{2}:?\d{2}$/.test(a)?a:`${a}Z`:a,l=typeof o=="string"?new Date(o):o,u=Math.floor((Date.now()-l.getTime())/1e3),c={year:31536e3,month:2628e3,day:86400,hour:3600,minute:60};for(const[f,h]of Object.entries(c)){const g=Math.floor(u/h);if(g>1)return`${g} ${f}s ago`;if(g===1)return`${g} ${f} ago`}return"just now"}function b7(a){if(!a||a===0)return"25";const o=a<0,l=Math.abs(a);if(l<1e3)return Math.floor(l).toString();let u=Math.log10(l);return u=Math.max(u-9,0),((o?-1:1)*u*9+25).toFixed(0)}function Vj(a){if(typeof a=="number")return a;if(typeof a!="string")return 0;const o=parseFloat(a);return Number.isFinite(o)?o:0}const dw=["var(--hrk-brand)","#f59e0b","#facc15","#22c55e","#10b981","#06b6d4","#3b82f6","#6366f1","#8b5cf6","#ec4899"],Fj={value:"Vote Value",voter:"Voter",newest:"Newest",oldest:"Oldest",curation:"Curation Rewards"},Ij={value:"Flag Weight",voter:"Voter",newest:"Newest",oldest:"Oldest"},ry=({author:a,permlink:o,onClose:l,currentUser:u,token:c,onClickUpvoteButton:f,hiveIconUrl:h,voters:g,fetchVoters:b,valueUnit:w,title:x,voteFilter:_="upvotes",onUserClick:v,getUserUrl:N,totalVoteCount:C})=>{const R=_==="downvotes",O=x??(R?"Downvotes":"Votes (Hive Rewards)"),E=Array.isArray(g)||typeof b=="function",[$,V]=T.useState(g?.map(De=>({account:De}))??[]),U=h&&h.length>0?h:"https://hive.io/images/hive-logo.png",[z,A]=T.useState([]),[H,I]=T.useState(null),[q,Z]=T.useState(!0),[J,ee]=T.useState(!1),[se,fe]=T.useState(!1),[he,X]=T.useState(""),[W,ne]=T.useState(!1),[be,ve]=T.useState("value"),[Le,Ce]=T.useState(!1),[pe,ie]=T.useState(!1),[ye,Ne]=T.useState(""),[Ge,me]=T.useState(!1),rt=T.useMemo(()=>z.filter(De=>R?ty(De):!ty(De)),[z,R]),Oe=!R&&!!u&&rt.some(De=>De.voter===u),ue=De=>{X(De),fe(!0),setTimeout(()=>fe(!1),2500)},Pe=async()=>{if(E||!a||!o)return;Z(!0);const[De,Ot]=await Promise.all([qn.getActiveVotes(a,o),qn.getPostContent(a,o)]);A(De),I(Ot),Z(!1)};T.useEffect(()=>{if(E){if(b){let De=!1;return Z(!0),b().then(Ot=>{De||(V(Ot),Z(!1))}).catch(()=>{De||(V([]),Z(!1))}),()=>{De=!0}}V((g??[]).map(De=>({account:De}))),Z(!1);return}Pe()},[a,o,E]);const{totalPayout:xe,totalCurationPool:We}=T.useMemo(()=>{if(!H)return{totalPayout:0,totalCurationPool:0};const De=Vj(H.pending_payout_value),Ot=Vj(H.author_payout_value),ot=Vj(H.curator_payout_value),Re=De>0?De:Ot+ot,Je=ot>0?ot:Re/2;return{totalPayout:Re,totalCurationPool:Je}},[H]),qe=T.useMemo(()=>rt.reduce((De,Ot)=>De+(R?Math.abs(Number(Ot.rshares)||0):Math.max(0,Number(Ot.rshares)||0)),0),[rt,R]),Xe=T.useMemo(()=>rt.reduce((De,Ot)=>De+(R?Math.abs(Number(Ot.weight)||0):Math.max(0,Number(Ot.weight)||0)),0),[rt,R]),pt=T.useMemo(()=>rt.map(De=>{const Ot=Number(De.rshares)||0,ot=Number(De.weight)||0,Re=R?Math.abs(Ot):Math.max(0,Ot),Je=R?Math.abs(ot):Math.max(0,ot),kt=R?Re:qe>0?Re/qe*xe:0,it=R?0:Xe>0?Je/Xe*We:0;return{...De,value:kt,curation:it}}),[rt,R,qe,Xe,xe,We]),Vt=T.useMemo(()=>{const De=pt.slice();return De.sort((Ot,ot)=>{switch(be){case"value":return ot.value-Ot.value;case"voter":return Ot.voter.localeCompare(ot.voter);case"newest":return new Date(ot.time??0).getTime()-new Date(Ot.time??0).getTime();case"oldest":return new Date(Ot.time??0).getTime()-new Date(ot.time??0).getTime();case"curation":return ot.curation-Ot.curation}return 0}),De},[pt,be]),Tr=T.useMemo(()=>{const De=R?qe:xe;if(De<=0)return[];const Ot=pt.slice().sort((it,Pt)=>Pt.value-it.value),ot=9,Re=Ot.slice(0,ot),Je=Ot.slice(ot),kt=Re.map((it,Pt)=>({color:R?"#f87171":dw[Pt%dw.length],widthPct:it.value/De*100,voter:it.voter}));if(Je.length>0){const it=Je.reduce((Pt,Yt)=>Pt+Yt.value,0);kt.push({color:"var(--hrk-border-strong)",widthPct:it/De*100,voter:`+${Je.length} more`})}return kt},[pt,xe,qe,R]),jt=T.useMemo(()=>$.reduce((De,Ot)=>De+Math.max(0,Ot.value??0),0),[$]),Nt=jt>0,fr=T.useMemo(()=>{const De=$.slice();return De.sort((Ot,ot)=>Nt?(ot.value??0)-(Ot.value??0):Ot.account.localeCompare(ot.account)),De},[$,Nt]),Mr=T.useMemo(()=>{if(jt<=0)return[];const De=9,Ot=fr.slice(0,De),ot=fr.slice(De),Re=Ot.map((Je,kt)=>({color:dw[kt%dw.length],widthPct:(Je.value??0)/jt*100,voter:Je.account}));if(ot.length>0){const Je=ot.reduce((kt,it)=>kt+(it.value??0),0);Re.push({color:"var(--hrk-border-strong)",widthPct:Je/jt*100,voter:`+${ot.length} more`})}return Re},[fr,jt]),Zt=async()=>{if(!(!a||!o||pe)){ie(!0);try{const De=Ge?ye:"",Ot=await qn.listVotes(a,o,De,1e3),ot=Ot.map(it=>({voter:it.voter,percent:it.vote_percent,rshares:parseInt(it.rshares)||0,time:it.last_update,weight:parseInt(it.weight)||0})),Re=new Map;z.forEach(it=>Re.set(it.voter,it));const Je=ot.map(it=>it.voter).filter(it=>!Re.has(it));if(Je.length>0)for(let Pt=0;Pt<Je.length;Pt+=100){const Yt=Je.slice(Pt,Pt+100);(await qn.getAccounts(Yt)).forEach(ma=>{const Zr=ot.findIndex(Wr=>Wr.voter===ma.name);Zr!==-1&&(ot[Zr].reputation=ma.reputation)})}ot.forEach(it=>{Re.has(it.voter)||Re.set(it.voter,it)});const kt=Array.from(Re.values());A(kt),Ot.length>0&&Ne(Ot[Ot.length-1].voter),me(!0)}catch(De){console.error("Failed to load more votes:",De)}finally{ie(!1)}}},He=De=>{De.target===De.currentTarget&&l()},Kt=async De=>{if(!c||!u){alert("Please login to upvote");return}try{const Ot=Math.round(De*100);await qn.handleUpvote({author:a,permlink:o,weight:Ot,authToken:c}),ee(!1),ne(!0),setTimeout(async()=>{await Pe(),ne(!1),ue("Vote submitted successfully ✅"),l()},3e3)}catch(Ot){const ot=Ot instanceof Error?Ot.message:"Failed to upvote";Fl({title:"Error",description:ot}),ne(!1)}};return e.jsxs("div",{className:"fixed inset-0 bg-black/60 flex items-end items-center justify-center z-50 px-3 sm:items-center sm:px-4 h-screen",onClick:He,children:[e.jsxs("div",{className:"relative bg-[var(--hrk-bg-surface-raised)] rounded-t-[16px] sm:rounded-[16px] shadow-[var(--hrk-shadow-lg)] w-full max-w-4xl max-h-[85vh] flex flex-col overflow-hidden border border-[var(--hrk-border-default)]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[var(--hrk-border-subtle)] px-4 py-3 sm:px-5 sm:py-4",children:[e.jsxs("div",{className:"flex flex-1 items-center gap-3 min-w-0",children:[e.jsx("h2",{className:"text-base sm:text-lg font-semibold text-white truncate",children:O}),!E&&!q&&(rt.length>0||(C??0)>0)&&e.jsx("span",{className:"shrink-0 rounded bg-[var(--hrk-bg-surface)] px-1.5 py-0.5 text-[11px] font-medium text-[var(--hrk-text-tertiary)]",children:Math.max(rt.length,C??0).toLocaleString()}),E&&!q&&e.jsx("span",{className:"shrink-0 rounded bg-[var(--hrk-bg-surface)] px-1.5 py-0.5 text-[11px] font-medium text-[var(--hrk-text-tertiary)]",children:$.length.toLocaleString()}),W&&e.jsx("span",{className:"inline-flex items-center","aria-label":"Refreshing",children:e.jsx("span",{className:"w-3.5 h-3.5 border-2 border-[var(--hrk-brand)] border-t-transparent rounded-full animate-spin"})})]}),!E&&e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>Ce(De=>!De),className:"inline-flex items-center gap-1.5 rounded-md border border-[var(--hrk-border-default)] bg-[var(--hrk-bg-surface)] px-2.5 py-1 text-xs font-medium text-[var(--hrk-text-secondary)] hover:bg-[var(--hrk-bg-hover)]","aria-haspopup":"menu","aria-expanded":Le,children:[e.jsx("span",{className:"hidden sm:inline",children:(R?Ij[be]:Fj[be])?.toUpperCase()??"SORT"}),e.jsx("span",{className:"sm:hidden",children:"SORT"}),e.jsx(Y.ChevronDown,{className:"w-3.5 h-3.5"})]}),Le&&e.jsx("ul",{role:"menu",className:"absolute right-0 top-full z-10 mt-1 w-44 overflow-hidden rounded-md border border-[var(--hrk-border-default)] bg-[var(--hrk-bg-surface-sunken)] shadow-xl",onClick:De=>De.stopPropagation(),children:Object.keys(R?Ij:Fj).map(De=>e.jsx("li",{children:e.jsx("button",{type:"button",role:"menuitem",onClick:()=>{ve(De),Ce(!1)},className:`w-full px-3 py-2 text-left text-xs hover:bg-[var(--hrk-bg-hover)] ${be===De?"text-[var(--hrk-brand)]":"text-[var(--hrk-text-secondary)]"}`,children:R?Ij[De]:Fj[De]})},De))})]}),!E&&!R&&!J&&e.jsx("button",{onClick:()=>{if(f){f(u,c);return}if(!u||!c){ue("Please login to upvote");return}Oe?ue("You have already upvoted this post"):ee(!0)},"aria-label":"Upvote this post",className:"rounded p-1 hover:bg-[var(--hrk-bg-hover)]",type:"button",children:e.jsx(Y.ThumbsUp,{className:`w-4 h-4 ${Oe?"text-[var(--hrk-brand)] fill-current":"text-[var(--hrk-text-secondary)]"}`})}),e.jsx("button",{type:"button",onClick:l,"aria-label":"Close",className:"rounded p-1 hover:bg-[var(--hrk-bg-hover)]",children:e.jsx(Y.X,{className:"w-4 h-4 text-[var(--hrk-text-secondary)]"})})]}),E&&!q&&Mr.length>0&&e.jsxs("div",{className:"border-b border-[var(--hrk-border-default)] bg-[var(--hrk-bg-surface-sunken)]/40 px-4 py-3 sm:px-5",children:[e.jsxs("p",{className:"text-xs text-[var(--hrk-text-tertiary)] mb-1.5",children:["Breakdown for ",$.length.toLocaleString()," ",$.length===1?"voter":"voters"]}),e.jsx("div",{className:"flex h-2.5 w-full overflow-hidden rounded-md bg-[var(--hrk-bg-surface)]",role:"img","aria-label":"Voter weight distribution",children:Mr.map((De,Ot)=>e.jsx("span",{title:`${De.voter} · ${De.widthPct.toFixed(1)}%`,style:{width:`${De.widthPct}%`,backgroundColor:De.color},className:"h-full"},`${De.voter}-${Ot}`))})]}),!E&&!q&&!J&&(rt.length>0||(C??0)>0)&&e.jsxs("div",{className:"border-b border-[var(--hrk-border-default)] bg-[var(--hrk-bg-surface-sunken)]/40 px-4 py-3 sm:px-5",children:[e.jsxs("p",{className:"text-xs text-[var(--hrk-text-tertiary)] mb-1.5",children:["Breakdown for ",Math.max(rt.length,C??0).toLocaleString()," ",Math.max(rt.length,C??0)===1?R?"downvote":"vote":R?"downvotes":"votes"]}),e.jsx("div",{className:"flex h-2.5 w-full overflow-hidden rounded-md bg-[var(--hrk-bg-surface)]",role:"img","aria-label":"Vote value distribution",children:Tr.map((De,Ot)=>e.jsx("span",{title:`${De.voter} · ${De.widthPct.toFixed(1)}%`,style:{width:`${De.widthPct}%`,backgroundColor:De.color},className:"h-full"},`${De.voter}-${Ot}`))})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3 sm:px-4 sm:py-4",children:[E?q?e.jsx("div",{className:"flex justify-center items-center h-full p-8",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-[var(--hrk-brand)]"})}):$.length===0?e.jsx("div",{className:"flex flex-col items-center justify-center py-12 text-center text-sm text-[var(--hrk-text-tertiary)]",children:"No voters yet."}):e.jsx("ul",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2 lg:grid-cols-3",children:fr.map(De=>{const Ot=De.account,ot=N?.(Ot),Re=e.jsxs(e.Fragment,{children:[e.jsx("img",{src:`https://images.hive.blog/u/${Ot}/avatar`,alt:Ot,loading:"lazy",className:"w-9 h-9 rounded-full bg-[var(--hrk-bg-surface-raised)] shrink-0",onError:kt=>{kt.target.src=`https://ui-avatars.com/api/?name=${Ot}&background=random`}}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-white",children:Ot}),De.value!=null&&Nt&&e.jsxs("span",{className:"shrink-0 text-xs font-semibold text-[var(--hrk-success)]",children:[De.value.toLocaleString(void 0,{maximumFractionDigits:3}),w?` ${w}`:""]})]}),Je="flex items-center gap-2.5 rounded-md px-2 py-1.5 hover:bg-[var(--hrk-bg-surface)]";return e.jsx("li",{children:ot?e.jsx("a",{href:ot,className:Je,onClick:kt=>{kt.metaKey||kt.ctrlKey||kt.shiftKey||kt.altKey||kt.button!==0||(kt.preventDefault(),v?.(Ot))},children:Re}):v?e.jsx("button",{type:"button",className:`w-full text-left ${Je}`,onClick:()=>v(Ot),children:Re}):e.jsx("div",{className:Je,children:Re})},Ot)})}):q?e.jsx("div",{className:"flex justify-center items-center h-full p-8",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-[var(--hrk-brand)]"})}):J&&!Oe?e.jsx(e_,{author:a,permlink:o,onUpvote:Kt,onCancel:()=>ee(!1)}):rt.length===0?e.jsx("div",{className:"flex flex-col items-center justify-center py-12 text-center text-sm text-[var(--hrk-text-tertiary)]",children:R?"No downvotes yet.":"No votes yet."}):e.jsx("ul",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2 lg:grid-cols-3",children:Vt.map(De=>{const Ot=(Math.abs(De.percent??0)/100).toFixed(2),ot=be==="curation"?De.curation:De.value,Re=N?.(De.voter),Je=e.jsxs(e.Fragment,{children:[e.jsx("img",{src:`https://images.hive.blog/u/${De.voter}/avatar`,alt:De.voter,className:"w-9 h-9 rounded-full bg-[var(--hrk-bg-surface-raised)] shrink-0",onError:it=>{it.target.src=`https://ui-avatars.com/api/?name=${De.voter}&background=random`}}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-sm min-w-0",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-white",children:De.voter}),e.jsx("span",{className:"shrink-0 rounded bg-[var(--hrk-bg-surface)] px-1.5 py-0.5 text-[10px] font-medium text-[var(--hrk-text-tertiary)]",children:b7(De.reputation)}),e.jsxs("span",{className:`shrink-0 inline-flex items-center gap-1 text-xs font-semibold ${R?"text-red-400":"text-[var(--hrk-success)]"}`,children:[R?`-${Ot}%`:ot.toFixed(3),!R&&e.jsx("img",{src:U,alt:"",className:"h-3.5 w-3.5 object-contain","aria-hidden":!0})]})]}),e.jsxs("div",{className:"text-[11px] text-[var(--hrk-text-tertiary)]",children:[R?`Flag weight · ${ot.toLocaleString()}`:`${Ot}%`,De.time&&` · ${x7(De.time+"Z")}`]})]})]}),kt="flex items-center gap-2.5 rounded-md px-2 py-1.5 hover:bg-[var(--hrk-bg-surface)]";return e.jsx("li",{children:Re?e.jsx("a",{href:Re,className:kt,onClick:it=>{it.metaKey||it.ctrlKey||it.shiftKey||it.altKey||it.button!==0||(it.preventDefault(),v?.(De.voter))},children:Je}):v?e.jsx("button",{type:"button",className:`w-full text-left ${kt}`,onClick:()=>v(De.voter),children:Je}):e.jsx("div",{className:kt,children:Je})},De.voter)})}),!E&&!q&&!J&&rt.length<(C??0)&&e.jsx("div",{className:"flex justify-center mt-4 pb-2",children:e.jsx("button",{type:"button",onClick:Zt,disabled:pe,className:"flex items-center gap-2 px-5 py-2.5 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-700 text-white disabled:text-gray-400 text-xs font-semibold rounded-lg transition-colors cursor-pointer",children:pe?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"w-3 h-3 border-2 border-white border-t-transparent rounded-full animate-spin shrink-0"}),"Loading more..."]}):"Load More Votes"})})]})]}),se&&e.jsx("div",{className:"fixed bottom-4 right-4 w-[280px] z-50",children:e.jsx("div",{className:"bg-[var(--hrk-bg-surface-sunken)] border border-[var(--hrk-border-default)] text-white rounded px-3 py-2 shadow-lg text-sm",children:he})})]})},jC=({isOpen:a,onClose:o,title:l,children:u,maxWidth:c="max-w-2xl"})=>a?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:o}),e.jsxs("div",{className:`relative bg-card border border-border rounded-xl shadow-xl w-full mx-4 ${c} max-h-[90vh] overflow-hidden animate-scale-in`,children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[e.jsx("h2",{className:"text-xl font-bold text-card-foreground",children:l}),e.jsx("button",{onClick:o,className:"p-2 rounded-lg hover:bg-muted transition-colors",children:e.jsx(Y.X,{className:"w-5 h-5 text-muted-foreground"})})]}),e.jsx("div",{className:"overflow-y-auto max-h-[calc(90vh-80px)] custom-scrollbar",children:u})]})]}):null,v7=({author:a,permlink:o,content:l,onClose:u})=>e.jsx(jC,{isOpen:!0,onClose:u,title:"Video Description",maxWidth:"max-w-2xl",children:e.jsxs("div",{className:"p-6",children:[l?e.jsx("div",{className:"prose prose-sm max-w-none",children:e.jsx("div",{className:"bg-muted/30 rounded-lg p-4",children:e.jsx("pre",{className:"whitespace-pre-wrap text-sm text-card-foreground font-sans leading-relaxed",children:l})})}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Y.FileText,{className:"w-12 h-12 text-muted-foreground mx-auto mb-2"}),e.jsx("p",{className:"text-muted-foreground",children:"No description available"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"This video doesn't have a description yet."})]}),e.jsx("div",{className:"mt-6 pt-4 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsxs("span",{children:["By @",a]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:["/",o]})]})})]})}),y7=({username:a,permlink:o,onAuthorClick:l,onVideoClick:u,onTagClick:c,onBack:f,onCommentsModal:h,onUpvotesModal:g,onDescriptionModal:b,onVideoInfo:w,onShare:x,onBookmark:_}={})=>{const v=a,N=o,[C,R]=T.useState(null),[O,E]=T.useState(!0),[$,V]=T.useState(null),[U,z]=T.useState(!1),[A,H]=T.useState(null),[I,q]=T.useState(!1),[Z,J]=T.useState(!1),[ee,se]=T.useState(!1),[fe,he]=T.useState(!1),X=T.useRef(null),W=T.useRef(null),ne=T.useRef(null);T.useEffect(()=>{(async()=>{if(!(!v||!N))try{E(!0),V(null);const ye=await qn.getVideoDetails(v,N);R(ye),z(!1),H(null)}catch(ye){V(ye instanceof Error?ye.message:"Failed to load video")}finally{E(!1)}})()},[v,N]);const be=ie=>ie?ie.startsWith("ipfs://")?`https://ipfs-3speak.b-cdn.net/ipfs/${ie.replace("ipfs://","").split("/")[0]}/manifest.m3u8`:ie:"";T.useEffect(()=>((async()=>{const ye=C?.video_v2;if(!U||!ye||!X.current)return;const Ne=X.current,Ge=be(ye);W.current&&(W.current.destroy(),W.current=null),Ne.src="",Ne.load();try{let me=!1;const rt=()=>{me||(me=!0,Ne.play().then(()=>H(null)).catch(qe=>H(`Playback failed: ${qe.message}`)))};if(Gd.isSupported()){const qe=new Gd({debug:!1,enableWorker:!1,lowLatencyMode:!1,backBufferLength:90,maxLoadingDelay:4,maxBufferLength:30,maxMaxBufferLength:600,startLevel:-1});W.current=qe,qe.on(Gd.Events.MANIFEST_PARSED,()=>{}),qe.on(Gd.Events.ERROR,(Xe,pt)=>{if(pt.fatal)switch(pt.type){case Gd.ErrorTypes.NETWORK_ERROR:H("Network error, retrying..."),setTimeout(()=>qe.startLoad(),1e3);break;case Gd.ErrorTypes.MEDIA_ERROR:H("Media error, retrying..."),setTimeout(()=>qe.recoverMediaError(),1e3);break;default:H(`Fatal error: ${pt.details}`),qe.destroy(),W.current=null;break}}),qe.attachMedia(Ne),qe.loadSource(Ge)}else if(Ne.canPlayType("application/vnd.apple.mpegurl"))Ne.src=Ge;else{const qe=Ge.replace("/manifest.m3u8","/480p/index.m3u8");Ne.src=qe}const Oe=()=>q(!0),ue=()=>{q(!1),rt()},Pe=qe=>{const Xe=qe.target;H(`Video error: ${Xe.error?.message||"Unknown error"}`),q(!1)},xe=()=>q(!1);Ne.addEventListener("loadstart",Oe),Ne.addEventListener("canplay",ue),Ne.addEventListener("error",Pe),Ne.addEventListener("loadeddata",xe);const We=async()=>{const qe=!!document.fullscreenElement;try{qe?"orientation"in screen&&await(screen.orientation?.lock?.("landscape")??Promise.resolve()):"orientation"in screen&&screen.orientation?.unlock?.()}catch{}};return document.addEventListener("fullscreenchange",We),ne.current=()=>{document.removeEventListener("fullscreenchange",We)},()=>{Ne.removeEventListener("loadstart",Oe),Ne.removeEventListener("canplay",ue),Ne.removeEventListener("error",Pe),Ne.removeEventListener("loadeddata",xe),ne.current&&ne.current()}}catch(me){H(`Setup error: ${me instanceof Error?me.message:"Unknown"}`)}})(),()=>{W.current&&(W.current.destroy(),W.current=null)}),[U,C?.video_v2]);const ve=()=>{if(!C?.video_v2){H("No video source available");return}z(!0),H(null),q(!0)},Le=ie=>{u&&u(ie)},Ce=ie=>{l&&l(ie)},pe=ie=>{if(!ie)return"00:00";const ye=Math.floor(ie),Ne=Math.floor(ye/3600),Ge=Math.floor(ye%3600/60),me=ye%60,rt=Oe=>Oe.toString().padStart(2,"0");return ye<60?`00:${rt(me)}`:Ne===0?`${rt(Ge)}:${rt(me)}`:`${rt(Ne)}:${rt(Ge)}:${rt(me)}`};return O?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("div",{className:"sticky top-0 z-50 w-full bg-background border-b border-border",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsx("div",{className:"h-8 w-24 bg-muted rounded-full animate-pulse"})})}),e.jsx("div",{className:"container mx-auto px-4 py-8 max-w-6xl",children:e.jsxs("div",{className:"animate-pulse space-y-6",children:[e.jsx("div",{className:"aspect-video bg-muted rounded-xl"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-6 bg-muted rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-muted rounded w-1/2"})]})]})})]}):$||!C?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsxs("div",{className:"text-center max-w-md mx-auto px-4",children:[e.jsx("h2",{className:"text-xl font-semibold text-card-foreground mb-2",children:"Failed to Load Video"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:$||"Video not found"}),e.jsxs("button",{onClick:()=>{f&&f()},className:"inline-flex items-center gap-2 px-4 py-2 bg-card border border-border text-card-foreground rounded-lg hover:bg-card-hover transition-colors",children:[e.jsx(Y.ArrowLeft,{className:"w-4 h-4"}),"Go Back"]})]})}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("div",{className:"sticky top-0 z-50 w-full bg-background/95 backdrop-blur-sm border-b border-border",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsxs("button",{onClick:()=>{f&&f()},className:"inline-flex items-center gap-2 text-muted-foreground hover:text-card-foreground transition-colors",children:[e.jsx(Y.ArrowLeft,{className:"w-4 h-4"}),"Back"]})})}),e.jsx("div",{className:"container mx-auto px-4 py-8 max-w-6xl",children:e.jsxs("div",{className:"flex flex-col gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsx("div",{className:"w-full aspect-video bg-black rounded-xl overflow-hidden relative shadow-card",children:U?e.jsxs("div",{className:"relative w-full h-full",children:[e.jsx("video",{ref:X,controls:!0,poster:yp(C.thumbnail),className:"w-full h-full object-contain bg-black",onDoubleClick:async ie=>{const ye=ie.currentTarget;try{document.fullscreenElement?await document.exitFullscreen():await ye.requestFullscreen()}catch{}}}),I&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary"})}),A&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/80",children:e.jsxs("div",{className:"text-center text-white",children:[e.jsx("p",{className:"mb-4",children:A}),e.jsx("button",{onClick:()=>{z(!1),H(null)},className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary-hover transition-colors",children:"Try Again"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("img",{src:yp(C.thumbnail)||`https://images.hive.blog/u/${C.owner}/avatar`,alt:C.title,className:"w-full h-full object-cover",onError:ie=>{ie.target.src=`https://images.hive.blog/u/${C.owner}/avatar`}}),e.jsx("div",{className:"absolute inset-0 bg-gradient-overlay opacity-30"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("button",{onClick:ve,className:"bg-primary hover:bg-primary-hover rounded-full p-6 transform hover:scale-110 transition-all duration-300 shadow-lg",children:e.jsx(Y.Play,{className:"w-8 h-8 text-primary-foreground ml-1",fill:"currentColor"})})}),C.duration&&e.jsxs("div",{className:"absolute bottom-4 right-4 bg-black/80 text-white text-sm px-3 py-1 rounded-md flex items-center gap-1 backdrop-blur-sm",children:[e.jsx(Y.Clock,{className:"w-3 h-3"}),pe(C.duration)]}),C.views&&e.jsxs("div",{className:"absolute bottom-4 left-4 bg-black/80 text-white text-sm px-3 py-1 rounded-md flex items-center gap-1 backdrop-blur-sm",children:[e.jsx(Y.Eye,{className:"w-3 h-3"}),C.views.toLocaleString()," views"]})]})}),e.jsx(aT,{title:C.title||"",author:C.owner||"",permlink:C.permlink||"",createdAt:C.created,description:C.description||"",video:{title:C.title||"",author:C.owner||"",permlink:C.permlink||"",created:C.created||new Date,category:C.category||"",numOfUpvotes:void 0,numOfComments:void 0,hiveValue:void 0,duration:C.duration,thumbnail:C.thumbnail,views:C.views},onTapComment:()=>{h?h(v,N):J(!0)},onTapUpvote:()=>{g?g(v,N):se(!0)},onTapInfo:()=>{b?b(v,N,C.description||""):he(!0)},onTapAuthor:()=>{l&&l(C.owner)},onTapShare:()=>{x&&x(v,N)},onTapBookmark:()=>{_&&_(v,N)}}),C.tags&&e.jsx("div",{className:"flex flex-wrap gap-2",children:C.tags.split(",").map((ie,ye)=>e.jsxs("span",{className:"bg-primary/10 text-primary px-3 py-1 rounded-full text-sm font-medium hover:bg-primary/20 transition-colors cursor-pointer",onClick:()=>{c&&c(ie.trim())},children:["#",ie.trim()]},ye))})]}),e.jsxs("div",{className:"bg-card border border-border rounded-xl p-6 sticky top-24",children:[e.jsx("h3",{className:"font-semibold text-card-foreground mb-4 text-lg",children:"Related Videos"}),e.jsx("div",{className:"space-y-4",children:e.jsx(U3,{feedType:xo.RELATED,username:C.owner,onVideoClick:Le,onAuthorClick:Ce})})]})]})}),Z&&v&&N&&e.jsx(SN,{author:v,permlink:N,onClose:()=>J(!1)}),ee&&v&&N&&e.jsx(ry,{author:v,permlink:N,onClose:()=>se(!1),onUserClick:l,totalVoteCount:C?.numOfUpvotes??void 0}),fe&&v&&N&&e.jsx(v7,{author:v,permlink:N,content:C.description||"",onClose:()=>he(!1)})]})};var NC={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},m6=T.createContext&&T.createContext(NC),w7=["attr","size","title"];function _7(a,o){if(a==null)return{};var l=k7(a,o),u,c;if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(c=0;c<f.length;c++)u=f[c],!(o.indexOf(u)>=0)&&Object.prototype.propertyIsEnumerable.call(a,u)&&(l[u]=a[u])}return l}function k7(a,o){if(a==null)return{};var l={};for(var u in a)if(Object.prototype.hasOwnProperty.call(a,u)){if(o.indexOf(u)>=0)continue;l[u]=a[u]}return l}function Rw(){return Rw=Object.assign?Object.assign.bind():function(a){for(var o=1;o<arguments.length;o++){var l=arguments[o];for(var u in l)Object.prototype.hasOwnProperty.call(l,u)&&(a[u]=l[u])}return a},Rw.apply(this,arguments)}function p6(a,o){var l=Object.keys(a);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(a);o&&(u=u.filter(function(c){return Object.getOwnPropertyDescriptor(a,c).enumerable})),l.push.apply(l,u)}return l}function Lw(a){for(var o=1;o<arguments.length;o++){var l=arguments[o]!=null?arguments[o]:{};o%2?p6(Object(l),!0).forEach(function(u){j7(a,u,l[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(l)):p6(Object(l)).forEach(function(u){Object.defineProperty(a,u,Object.getOwnPropertyDescriptor(l,u))})}return a}function j7(a,o,l){return o=N7(o),o in a?Object.defineProperty(a,o,{value:l,enumerable:!0,configurable:!0,writable:!0}):a[o]=l,a}function N7(a){var o=S7(a,"string");return typeof o=="symbol"?o:o+""}function S7(a,o){if(typeof a!="object"||!a)return a;var l=a[Symbol.toPrimitive];if(l!==void 0){var u=l.call(a,o);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(a)}function SC(a){return a&&a.map((o,l)=>T.createElement(o.tag,Lw({key:l},o.attr),SC(o.child)))}function Hs(a){return o=>T.createElement(E7,Rw({attr:Lw({},a.attr)},o),SC(a.child))}function E7(a){var o=l=>{var{attr:u,size:c,title:f}=a,h=_7(a,w7),g=c||l.size||"1em",b;return l.className&&(b=l.className),a.className&&(b=(b?b+" ":"")+a.className),T.createElement("svg",Rw({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},l.attr,u,h,{className:b,style:Lw(Lw({color:a.color||l.color},l.style),a.style),height:g,width:g,xmlns:"http://www.w3.org/2000/svg"}),f&&T.createElement("title",null,f),a.children)};return m6!==void 0?T.createElement(m6.Consumer,null,l=>o(l)):o(NC)}function A7(a){return Hs({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z"},child:[]}]})(a)}function T7(a){return Hs({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"},child:[]}]})(a)}function C7(a){return Hs({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z"},child:[]}]})(a)}function EC(a){return Hs({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M296 160H180.6l42.6-129.8C227.2 15 215.7 0 200 0H56C44 0 33.8 8.9 32.2 20.8l-32 240C-1.7 275.2 9.5 288 24 288h118.7L96.6 482.5c-3.6 15.2 8 29.5 23.3 29.5 8.4 0 16.4-4.4 20.8-12l176-304c9.3-15.9-2.2-36-20.7-36z"},child:[]}]})(a)}function D7(a){return Hs({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M436 480h-20V24c0-13.255-10.745-24-24-24H56C42.745 0 32 10.745 32 24v456H12c-6.627 0-12 5.373-12 12v20h448v-20c0-6.627-5.373-12-12-12zM128 76c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12V76zm0 96c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40zm52 148h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12zm76 160h-64v-84c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v84zm64-172c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40zm0-96c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40zm0-96c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12V76c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40z"},child:[]}]})(a)}function g6(a){return Hs({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 384H64V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-32c0-8.84-7.16-16-16-16zM464 96H345.94c-21.38 0-32.09 25.85-16.97 40.97l32.4 32.4L288 242.75l-73.37-73.37c-12.5-12.5-32.76-12.5-45.25 0l-68.69 68.69c-6.25 6.25-6.25 16.38 0 22.63l22.62 22.62c6.25 6.25 16.38 6.25 22.63 0L192 237.25l73.37 73.37c12.5 12.5 32.76 12.5 45.25 0l96-96 32.4 32.4c15.12 15.12 40.97 4.41 40.97-16.97V112c.01-8.84-7.15-16-15.99-16z"},child:[]}]})(a)}function M7(a){return Hs({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"},child:[]}]})(a)}function AC(a){return Hs({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(a)}function O7(a){return Hs({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 405.3V448c0 35.3 86 64 192 64s192-28.7 192-64v-42.7C342.7 434.4 267.2 448 192 448S41.3 434.4 0 405.3zM320 128c106 0 192-28.7 192-64S426 0 320 0 128 28.7 128 64s86 64 192 64zM0 300.4V352c0 35.3 86 64 192 64s192-28.7 192-64v-51.6c-41.3 34-116.9 51.6-192 51.6S41.3 334.4 0 300.4zm416 11c57.3-11.1 96-31.7 96-55.4v-42.7c-23.2 16.4-57.3 27.6-96 34.5v63.6zM192 160C86 160 0 195.8 0 240s86 80 192 80 192-35.8 192-80-86-80-192-80zm219.3 56.3c60-10.8 100.7-32 100.7-56.3v-42.7c-35.5 25.1-96.5 38.6-160.7 41.8 29.5 14.3 51.2 33.5 60 57.2z"},child:[]}]})(a)}function R7(a){return Hs({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M160 224v64h320v-64c0-35.3 28.7-64 64-64h32c0-53-43-96-96-96H160c-53 0-96 43-96 96h32c35.3 0 64 28.7 64 64zm416-32h-32c-17.7 0-32 14.3-32 32v96H128v-96c0-17.7-14.3-32-32-32H64c-35.3 0-64 28.7-64 64 0 23.6 13 44 32 55.1V432c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16v-16h384v16c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16V311.1c19-11.1 32-31.5 32-55.1 0-35.3-28.7-64-64-64z"},child:[]}]})(a)}function N3(a){return Hs({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"},child:[]}]})(a)}function L7(a){return Hs({attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M336.5 160C322 70.7 287.8 8 248 8s-74 62.7-88.5 152h177zM152 256c0 22.2 1.2 43.5 3.3 64h185.3c2.1-20.5 3.3-41.8 3.3-64s-1.2-43.5-3.3-64H155.3c-2.1 20.5-3.3 41.8-3.3 64zm324.7-96c-28.6-67.9-86.5-120.4-158-141.6 24.4 33.8 41.2 84.7 50 141.6h108zM177.2 18.4C105.8 39.6 47.8 92.1 19.3 160h108c8.7-56.9 25.5-107.8 49.9-141.6zM487.4 192H372.7c2.1 21 3.3 42.5 3.3 64s-1.2 43-3.3 64h114.6c5.5-20.5 8.6-41.8 8.6-64s-3.1-43.5-8.5-64zM120 256c0-21.5 1.2-43 3.3-64H8.6C3.2 212.5 0 233.8 0 256s3.2 43.5 8.6 64h114.6c-2-21-3.2-42.5-3.2-64zm39.5 96c14.5 89.3 48.7 152 88.5 152s74-62.7 88.5-152h-177zm159.3 141.6c71.4-21.2 129.4-73.7 158-141.6h-108c-8.8 56.9-25.6 107.8-50 141.6zM19.3 352c28.6 67.9 86.5 120.4 158 141.6-24.4-33.8-41.2-84.7-50-141.6h-108z"},child:[]}]})(a)}function qj(a){return Hs({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M275.3 250.5c7 7.4 18.4 7.4 25.5 0l108.9-114.2c31.6-33.2 29.8-88.2-5.6-118.8-30.8-26.7-76.7-21.9-104.9 7.7L288 36.9l-11.1-11.6C248.7-4.4 202.8-9.2 172 17.5c-35.3 30.6-37.2 85.6-5.6 118.8l108.9 114.2zm290 77.6c-11.8-10.7-30.2-10-42.6 0L430.3 402c-11.3 9.1-25.4 14-40 14H272c-8.8 0-16-7.2-16-16s7.2-16 16-16h78.3c15.9 0 30.7-10.9 33.3-26.6 3.3-20-12.1-37.4-31.6-37.4H192c-27 0-53.1 9.3-74.1 26.3L71.4 384H16c-8.8 0-16 7.2-16 16v96c0 8.8 7.2 16 16 16h356.8c14.5 0 28.6-4.9 40-14L564 377c15.2-12.1 16.4-35.3 1.3-48.9z"},child:[]}]})(a)}function Gj(a){return Hs({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M624 416H381.54c-.74 19.81-14.71 32-32.74 32H288c-18.69 0-33.02-17.47-32.77-32H16c-8.8 0-16 7.2-16 16v16c0 35.2 28.8 64 64 64h512c35.2 0 64-28.8 64-64v-16c0-8.8-7.2-16-16-16zM576 48c0-26.4-21.6-48-48-48H112C85.6 0 64 21.6 64 48v336h512V48zm-64 272H128V64h384v256z"},child:[]}]})(a)}function z7(a){return Hs({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M621.16 54.46C582.37 38.19 543.55 32 504.75 32c-123.17-.01-246.33 62.34-369.5 62.34-30.89 0-61.76-3.92-92.65-13.72-3.47-1.1-6.95-1.62-10.35-1.62C15.04 79 0 92.32 0 110.81v317.26c0 12.63 7.23 24.6 18.84 29.46C57.63 473.81 96.45 480 135.25 480c123.17 0 246.34-62.35 369.51-62.35 30.89 0 61.76 3.92 92.65 13.72 3.47 1.1 6.95 1.62 10.35 1.62 17.21 0 32.25-13.32 32.25-31.81V83.93c-.01-12.64-7.24-24.6-18.85-29.47zM48 132.22c20.12 5.04 41.12 7.57 62.72 8.93C104.84 170.54 79 192.69 48 192.69v-60.47zm0 285v-47.78c34.37 0 62.18 27.27 63.71 61.4-22.53-1.81-43.59-6.31-63.71-13.62zM320 352c-44.19 0-80-42.99-80-96 0-53.02 35.82-96 80-96s80 42.98 80 96c0 53.03-35.83 96-80 96zm272 27.78c-17.52-4.39-35.71-6.85-54.32-8.44 5.87-26.08 27.5-45.88 54.32-49.28v57.72zm0-236.11c-30.89-3.91-54.86-29.7-55.81-61.55 19.54 2.17 38.09 6.23 55.81 12.66v48.89z"},child:[]}]})(a)}function $7(a){return Hs({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M608 64H32C14.33 64 0 78.33 0 96v320c0 17.67 14.33 32 32 32h576c17.67 0 32-14.33 32-32V96c0-17.67-14.33-32-32-32zM48 400v-64c35.35 0 64 28.65 64 64H48zm0-224v-64h64c0 35.35-28.65 64-64 64zm272 176c-44.19 0-80-42.99-80-96 0-53.02 35.82-96 80-96s80 42.98 80 96c0 53.03-35.83 96-80 96zm272 48h-64c0-35.35 28.65-64 64-64v64zm0-224c-35.35 0-64-28.65-64-64h64v64z"},child:[]}]})(a)}function P7(a){return Hs({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M290.74 93.24l128.02 128.02-277.99 277.99-114.14 12.6C11.35 513.54-1.56 500.62.14 485.34l12.7-114.22 277.9-277.88zm207.2-19.06l-60.11-60.11c-18.75-18.75-49.16-18.75-67.91 0l-56.55 56.55 128.02 128.02 56.55-56.55c18.75-18.76 18.75-49.16 0-67.91z"},child:[]}]})(a)}function B7(a){return Hs({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"},child:[]}]})(a)}function U7(a){return Hs({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"},child:[]}]})(a)}function H7(a){return Hs({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M480 160H32c-17.673 0-32-14.327-32-32V64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24z"},child:[]}]})(a)}function TC(a){return Hs({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(a)}function V7(a){return Hs({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"},child:[]}]})(a)}function F7(a){return Hs({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"},child:[]}]})(a)}function Zj(a){return Hs({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M96 224c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm448 0c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm32 32h-64c-17.6 0-33.5 7.1-45.1 18.6 40.3 22.1 68.9 62 75.1 109.4h66c17.7 0 32-14.3 32-32v-32c0-35.3-28.7-64-64-64zm-256 0c61.9 0 112-50.1 112-112S381.9 32 320 32 208 82.1 208 144s50.1 112 112 112zm76.8 32h-8.3c-20.8 10-43.9 16-68.5 16s-47.6-6-68.5-16h-8.3C179.6 288 128 339.6 128 403.2V432c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48v-28.8c0-63.6-51.6-115.2-115.2-115.2zm-223.7-13.4C161.5 263.1 145.6 256 128 256H64c-35.3 0-64 28.7-64 64v32c0 17.7 14.3 32 32 32h65.9c6.3-47.4 34.9-87.3 75.2-109.4z"},child:[]}]})(a)}function I7(a){return Hs({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M461.2 128H80c-8.84 0-16-7.16-16-16s7.16-16 16-16h384c8.84 0 16-7.16 16-16 0-26.51-21.49-48-48-48H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h397.2c28.02 0 50.8-21.53 50.8-48V176c0-26.47-22.78-48-50.8-48zM416 336c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32z"},child:[]}]})(a)}const r_=Zc(),q7=async a=>{try{const o=await r_.database.getAccounts([a]);if(!o||o.length===0)throw new Error("Account not found");return o[0]}catch(o){return console.error("Error in getWalletDataDetail:",o),{error:o instanceof Error?o.message:"Unknown error"}}},Yj=async a=>{try{const o=await r_.database.getDynamicGlobalProperties(),l=parseFloat(a.split(" ")[0]),u=parseFloat(String(o.total_vesting_shares).split(" ")[0]),c=parseFloat(String(o.total_vesting_fund_hive).split(" ")[0]);return(l*c/u).toFixed(3)}catch(o){return console.error("Error in convertVestingSharesToHiveData:",o),"0"}},CC=async()=>{const o=(await r_.database.call("get_feed_history",[])).current_median_history,l=parseFloat(o.base.split(" ")[0]),u=parseFloat(o.quote.split(" ")[0]);return{baseAmount:l,quoteAmount:u}},G7=async a=>{try{const{baseAmount:o}=await CC(),l=typeof a=="string"?parseFloat(a):a;return(o*l).toFixed(2)}catch(o){return console.error("Error in convertHivetoUSDData:",o),"0"}},Z7=async a=>{try{const{baseAmount:o,quoteAmount:l}=await CC();return o===0?0:a*l/o}catch(o){return console.error("Error in convertHBDtoHive:",o),0}},DC=()=>{try{const a=Intl.DateTimeFormat().resolvedOptions().timeZone||"",o={"Asia/Kolkata":"INR","Asia/Calcutta":"INR","Asia/Chennai":"INR","Asia/Mumbai":"INR","Asia/Karachi":"PKR","Asia/Dhaka":"BDT","Asia/Colombo":"LKR","Asia/Kathmandu":"NPR","Asia/Rangoon":"MMK","Asia/Yangon":"MMK","Asia/Bangkok":"THB","Asia/Ho_Chi_Minh":"VND","Asia/Saigon":"VND","Asia/Jakarta":"IDR","Asia/Kuala_Lumpur":"MYR","Asia/Singapore":"SGD","Asia/Manila":"PHP","Asia/Hong_Kong":"HKD","Asia/Taipei":"TWD","Asia/Shanghai":"CNY","Asia/Chongqing":"CNY","Asia/Beijing":"CNY","Asia/Tokyo":"JPY","Asia/Seoul":"KRW","Asia/Dubai":"AED","Asia/Riyadh":"SAR","Asia/Jerusalem":"ILS","Asia/Tel_Aviv":"ILS","Asia/Phnom_Penh":"KHR","Asia/Vientiane":"LAK","America/New_York":"USD","America/Chicago":"USD","America/Denver":"USD","America/Los_Angeles":"USD","America/Phoenix":"USD","America/Anchorage":"USD","Pacific/Honolulu":"USD","America/Toronto":"CAD","America/Vancouver":"CAD","America/Montreal":"CAD","America/Edmonton":"CAD","America/Sao_Paulo":"BRL","America/Rio_Branco":"BRL","America/Mexico_City":"MXN","America/Cancun":"MXN","America/Argentina/Buenos_Aires":"ARS","America/Bogota":"COP","America/Lima":"PEN","America/Santiago":"CLP","Europe/London":"GBP","Europe/Dublin":"EUR","Europe/Berlin":"EUR","Europe/Paris":"EUR","Europe/Rome":"EUR","Europe/Madrid":"EUR","Europe/Lisbon":"EUR","Europe/Amsterdam":"EUR","Europe/Brussels":"EUR","Europe/Vienna":"EUR","Europe/Helsinki":"EUR","Europe/Athens":"EUR","Europe/Bratislava":"EUR","Europe/Ljubljana":"EUR","Europe/Vilnius":"EUR","Europe/Riga":"EUR","Europe/Tallinn":"EUR","Europe/Malta":"EUR","Europe/Nicosia":"EUR","Europe/Luxembourg":"EUR","Europe/Zagreb":"EUR","Europe/Zurich":"CHF","Europe/Stockholm":"SEK","Europe/Oslo":"NOK","Europe/Copenhagen":"DKK","Europe/Warsaw":"PLN","Europe/Prague":"CZK","Europe/Budapest":"HUF","Europe/Bucharest":"RON","Europe/Moscow":"RUB","Europe/Kiev":"UAH","Europe/Kyiv":"UAH","Europe/Istanbul":"TRY","Africa/Lagos":"NGN","Africa/Johannesburg":"ZAR","Africa/Nairobi":"KES","Africa/Accra":"GHS","Africa/Cairo":"EGP","Australia/Sydney":"AUD","Australia/Melbourne":"AUD","Australia/Brisbane":"AUD","Australia/Perth":"AUD","Pacific/Auckland":"NZD"};if(o[a])return o[a];const l=navigator.language||"en-US",u={US:"USD",GB:"GBP",IN:"INR",JP:"JPY",CN:"CNY",KR:"KRW",AU:"AUD",CA:"CAD",BR:"BRL",MX:"MXN",DE:"EUR",FR:"EUR",IT:"EUR",ES:"EUR",NL:"EUR"},c=l.split("-")[1]?.toUpperCase();return c&&u[c]||"USD"}catch{return"USD"}},Y7=async()=>{try{const o=await(await fetch("https://open.er-api.com/v6/latest/USD")).json();return o?.rates?o.rates:{USD:1}}catch{return{USD:1}}},Bv=[{code:"USD",name:"US Dollar"},{code:"EUR",name:"Euro"},{code:"GBP",name:"British Pound"},{code:"INR",name:"Indian Rupee"},{code:"JPY",name:"Japanese Yen"},{code:"CNY",name:"Chinese Yuan"},{code:"KRW",name:"South Korean Won"},{code:"AUD",name:"Australian Dollar"},{code:"CAD",name:"Canadian Dollar"},{code:"BRL",name:"Brazilian Real"},{code:"MXN",name:"Mexican Peso"},{code:"CHF",name:"Swiss Franc"},{code:"SGD",name:"Singapore Dollar"},{code:"HKD",name:"Hong Kong Dollar"},{code:"SEK",name:"Swedish Krona"},{code:"NOK",name:"Norwegian Krone"},{code:"DKK",name:"Danish Krone"},{code:"PLN",name:"Polish Zloty"},{code:"TRY",name:"Turkish Lira"},{code:"RUB",name:"Russian Ruble"},{code:"ZAR",name:"South African Rand"},{code:"AED",name:"UAE Dirham"},{code:"SAR",name:"Saudi Riyal"},{code:"THB",name:"Thai Baht"},{code:"IDR",name:"Indonesian Rupiah"},{code:"MYR",name:"Malaysian Ringgit"},{code:"PHP",name:"Philippine Peso"},{code:"VND",name:"Vietnamese Dong"},{code:"PKR",name:"Pakistani Rupee"},{code:"BDT",name:"Bangladeshi Taka"},{code:"GTQ",name:"Guatemalan Quetzal"},{code:"NGN",name:"Nigerian Naira"},{code:"EGP",name:"Egyptian Pound"},{code:"KES",name:"Kenyan Shilling"},{code:"NZD",name:"New Zealand Dollar"},{code:"TWD",name:"Taiwan Dollar"},{code:"CZK",name:"Czech Koruna"},{code:"HUF",name:"Hungarian Forint"},{code:"ILS",name:"Israeli Shekel"},{code:"CLP",name:"Chilean Peso"},{code:"ARS",name:"Argentine Peso"},{code:"COP",name:"Colombian Peso"},{code:"LKR",name:"Sri Lankan Rupee"},{code:"NPR",name:"Nepalese Rupee"},{code:"UAH",name:"Ukrainian Hryvnia"},{code:"RON",name:"Romanian Leu"},{code:"GHS",name:"Ghanaian Cedi"}],fw=(a,o)=>{try{const l=navigator.language||"en-US";return new Intl.NumberFormat(l,{style:"currency",currency:o,minimumFractionDigits:2,maximumFractionDigits:2,currencyDisplay:"narrowSymbol"}).formatToParts(a).map(c=>c.value).join("")}catch{try{return new Intl.NumberFormat("en-US",{style:"currency",currency:o,minimumFractionDigits:2,maximumFractionDigits:2}).format(a)}catch{return`$${a.toFixed(2)}`}}},x6=async a=>{try{const l=await(await fetch(Hl(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:0,jsonrpc:"2.0",method:"condenser_api.get_savings_withdraw_from",params:[a]})})).json();return l.error?[]:(l.result||[]).map(u=>({request_id:u.request_id,from:u.from,to:u.to,amount:u.amount,memo:u.memo||"",complete:u.complete}))}catch(o){return console.error("fetchPendingSavingsWithdrawals failed:",o),[]}},X7="848647637693366652",W7="129639434";let Ng=0,b6=0;const J7=300*1e3;async function v6(a=!1){const o=Date.now();if(!a&&Ng>0&&o-b6<J7)return Ng;try{const l=await r_.database.getDynamicGlobalProperties(),u=parseFloat(String(l.total_vesting_shares).split(" ")[0]),c=parseFloat(String(l.total_vesting_fund_hive).split(" ")[0]);u>0&&c>0&&(Ng=c/u,b6=o)}catch{}return Ng}function wh(a){if(!a||!a.includes("VESTS"))return a;const o=parseFloat(a.split(" ")[0]);return!Number.isFinite(o)||Ng<=0?a:`${(o*Ng).toFixed(3)} HP`}function Q7(a,o){const[l,u]=a,[c,f]=u.op,h={id:l,timestamp:u.timestamp,trx_id:u.trx_id};switch(c){case"transfer":return{...h,type:f.from===o?"sent":"received",amount:String(f.amount),from:f.from,to:f.to,memo:f.memo||""};case"transfer_to_vesting":return{...h,type:f.from===o?"sent":"received",amount:String(f.amount),from:f.from,to:f.to,memo:f.from===f.to?"Power up":`Power up → @${f.to}`};case"transfer_to_savings":return{...h,type:f.from===o?"sent":"received",amount:String(f.amount),from:f.from,to:f.to,memo:f.memo?`Savings deposit · ${f.memo}`:"Savings deposit"};case"transfer_from_savings":return{...h,type:f.from===o?"sent":"received",amount:String(f.amount),from:f.from,to:f.to,memo:f.memo?`Savings withdraw · ${f.memo}`:"Savings withdraw"};case"fill_transfer_from_savings":return{...h,type:"received",amount:String(f.amount),from:f.from,to:f.to,memo:"Savings withdraw fill"};case"cancel_transfer_from_savings":return{...h,type:"received",amount:"—",from:f.from,to:f.from,memo:`Cancelled savings withdrawal #${f.request_id}`};case"fill_vesting_withdraw":return{...h,type:f.to_account===o?"received":"sent",amount:String(f.deposited),from:f.from_account,to:f.to_account,memo:"Power down"};case"claim_reward_balance":{const g=[];return f.reward_hive&&parseFloat(f.reward_hive)>0&&g.push(String(f.reward_hive)),f.reward_hbd&&parseFloat(f.reward_hbd)>0&&g.push(String(f.reward_hbd)),f.reward_vests&&parseFloat(f.reward_vests)>0&&g.push(wh(String(f.reward_vests))),{...h,type:"received",amount:g.join(", ")||"—",from:f.account,to:f.account,memo:"Claimed rewards"}}case"delegate_vesting_shares":return{...h,type:f.delegator===o?"sent":"received",amount:wh(String(f.vesting_shares)),from:f.delegator,to:f.delegatee,memo:`Delegate HP → @${f.delegatee}`};case"return_vesting_delegation":return{...h,type:"received",amount:wh(String(f.vesting_shares)),from:"delegation",to:f.account,memo:"Delegation returned"};case"withdraw_vesting":{const g=parseFloat(String(f.vesting_shares).split(" ")[0]),b=!Number.isFinite(g)||g===0;return{...h,type:"sent",amount:b?"0.000 HP":wh(String(f.vesting_shares)),from:f.account,to:f.account,memo:b?"Stopped power down":"Started power down"}}case"author_reward":{const g=[];return f.hive_payout&&parseFloat(f.hive_payout)>0&&g.push(String(f.hive_payout)),f.hbd_payout&&parseFloat(f.hbd_payout)>0&&g.push(String(f.hbd_payout)),f.vesting_payout&&parseFloat(f.vesting_payout)>0&&g.push(wh(String(f.vesting_payout))),{...h,type:"received",amount:g.join(", ")||"—",from:"author_reward",to:f.author,memo:`Author reward · ${f.permlink}`}}case"curation_reward":return{...h,type:"received",amount:wh(String(f.reward)),from:"curation",to:f.curator,memo:`Curation · @${f.comment_author}/${f.permlink}`};case"comment_benefactor_reward":{const g=[];return f.hive_payout&&parseFloat(f.hive_payout)>0&&g.push(String(f.hive_payout)),f.hbd_payout&&parseFloat(f.hbd_payout)>0&&g.push(String(f.hbd_payout)),f.vesting_payout&&parseFloat(f.vesting_payout)>0&&g.push(wh(String(f.vesting_payout))),{...h,type:"received",amount:g.join(", ")||"—",from:f.author,to:f.benefactor,memo:"Benefactor reward"}}case"producer_reward":return{...h,type:"received",amount:wh(String(f.vesting_shares)),from:"producer",to:f.producer,memo:"Producer reward"};case"fill_order":return{...h,type:"received",amount:`${f.current_pays} → ${f.open_pays}`,from:f.current_owner,to:f.open_owner,memo:"Market fill"};case"recurrent_transfer":return{...h,type:f.from===o?"sent":"received",amount:String(f.amount),from:f.from,to:f.to,memo:f.memo?`Recurrent · ${f.memo}`:"Recurrent transfer"};case"fill_recurrent_transfer":return{...h,type:f.from===o?"sent":"received",amount:String(f.amount),from:f.from,to:f.to,memo:"Recurrent fill"};default:return null}}const y6=async(a,o=100,l=-1)=>{const c=await(await fetch(Hl(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:0,jsonrpc:"2.0",method:"condenser_api.get_account_history",params:[a,l,o,X7,W7]})})).json();if(c.error)throw new Error(c.error.message||"Failed to fetch transactions");const f=c.result||[];let h=null;return f.length>0&&(h=f.reduce((b,w)=>w[0]<b?w[0]:b,f[0][0])),{transactions:f.map(b=>Q7(b,a)).filter(b=>b!==null).reverse(),rawCount:f.length,oldestIndex:h}},K7=DC(),EN=eT.create((a,o)=>({walletData:null,isLoading:!1,error:null,transactions:[],isLoadingTransactions:!1,transactionError:null,hasMoreTransactions:!0,isLoadingMoreTransactions:!1,selectedCurrency:"USD",localCurrency:K7,exchangeRates:{USD:1},setWalletData:l=>a({walletData:l}),clearWalletData:()=>a({walletData:null,error:null,transactions:[],transactionError:null}),setSelectedCurrency:l=>{const{walletData:u,exchangeRates:c}=o();if(!u){a({selectedCurrency:l});return}const f=c[l]||1,h=u.estimated_value_usd*f,g=fw(h,l);a({selectedCurrency:l,walletData:{...u,estimated_value:g}})},getFormattedEstimatedValue:()=>{const{walletData:l,selectedCurrency:u,exchangeRates:c}=o();if(!l)return"-";const f=c[u]||1,h=l.estimated_value_usd*f;return fw(h,u)},fetchWalletData:async l=>{a({isLoading:!0,error:null});try{const u=await q7(l),c=ve=>"error"in ve;if(!u||c(u))throw new Error(c(u)?u.error:"Account not found");const f=typeof u.vesting_shares=="string"?u.vesting_shares:"0.000000 VESTS",h=typeof u.balance=="string"?u.balance:u.balance.toString(),g=typeof u.hbd_balance=="string"?u.hbd_balance:u.hbd_balance.toString(),b=typeof u.savings_balance=="string"?u.savings_balance:u.savings_balance.toString(),w=typeof u.savings_hbd_balance=="string"?u.savings_hbd_balance:u.savings_hbd_balance.toString(),x=await Yj(f),_=typeof u.reward_hive_balance=="string"?u.reward_hive_balance:"0.000 HIVE",v=typeof u.reward_hbd_balance=="string"?u.reward_hbd_balance:"0.000 HBD",N=typeof u.reward_vesting_balance=="string"?u.reward_vesting_balance:"0.000000 VESTS";let C=typeof u.reward_vesting_hive=="string"?u.reward_vesting_hive:void 0;!C&&parseFloat(N.split(" ")[0]||"0")>0&&(C=`${await Yj(N)} HIVE`);const R=typeof u.vesting_withdraw_rate=="string"?u.vesting_withdraw_rate:"0.000000 VESTS",E=parseFloat(R.split(" ")[0]||"0")>0,$=E?await Yj(R):void 0,V=E&&u.next_vesting_withdrawal?String(u.next_vesting_withdrawal):void 0,U=parseFloat(h.split(" ")[0]||"0"),z=parseFloat(x),A=parseFloat(g.split(" ")[0]||"0"),H=parseFloat(w.split(" ")[0]||"0"),I=A+H,q=await Z7(I),Z=(U+z+q).toFixed(3),J=await G7(Z),ee=parseFloat(J),se=await Y7(),{selectedCurrency:fe}=o(),he=se[fe]||1,X=ee*he,W=fw(X,fe),ne=await x6(l),be={balance:h,hbd_balance:g,savings_balance:b,savings_hbd_balance:w,hive_power:`${x} HP`,estimated_value:W,estimated_value_usd:ee,power_down_active:E,power_down_hp_per_week:$,next_vesting_withdrawal:V,pending_savings_withdrawals:ne,reward_hive_balance:_,reward_hbd_balance:v,reward_vesting_balance:N,reward_vesting_hive:C};return a({walletData:be,exchangeRates:se}),be}catch(u){const c=u instanceof Error?u.message:"Failed to fetch wallet data";console.error("Wallet fetch error:",c);const f={balance:"0.000 HIVE",hbd_balance:"0.000 HBD",savings_balance:"0.000 HIVE",savings_hbd_balance:"0.000 HBD",hive_power:"0 HP",estimated_value:fw(0,"USD"),estimated_value_usd:0,error:c};return a({walletData:f,error:c}),f}finally{a({isLoading:!1})}},fetchSavingsWithdrawals:async l=>{const u=await x6(l),{walletData:c}=o();return c&&a({walletData:{...c,pending_savings_withdrawals:u}}),u},fetchTransactions:async(l,u=100)=>{a({isLoadingTransactions:!0,transactionError:null});try{await v6();const{transactions:c,oldestIndex:f}=await y6(l,u,-1);return a({transactions:c,hasMoreTransactions:f!==null&&f>0}),c}catch(c){const f=c instanceof Error?c.message:"Failed to fetch transactions";return console.error("Transaction fetch error:",f),a({transactionError:f,hasMoreTransactions:!1}),[]}finally{a({isLoadingTransactions:!1})}},fetchMoreTransactions:async(l,u=100)=>{const{transactions:c,isLoadingMoreTransactions:f,hasMoreTransactions:h}=o();if(f||!h)return[];a({isLoadingMoreTransactions:!0});try{await v6();const g=c.reduce((N,C)=>C.id<N?C.id:N,c[0]?.id??-1);if(g<=0)return a({hasMoreTransactions:!1}),[];const b=g-1,{transactions:w,oldestIndex:x}=await y6(l,u,b),_=new Set(c.map(N=>`${N.trx_id}:${N.id}`)),v=w.filter(N=>!_.has(`${N.trx_id}:${N.id}`));return a({transactions:[...c,...v],hasMoreTransactions:x!==null&&x>0}),v}catch(g){const b=g instanceof Error?g.message:"Failed to fetch more transactions";return console.error("Transaction paginate error:",b),[]}finally{a({isLoadingMoreTransactions:!1})}}})),MC="https://api.hive.blog/balance-api",ez=a=>{const o=Number(a);return Number.isFinite(o)?`${(o/1e9).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}b RC`:a},tz=a=>`${a.toLocaleString("en-US",{minimumFractionDigits:3,maximumFractionDigits:3})} HP`,rz=async a=>{const o=await fetch(`${MC}/accounts/${a}/delegations`);if(!o.ok)throw new Error(`HP delegations: ${o.status}`);return o.json()},az=async a=>{const o=await fetch(`${MC}/accounts/${a}/rc-delegations`);if(!o.ok)throw new Error(`RC delegations: ${o.status}`);return o.json()},nz=async()=>{try{const o=await Zc().database.getDynamicGlobalProperties(),l=parseFloat(String(o.total_vesting_shares).split(" ")[0]),u=parseFloat(String(o.total_vesting_fund_hive).split(" ")[0]);return l?u/l/1e6:0}catch(a){return console.error("Delegations: failed to load global props:",a),0}},ay=({name:a,size:o=24})=>{const l=a.trim().toLowerCase(),u=/^[a-z][a-z0-9-.]{2,15}$/.test(l),[c,f]=T.useState(!1);return T.useEffect(()=>{f(!1)},[l]),!u||c?e.jsx("div",{style:{width:o,height:o},className:"rounded-full flex-shrink-0 border border-gray-700 bg-gray-700 flex items-center justify-center text-gray-400",title:l?`@${l}`:"No account",children:e.jsx(F7,{size:Math.max(8,o*.45)})}):e.jsx("img",{src:`https://images.hive.blog/u/${l}/avatar`,alt:l,style:{width:o,height:o},className:"rounded-full flex-shrink-0 border border-gray-700 bg-gray-800 object-cover",onError:()=>f(!0)})},hw=({direction:a,total:o,count:l,search:u,onSearch:c,onCreate:f,createLabel:h})=>e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 mb-2 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs sm:text-sm font-semibold text-gray-200 min-w-0",children:[e.jsx("span",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${a==="outgoing"?"bg-orange-400":"bg-emerald-400"}`}),e.jsxs("span",{className:"truncate",children:[a==="outgoing"?"Delegated:":"Received:"," ",o,l>0&&e.jsxs("span",{className:"text-gray-400 font-normal",children:[" (",l,")"]})]})]}),a==="outgoing"&&e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsxs("div",{className:"relative flex-1 sm:flex-none min-w-0",children:[e.jsx(U7,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500 text-xs"}),e.jsx("input",{type:"text",value:u,onChange:g=>c(g.target.value),placeholder:"Search",className:"pl-8 pr-2 py-1 text-xs bg-gray-900 border border-gray-700 rounded text-gray-200 focus:outline-none focus:border-blue-500 w-full sm:w-40"})]}),f&&e.jsxs("button",{onClick:f,className:"flex items-center gap-1.5 px-2 sm:px-2.5 py-1 text-[11px] font-semibold tracking-wide rounded bg-teal-600 hover:bg-teal-500 text-white transition-colors flex-shrink-0",title:h,children:[e.jsx(B7,{size:10}),e.jsx("span",{className:"hidden sm:inline",children:h})]})]})]}),sz=({kind:a,delegator:o,onClose:l,onSubmit:u})=>{const[c,f]=T.useState(""),[h,g]=T.useState(""),[b,w]=T.useState(!1),[x,_]=T.useState(null),v=async()=>{_(null);const O=c.trim().replace(/^@/,"").toLowerCase();if(!O){_("Enter a delegatee account.");return}const E=parseFloat(h);if(!Number.isFinite(E)||E<=0){_("Enter a valid amount.");return}w(!0);try{const $=a==="rc"?Math.round(E*1e9).toString():E.toString();await u(O,$)}catch($){_($ instanceof Error?$.message:"Failed to delegate")}finally{w(!1)}},N=a==="hp"?"Delegate HP":"Delegate RC",C=a==="hp"?"Delegate Hive Power to another account. Updating an existing delegation replaces the previous amount; reducing it locks the difference for 5 days.":"Delegate Resource Credits (RC) to another account. Updating an existing delegation replaces the previous amount.",R=a==="hp"?"HP":"B (BILLION) RC";return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 px-4",children:e.jsxs("div",{className:"w-full max-w-md rounded-xl border border-gray-700 bg-gray-900 p-5 shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-base font-bold text-white",children:N}),e.jsx("button",{onClick:l,className:"text-gray-400 hover:text-white",children:e.jsx(TC,{size:14})})]}),e.jsx("p",{className:"text-xs text-gray-400 mb-4 leading-relaxed border border-gray-700 rounded-md p-2.5 bg-gray-800/40",children:C}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] font-semibold text-gray-400 uppercase tracking-wide",children:"Delegator"}),e.jsxs("div",{className:"mt-1 flex items-center gap-2 px-3 py-2 rounded-md bg-gray-800 border border-gray-700",children:[e.jsx(ay,{name:o,size:22}),e.jsx("span",{className:"text-sm text-gray-200 truncate",children:o})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] font-semibold text-gray-400 uppercase tracking-wide",children:"Delegatee"}),e.jsxs("div",{className:"mt-1 flex items-center gap-2 px-2 py-1.5 rounded-md bg-gray-800 border border-gray-700 focus-within:border-teal-500",children:[e.jsx(ay,{name:c.replace(/^@/,""),size:22}),e.jsx("input",{type:"text",value:c,onChange:O=>f(O.target.value.toLowerCase()),placeholder:"username",className:"flex-1 min-w-0 bg-transparent text-sm text-gray-100 focus:outline-none placeholder-gray-500",autoFocus:!0,spellCheck:!1,autoComplete:"off",autoCapitalize:"none"})]})]})]}),e.jsxs("label",{className:"text-[11px] font-semibold text-gray-400 uppercase tracking-wide",children:["Amount (",R,")"]}),e.jsx("input",{type:"number",min:"0",step:a==="hp"?"0.001":"0.01",value:h,onChange:O=>g(O.target.value),placeholder:a==="hp"?"1000":"50",className:"mt-1 w-full px-3 py-2 rounded-md bg-gray-800 border border-gray-700 text-sm text-gray-100 focus:outline-none focus:border-teal-500"}),x&&e.jsx("div",{className:"mt-3 text-xs text-red-400",children:x}),e.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[e.jsx("button",{onClick:l,disabled:b,className:"px-4 py-2 text-sm rounded-md border border-gray-700 text-gray-200 hover:bg-gray-800 disabled:opacity-50",children:"Cancel"}),e.jsx("button",{onClick:v,disabled:b,className:"px-4 py-2 text-sm font-semibold rounded-md bg-teal-600 hover:bg-teal-500 text-white disabled:opacity-50",children:b?"Submitting…":"Confirm"})]})]})})},iz=({delegatee:a,initialBillions:o,onCancel:l,onSubmit:u})=>{const[c,f]=T.useState(o.toString()),[h,g]=T.useState(!1),b=async()=>{const w=parseFloat(c);if(!(!Number.isFinite(w)||w<0)){g(!0);try{const x=Math.round(w*1e9).toString();await u(x)}finally{g(!1)}}};return e.jsxs("div",{className:"px-2 sm:px-3 py-2 bg-gray-900 border border-blue-500/40 rounded-md min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5 min-w-0",children:[e.jsx(ay,{name:a,size:20}),e.jsxs("span",{className:"text-[11px] text-gray-300 truncate",children:["@",a]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 min-w-0",children:[e.jsx("input",{type:"number",min:"0",step:"0.01",value:c,onChange:w=>f(w.target.value),className:"flex-1 min-w-0 px-2 py-1 text-sm bg-gray-800 border border-gray-700 rounded text-gray-100 focus:outline-none focus:border-blue-500",autoFocus:!0}),e.jsx("span",{className:"text-[11px] text-gray-400 whitespace-nowrap",children:"b RC"}),e.jsx("button",{onClick:b,disabled:h,className:"p-1.5 rounded bg-blue-600/80 hover:bg-blue-500 text-white disabled:opacity-50 flex-shrink-0",title:"Confirm",children:e.jsx(M7,{size:11})}),e.jsx("button",{onClick:l,disabled:h,className:"p-1.5 rounded bg-gray-700 hover:bg-gray-600 text-gray-200 disabled:opacity-50 flex-shrink-0",title:"Cancel",children:e.jsx(TC,{size:11})})]})]})},OC=({username:a,currentUsername:o,className:l="",onUpdateRcDelegation:u,onDeleteRcDelegation:c,onCreateHpDelegation:f,onCreateRcDelegation:h})=>{const[g,b]=T.useState("hp"),[w,x]=T.useState({hp:{outgoing:[],incoming:[]},rc:{outgoing:[],incoming:[]}}),[_,v]=T.useState(!1),[N,C]=T.useState(null),[R,O]=T.useState(""),[E,$]=T.useState(null),[V,U]=T.useState(null),[z,A]=T.useState(null),H=o===a,I=H&&(!!u||!!c),q=H&&!!f,Z=H&&!!h,J=T.useCallback(async()=>{if(a){v(!0),C(null);try{const[pe,ie,ye]=await Promise.all([rz(a),az(a),nz()]),Ne=Ge=>{const me=parseFloat(Ge);return!Number.isFinite(me)||!ye?0:me*ye};x({hp:{outgoing:pe.outgoing_delegations.map(Ge=>({account:Ge.delegatee,vests:Ge.amount,hp:Ne(Ge.amount),operation_id:Ge.operation_id,block_num:Ge.block_num})),incoming:pe.incoming_delegations.map(Ge=>({account:Ge.delegator,vests:Ge.amount,hp:Ne(Ge.amount),operation_id:Ge.operation_id,block_num:Ge.block_num}))},rc:{outgoing:ie.outgoing_delegations.map(Ge=>({account:Ge.delegatee,max_rc:Ge.max_rc,operation_id:Ge.operation_id,block_num:Ge.block_num})),incoming:ie.incoming_delegations.map(Ge=>({account:Ge.delegator,max_rc:Ge.max_rc,operation_id:Ge.operation_id,block_num:Ge.block_num}))}})}catch(pe){const ie=pe instanceof Error?pe.message:"Failed to load delegations";console.error("Delegations load error:",ie),C(ie)}finally{v(!1)}}},[a]);T.useEffect(()=>{J()},[J]),T.useEffect(()=>{O(""),$(null),U(null)},[a,g]);const ee=T.useMemo(()=>w.hp.outgoing.reduce((pe,ie)=>pe+ie.hp,0),[w.hp.outgoing]),se=T.useMemo(()=>w.hp.incoming.reduce((pe,ie)=>pe+ie.hp,0),[w.hp.incoming]),fe=T.useMemo(()=>w.rc.outgoing.reduce((pe,ie)=>pe+Number(ie.max_rc),0)/1e9,[w.rc.outgoing]),he=T.useMemo(()=>w.rc.incoming.reduce((pe,ie)=>pe+Number(ie.max_rc),0)/1e9,[w.rc.incoming]),X=T.useCallback(pe=>{const ie=R.trim().toLowerCase();return ie?pe.filter(ye=>ye.account.toLowerCase().includes(ie)):pe},[R]),W=async(pe,ie)=>{if(u){U(pe);try{if(await u(pe,ie)===!1)return;$(null),x(Ne=>({...Ne,rc:{...Ne.rc,outgoing:Ne.rc.outgoing.map(Ge=>Ge.account===pe?{...Ge,max_rc:ie}:Ge)}})),setTimeout(()=>{J()},4e3)}finally{U(null)}}},ne=async pe=>{if(c){U(pe);try{if(await c(pe)===!1)return;x(ye=>({...ye,rc:{...ye.rc,outgoing:ye.rc.outgoing.filter(Ne=>Ne.account!==pe)}})),setTimeout(()=>{J()},4e3)}finally{U(null)}}},be=async(pe,ie)=>{const ye=z==="hp"?f:h;!ye||await ye(pe,ie)===!1||(A(null),setTimeout(()=>{J()},4e3))},ve=(pe,ie)=>e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 py-2 border-b border-gray-800 last:border-b-0 min-w-0",children:[e.jsx(ay,{name:pe.account}),e.jsxs("span",{className:"text-sm text-gray-200 flex-1 truncate min-w-0",title:`@${pe.account}`,children:["@",pe.account]}),e.jsx("span",{className:"text-sm text-gray-300 font-medium whitespace-nowrap",children:tz(pe.hp)}),e.jsx("div",{className:"hidden md:flex w-20 h-2 rounded-full bg-gray-800 overflow-hidden",children:e.jsx("div",{className:"h-full bg-emerald-500",style:{width:`${Math.max(2,Math.min(100,ie))}%`}})})]},`${pe.account}-${pe.operation_id??""}`),Le=(pe,ie,ye)=>E===pe.account?e.jsx("div",{className:"py-2 border-b border-gray-800 last:border-b-0",children:e.jsx(iz,{delegatee:pe.account,initialBillions:Number(pe.max_rc)/1e9,onCancel:()=>$(null),onSubmit:Ne=>W(pe.account,Ne)})},pe.account):e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 py-2 border-b border-gray-800 last:border-b-0 min-w-0",children:[e.jsx(ay,{name:pe.account}),e.jsxs("span",{className:"text-sm text-gray-200 flex-1 truncate min-w-0",title:`@${pe.account}`,children:["@",pe.account]}),e.jsx("span",{className:"text-sm text-gray-300 font-medium whitespace-nowrap",children:ez(pe.max_rc)}),e.jsx("div",{className:"hidden md:flex w-20 h-2 rounded-full bg-gray-800 overflow-hidden",children:e.jsx("div",{className:"h-full bg-emerald-500",style:{width:`${Math.max(2,Math.min(100,ie))}%`}})}),ye&&e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[u&&e.jsx("button",{onClick:()=>$(pe.account),disabled:V===pe.account,className:"p-1.5 rounded border border-gray-700 text-gray-300 hover:bg-gray-800 hover:text-white disabled:opacity-50",title:"Update delegation",children:e.jsx(P7,{size:10})}),c&&e.jsx("button",{onClick:()=>ne(pe.account),disabled:V===pe.account,className:"p-1.5 rounded border border-red-500/40 text-red-400 hover:bg-red-500/10 disabled:opacity-50",title:"Remove delegation",children:e.jsx(V7,{size:10})})]})]},`${pe.account}-${pe.operation_id??""}`),Ce=pe=>`flex-1 py-2 sm:py-2.5 px-2 text-[11px] sm:text-xs font-semibold tracking-wide rounded transition-colors whitespace-nowrap ${pe?"bg-teal-600 text-white":"bg-gray-800 text-gray-300 hover:bg-gray-700"}`;return e.jsxs("div",{className:`rounded-xl bg-gray-800 border border-gray-700 ${l}`,children:[e.jsxs("div",{className:"px-3 sm:px-4 pt-3 pb-2 border-b border-gray-700",children:[e.jsx("div",{className:"text-sm font-bold text-white",children:"Delegated HIVE"}),e.jsx("div",{className:"text-xs text-gray-400",children:"Staked tokens delegated between users."})]}),e.jsxs("div",{className:"flex gap-2 p-2 sm:p-3 border-b border-gray-700",children:[e.jsxs("button",{onClick:()=>b("hp"),className:Ce(g==="hp"),children:[e.jsx("span",{className:"sm:hidden",children:"HP"}),e.jsx("span",{className:"hidden sm:inline",children:"HP DELEGATIONS"})]}),e.jsxs("button",{onClick:()=>b("rc"),className:Ce(g==="rc"),children:[e.jsx("span",{className:"sm:hidden",children:"RC"}),e.jsx("span",{className:"hidden sm:inline",children:"RC DELEGATIONS"})]})]}),e.jsxs("div",{className:"p-2 sm:p-4",children:[N&&e.jsx("div",{className:"text-xs text-red-400 mb-2",children:N}),_?e.jsx("div",{className:"space-y-2 animate-pulse",children:[1,2,3].map(pe=>e.jsx("div",{className:"h-9 bg-gray-900 rounded"},pe))}):g==="hp"?e.jsxs(e.Fragment,{children:[e.jsx(hw,{direction:"outgoing",total:`${ee.toLocaleString("en-US",{maximumFractionDigits:3})} HP`,count:w.hp.outgoing.length,search:R,onSearch:O,onCreate:q?()=>A("hp"):void 0,createLabel:"Delegate HP"}),w.hp.outgoing.length===0?e.jsx("p",{className:"text-xs text-gray-500 text-center py-4",children:"No outgoing delegations"}):e.jsx("div",{className:"mb-4",children:X(w.hp.outgoing).map(pe=>ve(pe,ee>0?pe.hp/ee*100:0))}),e.jsx(hw,{direction:"incoming",total:`${se.toLocaleString("en-US",{maximumFractionDigits:3})} HP`,count:w.hp.incoming.length,search:"",onSearch:()=>{}}),w.hp.incoming.length===0?e.jsx("p",{className:"text-xs text-gray-500 text-center py-4",children:"No incoming delegations"}):e.jsx("div",{children:w.hp.incoming.map(pe=>ve(pe,se>0?pe.hp/se*100:0))})]}):e.jsxs(e.Fragment,{children:[e.jsx(hw,{direction:"outgoing",total:`${fe.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}b RC`,count:w.rc.outgoing.length,search:R,onSearch:O,onCreate:Z?()=>A("rc"):void 0,createLabel:"Delegate RC"}),w.rc.outgoing.length===0?e.jsx("p",{className:"text-xs text-gray-500 text-center py-4",children:"No outgoing RC delegations"}):e.jsx("div",{className:"mb-4",children:X(w.rc.outgoing).map(pe=>{const ie=Number(pe.max_rc)/1e9,ye=fe>0?ie/fe*100:0;return Le(pe,ye,I)})}),e.jsx(hw,{direction:"incoming",total:`${he.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}b RC`,count:w.rc.incoming.length,search:"",onSearch:()=>{}}),w.rc.incoming.length===0?e.jsx("p",{className:"text-xs text-gray-500 text-center py-4",children:"No incoming RC delegations"}):e.jsx("div",{children:w.rc.incoming.map(pe=>{const ie=Number(pe.max_rc)/1e9,ye=he>0?ie/he*100:0;return Le(pe,ye,!1)})})]})]}),z&&e.jsx(sz,{kind:z,delegator:a,onClose:()=>A(null),onSubmit:be})]})},gy="fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-3 sm:p-4",xy="w-full max-w-md sm:max-w-lg rounded-xl bg-[#181d23] border border-[var(--hrk-border-subtle)] shadow-2xl overflow-hidden",by="flex items-center justify-between px-4 sm:px-5 py-3.5 border-b border-[var(--hrk-border-subtle)]",vy="text-base sm:text-lg font-semibold text-white",yy="p-4 sm:p-5 space-y-4",a_="rounded-md border border-[var(--hrk-border-subtle)] bg-[#1e242c] px-3 py-2.5 text-xs text-[var(--hrk-text-tertiary)]",Qd="w-full bg-transparent border-b border-[var(--hrk-border-default)] px-1 py-1.5 text-sm text-white placeholder-[var(--hrk-text-tertiary)] focus:outline-none focus:border-[var(--hrk-info)] transition-colors",Vl="text-xs text-[var(--hrk-text-tertiary)] mb-1",wy="flex justify-end gap-2 px-4 sm:px-5 py-3 border-t border-[var(--hrk-border-subtle)] bg-[#15191e]",_y="px-4 py-2 rounded-md text-xs font-semibold tracking-wide bg-[var(--hrk-bg-surface-raised)] text-[var(--hrk-text-primary)] hover:bg-[var(--hrk-bg-hover)] transition-colors",ky="px-4 py-2 rounded-md text-xs font-semibold tracking-wide bg-blue-600 text-white hover:bg-blue-500 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",ny=({username:a})=>e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("img",{src:`https://images.hive.blog/u/${a}/avatar`,alt:a,className:"w-7 h-7 rounded-full border border-[var(--hrk-border-subtle)] flex-shrink-0",onError:o=>{o.target.src=`https://ui-avatars.com/api/?name=${a}&background=random&size=28`}}),e.jsx("span",{className:"text-sm text-[var(--hrk-text-primary)] truncate",children:a})]});function n_(a){if(a===void 0)return 1/0;if(!a)return 0;const o=parseFloat(a.split(" ")[0]);return Number.isFinite(o)?o:0}function s_(a,o,l=3){if(a===""||a===".")return a;let u=a.replace(",",".");u=u.replace(/[^0-9.]/g,"");const c=u.split(".");if(c.length>2&&(u=c[0]+"."+c.slice(1).join("")),u.includes(".")){const[h,g]=u.split(".");u=h+"."+g.slice(0,l)}const f=parseFloat(u);return Number.isFinite(f)&&f>o?o.toFixed(l):u}const oz=({from:a,toDefault:o="",hiveBalance:l,hbdBalance:u,initialCurrency:c="HIVE",hidePicker:f=!1,onClose:h,onSubmit:g})=>{const[b,w]=T.useState(o),[x,_]=T.useState(""),[v,N]=T.useState(""),[C,R]=T.useState(c),[O,E]=T.useState(!1),[$,V]=T.useState(!1),U=T.useMemo(()=>n_(C==="HIVE"?l:u),[C,l,u]),z=()=>{U!==1/0&&_(U.toFixed(3))},A=!!b.trim()&&parseFloat(x)>0&&parseFloat(x)<=U&&!$,H=async()=>{if(A){V(!0);try{await g(b.trim(),x,C,v)!==!1&&h()}finally{V(!1)}}};return e.jsx("div",{className:gy,onClick:h,children:e.jsxs("div",{className:xy,onClick:I=>I.stopPropagation(),children:[e.jsxs("div",{className:by,children:[e.jsxs("h3",{className:vy,children:["Transfer ",C]}),e.jsx("button",{onClick:h,className:"text-[var(--hrk-text-tertiary)] hover:text-[var(--hrk-text-primary)] text-lg",children:"×"})]}),e.jsxs("div",{className:yy,children:[e.jsx("div",{className:a_,children:"Transfer funds to another Hive account."}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"From:"}),e.jsx(ny,{username:a})]}),e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"To:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[b.trim()&&e.jsx("img",{src:`https://images.hive.blog/u/${b.trim()}/avatar`,alt:b,className:"w-7 h-7 rounded-full border border-[var(--hrk-border-subtle)] flex-shrink-0",onError:I=>{I.target.src=`https://ui-avatars.com/api/?name=${b.trim()}&background=random&size=28`}}),e.jsx("input",{type:"text",value:b,onChange:I=>w(I.target.value.replace(/^@/,"").trim()),placeholder:"username",className:`${Qd} flex-1`})]})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center justify-between mb-1",children:e.jsxs("span",{className:Vl,children:["Amount (Balance:"," ",e.jsxs("button",{type:"button",onClick:z,className:`text-blue-400 ${U===1/0?"cursor-default opacity-50":"hover:text-blue-300 hover:underline cursor-pointer"}`,title:U===1/0?"Balance unknown":"Click to use full balance",disabled:U===1/0,children:[U===1/0?"?":U.toFixed(3)," ",C]}),")"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",inputMode:"decimal",value:x,onChange:I=>_(s_(I.target.value,U,3)),placeholder:"0",className:`${Qd} flex-1`}),f?e.jsx("span",{className:"px-3 py-1.5 rounded-md bg-[var(--hrk-bg-surface-raised)] text-xs text-[var(--hrk-text-primary)] font-semibold",children:C}):e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>E(I=>!I),className:"px-3 py-1.5 rounded-md bg-[var(--hrk-bg-surface-raised)] hover:bg-[var(--hrk-bg-hover)] text-xs text-[var(--hrk-text-primary)] font-semibold flex items-center gap-1",children:[C," ",e.jsx("span",{className:"text-[10px]",children:"▾"})]}),O&&e.jsx("div",{className:"absolute right-0 mt-1 rounded-md bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-subtle)] shadow-lg z-10 min-w-[80px]",children:["HIVE","HBD"].map(I=>e.jsx("button",{type:"button",onClick:()=>{R(I),_(""),E(!1)},className:"block w-full text-left px-3 py-1.5 text-xs text-[var(--hrk-text-primary)] hover:bg-[var(--hrk-bg-surface-raised)]",children:I},I))})]})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"Memo:"}),e.jsx("input",{type:"text",value:v,onChange:I=>N(I.target.value),placeholder:"A message to include in the transfer",className:Qd})]})]}),e.jsxs("div",{className:wy,children:[e.jsx("button",{onClick:h,className:_y,children:"CANCEL"}),e.jsx("button",{onClick:H,disabled:!A,className:ky,children:$?"...":"CONTINUE"})]})]})})},lz=({from:a,toDefault:o,hiveBalance:l,onClose:u,onSubmit:c})=>{const f=n_(l),[h,g]=T.useState(o||a),[b,w]=T.useState("0"),[x,_]=T.useState(!1),v=parseFloat(b)>0&&parseFloat(b)<=f&&!!h.trim()&&!x,N=async()=>{if(v){_(!0);try{await c(h.trim(),b)!==!1&&u()}finally{_(!1)}}};return e.jsx("div",{className:gy,onClick:u,children:e.jsxs("div",{className:xy,onClick:C=>C.stopPropagation(),children:[e.jsxs("div",{className:by,children:[e.jsx("h3",{className:vy,children:"Stake HIVE (Power Up)"}),e.jsx("button",{onClick:u,className:"text-[var(--hrk-text-tertiary)] hover:text-[var(--hrk-text-primary)] text-lg",children:"×"})]}),e.jsxs("div",{className:yy,children:[e.jsxs("div",{className:a_,children:["Influence tokens which give you more control over post payouts and allow you to earn on curation rewards.",e.jsx("br",{}),e.jsx("br",{}),"Hive Power is non-transferable and requires 3 months (13 payments) to convert back to Hive."]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"From:"}),e.jsx(ny,{username:a})]}),e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"To (usually your own account):"}),e.jsxs("div",{className:"flex items-center gap-2",children:[h.trim()&&e.jsx("img",{src:`https://images.hive.blog/u/${h.trim()}/avatar`,alt:h,className:"w-7 h-7 rounded-full border border-[var(--hrk-border-subtle)] flex-shrink-0",onError:C=>{C.target.src=`https://ui-avatars.com/api/?name=${h.trim()}&background=random&size=28`}}),e.jsx("input",{type:"text",value:h,onChange:C=>g(C.target.value.replace(/^@/,"").trim()),placeholder:"username",className:`${Qd} flex-1`})]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:Vl,children:["Amount (Max"," ",e.jsxs("button",{type:"button",onClick:()=>{f!==1/0&&w(f.toFixed(3))},className:`text-blue-400 ${f===1/0?"cursor-default opacity-50":"hover:text-blue-300 hover:underline cursor-pointer"}`,title:f===1/0?"Balance unknown":"Click to use max balance",disabled:f===1/0,children:[f===1/0?"?":f.toFixed(3)," HIVE"]}),"):"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",inputMode:"decimal",value:b,onChange:C=>w(s_(C.target.value,f,3)),className:`${Qd} flex-1`}),e.jsx("span",{className:"px-3 py-1.5 rounded-md bg-[var(--hrk-bg-surface-raised)] text-xs text-[var(--hrk-text-primary)] font-semibold",children:"HIVE"})]}),f!==1/0&&e.jsx("input",{type:"range",min:0,max:Math.max(.001,f),step:.001,value:parseFloat(b)||0,onChange:C=>w(parseFloat(C.target.value).toFixed(3)),className:"w-full mt-3 accent-blue-500"})]})]}),e.jsxs("div",{className:wy,children:[e.jsx("button",{onClick:u,className:_y,children:"CANCEL"}),e.jsx("button",{onClick:N,disabled:!v,className:ky,children:x?"...":"CONTINUE"})]})]})})},uz=({from:a,hivePower:o,onClose:l,onSubmit:u})=>{const c=n_(o),[f,h]=T.useState("0"),[g,b]=T.useState(!1),w=T.useMemo(()=>{const v=parseFloat(f);return!Number.isFinite(v)||v<=0?"0.000":(v/13).toFixed(3)},[f]),x=parseFloat(f)>=0&&parseFloat(f)<=c&&!g,_=async()=>{if(x){b(!0);try{await u(f)!==!1&&l()}finally{b(!1)}}};return e.jsx("div",{className:gy,onClick:l,children:e.jsxs("div",{className:xy,onClick:v=>v.stopPropagation(),children:[e.jsxs("div",{className:by,children:[e.jsx("h3",{className:vy,children:"Unstake HIVE (Power Down)"}),e.jsx("button",{onClick:l,className:"text-[var(--hrk-text-tertiary)] hover:text-[var(--hrk-text-primary)] text-lg",children:"×"})]}),e.jsxs("div",{className:yy,children:[e.jsx("div",{className:a_,children:"Create a Hive Power unstake request. The request is fulfilled once a week over the next 13 weeks."}),e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"Account:"}),e.jsx(ny,{username:a})]}),e.jsxs("div",{children:[e.jsxs("div",{className:Vl,children:["Amount (Max"," ",e.jsxs("button",{type:"button",onClick:()=>{c!==1/0&&h(c.toFixed(3))},className:`text-blue-400 ${c===1/0?"cursor-default opacity-50":"hover:text-blue-300 hover:underline cursor-pointer"}`,title:c===1/0?"Balance unknown":"Click to use max balance",disabled:c===1/0,children:[c===1/0?"?":c.toFixed(3)," HP"]}),"):"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",inputMode:"decimal",value:f,onChange:v=>h(s_(v.target.value,c,3)),className:`${Qd} flex-1`}),e.jsx("span",{className:"px-3 py-1.5 rounded-md bg-[var(--hrk-bg-surface-raised)] text-xs text-[var(--hrk-text-primary)] font-semibold",children:"HP"})]}),c!==1/0&&e.jsx("input",{type:"range",min:0,max:Math.max(.001,c),step:.001,value:parseFloat(f)||0,onChange:v=>h(parseFloat(v.target.value).toFixed(3)),className:"w-full mt-3 accent-blue-500"}),e.jsxs("div",{className:"text-xs text-[var(--hrk-text-tertiary)] mt-2",children:["You will receive ",e.jsxs("span",{className:"text-[var(--hrk-text-primary)]",children:[w," HIVE"]})," per week"]})]})]}),e.jsxs("div",{className:wy,children:[e.jsx("button",{onClick:l,className:_y,children:"CANCEL"}),e.jsx("button",{onClick:_,disabled:!x,className:ky,children:g?"...":"CONTINUE"})]})]})})},w6=({mode:a,from:o,toDefault:l,currency:u,availableBalance:c,onClose:f,onSubmit:h})=>{const g=n_(c),[b,w]=T.useState(l||o),[x,_]=T.useState("0"),[v,N]=T.useState(""),[C,R]=T.useState(!1);T.useEffect(()=>{_("0")},[u]);const O=parseFloat(x)>0&&parseFloat(x)<=g&&!C,E=async()=>{if(O){R(!0);try{await h(a==="add"?b.trim():u,a==="add"?u:x,a==="add"?x:v,a==="add"?v:void 0)!==!1&&f()}finally{R(!1)}}},$=a==="add"?`Stake ${u} (Transfer to Savings)`:`Unstake ${u} (Withdraw Savings)`,V=a==="add"?"Stake/Move funds to savings. Funds will be subject to 3 days unstake/withdraw waiting period.":"Withdraw funds from savings. Funds are released after a 3-day waiting period.";return e.jsx("div",{className:gy,onClick:f,children:e.jsxs("div",{className:xy,onClick:U=>U.stopPropagation(),children:[e.jsxs("div",{className:by,children:[e.jsx("h3",{className:vy,children:$}),e.jsx("button",{onClick:f,className:"text-[var(--hrk-text-tertiary)] hover:text-[var(--hrk-text-primary)] text-lg",children:"×"})]}),e.jsxs("div",{className:yy,children:[e.jsx("div",{className:a_,children:V}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"From:"}),e.jsx(ny,{username:o})]}),e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"To:"}),a==="add"?e.jsxs("div",{className:"flex items-center gap-2",children:[b.trim()&&e.jsx("img",{src:`https://images.hive.blog/u/${b.trim()}/avatar`,alt:b,className:"w-7 h-7 rounded-full border border-[var(--hrk-border-subtle)] flex-shrink-0",onError:U=>{U.target.src=`https://ui-avatars.com/api/?name=${b.trim()}&background=random&size=28`}}),e.jsx("input",{type:"text",value:b,onChange:U=>w(U.target.value.replace(/^@/,"").trim()),placeholder:"username",className:`${Qd} flex-1`})]}):e.jsx(ny,{username:o})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:Vl,children:["Amount (Balance:"," ",e.jsxs("button",{type:"button",onClick:()=>{g!==1/0&&_(g.toFixed(3))},className:`text-blue-400 ${g===1/0?"cursor-default opacity-50":"hover:text-blue-300 hover:underline cursor-pointer"}`,title:g===1/0?"Balance unknown":"Click to use full balance",disabled:g===1/0,children:[g===1/0?"?":g.toFixed(3)," ",u]}),"):"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",inputMode:"decimal",value:x,onChange:U=>_(s_(U.target.value,g,3)),className:`${Qd} flex-1`}),e.jsx("span",{className:"px-3 py-1.5 rounded-md bg-[var(--hrk-bg-surface-raised)] text-xs text-[var(--hrk-text-primary)] font-semibold",children:u})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"Memo:"}),e.jsx("input",{type:"text",value:v,onChange:U=>N(U.target.value),placeholder:"A message to include in the transaction",className:Qd})]})]}),e.jsxs("div",{className:wy,children:[e.jsx("button",{onClick:f,className:_y,children:"CANCEL"}),e.jsx("button",{onClick:E,disabled:!O,className:ky,children:C?"...":"CONTINUE"})]})]})})},_6=({title:a,message:o,confirmLabel:l="CONFIRM",onClose:u,onConfirm:c})=>{const[f,h]=T.useState(!1),g=async()=>{h(!0);try{await c()!==!1&&u()}finally{h(!1)}};return e.jsx("div",{className:gy,onClick:u,children:e.jsxs("div",{className:xy,onClick:b=>b.stopPropagation(),children:[e.jsxs("div",{className:by,children:[e.jsx("h3",{className:vy,children:a}),e.jsx("button",{onClick:u,className:"text-[var(--hrk-text-tertiary)] hover:text-[var(--hrk-text-primary)] text-lg",children:"×"})]}),e.jsx("div",{className:yy,children:e.jsx("p",{className:"text-sm text-[var(--hrk-text-primary)]",children:o})}),e.jsxs("div",{className:wy,children:[e.jsx("button",{onClick:u,disabled:f,className:_y,children:"CANCEL"}),e.jsx("button",{onClick:g,disabled:f,className:ky,children:f?"...":l})]})]})})};function cz(a){const o=new Date,l=new Date(a+"Z"),u=o.getTime()-l.getTime(),c=Math.floor(u/1e3),f=Math.floor(c/60),h=Math.floor(f/60),g=Math.floor(h/24);return g>30?l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):g>0?`${g}d ago`:h>0?`${h}h ago`:f>0?`${f}m ago`:"just now"}function dz(a){if(!a||a.indexOf(":")===-1)return null;const o=a.split(/\r?\n/).map(u=>u.trim()).filter(Boolean),l={};for(const u of o){const c=u.indexOf(":");if(c===-1)continue;const f=u.slice(0,c).trim().toLowerCase(),h=u.slice(c+1).trim();!f||!h||["author","post","sender","app","message"].includes(f)&&(l[f]=h)}return!l.author||!l.sender&&!l.app?null:l}function RC(a){const o=a.memo||"";if(o==="Stopped power down"||o==="Started power down")return{title:o,kind:"power"};if(o.startsWith("Power up")||o.startsWith("Power down"))return{title:o,kind:"power",badge:a.type==="sent"?"out":"in"};if(o==="Claimed rewards")return{title:"Claimed rewards",kind:"reward"};if(o.startsWith("Author reward"))return{title:"Author reward",kind:"reward"};if(o==="Producer reward")return{title:"Producer reward",kind:"reward"};if(o==="Benefactor reward")return{title:"Benefactor reward",kind:"reward"};if(o.startsWith("Curation"))return{title:"Curation reward",kind:"reward"};if(o==="Market fill")return{title:"Market fill",kind:"market"};if(o.startsWith("Delegate HP")||o==="Delegation returned")return{title:o,kind:"delegation"};if(o==="Recurrent fill"||o.startsWith("Recurrent"))return{title:a.type==="sent"?`Recurrent sent to ${a.to}`:`Recurrent received from ${a.from}`,kind:"transfer",badge:a.type==="sent"?"out":"in"};if(o.startsWith("Savings deposit"))return{title:"Savings deposit",kind:"transfer",badge:"out"};if(o.startsWith("Savings withdraw"))return{title:"Savings withdraw",kind:"transfer",badge:"in"};const l=dz(o);if(l){const u=l.sender||a.from;return{title:a.type==="received"?`Tip received from ${u}`:`Tip sent to ${a.to}`,kind:"tip",tipData:l,badge:a.type==="sent"?"out":"in"}}return{title:a.type==="sent"?`Sent to ${a.to}`:`Received from ${a.from}`,kind:"transfer",badge:a.type==="sent"?"out":"in"}}const fz=({tx:a})=>{const o=a.type==="sent",l=o?a.to:a.from,u=RC(a),c=u.tipData;return e.jsxs("div",{className:"flex items-start gap-2.5 p-2.5 sm:p-3.5 rounded-lg bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-subtle)] mb-2 transition-all duration-200 hover:bg-[var(--hrk-bg-surface-raised)] hover:border-[var(--hrk-border-default)] min-w-0",children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx("img",{src:`https://images.hive.blog/u/${l}/avatar`,alt:l,className:"w-9 h-9 rounded-full border border-[var(--hrk-border-subtle)]",onError:f=>{f.target.src=`https://ui-avatars.com/api/?name=${l}&background=random&size=36`}}),e.jsx("span",{className:`absolute -bottom-1 -right-1 w-4 h-4 rounded-full border-2 border-[var(--hrk-border-subtle)] flex items-center justify-center ${o?"bg-red-500/90 text-white":"bg-emerald-500/90 text-white"}`,children:o?e.jsx(C7,{size:7}):e.jsx(A7,{size:7})})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2 min-w-0",children:[e.jsx("span",{className:"text-sm font-semibold text-[var(--hrk-text-primary)] truncate",children:u.title}),e.jsxs("span",{className:`text-xs sm:text-sm font-bold whitespace-nowrap ${o?"text-red-400":"text-emerald-400"}`,children:[o?"-":"+",a.amount]})]}),e.jsx("div",{className:"text-[11px] text-[var(--hrk-text-tertiary)] mt-0.5 truncate",children:cz(a.timestamp)}),c?e.jsx("pre",{className:"mt-2 max-w-full overflow-x-auto rounded-md border border-[var(--hrk-border-subtle)] bg-[var(--hrk-bg-app)] px-2.5 py-2 font-mono text-[11px] leading-relaxed text-[var(--hrk-text-tertiary)] whitespace-pre-wrap break-words",children:["author","post","sender","app","message"].map(f=>c[f]?e.jsxs("div",{children:[e.jsxs("span",{className:"text-[var(--hrk-text-tertiary)]",children:[f,":"]})," ",e.jsx("span",{className:"text-blue-400",children:c[f]})]},f):null)}):a.memo&&u.kind==="transfer"?e.jsx("p",{className:"mt-1 text-[11px] text-[var(--hrk-text-tertiary)] line-clamp-2",children:a.memo}):null]})]})},hz=()=>{const{selectedCurrency:a,localCurrency:o,setSelectedCurrency:l,exchangeRates:u}=EN(),[c,f]=T.useState(!1),h=T.useRef(null);T.useEffect(()=>{const x=_=>{h.current&&!h.current.contains(_.target)&&f(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[]);const g=["USD",o,"GTQ"],b=T.useMemo(()=>{const x=Bv.find(C=>C.code==="USD"),_=o!=="USD"?Bv.find(C=>C.code===o):null,v=o!=="GTQ"?Bv.find(C=>C.code==="GTQ"):null,N=Bv.filter(C=>!g.includes(C.code)&&u[C.code]);return[x,..._?[_]:[],...v?[v]:[],...N]},[o,u]),w=x=>{try{return new Intl.NumberFormat("en",{style:"currency",currency:x}).formatToParts(0).find(v=>v.type==="currency")?.value||x}catch{return x}};return e.jsxs("div",{ref:h,className:"relative inline-block",children:[e.jsxs("button",{onClick:()=>f(!c),className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-white/15 hover:bg-white/25 transition-colors text-white text-xs font-medium border border-white/20",children:[e.jsx("span",{children:w(a)}),e.jsx("span",{children:a}),e.jsx(AC,{size:8,className:`transition-transform ${c?"rotate-180":""}`})]}),c&&e.jsx("div",{className:"absolute top-full mt-1 right-0 w-56 max-h-64 overflow-y-auto rounded-lg bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-default)] shadow-xl z-50 scrollbar-hide",children:b.map((x,_)=>e.jsxs(T.Fragment,{children:[_===(o!=="USD"?3:2)&&e.jsx("div",{className:"border-t border-[var(--hrk-border-default)] my-1"}),e.jsxs("button",{onClick:()=>{l(x.code),f(!1)},className:`w-full flex items-center gap-2.5 px-3 py-2 text-left text-sm transition-colors hover:bg-[var(--hrk-bg-surface-raised)] ${a===x.code?"bg-blue-500/20 text-blue-300":"text-[var(--hrk-text-secondary)]"}`,children:[e.jsx("span",{className:"w-6 text-center font-medium text-[var(--hrk-text-tertiary)]",children:w(x.code)}),e.jsx("span",{className:"font-medium",children:x.code}),e.jsx("span",{className:"text-xs text-[var(--hrk-text-tertiary)] truncate",children:x.name})]})]},x.code))})]})},Xj=({icon:a,iconBg:o,iconText:l,label:u,value:c,valueText:f,actions:h})=>e.jsx("div",{className:"p-3 sm:p-3.5 rounded-lg bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-subtle)] mb-2.5 transition-all duration-200 hover:bg-[var(--hrk-bg-surface-raised)] hover:border-[var(--hrk-border-default)] min-w-0",children:e.jsxs("div",{className:"flex items-center justify-between gap-2 min-w-0 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[e.jsx("div",{className:`p-2 rounded-full flex items-center justify-center flex-shrink-0 ${o} ${l}`,children:a}),e.jsx("span",{className:"font-semibold text-xs sm:text-sm text-[var(--hrk-text-secondary)] truncate",children:u})]}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 ml-auto flex-wrap justify-end",children:[e.jsx("span",{className:`font-medium text-xs sm:text-sm whitespace-nowrap ${f}`,children:c}),h&&h.length>0&&e.jsx("div",{className:"flex gap-2 flex-wrap justify-end",children:h.map(g=>e.jsx("button",{onClick:g.onClick,className:`px-3 py-1.5 rounded-[10px] text-[11px] sm:text-xs font-semibold tracking-wide transition-colors ${g.variant==="secondary"?"bg-[var(--hrk-bg-surface-sunken)] border border-[var(--hrk-border-subtle)] text-[var(--hrk-text-primary)] hover:bg-[var(--hrk-bg-surface-raised)] hover:border-[var(--hrk-border-default)]":"bg-[var(--hrk-info)] text-[var(--hrk-text-on-brand)] hover:brightness-110"}`,children:g.label},g.label))})]})]})}),mz=({label:a,value:o,icon:l,iconBgClass:u="bg-blue-500/15",iconTextClass:c="text-blue-400",valueClass:f="text-[var(--hrk-text-primary)]",actions:h})=>e.jsx("div",{className:"p-3 sm:p-3.5 rounded-lg bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-subtle)] mb-2.5 transition-all duration-200 hover:bg-[var(--hrk-bg-surface-raised)] hover:border-[var(--hrk-border-default)] min-w-0",children:e.jsxs("div",{className:"flex items-center justify-between gap-2 min-w-0 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[l&&e.jsx("div",{className:`p-2 rounded-full flex items-center justify-center flex-shrink-0 ${u} ${c}`,children:l}),e.jsx("span",{className:"font-semibold text-xs sm:text-sm text-[var(--hrk-text-secondary)] truncate",children:a})]}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 ml-auto flex-wrap justify-end",children:[e.jsx("span",{className:`font-medium text-xs sm:text-sm whitespace-nowrap ${f}`,children:o??"-"}),h&&h.length>0&&e.jsx("div",{className:"flex gap-2 flex-wrap justify-end",children:h.map(g=>e.jsx("button",{onClick:g.onClick,className:`px-3 py-1.5 rounded-md text-[11px] sm:text-xs font-semibold tracking-wide transition-colors ${g.variant==="secondary"?"bg-[var(--hrk-bg-surface-raised)] text-[var(--hrk-text-primary)] hover:bg-[var(--hrk-bg-hover)]":"bg-blue-600 text-white hover:bg-blue-500"}`,children:g.label},g.label))})]})]})});function k6(a){if(!a)return"";const l=new Date(/Z|[+-]\d{2}:?\d{2}$/.test(a)?a:`${a}Z`).getTime()-Date.now();if(l<=0)return"any moment";const u=Math.floor(l/864e5),c=Math.floor(l%864e5/36e5);if(u>0)return`${u}d ${c}h`;const f=Math.floor(l%36e5/6e4);return`${c}h ${f}m`}const pz=({walletData:a,isOwn:o,currentUsername:l,onTransferHive:u,onPowerUp:c,onAddSavingsHbd:f,onRemoveSavingsHbd:h,onPowerDown:g,onStopPowerDown:b,onCancelSavingsWithdrawal:w})=>{const[x,_]=T.useState(!0),v=a?.pending_savings_withdrawals??[],N=!!a?.power_down_active;return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>_(!x),className:"w-full flex items-center justify-between p-3 rounded-lg bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-subtle)] mb-2.5 transition-all duration-200 hover:bg-[var(--hrk-bg-surface-raised)] hover:border-[var(--hrk-border-default)]",children:[e.jsx("span",{className:"font-semibold text-sm text-[var(--hrk-text-secondary)]",children:"All Balances"}),e.jsx(AC,{size:12,className:`text-[var(--hrk-text-tertiary)] transition-transform duration-200 ${x?"rotate-180":""}`})]}),x&&e.jsxs("div",{className:"ml-2 border-l-2 border-[var(--hrk-border-subtle)] pl-2 space-y-0",children:[e.jsx(Xj,{icon:e.jsx(I7,{}),iconBg:"bg-blue-500/15",iconText:"text-blue-400",label:"Balance",value:a?.balance??"-",valueText:"text-blue-300",actions:(o||!o&&l)&&u?[...u?[{label:"Transfer",onClick:u}]:[],...o&&c?[{label:"Power Up",onClick:c,variant:"secondary"}]:[]]:void 0}),e.jsx(Xj,{icon:e.jsx(O7,{}),iconBg:"bg-purple-500/15",iconText:"text-purple-400",label:"Savings HBD",value:a?.savings_hbd_balance??"-",valueText:"text-purple-300",actions:(o||!o&&l)&&(f||h)?[...f?[{label:o?"Add":"Send HBD Savings",onClick:f}]:[],...o&&h?[{label:"Remove",onClick:h,variant:"secondary"}]:[]]:void 0}),v.length>0&&e.jsxs("div",{className:"ml-2 p-3 rounded-lg bg-[var(--hrk-bg-app)] border border-[var(--hrk-border-subtle)] mb-2.5",children:[e.jsx("div",{className:"text-xs font-semibold text-[var(--hrk-text-secondary)] mb-2",children:"Pending withdraws from savings"}),e.jsx("div",{className:"space-y-2",children:v.map(C=>e.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs text-[var(--hrk-text-secondary)] flex-wrap",children:[e.jsxs("span",{children:[e.jsx("span",{className:"text-purple-300",children:C.amount})," ","withdraw will complete in"," ",e.jsx("span",{className:"text-[var(--hrk-text-primary)]",children:k6(C.complete)})]}),o&&w&&e.jsx("button",{onClick:()=>w(C.request_id),className:"px-2.5 py-1 rounded-md text-[11px] font-semibold tracking-wide bg-red-600/20 text-red-300 border border-red-500/40 hover:bg-red-600/30 transition-colors",children:"STOP"})]},C.request_id))})]}),e.jsx(Xj,{icon:e.jsx(EC,{}),iconBg:"bg-orange-500/15",iconText:"text-orange-400",label:"Hive Power",value:a?.hive_power??"-",valueText:"text-orange-300",actions:o||!o&&l?[...!o&&c?[{label:"Send Power Up",onClick:c,variant:"secondary"}]:[],...o&&g?[{label:"Power Down",onClick:g,variant:"secondary"}]:[],...o&&N&&b?[{label:"Stop Power Down",onClick:b}]:[]]:void 0}),N&&a?.power_down_hp_per_week&&e.jsxs("div",{className:"ml-2 p-3 rounded-lg bg-[var(--hrk-bg-app)] border border-orange-500/30 mb-2.5 text-xs text-[var(--hrk-text-secondary)]",children:["An unstake (power down) is in progress —"," ",e.jsxs("span",{className:"text-orange-300",children:["~",a.power_down_hp_per_week," HIVE / week"]}),a.next_vesting_withdrawal&&e.jsxs(e.Fragment,{children:["; next payout in"," ",e.jsx("span",{className:"text-[var(--hrk-text-primary)]",children:k6(a.next_vesting_withdrawal)})]}),"."]})]})]})},LC=({username:a,className:o="",scrollRootRef:l,currentUsername:u,onUpdateRcDelegation:c,onDeleteRcDelegation:f,onCreateHpDelegation:h,onCreateRcDelegation:g,hideDelegations:b=!1,onTransfer:w,onPowerUp:x,onPowerDown:_,onTransferToSavings:v,onTransferFromSavings:N,onStopPowerDown:C,onCancelSavingsWithdrawal:R,onClaimRewards:O})=>{const{walletData:E,fetchWalletData:$,isLoading:V,error:U,transactions:z,fetchTransactions:A,fetchMoreTransactions:H,hasMoreTransactions:I,isLoadingMoreTransactions:q,isLoadingTransactions:Z,transactionError:J}=EN(),[ee,se]=T.useState(!1),[fe,he]=T.useState(!1),[X,W]=T.useState(!1),[ne,be]=T.useState(!1),ve=T.useMemo(()=>z.filter(xe=>{const We=xe.type==="sent";if((ee||fe)&&(We&&!ee||!We&&!fe)||X&&(xe.amount.startsWith("0.001 ")||xe.amount==="0.001"))return!1;if(ne){const qe=RC(xe);if(!(qe.kind==="transfer"||qe.kind==="tip"))return!1}return!0}),[z,ee,fe,X,ne]),Le=T.useRef(null);T.useEffect(()=>{a&&($(a),A(a))},[a,$,A]);const Ce=T.useCallback(()=>{const xe=l?.current;if(xe)return xe;let We=Le.current?.parentElement||null;for(;We&&We!==document.body&&We!==document.documentElement;){const{overflowY:qe}=window.getComputedStyle(We);if((qe==="auto"||qe==="scroll")&&We.scrollHeight>We.clientHeight)return We;We=We.parentElement}return null},[l]);T.useEffect(()=>{if(!a||!I)return;const xe=Ce(),We=600,qe=()=>{if(xe)return xe.scrollTop+xe.clientHeight>=xe.scrollHeight-We;const Tr=document.scrollingElement??document.documentElement;return window.scrollY+window.innerHeight>=Tr.scrollHeight-We};let Xe=!1;const pt=()=>{Xe||(Xe=!0,requestAnimationFrame(()=>{Xe=!1,!q&&qe()&&H(a)}))},Vt=xe??window;return Vt.addEventListener("scroll",pt,{passive:!0}),()=>Vt.removeEventListener("scroll",pt)},[a,I,q,H,Ce]),T.useEffect(()=>{if(!a||!I||q)return;const xe=Ce(),We=600;(xe?xe.scrollTop+xe.clientHeight>=xe.scrollHeight-We:window.scrollY+window.innerHeight>=(document.scrollingElement??document.documentElement).scrollHeight-We)&&H(a)},[a,I,q,z.length,H,Ce]);const pe=!!a&&!!u&&a.toLowerCase()===u.toLowerCase(),ie=T.useCallback(()=>{a&&setTimeout(()=>{$(a),A(a)},4e3)},[a,$,A]),ye=xe=>xe?async(...We)=>{const qe=await xe(...We);return qe!==!1&&ie(),qe}:void 0,[Ne,Ge]=T.useState(null),[me,rt]=T.useState(!1),[Oe,ue]=T.useState("delegations");T.useEffect(()=>{b&&Oe==="delegations"&&ue("transactions")},[b,Oe]);const Pe=xe=>`flex-1 py-2 sm:py-2.5 px-2 text-[11px] sm:text-xs font-semibold tracking-wide rounded transition-colors whitespace-nowrap ${xe?"bg-teal-600 text-white":"bg-[var(--hrk-bg-surface)] text-[var(--hrk-text-secondary)] hover:bg-[var(--hrk-bg-surface-raised)]"}`;return e.jsxs("div",{className:`p-2 sm:p-4 transition-all duration-300 min-w-0 ${o}`,children:[e.jsxs("div",{className:"max-w-3xl mx-auto min-w-0",children:[e.jsxs("div",{className:"flex flex-col items-center p-4 sm:p-5 mb-4 sm:mb-5 rounded-xl bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-subtle)]",children:[a&&e.jsx("img",{src:`https://images.hive.blog/u/${a}/avatar`,alt:`${a} avatar`,className:"w-16 h-16 rounded-full border-3 border-blue-500/30 mb-2.5 transition-transform hover:scale-105",onError:xe=>{xe.target.src=`https://ui-avatars.com/api/?name=${a}&background=random`}}),e.jsx("div",{className:"text-base font-bold text-white",children:a}),e.jsx("div",{className:"text-xs text-[var(--hrk-text-tertiary)]",children:"Hive Wallet Overview"})]}),e.jsxs("div",{className:"rounded-xl bg-gradient-to-r from-blue-600 to-purple-600 p-4 sm:p-5 mb-4 sm:mb-5 transition-all duration-300 hover:from-blue-500 hover:to-purple-500 shadow-lg shadow-blue-500/10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("div",{className:"text-xs font-semibold text-blue-100/80",children:"Estimated Value"}),e.jsx(hz,{})]}),e.jsx("div",{className:"text-2xl font-bold text-white text-center",children:V?e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),e.jsx("span",{className:"text-lg",children:"Loading..."})]}):E?.estimated_value??"-"})]}),U&&e.jsxs("div",{className:"flex items-center p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 mb-4 text-sm",children:[e.jsx(N3,{className:"mr-2 flex-shrink-0"}),e.jsx("span",{children:U})]}),pe&&O&&(()=>{const xe=parseFloat((E?.reward_hive_balance??"0").split(" ")[0]||"0"),We=parseFloat((E?.reward_hbd_balance??"0").split(" ")[0]||"0"),qe=parseFloat((E?.reward_vesting_balance??"0").split(" ")[0]||"0"),Xe=parseFloat((E?.reward_vesting_hive??"0").split(" ")[0]||"0");if(xe<=0&&We<=0&&qe<=0)return null;const pt=[];return xe>0&&pt.push(E?.reward_hive_balance??""),We>0&&pt.push(E?.reward_hbd_balance??""),qe>0&&Xe>0&&pt.push(`${Xe.toFixed(3)} HP`),e.jsxs("div",{className:"p-3 sm:p-4 rounded-lg bg-gradient-to-r from-amber-900/30 to-orange-900/30 border border-amber-700/40 mb-3 flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold text-amber-300 flex items-center gap-1.5",children:"Pending Rewards"}),e.jsx("div",{className:"text-xs text-amber-200/80 mt-0.5",children:pt.length>0?pt.join(" · "):"You have some pending rewards to claim."})]}),e.jsx("button",{disabled:me,onClick:async()=>{rt(!0);try{await O({hive:E?.reward_hive_balance??"0.000 HIVE",hbd:E?.reward_hbd_balance??"0.000 HBD",vests:E?.reward_vesting_balance??"0.000000 VESTS"})!==!1&&ie()}finally{rt(!1)}},className:"px-3.5 py-1.5 rounded-md text-xs font-semibold tracking-wide bg-blue-600 text-white hover:bg-blue-500 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center gap-1.5",children:me?"Claiming…":"CLAIM"})]})})(),e.jsx(mz,{label:"HBD Balance",value:E?.hbd_balance,icon:e.jsx($7,{}),iconBgClass:"bg-emerald-500/15",iconTextClass:"text-emerald-400",valueClass:"text-emerald-300",actions:(pe||!pe&&u)&&w?[{label:"Transfer",onClick:()=>Ge({kind:"transfer",initialCurrency:"HBD"})}]:void 0}),e.jsx(pz,{walletData:E,isOwn:pe,currentUsername:u,onTransferHive:w?()=>Ge({kind:"transfer",initialCurrency:"HIVE"}):void 0,onPowerUp:x?()=>Ge({kind:"powerUp"}):void 0,onAddSavingsHbd:v?()=>Ge({kind:"savingsAdd",currency:"HBD"}):void 0,onRemoveSavingsHbd:N?()=>Ge({kind:"savingsRemove",currency:"HBD"}):void 0,onPowerDown:_?()=>Ge({kind:"powerDown"}):void 0,onStopPowerDown:C?()=>Ge({kind:"stopPowerDown"}):void 0,onCancelSavingsWithdrawal:R?xe=>{const We=E?.pending_savings_withdrawals?.find(qe=>qe.request_id===xe);Ge({kind:"cancelSavingsWithdrawal",requestId:xe,amount:We?.amount??""})}:void 0}),e.jsxs("div",{className:"mt-4 sm:mt-5 flex gap-2 mb-3",children:[!b&&e.jsxs("button",{onClick:()=>ue("delegations"),className:Pe(Oe==="delegations"),children:[e.jsx("span",{className:"sm:hidden",children:"Delegations"}),e.jsx("span",{className:"hidden sm:inline",children:"DELEGATIONS"})]}),e.jsxs("button",{onClick:()=>ue("transactions"),className:Pe(Oe==="transactions"),children:[e.jsx("span",{className:"sm:hidden",children:"Transactions"}),e.jsx("span",{className:"hidden sm:inline",children:"TRANSACTION HISTORY"})]})]}),Oe==="delegations"&&!b&&a&&e.jsx(OC,{username:a,currentUsername:u,onUpdateRcDelegation:c,onDeleteRcDelegation:f,onCreateHpDelegation:h,onCreateRcDelegation:g}),Oe==="transactions"&&e.jsxs("div",{className:"rounded-xl bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-subtle)] p-2 sm:p-4 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 px-1",children:[e.jsx("h3",{className:"text-sm font-bold text-[var(--hrk-text-secondary)] tracking-wide uppercase",children:"Transaction History"}),ve.length!==z.length?e.jsxs("span",{className:"text-xs text-[var(--hrk-text-tertiary)]",children:["Showing ",ve.length," of ",z.length]}):z.length>0?e.jsxs("span",{className:"text-xs text-[var(--hrk-text-tertiary)]",children:[z.length," transactions"]}):null]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 mb-4 px-2 py-2 bg-[var(--hrk-bg-surface-raised)]/35 rounded-lg border border-[var(--hrk-border-subtle)]/50 text-xs text-[var(--hrk-text-secondary)] font-medium",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none hover:text-white transition-colors",children:[e.jsx("input",{type:"checkbox",checked:ee,onChange:xe=>se(xe.target.checked),className:"rounded border-[var(--hrk-border-default)] bg-[var(--hrk-bg-surface)] text-blue-500 focus:ring-blue-500 focus:ring-offset-[var(--hrk-bg-surface)] cursor-pointer w-3.5 h-3.5"}),e.jsx("span",{children:"Outgoing"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none hover:text-white transition-colors",children:[e.jsx("input",{type:"checkbox",checked:fe,onChange:xe=>he(xe.target.checked),className:"rounded border-[var(--hrk-border-default)] bg-[var(--hrk-bg-surface)] text-blue-500 focus:ring-blue-500 focus:ring-offset-[var(--hrk-bg-surface)] cursor-pointer w-3.5 h-3.5"}),e.jsx("span",{children:"Incoming"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none hover:text-white transition-colors",children:[e.jsx("input",{type:"checkbox",checked:X,onChange:xe=>W(xe.target.checked),className:"rounded border-[var(--hrk-border-default)] bg-[var(--hrk-bg-surface)] text-blue-500 focus:ring-blue-500 focus:ring-offset-[var(--hrk-bg-surface)] cursor-pointer w-3.5 h-3.5"}),e.jsx("span",{children:"Exclude 0.001"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none hover:text-white transition-colors",children:[e.jsx("input",{type:"checkbox",checked:ne,onChange:xe=>be(xe.target.checked),className:"rounded border-[var(--hrk-border-default)] bg-[var(--hrk-bg-surface)] text-blue-500 focus:ring-blue-500 focus:ring-offset-[var(--hrk-bg-surface)] cursor-pointer w-3.5 h-3.5"}),e.jsx("span",{children:"Transfers"})]})]}),Z&&e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-[var(--hrk-border-default)] border-t-blue-400 rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-[var(--hrk-text-tertiary)]",children:"Loading transactions..."})]})}),J&&e.jsxs("div",{className:"flex items-center p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 mb-4 text-sm",children:[e.jsx(N3,{className:"mr-2 flex-shrink-0"}),e.jsx("span",{children:J})]}),!Z&&!J&&ve.length===0&&e.jsx("div",{className:"text-center p-8 rounded-lg bg-[var(--hrk-bg-app)] border border-[var(--hrk-border-subtle)]",children:e.jsx("p",{className:"text-sm text-[var(--hrk-text-tertiary)]",children:"No transactions found"})}),!Z&&a&&ve.map(xe=>e.jsx(fz,{tx:xe},xe.trx_id+xe.id)),!Z&&z.length>0&&I&&e.jsx("div",{ref:Le,className:"py-4 flex items-center justify-center",children:q?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-[var(--hrk-border-default)] border-t-blue-400 rounded-full animate-spin"}),e.jsx("span",{className:"text-xs text-[var(--hrk-text-tertiary)]",children:"Loading more transactions…"})]}):e.jsx("button",{type:"button",onClick:()=>a&&H(a),className:"px-4 py-2 rounded-lg text-xs font-medium bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-default)] text-[var(--hrk-text-secondary)] hover:text-[var(--hrk-text-primary)] hover:border-blue-400/50 transition-colors",children:"Load more transactions"})}),!Z&&z.length>0&&!I&&e.jsx("div",{className:"py-3 text-center text-[11px] text-[var(--hrk-text-tertiary)]",children:"No more transactions"})]})]}),(pe||u)&&a&&Ne?.kind==="transfer"&&w&&e.jsx(oz,{from:pe?a:u,toDefault:pe?"":a,hiveBalance:pe?E?.balance:void 0,hbdBalance:pe?E?.hbd_balance:void 0,initialCurrency:Ne.initialCurrency,onClose:()=>Ge(null),onSubmit:ye(w)}),(pe||u)&&a&&Ne?.kind==="powerUp"&&x&&e.jsx(lz,{from:pe?a:u,toDefault:pe?void 0:a,hiveBalance:pe?E?.balance:void 0,onClose:()=>Ge(null),onSubmit:ye(x)}),pe&&a&&Ne?.kind==="powerDown"&&_&&e.jsx(uz,{from:a,hivePower:E?.hive_power,onClose:()=>Ge(null),onSubmit:ye(_)}),(pe||u)&&a&&Ne?.kind==="savingsAdd"&&v&&e.jsx(w6,{mode:"add",from:pe?a:u,toDefault:pe?void 0:a,currency:Ne.currency,availableBalance:pe?Ne.currency==="HIVE"?E?.balance:E?.hbd_balance:void 0,onClose:()=>Ge(null),onSubmit:ye(v)}),pe&&a&&Ne?.kind==="savingsRemove"&&N&&e.jsx(w6,{mode:"remove",from:a,currency:Ne.currency,availableBalance:Ne.currency==="HIVE"?E?.savings_balance:E?.savings_hbd_balance,onClose:()=>Ge(null),onSubmit:ye(N)}),pe&&a&&Ne?.kind==="stopPowerDown"&&C&&e.jsx(_6,{title:"Cancel Unstake (Power Down)?",message:"This will cancel the current unstake (power down) request. Are you sure?",onClose:()=>Ge(null),onConfirm:ye(C)}),pe&&a&&Ne?.kind==="cancelSavingsWithdrawal"&&R&&e.jsx(_6,{title:"Cancel Unstake (Withdraw) From Savings?",message:`This will cancel the selected unstake (withdraw) request${Ne.amount?` of ${Ne.amount}`:""}. Are you sure?`,onClose:()=>Ge(null),onConfirm:ye(()=>R(Ne.requestId))})]})};var Uv={exports:{}};var gz=Uv.exports,j6;function xz(){return j6||(j6=1,(function(a,o){(function(l,u){u(o)})(gz,(function(l){var u="1.9.4";function c(d){var y,D,F,Q;for(D=1,F=arguments.length;D<F;D++){Q=arguments[D];for(y in Q)d[y]=Q[y]}return d}var f=Object.create||(function(){function d(){}return function(y){return d.prototype=y,new d}})();function h(d,y){var D=Array.prototype.slice;if(d.bind)return d.bind.apply(d,D.call(arguments,1));var F=D.call(arguments,2);return function(){return d.apply(y,F.length?F.concat(D.call(arguments)):arguments)}}var g=0;function b(d){return"_leaflet_id"in d||(d._leaflet_id=++g),d._leaflet_id}function w(d,y,D){var F,Q,ce,Ae;return Ae=function(){F=!1,Q&&(ce.apply(D,Q),Q=!1)},ce=function(){F?Q=arguments:(d.apply(D,arguments),setTimeout(Ae,y),F=!0)},ce}function x(d,y,D){var F=y[1],Q=y[0],ce=F-Q;return d===F&&D?d:((d-Q)%ce+ce)%ce+Q}function _(){return!1}function v(d,y){if(y===!1)return d;var D=Math.pow(10,y===void 0?6:y);return Math.round(d*D)/D}function N(d){return d.trim?d.trim():d.replace(/^\s+|\s+$/g,"")}function C(d){return N(d).split(/\s+/)}function R(d,y){Object.prototype.hasOwnProperty.call(d,"options")||(d.options=d.options?f(d.options):{});for(var D in y)d.options[D]=y[D];return d.options}function O(d,y,D){var F=[];for(var Q in d)F.push(encodeURIComponent(D?Q.toUpperCase():Q)+"="+encodeURIComponent(d[Q]));return(!y||y.indexOf("?")===-1?"?":"&")+F.join("&")}var E=/\{ *([\w_ -]+) *\}/g;function $(d,y){return d.replace(E,function(D,F){var Q=y[F];if(Q===void 0)throw new Error("No value provided for variable "+D);return typeof Q=="function"&&(Q=Q(y)),Q})}var V=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"};function U(d,y){for(var D=0;D<d.length;D++)if(d[D]===y)return D;return-1}var z="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function A(d){return window["webkit"+d]||window["moz"+d]||window["ms"+d]}var H=0;function I(d){var y=+new Date,D=Math.max(0,16-(y-H));return H=y+D,window.setTimeout(d,D)}var q=window.requestAnimationFrame||A("RequestAnimationFrame")||I,Z=window.cancelAnimationFrame||A("CancelAnimationFrame")||A("CancelRequestAnimationFrame")||function(d){window.clearTimeout(d)};function J(d,y,D){if(D&&q===I)d.call(y);else return q.call(window,h(d,y))}function ee(d){d&&Z.call(window,d)}var se={__proto__:null,extend:c,create:f,bind:h,get lastId(){return g},stamp:b,throttle:w,wrapNum:x,falseFn:_,formatNum:v,trim:N,splitWords:C,setOptions:R,getParamString:O,template:$,isArray:V,indexOf:U,emptyImageUrl:z,requestFn:q,cancelFn:Z,requestAnimFrame:J,cancelAnimFrame:ee};function fe(){}fe.extend=function(d){var y=function(){R(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},D=y.__super__=this.prototype,F=f(D);F.constructor=y,y.prototype=F;for(var Q in this)Object.prototype.hasOwnProperty.call(this,Q)&&Q!=="prototype"&&Q!=="__super__"&&(y[Q]=this[Q]);return d.statics&&c(y,d.statics),d.includes&&(he(d.includes),c.apply(null,[F].concat(d.includes))),c(F,d),delete F.statics,delete F.includes,F.options&&(F.options=D.options?f(D.options):{},c(F.options,d.options)),F._initHooks=[],F.callInitHooks=function(){if(!this._initHooksCalled){D.callInitHooks&&D.callInitHooks.call(this),this._initHooksCalled=!0;for(var ce=0,Ae=F._initHooks.length;ce<Ae;ce++)F._initHooks[ce].call(this)}},y},fe.include=function(d){var y=this.prototype.options;return c(this.prototype,d),d.options&&(this.prototype.options=y,this.mergeOptions(d.options)),this},fe.mergeOptions=function(d){return c(this.prototype.options,d),this},fe.addInitHook=function(d){var y=Array.prototype.slice.call(arguments,1),D=typeof d=="function"?d:function(){this[d].apply(this,y)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(D),this};function he(d){if(!(typeof L>"u"||!L||!L.Mixin)){d=V(d)?d:[d];for(var y=0;y<d.length;y++)d[y]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",new Error().stack)}}var X={on:function(d,y,D){if(typeof d=="object")for(var F in d)this._on(F,d[F],y);else{d=C(d);for(var Q=0,ce=d.length;Q<ce;Q++)this._on(d[Q],y,D)}return this},off:function(d,y,D){if(!arguments.length)delete this._events;else if(typeof d=="object")for(var F in d)this._off(F,d[F],y);else{d=C(d);for(var Q=arguments.length===1,ce=0,Ae=d.length;ce<Ae;ce++)Q?this._off(d[ce]):this._off(d[ce],y,D)}return this},_on:function(d,y,D,F){if(typeof y!="function"){console.warn("wrong listener type: "+typeof y);return}if(this._listens(d,y,D)===!1){D===this&&(D=void 0);var Q={fn:y,ctx:D};F&&(Q.once=!0),this._events=this._events||{},this._events[d]=this._events[d]||[],this._events[d].push(Q)}},_off:function(d,y,D){var F,Q,ce;if(this._events&&(F=this._events[d],!!F)){if(arguments.length===1){if(this._firingCount)for(Q=0,ce=F.length;Q<ce;Q++)F[Q].fn=_;delete this._events[d];return}if(typeof y!="function"){console.warn("wrong listener type: "+typeof y);return}var Ae=this._listens(d,y,D);if(Ae!==!1){var Qe=F[Ae];this._firingCount&&(Qe.fn=_,this._events[d]=F=F.slice()),F.splice(Ae,1)}}},fire:function(d,y,D){if(!this.listens(d,D))return this;var F=c({},y,{type:d,target:this,sourceTarget:y&&y.sourceTarget||this});if(this._events){var Q=this._events[d];if(Q){this._firingCount=this._firingCount+1||1;for(var ce=0,Ae=Q.length;ce<Ae;ce++){var Qe=Q[ce],dt=Qe.fn;Qe.once&&this.off(d,dt,Qe.ctx),dt.call(Qe.ctx||this,F)}this._firingCount--}}return D&&this._propagateEvent(F),this},listens:function(d,y,D,F){typeof d!="string"&&console.warn('"string" type argument expected');var Q=y;typeof y!="function"&&(F=!!y,Q=void 0,D=void 0);var ce=this._events&&this._events[d];if(ce&&ce.length&&this._listens(d,Q,D)!==!1)return!0;if(F){for(var Ae in this._eventParents)if(this._eventParents[Ae].listens(d,y,D,F))return!0}return!1},_listens:function(d,y,D){if(!this._events)return!1;var F=this._events[d]||[];if(!y)return!!F.length;D===this&&(D=void 0);for(var Q=0,ce=F.length;Q<ce;Q++)if(F[Q].fn===y&&F[Q].ctx===D)return Q;return!1},once:function(d,y,D){if(typeof d=="object")for(var F in d)this._on(F,d[F],y,!0);else{d=C(d);for(var Q=0,ce=d.length;Q<ce;Q++)this._on(d[Q],y,D,!0)}return this},addEventParent:function(d){return this._eventParents=this._eventParents||{},this._eventParents[b(d)]=d,this},removeEventParent:function(d){return this._eventParents&&delete this._eventParents[b(d)],this},_propagateEvent:function(d){for(var y in this._eventParents)this._eventParents[y].fire(d.type,c({layer:d.target,propagatedFrom:d.target},d),!0)}};X.addEventListener=X.on,X.removeEventListener=X.clearAllEventListeners=X.off,X.addOneTimeEventListener=X.once,X.fireEvent=X.fire,X.hasEventListeners=X.listens;var W=fe.extend(X);function ne(d,y,D){this.x=D?Math.round(d):d,this.y=D?Math.round(y):y}var be=Math.trunc||function(d){return d>0?Math.floor(d):Math.ceil(d)};ne.prototype={clone:function(){return new ne(this.x,this.y)},add:function(d){return this.clone()._add(ve(d))},_add:function(d){return this.x+=d.x,this.y+=d.y,this},subtract:function(d){return this.clone()._subtract(ve(d))},_subtract:function(d){return this.x-=d.x,this.y-=d.y,this},divideBy:function(d){return this.clone()._divideBy(d)},_divideBy:function(d){return this.x/=d,this.y/=d,this},multiplyBy:function(d){return this.clone()._multiplyBy(d)},_multiplyBy:function(d){return this.x*=d,this.y*=d,this},scaleBy:function(d){return new ne(this.x*d.x,this.y*d.y)},unscaleBy:function(d){return new ne(this.x/d.x,this.y/d.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=be(this.x),this.y=be(this.y),this},distanceTo:function(d){d=ve(d);var y=d.x-this.x,D=d.y-this.y;return Math.sqrt(y*y+D*D)},equals:function(d){return d=ve(d),d.x===this.x&&d.y===this.y},contains:function(d){return d=ve(d),Math.abs(d.x)<=Math.abs(this.x)&&Math.abs(d.y)<=Math.abs(this.y)},toString:function(){return"Point("+v(this.x)+", "+v(this.y)+")"}};function ve(d,y,D){return d instanceof ne?d:V(d)?new ne(d[0],d[1]):d==null?d:typeof d=="object"&&"x"in d&&"y"in d?new ne(d.x,d.y):new ne(d,y,D)}function Le(d,y){if(d)for(var D=y?[d,y]:d,F=0,Q=D.length;F<Q;F++)this.extend(D[F])}Le.prototype={extend:function(d){var y,D;if(!d)return this;if(d instanceof ne||typeof d[0]=="number"||"x"in d)y=D=ve(d);else if(d=Ce(d),y=d.min,D=d.max,!y||!D)return this;return!this.min&&!this.max?(this.min=y.clone(),this.max=D.clone()):(this.min.x=Math.min(y.x,this.min.x),this.max.x=Math.max(D.x,this.max.x),this.min.y=Math.min(y.y,this.min.y),this.max.y=Math.max(D.y,this.max.y)),this},getCenter:function(d){return ve((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,d)},getBottomLeft:function(){return ve(this.min.x,this.max.y)},getTopRight:function(){return ve(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(d){var y,D;return typeof d[0]=="number"||d instanceof ne?d=ve(d):d=Ce(d),d instanceof Le?(y=d.min,D=d.max):y=D=d,y.x>=this.min.x&&D.x<=this.max.x&&y.y>=this.min.y&&D.y<=this.max.y},intersects:function(d){d=Ce(d);var y=this.min,D=this.max,F=d.min,Q=d.max,ce=Q.x>=y.x&&F.x<=D.x,Ae=Q.y>=y.y&&F.y<=D.y;return ce&&Ae},overlaps:function(d){d=Ce(d);var y=this.min,D=this.max,F=d.min,Q=d.max,ce=Q.x>y.x&&F.x<D.x,Ae=Q.y>y.y&&F.y<D.y;return ce&&Ae},isValid:function(){return!!(this.min&&this.max)},pad:function(d){var y=this.min,D=this.max,F=Math.abs(y.x-D.x)*d,Q=Math.abs(y.y-D.y)*d;return Ce(ve(y.x-F,y.y-Q),ve(D.x+F,D.y+Q))},equals:function(d){return d?(d=Ce(d),this.min.equals(d.getTopLeft())&&this.max.equals(d.getBottomRight())):!1}};function Ce(d,y){return!d||d instanceof Le?d:new Le(d,y)}function pe(d,y){if(d)for(var D=y?[d,y]:d,F=0,Q=D.length;F<Q;F++)this.extend(D[F])}pe.prototype={extend:function(d){var y=this._southWest,D=this._northEast,F,Q;if(d instanceof ye)F=d,Q=d;else if(d instanceof pe){if(F=d._southWest,Q=d._northEast,!F||!Q)return this}else return d?this.extend(Ne(d)||ie(d)):this;return!y&&!D?(this._southWest=new ye(F.lat,F.lng),this._northEast=new ye(Q.lat,Q.lng)):(y.lat=Math.min(F.lat,y.lat),y.lng=Math.min(F.lng,y.lng),D.lat=Math.max(Q.lat,D.lat),D.lng=Math.max(Q.lng,D.lng)),this},pad:function(d){var y=this._southWest,D=this._northEast,F=Math.abs(y.lat-D.lat)*d,Q=Math.abs(y.lng-D.lng)*d;return new pe(new ye(y.lat-F,y.lng-Q),new ye(D.lat+F,D.lng+Q))},getCenter:function(){return new ye((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new ye(this.getNorth(),this.getWest())},getSouthEast:function(){return new ye(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(d){typeof d[0]=="number"||d instanceof ye||"lat"in d?d=Ne(d):d=ie(d);var y=this._southWest,D=this._northEast,F,Q;return d instanceof pe?(F=d.getSouthWest(),Q=d.getNorthEast()):F=Q=d,F.lat>=y.lat&&Q.lat<=D.lat&&F.lng>=y.lng&&Q.lng<=D.lng},intersects:function(d){d=ie(d);var y=this._southWest,D=this._northEast,F=d.getSouthWest(),Q=d.getNorthEast(),ce=Q.lat>=y.lat&&F.lat<=D.lat,Ae=Q.lng>=y.lng&&F.lng<=D.lng;return ce&&Ae},overlaps:function(d){d=ie(d);var y=this._southWest,D=this._northEast,F=d.getSouthWest(),Q=d.getNorthEast(),ce=Q.lat>y.lat&&F.lat<D.lat,Ae=Q.lng>y.lng&&F.lng<D.lng;return ce&&Ae},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(d,y){return d?(d=ie(d),this._southWest.equals(d.getSouthWest(),y)&&this._northEast.equals(d.getNorthEast(),y)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function ie(d,y){return d instanceof pe?d:new pe(d,y)}function ye(d,y,D){if(isNaN(d)||isNaN(y))throw new Error("Invalid LatLng object: ("+d+", "+y+")");this.lat=+d,this.lng=+y,D!==void 0&&(this.alt=+D)}ye.prototype={equals:function(d,y){if(!d)return!1;d=Ne(d);var D=Math.max(Math.abs(this.lat-d.lat),Math.abs(this.lng-d.lng));return D<=(y===void 0?1e-9:y)},toString:function(d){return"LatLng("+v(this.lat,d)+", "+v(this.lng,d)+")"},distanceTo:function(d){return me.distance(this,Ne(d))},wrap:function(){return me.wrapLatLng(this)},toBounds:function(d){var y=180*d/40075017,D=y/Math.cos(Math.PI/180*this.lat);return ie([this.lat-y,this.lng-D],[this.lat+y,this.lng+D])},clone:function(){return new ye(this.lat,this.lng,this.alt)}};function Ne(d,y,D){return d instanceof ye?d:V(d)&&typeof d[0]!="object"?d.length===3?new ye(d[0],d[1],d[2]):d.length===2?new ye(d[0],d[1]):null:d==null?d:typeof d=="object"&&"lat"in d?new ye(d.lat,"lng"in d?d.lng:d.lon,d.alt):y===void 0?null:new ye(d,y,D)}var Ge={latLngToPoint:function(d,y){var D=this.projection.project(d),F=this.scale(y);return this.transformation._transform(D,F)},pointToLatLng:function(d,y){var D=this.scale(y),F=this.transformation.untransform(d,D);return this.projection.unproject(F)},project:function(d){return this.projection.project(d)},unproject:function(d){return this.projection.unproject(d)},scale:function(d){return 256*Math.pow(2,d)},zoom:function(d){return Math.log(d/256)/Math.LN2},getProjectedBounds:function(d){if(this.infinite)return null;var y=this.projection.bounds,D=this.scale(d),F=this.transformation.transform(y.min,D),Q=this.transformation.transform(y.max,D);return new Le(F,Q)},infinite:!1,wrapLatLng:function(d){var y=this.wrapLng?x(d.lng,this.wrapLng,!0):d.lng,D=this.wrapLat?x(d.lat,this.wrapLat,!0):d.lat,F=d.alt;return new ye(D,y,F)},wrapLatLngBounds:function(d){var y=d.getCenter(),D=this.wrapLatLng(y),F=y.lat-D.lat,Q=y.lng-D.lng;if(F===0&&Q===0)return d;var ce=d.getSouthWest(),Ae=d.getNorthEast(),Qe=new ye(ce.lat-F,ce.lng-Q),dt=new ye(Ae.lat-F,Ae.lng-Q);return new pe(Qe,dt)}},me=c({},Ge,{wrapLng:[-180,180],R:6371e3,distance:function(d,y){var D=Math.PI/180,F=d.lat*D,Q=y.lat*D,ce=Math.sin((y.lat-d.lat)*D/2),Ae=Math.sin((y.lng-d.lng)*D/2),Qe=ce*ce+Math.cos(F)*Math.cos(Q)*Ae*Ae,dt=2*Math.atan2(Math.sqrt(Qe),Math.sqrt(1-Qe));return this.R*dt}}),rt=6378137,Oe={R:rt,MAX_LATITUDE:85.0511287798,project:function(d){var y=Math.PI/180,D=this.MAX_LATITUDE,F=Math.max(Math.min(D,d.lat),-D),Q=Math.sin(F*y);return new ne(this.R*d.lng*y,this.R*Math.log((1+Q)/(1-Q))/2)},unproject:function(d){var y=180/Math.PI;return new ye((2*Math.atan(Math.exp(d.y/this.R))-Math.PI/2)*y,d.x*y/this.R)},bounds:(function(){var d=rt*Math.PI;return new Le([-d,-d],[d,d])})()};function ue(d,y,D,F){if(V(d)){this._a=d[0],this._b=d[1],this._c=d[2],this._d=d[3];return}this._a=d,this._b=y,this._c=D,this._d=F}ue.prototype={transform:function(d,y){return this._transform(d.clone(),y)},_transform:function(d,y){return y=y||1,d.x=y*(this._a*d.x+this._b),d.y=y*(this._c*d.y+this._d),d},untransform:function(d,y){return y=y||1,new ne((d.x/y-this._b)/this._a,(d.y/y-this._d)/this._c)}};function Pe(d,y,D,F){return new ue(d,y,D,F)}var xe=c({},me,{code:"EPSG:3857",projection:Oe,transformation:(function(){var d=.5/(Math.PI*Oe.R);return Pe(d,.5,-d,.5)})()}),We=c({},xe,{code:"EPSG:900913"});function qe(d){return document.createElementNS("http://www.w3.org/2000/svg",d)}function Xe(d,y){var D="",F,Q,ce,Ae,Qe,dt;for(F=0,ce=d.length;F<ce;F++){for(Qe=d[F],Q=0,Ae=Qe.length;Q<Ae;Q++)dt=Qe[Q],D+=(Q?"L":"M")+dt.x+" "+dt.y;D+=y?rr.svg?"z":"x":""}return D||"M0 0"}var pt=document.documentElement.style,Vt="ActiveXObject"in window,Tr=Vt&&!document.addEventListener,jt="msLaunchUri"in navigator&&!("documentMode"in document),Nt=pa("webkit"),fr=pa("android"),Mr=pa("android 2")||pa("android 3"),Zt=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),He=fr&&pa("Google")&&Zt<537&&!("AudioNode"in window),Kt=!!window.opera,De=!jt&&pa("chrome"),Ot=pa("gecko")&&!Nt&&!Kt&&!Vt,ot=!De&&pa("safari"),Re=pa("phantom"),Je="OTransition"in pt,kt=navigator.platform.indexOf("Win")===0,it=Vt&&"transition"in pt,Pt="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!Mr,Yt="MozPerspective"in pt,Ir=!window.L_DISABLE_3D&&(it||Pt||Yt)&&!Je&&!Re,ma=typeof orientation<"u"||pa("mobile"),Zr=ma&&Nt,Wr=ma&&Pt,da=!window.PointerEvent&&window.MSPointerEvent,ae=!!(window.PointerEvent||da),oe="ontouchstart"in window||!!window.TouchEvent,_e=!window.L_NO_TOUCH&&(oe||ae),Be=ma&&Kt,wt=ma&&Ot,ar=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,xt=(function(){var d=!1;try{var y=Object.defineProperty({},"passive",{get:function(){d=!0}});window.addEventListener("testPassiveEventSupport",_,y),window.removeEventListener("testPassiveEventSupport",_,y)}catch{}return d})(),St=(function(){return!!document.createElement("canvas").getContext})(),Jr=!!(document.createElementNS&&qe("svg").createSVGRect),ct=!!Jr&&(function(){var d=document.createElement("div");return d.innerHTML="<svg/>",(d.firstChild&&d.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),cr=!Jr&&(function(){try{var d=document.createElement("div");d.innerHTML='<v:shape adj="1"/>';var y=d.firstChild;return y.style.behavior="url(#default#VML)",y&&typeof y.adj=="object"}catch{return!1}})(),dr=navigator.platform.indexOf("Mac")===0,Lr=navigator.platform.indexOf("Linux")===0;function pa(d){return navigator.userAgent.toLowerCase().indexOf(d)>=0}var rr={ie:Vt,ielt9:Tr,edge:jt,webkit:Nt,android:fr,android23:Mr,androidStock:He,opera:Kt,chrome:De,gecko:Ot,safari:ot,phantom:Re,opera12:Je,win:kt,ie3d:it,webkit3d:Pt,gecko3d:Yt,any3d:Ir,mobile:ma,mobileWebkit:Zr,mobileWebkit3d:Wr,msPointer:da,pointer:ae,touch:_e,touchNative:oe,mobileOpera:Be,mobileGecko:wt,retina:ar,passiveEvents:xt,canvas:St,svg:Jr,vml:cr,inlineSvg:ct,mac:dr,linux:Lr},_a=rr.msPointer?"MSPointerDown":"pointerdown",Ct=rr.msPointer?"MSPointerMove":"pointermove",Xt=rr.msPointer?"MSPointerUp":"pointerup",er=rr.msPointer?"MSPointerCancel":"pointercancel",pr={touchstart:_a,touchmove:Ct,touchend:Xt,touchcancel:er},Qr={touchstart:Ur,touchmove:fa,touchend:fa,touchcancel:fa},Kr={},Da=!1;function Bn(d,y,D){return y==="touchstart"&&Br(),Qr[y]?(D=Qr[y].bind(this,D),d.addEventListener(pr[y],D,!1),D):(console.warn("wrong event specified:",y),_)}function Cr(d,y,D){if(!pr[y]){console.warn("wrong event specified:",y);return}d.removeEventListener(pr[y],D,!1)}function Dt(d){Kr[d.pointerId]=d}function sr(d){Kr[d.pointerId]&&(Kr[d.pointerId]=d)}function Nr(d){delete Kr[d.pointerId]}function Br(){Da||(document.addEventListener(_a,Dt,!0),document.addEventListener(Ct,sr,!0),document.addEventListener(Xt,Nr,!0),document.addEventListener(er,Nr,!0),Da=!0)}function fa(d,y){if(y.pointerType!==(y.MSPOINTER_TYPE_MOUSE||"mouse")){y.touches=[];for(var D in Kr)y.touches.push(Kr[D]);y.changedTouches=[y],d(y)}}function Ur(d,y){y.MSPOINTER_TYPE_TOUCH&&y.pointerType===y.MSPOINTER_TYPE_TOUCH&&va(y),fa(d,y)}function gr(d){var y={},D,F;for(F in d)D=d[F],y[F]=D&&D.bind?D.bind(d):D;return d=y,y.type="dblclick",y.detail=2,y.isTrusted=!1,y._simulated=!0,y}var zr=200;function Se(d,y){d.addEventListener("dblclick",y);var D=0,F;function Q(ce){if(ce.detail!==1){F=ce.detail;return}if(!(ce.pointerType==="mouse"||ce.sourceCapabilities&&!ce.sourceCapabilities.firesTouchEvents)){var Ae=ge(ce);if(!(Ae.some(function(dt){return dt instanceof HTMLLabelElement&&dt.attributes.for})&&!Ae.some(function(dt){return dt instanceof HTMLInputElement||dt instanceof HTMLSelectElement}))){var Qe=Date.now();Qe-D<=zr?(F++,F===2&&y(gr(ce))):F=1,D=Qe}}}return d.addEventListener("click",Q),{dblclick:y,simDblclick:Q}}function et(d,y){d.removeEventListener("dblclick",y.dblclick),d.removeEventListener("click",y.simDblclick)}var At=Oa(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),$t=Oa(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Vr=$t==="webkitTransition"||$t==="OTransition"?$t+"End":"transitionend";function lr(d){return typeof d=="string"?document.getElementById(d):d}function Pr(d,y){var D=d.style[y]||d.currentStyle&&d.currentStyle[y];if((!D||D==="auto")&&document.defaultView){var F=document.defaultView.getComputedStyle(d,null);D=F?F[y]:null}return D==="auto"?null:D}function nr(d,y,D){var F=document.createElement(d);return F.className=y||"",D&&D.appendChild(F),F}function Wt(d){var y=d.parentNode;y&&y.removeChild(d)}function Or(d){for(;d.firstChild;)d.removeChild(d.firstChild)}function hr(d){var y=d.parentNode;y&&y.lastChild!==d&&y.appendChild(d)}function Rr(d){var y=d.parentNode;y&&y.firstChild!==d&&y.insertBefore(d,y.firstChild)}function ga(d,y){if(d.classList!==void 0)return d.classList.contains(y);var D=jn(d);return D.length>0&&new RegExp("(^|\\s)"+y+"(\\s|$)").test(D)}function Rt(d,y){if(d.classList!==void 0)for(var D=C(y),F=0,Q=D.length;F<Q;F++)d.classList.add(D[F]);else if(!ga(d,y)){var ce=jn(d);Fr(d,(ce?ce+" ":"")+y)}}function Yr(d,y){d.classList!==void 0?d.classList.remove(y):Fr(d,N((" "+jn(d)+" ").replace(" "+y+" "," ")))}function Fr(d,y){d.className.baseVal===void 0?d.className=y:d.className.baseVal=y}function jn(d){return d.correspondingElement&&(d=d.correspondingElement),d.className.baseVal===void 0?d.className:d.className.baseVal}function ea(d,y){"opacity"in d.style?d.style.opacity=y:"filter"in d.style&&fn(d,y)}function fn(d,y){var D=!1,F="DXImageTransform.Microsoft.Alpha";try{D=d.filters.item(F)}catch{if(y===1)return}y=Math.round(y*100),D?(D.Enabled=y!==100,D.Opacity=y):d.style.filter+=" progid:"+F+"(opacity="+y+")"}function Oa(d){for(var y=document.documentElement.style,D=0;D<d.length;D++)if(d[D]in y)return d[D];return!1}function $a(d,y,D){var F=y||new ne(0,0);d.style[At]=(rr.ie3d?"translate("+F.x+"px,"+F.y+"px)":"translate3d("+F.x+"px,"+F.y+"px,0)")+(D?" scale("+D+")":"")}function xa(d,y){d._leaflet_pos=y,rr.any3d?$a(d,y):(d.style.left=y.x+"px",d.style.top=y.y+"px")}function ia(d){return d._leaflet_pos||new ne(0,0)}var oa,Qa,Ha;if("onselectstart"in document)oa=function(){nt(window,"selectstart",va)},Qa=function(){at(window,"selectstart",va)};else{var Gn=Oa(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);oa=function(){if(Gn){var d=document.documentElement.style;Ha=d[Gn],d[Gn]="none"}},Qa=function(){Gn&&(document.documentElement.style[Gn]=Ha,Ha=void 0)}}function ua(){nt(window,"dragstart",va)}function Xa(){at(window,"dragstart",va)}var nn,sn;function Za(d){for(;d.tabIndex===-1;)d=d.parentNode;d.style&&(Ka(),nn=d,sn=d.style.outlineStyle,d.style.outlineStyle="none",nt(window,"keydown",Ka))}function Ka(){nn&&(nn.style.outlineStyle=sn,nn=void 0,sn=void 0,at(window,"keydown",Ka))}function ke(d){do d=d.parentNode;while((!d.offsetWidth||!d.offsetHeight)&&d!==document.body);return d}function Mt(d){var y=d.getBoundingClientRect();return{x:y.width/d.offsetWidth||1,y:y.height/d.offsetHeight||1,boundingClientRect:y}}var Et={__proto__:null,TRANSFORM:At,TRANSITION:$t,TRANSITION_END:Vr,get:lr,getStyle:Pr,create:nr,remove:Wt,empty:Or,toFront:hr,toBack:Rr,hasClass:ga,addClass:Rt,removeClass:Yr,setClass:Fr,getClass:jn,setOpacity:ea,testProp:Oa,setTransform:$a,setPosition:xa,getPosition:ia,get disableTextSelection(){return oa},get enableTextSelection(){return Qa},disableImageDrag:ua,enableImageDrag:Xa,preventOutline:Za,restoreOutline:Ka,getSizedParentNode:ke,getScale:Mt};function nt(d,y,D,F){if(y&&typeof y=="object")for(var Q in y)ir(d,Q,y[Q],D);else{y=C(y);for(var ce=0,Ae=y.length;ce<Ae;ce++)ir(d,y[ce],D,F)}return this}var Ft="_leaflet_events";function at(d,y,D,F){if(arguments.length===1)ur(d),delete d[Ft];else if(y&&typeof y=="object")for(var Q in y)Hr(d,Q,y[Q],D);else if(y=C(y),arguments.length===2)ur(d,function(Qe){return U(y,Qe)!==-1});else for(var ce=0,Ae=y.length;ce<Ae;ce++)Hr(d,y[ce],D,F);return this}function ur(d,y){for(var D in d[Ft]){var F=D.split(/\d/)[0];(!y||y(F))&&Hr(d,F,null,null,D)}}var Gt={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function ir(d,y,D,F){var Q=y+b(D)+(F?"_"+b(F):"");if(d[Ft]&&d[Ft][Q])return this;var ce=function(Qe){return D.call(F||d,Qe||window.event)},Ae=ce;!rr.touchNative&&rr.pointer&&y.indexOf("touch")===0?ce=Bn(d,y,ce):rr.touch&&y==="dblclick"?ce=Se(d,ce):"addEventListener"in d?y==="touchstart"||y==="touchmove"||y==="wheel"||y==="mousewheel"?d.addEventListener(Gt[y]||y,ce,rr.passiveEvents?{passive:!1}:!1):y==="mouseenter"||y==="mouseleave"?(ce=function(Qe){Qe=Qe||window.event,xr(d,Qe)&&Ae(Qe)},d.addEventListener(Gt[y],ce,!1)):d.addEventListener(y,Ae,!1):d.attachEvent("on"+y,ce),d[Ft]=d[Ft]||{},d[Ft][Q]=ce}function Hr(d,y,D,F,Q){Q=Q||y+b(D)+(F?"_"+b(F):"");var ce=d[Ft]&&d[Ft][Q];if(!ce)return this;!rr.touchNative&&rr.pointer&&y.indexOf("touch")===0?Cr(d,y,ce):rr.touch&&y==="dblclick"?et(d,ce):"removeEventListener"in d?d.removeEventListener(Gt[y]||y,ce,!1):d.detachEvent("on"+y,ce),d[Ft][Q]=null}function Dr(d){return d.stopPropagation?d.stopPropagation():d.originalEvent?d.originalEvent._stopped=!0:d.cancelBubble=!0,this}function ba(d){return ir(d,"wheel",Dr),this}function Aa(d){return nt(d,"mousedown touchstart dblclick contextmenu",Dr),d._leaflet_disable_click=!0,this}function va(d){return d.preventDefault?d.preventDefault():d.returnValue=!1,this}function Pa(d){return va(d),Dr(d),this}function ge(d){if(d.composedPath)return d.composedPath();for(var y=[],D=d.target;D;)y.push(D),D=D.parentNode;return y}function Ue(d,y){if(!y)return new ne(d.clientX,d.clientY);var D=Mt(y),F=D.boundingClientRect;return new ne((d.clientX-F.left)/D.x-y.clientLeft,(d.clientY-F.top)/D.y-y.clientTop)}var gt=rr.linux&&rr.chrome?window.devicePixelRatio:rr.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function Tt(d){return rr.edge?d.wheelDeltaY/2:d.deltaY&&d.deltaMode===0?-d.deltaY/gt:d.deltaY&&d.deltaMode===1?-d.deltaY*20:d.deltaY&&d.deltaMode===2?-d.deltaY*60:d.deltaX||d.deltaZ?0:d.wheelDelta?(d.wheelDeltaY||d.wheelDelta)/2:d.detail&&Math.abs(d.detail)<32765?-d.detail*20:d.detail?d.detail/-32765*60:0}function xr(d,y){var D=y.relatedTarget;if(!D)return!0;try{for(;D&&D!==d;)D=D.parentNode}catch{return!1}return D!==d}var qr={__proto__:null,on:nt,off:at,stopPropagation:Dr,disableScrollPropagation:ba,disableClickPropagation:Aa,preventDefault:va,stop:Pa,getPropagationPath:ge,getMousePosition:Ue,getWheelDelta:Tt,isExternalTarget:xr,addListener:nt,removeListener:at},Ra=W.extend({run:function(d,y,D,F){this.stop(),this._el=d,this._inProgress=!0,this._duration=D||.25,this._easeOutPower=1/Math.max(F||.5,.2),this._startPos=ia(d),this._offset=y.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=J(this._animate,this),this._step()},_step:function(d){var y=+new Date-this._startTime,D=this._duration*1e3;y<D?this._runFrame(this._easeOut(y/D),d):(this._runFrame(1),this._complete())},_runFrame:function(d,y){var D=this._startPos.add(this._offset.multiplyBy(d));y&&D._round(),xa(this._el,D),this.fire("step")},_complete:function(){ee(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(d){return 1-Math.pow(1-d,this._easeOutPower)}}),kr=W.extend({options:{crs:xe,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(d,y){y=R(this,y),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(d),this._initLayout(),this._onResize=h(this._onResize,this),this._initEvents(),y.maxBounds&&this.setMaxBounds(y.maxBounds),y.zoom!==void 0&&(this._zoom=this._limitZoom(y.zoom)),y.center&&y.zoom!==void 0&&this.setView(Ne(y.center),y.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=$t&&rr.any3d&&!rr.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),nt(this._proxy,Vr,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(d,y,D){if(y=y===void 0?this._zoom:this._limitZoom(y),d=this._limitCenter(Ne(d),y,this.options.maxBounds),D=D||{},this._stop(),this._loaded&&!D.reset&&D!==!0){D.animate!==void 0&&(D.zoom=c({animate:D.animate},D.zoom),D.pan=c({animate:D.animate,duration:D.duration},D.pan));var F=this._zoom!==y?this._tryAnimatedZoom&&this._tryAnimatedZoom(d,y,D.zoom):this._tryAnimatedPan(d,D.pan);if(F)return clearTimeout(this._sizeTimer),this}return this._resetView(d,y,D.pan&&D.pan.noMoveStart),this},setZoom:function(d,y){return this._loaded?this.setView(this.getCenter(),d,{zoom:y}):(this._zoom=d,this)},zoomIn:function(d,y){return d=d||(rr.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+d,y)},zoomOut:function(d,y){return d=d||(rr.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-d,y)},setZoomAround:function(d,y,D){var F=this.getZoomScale(y),Q=this.getSize().divideBy(2),ce=d instanceof ne?d:this.latLngToContainerPoint(d),Ae=ce.subtract(Q).multiplyBy(1-1/F),Qe=this.containerPointToLatLng(Q.add(Ae));return this.setView(Qe,y,{zoom:D})},_getBoundsCenterZoom:function(d,y){y=y||{},d=d.getBounds?d.getBounds():ie(d);var D=ve(y.paddingTopLeft||y.padding||[0,0]),F=ve(y.paddingBottomRight||y.padding||[0,0]),Q=this.getBoundsZoom(d,!1,D.add(F));if(Q=typeof y.maxZoom=="number"?Math.min(y.maxZoom,Q):Q,Q===1/0)return{center:d.getCenter(),zoom:Q};var ce=F.subtract(D).divideBy(2),Ae=this.project(d.getSouthWest(),Q),Qe=this.project(d.getNorthEast(),Q),dt=this.unproject(Ae.add(Qe).divideBy(2).add(ce),Q);return{center:dt,zoom:Q}},fitBounds:function(d,y){if(d=ie(d),!d.isValid())throw new Error("Bounds are not valid.");var D=this._getBoundsCenterZoom(d,y);return this.setView(D.center,D.zoom,y)},fitWorld:function(d){return this.fitBounds([[-90,-180],[90,180]],d)},panTo:function(d,y){return this.setView(d,this._zoom,{pan:y})},panBy:function(d,y){if(d=ve(d).round(),y=y||{},!d.x&&!d.y)return this.fire("moveend");if(y.animate!==!0&&!this.getSize().contains(d))return this._resetView(this.unproject(this.project(this.getCenter()).add(d)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new Ra,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),y.noMoveStart||this.fire("movestart"),y.animate!==!1){Rt(this._mapPane,"leaflet-pan-anim");var D=this._getMapPanePos().subtract(d).round();this._panAnim.run(this._mapPane,D,y.duration||.25,y.easeLinearity)}else this._rawPanBy(d),this.fire("move").fire("moveend");return this},flyTo:function(d,y,D){if(D=D||{},D.animate===!1||!rr.any3d)return this.setView(d,y,D);this._stop();var F=this.project(this.getCenter()),Q=this.project(d),ce=this.getSize(),Ae=this._zoom;d=Ne(d),y=y===void 0?Ae:y;var Qe=Math.max(ce.x,ce.y),dt=Qe*this.getZoomScale(Ae,y),Ht=Q.distanceTo(F)||1,vr=1.42,na=vr*vr;function an(ms){var ao=ms?-1:1,Jl=ms?dt:Qe,Lh=dt*dt-Qe*Qe+ao*na*na*Ht*Ht,cc=2*Jl*na*Ht,dc=Lh/cc,nl=Math.sqrt(dc*dc+1)-dc,Oo=nl<1e-9?-18:Math.log(nl);return Oo}function qs(ms){return(Math.exp(ms)-Math.exp(-ms))/2}function zs(ms){return(Math.exp(ms)+Math.exp(-ms))/2}function _i(ms){return qs(ms)/zs(ms)}var Hn=an(0);function Vn(ms){return Qe*(zs(Hn)/zs(Hn+vr*ms))}function vn(ms){return Qe*(zs(Hn)*_i(Hn+vr*ms)-qs(Hn))/na}function al(ms){return 1-Math.pow(1-ms,1.5)}var Js=Date.now(),Mo=(an(1)-Hn)/vr,yo=D.duration?1e3*D.duration:1e3*Mo*.8;function uc(){var ms=(Date.now()-Js)/yo,ao=al(ms)*Mo;ms<=1?(this._flyToFrame=J(uc,this),this._move(this.unproject(F.add(Q.subtract(F).multiplyBy(vn(ao)/Ht)),Ae),this.getScaleZoom(Qe/Vn(ao),Ae),{flyTo:!0})):this._move(d,y)._moveEnd(!0)}return this._moveStart(!0,D.noMoveStart),uc.call(this),this},flyToBounds:function(d,y){var D=this._getBoundsCenterZoom(d,y);return this.flyTo(D.center,D.zoom,y)},setMaxBounds:function(d){return d=ie(d),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),d.isValid()?(this.options.maxBounds=d,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(d){var y=this.options.minZoom;return this.options.minZoom=d,this._loaded&&y!==d&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(d):this},setMaxZoom:function(d){var y=this.options.maxZoom;return this.options.maxZoom=d,this._loaded&&y!==d&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(d):this},panInsideBounds:function(d,y){this._enforcingBounds=!0;var D=this.getCenter(),F=this._limitCenter(D,this._zoom,ie(d));return D.equals(F)||this.panTo(F,y),this._enforcingBounds=!1,this},panInside:function(d,y){y=y||{};var D=ve(y.paddingTopLeft||y.padding||[0,0]),F=ve(y.paddingBottomRight||y.padding||[0,0]),Q=this.project(this.getCenter()),ce=this.project(d),Ae=this.getPixelBounds(),Qe=Ce([Ae.min.add(D),Ae.max.subtract(F)]),dt=Qe.getSize();if(!Qe.contains(ce)){this._enforcingBounds=!0;var Ht=ce.subtract(Qe.getCenter()),vr=Qe.extend(ce).getSize().subtract(dt);Q.x+=Ht.x<0?-vr.x:vr.x,Q.y+=Ht.y<0?-vr.y:vr.y,this.panTo(this.unproject(Q),y),this._enforcingBounds=!1}return this},invalidateSize:function(d){if(!this._loaded)return this;d=c({animate:!1,pan:!0},d===!0?{animate:!0}:d);var y=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var D=this.getSize(),F=y.divideBy(2).round(),Q=D.divideBy(2).round(),ce=F.subtract(Q);return!ce.x&&!ce.y?this:(d.animate&&d.pan?this.panBy(ce):(d.pan&&this._rawPanBy(ce),this.fire("move"),d.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(h(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:y,newSize:D}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(d){if(d=this._locateOptions=c({timeout:1e4,watch:!1},d),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var y=h(this._handleGeolocationResponse,this),D=h(this._handleGeolocationError,this);return d.watch?this._locationWatchId=navigator.geolocation.watchPosition(y,D,d):navigator.geolocation.getCurrentPosition(y,D,d),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(d){if(this._container._leaflet_id){var y=d.code,D=d.message||(y===1?"permission denied":y===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:y,message:"Geolocation error: "+D+"."})}},_handleGeolocationResponse:function(d){if(this._container._leaflet_id){var y=d.coords.latitude,D=d.coords.longitude,F=new ye(y,D),Q=F.toBounds(d.coords.accuracy*2),ce=this._locateOptions;if(ce.setView){var Ae=this.getBoundsZoom(Q);this.setView(F,ce.maxZoom?Math.min(Ae,ce.maxZoom):Ae)}var Qe={latlng:F,bounds:Q,timestamp:d.timestamp};for(var dt in d.coords)typeof d.coords[dt]=="number"&&(Qe[dt]=d.coords[dt]);this.fire("locationfound",Qe)}},addHandler:function(d,y){if(!y)return this;var D=this[d]=new y(this);return this._handlers.push(D),this.options[d]&&D.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),Wt(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(ee(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var d;for(d in this._layers)this._layers[d].remove();for(d in this._panes)Wt(this._panes[d]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(d,y){var D="leaflet-pane"+(d?" leaflet-"+d.replace("Pane","")+"-pane":""),F=nr("div",D,y||this._mapPane);return d&&(this._panes[d]=F),F},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var d=this.getPixelBounds(),y=this.unproject(d.getBottomLeft()),D=this.unproject(d.getTopRight());return new pe(y,D)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(d,y,D){d=ie(d),D=ve(D||[0,0]);var F=this.getZoom()||0,Q=this.getMinZoom(),ce=this.getMaxZoom(),Ae=d.getNorthWest(),Qe=d.getSouthEast(),dt=this.getSize().subtract(D),Ht=Ce(this.project(Qe,F),this.project(Ae,F)).getSize(),vr=rr.any3d?this.options.zoomSnap:1,na=dt.x/Ht.x,an=dt.y/Ht.y,qs=y?Math.max(na,an):Math.min(na,an);return F=this.getScaleZoom(qs,F),vr&&(F=Math.round(F/(vr/100))*(vr/100),F=y?Math.ceil(F/vr)*vr:Math.floor(F/vr)*vr),Math.max(Q,Math.min(ce,F))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new ne(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(d,y){var D=this._getTopLeftPoint(d,y);return new Le(D,D.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(d){return this.options.crs.getProjectedBounds(d===void 0?this.getZoom():d)},getPane:function(d){return typeof d=="string"?this._panes[d]:d},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(d,y){var D=this.options.crs;return y=y===void 0?this._zoom:y,D.scale(d)/D.scale(y)},getScaleZoom:function(d,y){var D=this.options.crs;y=y===void 0?this._zoom:y;var F=D.zoom(d*D.scale(y));return isNaN(F)?1/0:F},project:function(d,y){return y=y===void 0?this._zoom:y,this.options.crs.latLngToPoint(Ne(d),y)},unproject:function(d,y){return y=y===void 0?this._zoom:y,this.options.crs.pointToLatLng(ve(d),y)},layerPointToLatLng:function(d){var y=ve(d).add(this.getPixelOrigin());return this.unproject(y)},latLngToLayerPoint:function(d){var y=this.project(Ne(d))._round();return y._subtract(this.getPixelOrigin())},wrapLatLng:function(d){return this.options.crs.wrapLatLng(Ne(d))},wrapLatLngBounds:function(d){return this.options.crs.wrapLatLngBounds(ie(d))},distance:function(d,y){return this.options.crs.distance(Ne(d),Ne(y))},containerPointToLayerPoint:function(d){return ve(d).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(d){return ve(d).add(this._getMapPanePos())},containerPointToLatLng:function(d){var y=this.containerPointToLayerPoint(ve(d));return this.layerPointToLatLng(y)},latLngToContainerPoint:function(d){return this.layerPointToContainerPoint(this.latLngToLayerPoint(Ne(d)))},mouseEventToContainerPoint:function(d){return Ue(d,this._container)},mouseEventToLayerPoint:function(d){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(d))},mouseEventToLatLng:function(d){return this.layerPointToLatLng(this.mouseEventToLayerPoint(d))},_initContainer:function(d){var y=this._container=lr(d);if(y){if(y._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");nt(y,"scroll",this._onScroll,this),this._containerId=b(y)},_initLayout:function(){var d=this._container;this._fadeAnimated=this.options.fadeAnimation&&rr.any3d,Rt(d,"leaflet-container"+(rr.touch?" leaflet-touch":"")+(rr.retina?" leaflet-retina":"")+(rr.ielt9?" leaflet-oldie":"")+(rr.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var y=Pr(d,"position");y!=="absolute"&&y!=="relative"&&y!=="fixed"&&y!=="sticky"&&(d.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var d=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),xa(this._mapPane,new ne(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Rt(d.markerPane,"leaflet-zoom-hide"),Rt(d.shadowPane,"leaflet-zoom-hide"))},_resetView:function(d,y,D){xa(this._mapPane,new ne(0,0));var F=!this._loaded;this._loaded=!0,y=this._limitZoom(y),this.fire("viewprereset");var Q=this._zoom!==y;this._moveStart(Q,D)._move(d,y)._moveEnd(Q),this.fire("viewreset"),F&&this.fire("load")},_moveStart:function(d,y){return d&&this.fire("zoomstart"),y||this.fire("movestart"),this},_move:function(d,y,D,F){y===void 0&&(y=this._zoom);var Q=this._zoom!==y;return this._zoom=y,this._lastCenter=d,this._pixelOrigin=this._getNewPixelOrigin(d),F?D&&D.pinch&&this.fire("zoom",D):((Q||D&&D.pinch)&&this.fire("zoom",D),this.fire("move",D)),this},_moveEnd:function(d){return d&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return ee(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(d){xa(this._mapPane,this._getMapPanePos().subtract(d))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(d){this._targets={},this._targets[b(this._container)]=this;var y=d?at:nt;y(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&y(window,"resize",this._onResize,this),rr.any3d&&this.options.transform3DLimit&&(d?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){ee(this._resizeRequest),this._resizeRequest=J(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var d=this._getMapPanePos();Math.max(Math.abs(d.x),Math.abs(d.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(d,y){for(var D=[],F,Q=y==="mouseout"||y==="mouseover",ce=d.target||d.srcElement,Ae=!1;ce;){if(F=this._targets[b(ce)],F&&(y==="click"||y==="preclick")&&this._draggableMoved(F)){Ae=!0;break}if(F&&F.listens(y,!0)&&(Q&&!xr(ce,d)||(D.push(F),Q))||ce===this._container)break;ce=ce.parentNode}return!D.length&&!Ae&&!Q&&this.listens(y,!0)&&(D=[this]),D},_isClickDisabled:function(d){for(;d&&d!==this._container;){if(d._leaflet_disable_click)return!0;d=d.parentNode}},_handleDOMEvent:function(d){var y=d.target||d.srcElement;if(!(!this._loaded||y._leaflet_disable_events||d.type==="click"&&this._isClickDisabled(y))){var D=d.type;D==="mousedown"&&Za(y),this._fireDOMEvent(d,D)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(d,y,D){if(d.type==="click"){var F=c({},d);F.type="preclick",this._fireDOMEvent(F,F.type,D)}var Q=this._findEventTargets(d,y);if(D){for(var ce=[],Ae=0;Ae<D.length;Ae++)D[Ae].listens(y,!0)&&ce.push(D[Ae]);Q=ce.concat(Q)}if(Q.length){y==="contextmenu"&&va(d);var Qe=Q[0],dt={originalEvent:d};if(d.type!=="keypress"&&d.type!=="keydown"&&d.type!=="keyup"){var Ht=Qe.getLatLng&&(!Qe._radius||Qe._radius<=10);dt.containerPoint=Ht?this.latLngToContainerPoint(Qe.getLatLng()):this.mouseEventToContainerPoint(d),dt.layerPoint=this.containerPointToLayerPoint(dt.containerPoint),dt.latlng=Ht?Qe.getLatLng():this.layerPointToLatLng(dt.layerPoint)}for(Ae=0;Ae<Q.length;Ae++)if(Q[Ae].fire(y,dt,!0),dt.originalEvent._stopped||Q[Ae].options.bubblingMouseEvents===!1&&U(this._mouseEvents,y)!==-1)return}},_draggableMoved:function(d){return d=d.dragging&&d.dragging.enabled()?d:this,d.dragging&&d.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var d=0,y=this._handlers.length;d<y;d++)this._handlers[d].disable()},whenReady:function(d,y){return this._loaded?d.call(y||this,{target:this}):this.on("load",d,y),this},_getMapPanePos:function(){return ia(this._mapPane)||new ne(0,0)},_moved:function(){var d=this._getMapPanePos();return d&&!d.equals([0,0])},_getTopLeftPoint:function(d,y){var D=d&&y!==void 0?this._getNewPixelOrigin(d,y):this.getPixelOrigin();return D.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(d,y){var D=this.getSize()._divideBy(2);return this.project(d,y)._subtract(D)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(d,y,D){var F=this._getNewPixelOrigin(D,y);return this.project(d,y)._subtract(F)},_latLngBoundsToNewLayerBounds:function(d,y,D){var F=this._getNewPixelOrigin(D,y);return Ce([this.project(d.getSouthWest(),y)._subtract(F),this.project(d.getNorthWest(),y)._subtract(F),this.project(d.getSouthEast(),y)._subtract(F),this.project(d.getNorthEast(),y)._subtract(F)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(d){return this.latLngToLayerPoint(d).subtract(this._getCenterLayerPoint())},_limitCenter:function(d,y,D){if(!D)return d;var F=this.project(d,y),Q=this.getSize().divideBy(2),ce=new Le(F.subtract(Q),F.add(Q)),Ae=this._getBoundsOffset(ce,D,y);return Math.abs(Ae.x)<=1&&Math.abs(Ae.y)<=1?d:this.unproject(F.add(Ae),y)},_limitOffset:function(d,y){if(!y)return d;var D=this.getPixelBounds(),F=new Le(D.min.add(d),D.max.add(d));return d.add(this._getBoundsOffset(F,y))},_getBoundsOffset:function(d,y,D){var F=Ce(this.project(y.getNorthEast(),D),this.project(y.getSouthWest(),D)),Q=F.min.subtract(d.min),ce=F.max.subtract(d.max),Ae=this._rebound(Q.x,-ce.x),Qe=this._rebound(Q.y,-ce.y);return new ne(Ae,Qe)},_rebound:function(d,y){return d+y>0?Math.round(d-y)/2:Math.max(0,Math.ceil(d))-Math.max(0,Math.floor(y))},_limitZoom:function(d){var y=this.getMinZoom(),D=this.getMaxZoom(),F=rr.any3d?this.options.zoomSnap:1;return F&&(d=Math.round(d/F)*F),Math.max(y,Math.min(D,d))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Yr(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(d,y){var D=this._getCenterOffset(d)._trunc();return(y&&y.animate)!==!0&&!this.getSize().contains(D)?!1:(this.panBy(D,y),!0)},_createAnimProxy:function(){var d=this._proxy=nr("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(d),this.on("zoomanim",function(y){var D=At,F=this._proxy.style[D];$a(this._proxy,this.project(y.center,y.zoom),this.getZoomScale(y.zoom,1)),F===this._proxy.style[D]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){Wt(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var d=this.getCenter(),y=this.getZoom();$a(this._proxy,this.project(d,y),this.getZoomScale(y,1))},_catchTransitionEnd:function(d){this._animatingZoom&&d.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(d,y,D){if(this._animatingZoom)return!0;if(D=D||{},!this._zoomAnimated||D.animate===!1||this._nothingToAnimate()||Math.abs(y-this._zoom)>this.options.zoomAnimationThreshold)return!1;var F=this.getZoomScale(y),Q=this._getCenterOffset(d)._divideBy(1-1/F);return D.animate!==!0&&!this.getSize().contains(Q)?!1:(J(function(){this._moveStart(!0,D.noMoveStart||!1)._animateZoom(d,y,!0)},this),!0)},_animateZoom:function(d,y,D,F){this._mapPane&&(D&&(this._animatingZoom=!0,this._animateToCenter=d,this._animateToZoom=y,Rt(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:d,zoom:y,noUpdate:F}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(h(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&Yr(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function ja(d,y){return new kr(d,y)}var Na=fe.extend({options:{position:"topright"},initialize:function(d){R(this,d)},getPosition:function(){return this.options.position},setPosition:function(d){var y=this._map;return y&&y.removeControl(this),this.options.position=d,y&&y.addControl(this),this},getContainer:function(){return this._container},addTo:function(d){this.remove(),this._map=d;var y=this._container=this.onAdd(d),D=this.getPosition(),F=d._controlCorners[D];return Rt(y,"leaflet-control"),D.indexOf("bottom")!==-1?F.insertBefore(y,F.firstChild):F.appendChild(y),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(Wt(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(d){this._map&&d&&d.screenX>0&&d.screenY>0&&this._map.getContainer().focus()}}),on=function(d){return new Na(d)};kr.include({addControl:function(d){return d.addTo(this),this},removeControl:function(d){return d.remove(),this},_initControlPos:function(){var d=this._controlCorners={},y="leaflet-",D=this._controlContainer=nr("div",y+"control-container",this._container);function F(Q,ce){var Ae=y+Q+" "+y+ce;d[Q+ce]=nr("div",Ae,D)}F("top","left"),F("top","right"),F("bottom","left"),F("bottom","right")},_clearControlPos:function(){for(var d in this._controlCorners)Wt(this._controlCorners[d]);Wt(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var or=Na.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(d,y,D,F){return D<F?-1:F<D?1:0}},initialize:function(d,y,D){R(this,D),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var F in d)this._addLayer(d[F],F);for(F in y)this._addLayer(y[F],F,!0)},onAdd:function(d){this._initLayout(),this._update(),this._map=d,d.on("zoomend",this._checkDisabledLayers,this);for(var y=0;y<this._layers.length;y++)this._layers[y].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(d){return Na.prototype.addTo.call(this,d),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var d=0;d<this._layers.length;d++)this._layers[d].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(d,y){return this._addLayer(d,y),this._map?this._update():this},addOverlay:function(d,y){return this._addLayer(d,y,!0),this._map?this._update():this},removeLayer:function(d){d.off("add remove",this._onLayerChange,this);var y=this._getLayer(b(d));return y&&this._layers.splice(this._layers.indexOf(y),1),this._map?this._update():this},expand:function(){Rt(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var d=this._map.getSize().y-(this._container.offsetTop+50);return d<this._section.clientHeight?(Rt(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=d+"px"):Yr(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return Yr(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var d="leaflet-control-layers",y=this._container=nr("div",d),D=this.options.collapsed;y.setAttribute("aria-haspopup",!0),Aa(y),ba(y);var F=this._section=nr("section",d+"-list");D&&(this._map.on("click",this.collapse,this),nt(y,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var Q=this._layersLink=nr("a",d+"-toggle",y);Q.href="#",Q.title="Layers",Q.setAttribute("role","button"),nt(Q,{keydown:function(ce){ce.keyCode===13&&this._expandSafely()},click:function(ce){va(ce),this._expandSafely()}},this),D||this.expand(),this._baseLayersList=nr("div",d+"-base",F),this._separator=nr("div",d+"-separator",F),this._overlaysList=nr("div",d+"-overlays",F),y.appendChild(F)},_getLayer:function(d){for(var y=0;y<this._layers.length;y++)if(this._layers[y]&&b(this._layers[y].layer)===d)return this._layers[y]},_addLayer:function(d,y,D){this._map&&d.on("add remove",this._onLayerChange,this),this._layers.push({layer:d,name:y,overlay:D}),this.options.sortLayers&&this._layers.sort(h(function(F,Q){return this.options.sortFunction(F.layer,Q.layer,F.name,Q.name)},this)),this.options.autoZIndex&&d.setZIndex&&(this._lastZIndex++,d.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;Or(this._baseLayersList),Or(this._overlaysList),this._layerControlInputs=[];var d,y,D,F,Q=0;for(D=0;D<this._layers.length;D++)F=this._layers[D],this._addItem(F),y=y||F.overlay,d=d||!F.overlay,Q+=F.overlay?0:1;return this.options.hideSingleBase&&(d=d&&Q>1,this._baseLayersList.style.display=d?"":"none"),this._separator.style.display=y&&d?"":"none",this},_onLayerChange:function(d){this._handlingClick||this._update();var y=this._getLayer(b(d.target)),D=y.overlay?d.type==="add"?"overlayadd":"overlayremove":d.type==="add"?"baselayerchange":null;D&&this._map.fire(D,y)},_createRadioElement:function(d,y){var D='<input type="radio" class="leaflet-control-layers-selector" name="'+d+'"'+(y?' checked="checked"':"")+"/>",F=document.createElement("div");return F.innerHTML=D,F.firstChild},_addItem:function(d){var y=document.createElement("label"),D=this._map.hasLayer(d.layer),F;d.overlay?(F=document.createElement("input"),F.type="checkbox",F.className="leaflet-control-layers-selector",F.defaultChecked=D):F=this._createRadioElement("leaflet-base-layers_"+b(this),D),this._layerControlInputs.push(F),F.layerId=b(d.layer),nt(F,"click",this._onInputClick,this);var Q=document.createElement("span");Q.innerHTML=" "+d.name;var ce=document.createElement("span");y.appendChild(ce),ce.appendChild(F),ce.appendChild(Q);var Ae=d.overlay?this._overlaysList:this._baseLayersList;return Ae.appendChild(y),this._checkDisabledLayers(),y},_onInputClick:function(){if(!this._preventClick){var d=this._layerControlInputs,y,D,F=[],Q=[];this._handlingClick=!0;for(var ce=d.length-1;ce>=0;ce--)y=d[ce],D=this._getLayer(y.layerId).layer,y.checked?F.push(D):y.checked||Q.push(D);for(ce=0;ce<Q.length;ce++)this._map.hasLayer(Q[ce])&&this._map.removeLayer(Q[ce]);for(ce=0;ce<F.length;ce++)this._map.hasLayer(F[ce])||this._map.addLayer(F[ce]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var d=this._layerControlInputs,y,D,F=this._map.getZoom(),Q=d.length-1;Q>=0;Q--)y=d[Q],D=this._getLayer(y.layerId).layer,y.disabled=D.options.minZoom!==void 0&&F<D.options.minZoom||D.options.maxZoom!==void 0&&F>D.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var d=this._section;this._preventClick=!0,nt(d,"click",va),this.expand();var y=this;setTimeout(function(){at(d,"click",va),y._preventClick=!1})}}),je=function(d,y,D){return new or(d,y,D)},ut=Na.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">−</span>',zoomOutTitle:"Zoom out"},onAdd:function(d){var y="leaflet-control-zoom",D=nr("div",y+" leaflet-bar"),F=this.options;return this._zoomInButton=this._createButton(F.zoomInText,F.zoomInTitle,y+"-in",D,this._zoomIn),this._zoomOutButton=this._createButton(F.zoomOutText,F.zoomOutTitle,y+"-out",D,this._zoomOut),this._updateDisabled(),d.on("zoomend zoomlevelschange",this._updateDisabled,this),D},onRemove:function(d){d.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(d){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(d.shiftKey?3:1))},_zoomOut:function(d){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(d.shiftKey?3:1))},_createButton:function(d,y,D,F,Q){var ce=nr("a",D,F);return ce.innerHTML=d,ce.href="#",ce.title=y,ce.setAttribute("role","button"),ce.setAttribute("aria-label",y),Aa(ce),nt(ce,"click",Pa),nt(ce,"click",Q,this),nt(ce,"click",this._refocusOnMap,this),ce},_updateDisabled:function(){var d=this._map,y="leaflet-disabled";Yr(this._zoomInButton,y),Yr(this._zoomOutButton,y),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||d._zoom===d.getMinZoom())&&(Rt(this._zoomOutButton,y),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||d._zoom===d.getMaxZoom())&&(Rt(this._zoomInButton,y),this._zoomInButton.setAttribute("aria-disabled","true"))}});kr.mergeOptions({zoomControl:!0}),kr.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new ut,this.addControl(this.zoomControl))});var Qt=function(d){return new ut(d)},ra=Na.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(d){var y="leaflet-control-scale",D=nr("div",y),F=this.options;return this._addScales(F,y+"-line",D),d.on(F.updateWhenIdle?"moveend":"move",this._update,this),d.whenReady(this._update,this),D},onRemove:function(d){d.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(d,y,D){d.metric&&(this._mScale=nr("div",y,D)),d.imperial&&(this._iScale=nr("div",y,D))},_update:function(){var d=this._map,y=d.getSize().y/2,D=d.distance(d.containerPointToLatLng([0,y]),d.containerPointToLatLng([this.options.maxWidth,y]));this._updateScales(D)},_updateScales:function(d){this.options.metric&&d&&this._updateMetric(d),this.options.imperial&&d&&this._updateImperial(d)},_updateMetric:function(d){var y=this._getRoundNum(d),D=y<1e3?y+" m":y/1e3+" km";this._updateScale(this._mScale,D,y/d)},_updateImperial:function(d){var y=d*3.2808399,D,F,Q;y>5280?(D=y/5280,F=this._getRoundNum(D),this._updateScale(this._iScale,F+" mi",F/D)):(Q=this._getRoundNum(y),this._updateScale(this._iScale,Q+" ft",Q/y))},_updateScale:function(d,y,D){d.style.width=Math.round(this.options.maxWidth*D)+"px",d.innerHTML=y},_getRoundNum:function(d){var y=Math.pow(10,(Math.floor(d)+"").length-1),D=d/y;return D=D>=10?10:D>=5?5:D>=3?3:D>=2?2:1,y*D}}),Sa=function(d){return new ra(d)},tn='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg>',Ba=Na.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(rr.inlineSvg?tn+" ":"")+"Leaflet</a>"},initialize:function(d){R(this,d),this._attributions={}},onAdd:function(d){d.attributionControl=this,this._container=nr("div","leaflet-control-attribution"),Aa(this._container);for(var y in d._layers)d._layers[y].getAttribution&&this.addAttribution(d._layers[y].getAttribution());return this._update(),d.on("layeradd",this._addAttribution,this),this._container},onRemove:function(d){d.off("layeradd",this._addAttribution,this)},_addAttribution:function(d){d.layer.getAttribution&&(this.addAttribution(d.layer.getAttribution()),d.layer.once("remove",function(){this.removeAttribution(d.layer.getAttribution())},this))},setPrefix:function(d){return this.options.prefix=d,this._update(),this},addAttribution:function(d){return d?(this._attributions[d]||(this._attributions[d]=0),this._attributions[d]++,this._update(),this):this},removeAttribution:function(d){return d?(this._attributions[d]&&(this._attributions[d]--,this._update()),this):this},_update:function(){if(this._map){var d=[];for(var y in this._attributions)this._attributions[y]&&d.push(y);var D=[];this.options.prefix&&D.push(this.options.prefix),d.length&&D.push(d.join(", ")),this._container.innerHTML=D.join(' <span aria-hidden="true">|</span> ')}}});kr.mergeOptions({attributionControl:!0}),kr.addInitHook(function(){this.options.attributionControl&&new Ba().addTo(this)});var Va=function(d){return new Ba(d)};Na.Layers=or,Na.Zoom=ut,Na.Scale=ra,Na.Attribution=Ba,on.layers=je,on.zoom=Qt,on.scale=Sa,on.attribution=Va;var Wa=fe.extend({initialize:function(d){this._map=d},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Wa.addTo=function(d,y){return d.addHandler(y,this),this};var ln={Events:X},rn=rr.touch?"touchstart mousedown":"mousedown",ps=W.extend({options:{clickTolerance:3},initialize:function(d,y,D,F){R(this,F),this._element=d,this._dragStartTarget=y||d,this._preventOutline=D},enable:function(){this._enabled||(nt(this._dragStartTarget,rn,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(ps._dragging===this&&this.finishDrag(!0),at(this._dragStartTarget,rn,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(d){if(this._enabled&&(this._moved=!1,!ga(this._element,"leaflet-zoom-anim"))){if(d.touches&&d.touches.length!==1){ps._dragging===this&&this.finishDrag();return}if(!(ps._dragging||d.shiftKey||d.which!==1&&d.button!==1&&!d.touches)&&(ps._dragging=this,this._preventOutline&&Za(this._element),ua(),oa(),!this._moving)){this.fire("down");var y=d.touches?d.touches[0]:d,D=ke(this._element);this._startPoint=new ne(y.clientX,y.clientY),this._startPos=ia(this._element),this._parentScale=Mt(D);var F=d.type==="mousedown";nt(document,F?"mousemove":"touchmove",this._onMove,this),nt(document,F?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(d){if(this._enabled){if(d.touches&&d.touches.length>1){this._moved=!0;return}var y=d.touches&&d.touches.length===1?d.touches[0]:d,D=new ne(y.clientX,y.clientY)._subtract(this._startPoint);!D.x&&!D.y||Math.abs(D.x)+Math.abs(D.y)<this.options.clickTolerance||(D.x/=this._parentScale.x,D.y/=this._parentScale.y,va(d),this._moved||(this.fire("dragstart"),this._moved=!0,Rt(document.body,"leaflet-dragging"),this._lastTarget=d.target||d.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),Rt(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(D),this._moving=!0,this._lastEvent=d,this._updatePosition())}},_updatePosition:function(){var d={originalEvent:this._lastEvent};this.fire("predrag",d),xa(this._element,this._newPos),this.fire("drag",d)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(d){Yr(document.body,"leaflet-dragging"),this._lastTarget&&(Yr(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),at(document,"mousemove touchmove",this._onMove,this),at(document,"mouseup touchend touchcancel",this._onUp,this),Xa(),Qa();var y=this._moved&&this._moving;this._moving=!1,ps._dragging=!1,y&&this.fire("dragend",{noInertia:d,distance:this._newPos.distanceTo(this._startPos)})}});function Vs(d,y,D){var F,Q=[1,4,2,8],ce,Ae,Qe,dt,Ht,vr,na,an;for(ce=0,vr=d.length;ce<vr;ce++)d[ce]._code=La(d[ce],y);for(Qe=0;Qe<4;Qe++){for(na=Q[Qe],F=[],ce=0,vr=d.length,Ae=vr-1;ce<vr;Ae=ce++)dt=d[ce],Ht=d[Ae],dt._code&na?Ht._code&na||(an=Ta(Ht,dt,na,y,D),an._code=La(an,y),F.push(an)):(Ht._code&na&&(an=Ta(Ht,dt,na,y,D),an._code=La(an,y),F.push(an)),F.push(dt));d=F}return d}function Ao(d,y){var D,F,Q,ce,Ae,Qe,dt,Ht,vr;if(!d||d.length===0)throw new Error("latlngs not passed");gs(d)||(console.warn("latlngs are not flat! Only the first ring will be used"),d=d[0]);var na=Ne([0,0]),an=ie(d),qs=an.getNorthWest().distanceTo(an.getSouthWest())*an.getNorthEast().distanceTo(an.getNorthWest());qs<1700&&(na=Kn(d));var zs=d.length,_i=[];for(D=0;D<zs;D++){var Hn=Ne(d[D]);_i.push(y.project(Ne([Hn.lat-na.lat,Hn.lng-na.lng])))}for(Qe=dt=Ht=0,D=0,F=zs-1;D<zs;F=D++)Q=_i[D],ce=_i[F],Ae=Q.y*ce.x-ce.y*Q.x,dt+=(Q.x+ce.x)*Ae,Ht+=(Q.y+ce.y)*Ae,Qe+=Ae*3;Qe===0?vr=_i[0]:vr=[dt/Qe,Ht/Qe];var Vn=y.unproject(ve(vr));return Ne([Vn.lat+na.lat,Vn.lng+na.lng])}function Kn(d){for(var y=0,D=0,F=0,Q=0;Q<d.length;Q++){var ce=Ne(d[Q]);y+=ce.lat,D+=ce.lng,F++}return Ne([y/F,D/F])}var js={__proto__:null,clipPolygon:Vs,polygonCenter:Ao,centroid:Kn};function to(d,y){if(!y||!d.length)return d.slice();var D=y*y;return d=Ut(d,D),d=Tn(d,D),d}function Fs(d,y,D){return Math.sqrt(En(d,y,D,!0))}function gl(d,y,D){return En(d,y,D)}function Tn(d,y){var D=d.length,F=typeof Uint8Array<"u"?Uint8Array:Array,Q=new F(D);Q[0]=Q[D-1]=1,Ee(d,Q,y,0,D-1);var ce,Ae=[];for(ce=0;ce<D;ce++)Q[ce]&&Ae.push(d[ce]);return Ae}function Ee(d,y,D,F,Q){var ce=0,Ae,Qe,dt;for(Qe=F+1;Qe<=Q-1;Qe++)dt=En(d[Qe],d[F],d[Q],!0),dt>ce&&(Ae=Qe,ce=dt);ce>D&&(y[Ae]=1,Ee(d,y,D,F,Ae),Ee(d,y,D,Ae,Q))}function Ut(d,y){for(var D=[d[0]],F=1,Q=0,ce=d.length;F<ce;F++)Ns(d[F],d[Q])>y&&(D.push(d[F]),Q=F);return Q<ce-1&&D.push(d[ce-1]),D}var mr;function aa(d,y,D,F,Q){var ce=F?mr:La(d,D),Ae=La(y,D),Qe,dt,Ht;for(mr=Ae;;){if(!(ce|Ae))return[d,y];if(ce&Ae)return!1;Qe=ce||Ae,dt=Ta(d,y,Qe,D,Q),Ht=La(dt,D),Qe===ce?(d=dt,ce=Ht):(y=dt,Ae=Ht)}}function Ta(d,y,D,F,Q){var ce=y.x-d.x,Ae=y.y-d.y,Qe=F.min,dt=F.max,Ht,vr;return D&8?(Ht=d.x+ce*(dt.y-d.y)/Ae,vr=dt.y):D&4?(Ht=d.x+ce*(Qe.y-d.y)/Ae,vr=Qe.y):D&2?(Ht=dt.x,vr=d.y+Ae*(dt.x-d.x)/ce):D&1&&(Ht=Qe.x,vr=d.y+Ae*(Qe.x-d.x)/ce),new ne(Ht,vr,Q)}function La(d,y){var D=0;return d.x<y.min.x?D|=1:d.x>y.max.x&&(D|=2),d.y<y.min.y?D|=4:d.y>y.max.y&&(D|=8),D}function Ns(d,y){var D=y.x-d.x,F=y.y-d.y;return D*D+F*F}function En(d,y,D,F){var Q=y.x,ce=y.y,Ae=D.x-Q,Qe=D.y-ce,dt=Ae*Ae+Qe*Qe,Ht;return dt>0&&(Ht=((d.x-Q)*Ae+(d.y-ce)*Qe)/dt,Ht>1?(Q=D.x,ce=D.y):Ht>0&&(Q+=Ae*Ht,ce+=Qe*Ht)),Ae=d.x-Q,Qe=d.y-ce,F?Ae*Ae+Qe*Qe:new ne(Q,ce)}function gs(d){return!V(d[0])||typeof d[0][0]!="object"&&typeof d[0][0]<"u"}function ss(d){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),gs(d)}function zi(d,y){var D,F,Q,ce,Ae,Qe,dt,Ht;if(!d||d.length===0)throw new Error("latlngs not passed");gs(d)||(console.warn("latlngs are not flat! Only the first ring will be used"),d=d[0]);var vr=Ne([0,0]),na=ie(d),an=na.getNorthWest().distanceTo(na.getSouthWest())*na.getNorthEast().distanceTo(na.getNorthWest());an<1700&&(vr=Kn(d));var qs=d.length,zs=[];for(D=0;D<qs;D++){var _i=Ne(d[D]);zs.push(y.project(Ne([_i.lat-vr.lat,_i.lng-vr.lng])))}for(D=0,F=0;D<qs-1;D++)F+=zs[D].distanceTo(zs[D+1])/2;if(F===0)Ht=zs[0];else for(D=0,ce=0;D<qs-1;D++)if(Ae=zs[D],Qe=zs[D+1],Q=Ae.distanceTo(Qe),ce+=Q,ce>F){dt=(ce-F)/Q,Ht=[Qe.x-dt*(Qe.x-Ae.x),Qe.y-dt*(Qe.y-Ae.y)];break}var Hn=y.unproject(ve(Ht));return Ne([Hn.lat+vr.lat,Hn.lng+vr.lng])}var Xn={__proto__:null,simplify:to,pointToSegmentDistance:Fs,closestPointOnSegment:gl,clipSegment:aa,_getEdgeIntersection:Ta,_getBitCode:La,_sqClosestPointOnSegment:En,isFlat:gs,_flat:ss,polylineCenter:zi},xl={project:function(d){return new ne(d.lng,d.lat)},unproject:function(d){return new ye(d.y,d.x)},bounds:new Le([-180,-90],[180,90])},Gi={R:6378137,R_MINOR:6356752314245179e-9,bounds:new Le([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(d){var y=Math.PI/180,D=this.R,F=d.lat*y,Q=this.R_MINOR/D,ce=Math.sqrt(1-Q*Q),Ae=ce*Math.sin(F),Qe=Math.tan(Math.PI/4-F/2)/Math.pow((1-Ae)/(1+Ae),ce/2);return F=-D*Math.log(Math.max(Qe,1e-10)),new ne(d.lng*y*D,F)},unproject:function(d){for(var y=180/Math.PI,D=this.R,F=this.R_MINOR/D,Q=Math.sqrt(1-F*F),ce=Math.exp(-d.y/D),Ae=Math.PI/2-2*Math.atan(ce),Qe=0,dt=.1,Ht;Qe<15&&Math.abs(dt)>1e-7;Qe++)Ht=Q*Math.sin(Ae),Ht=Math.pow((1-Ht)/(1+Ht),Q/2),dt=Math.PI/2-2*Math.atan(ce*Ht)-Ae,Ae+=dt;return new ye(Ae*y,d.x*y/D)}},ro={__proto__:null,LonLat:xl,Mercator:Gi,SphericalMercator:Oe},To=c({},me,{code:"EPSG:3395",projection:Gi,transformation:(function(){var d=.5/(Math.PI*Gi.R);return Pe(d,.5,-d,.5)})()}),ql=c({},me,{code:"EPSG:4326",projection:xl,transformation:Pe(1/180,1,-1/180,.5)}),Co=c({},Ge,{projection:xl,transformation:Pe(1,0,-1,0),scale:function(d){return Math.pow(2,d)},zoom:function(d){return Math.log(d)/Math.LN2},distance:function(d,y){var D=y.lng-d.lng,F=y.lat-d.lat;return Math.sqrt(D*D+F*F)},infinite:!0});Ge.Earth=me,Ge.EPSG3395=To,Ge.EPSG3857=xe,Ge.EPSG900913=We,Ge.EPSG4326=ql,Ge.Simple=Co;var bi=W.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(d){return d.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(d){return d&&d.removeLayer(this),this},getPane:function(d){return this._map.getPane(d?this.options[d]||d:this.options.pane)},addInteractiveTarget:function(d){return this._map._targets[b(d)]=this,this},removeInteractiveTarget:function(d){return delete this._map._targets[b(d)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(d){var y=d.target;if(y.hasLayer(this)){if(this._map=y,this._zoomAnimated=y._zoomAnimated,this.getEvents){var D=this.getEvents();y.on(D,this),this.once("remove",function(){y.off(D,this)},this)}this.onAdd(y),this.fire("add"),y.fire("layeradd",{layer:this})}}});kr.include({addLayer:function(d){if(!d._layerAdd)throw new Error("The provided object is not a Layer.");var y=b(d);return this._layers[y]?this:(this._layers[y]=d,d._mapToAdd=this,d.beforeAdd&&d.beforeAdd(this),this.whenReady(d._layerAdd,d),this)},removeLayer:function(d){var y=b(d);return this._layers[y]?(this._loaded&&d.onRemove(this),delete this._layers[y],this._loaded&&(this.fire("layerremove",{layer:d}),d.fire("remove")),d._map=d._mapToAdd=null,this):this},hasLayer:function(d){return b(d)in this._layers},eachLayer:function(d,y){for(var D in this._layers)d.call(y,this._layers[D]);return this},_addLayers:function(d){d=d?V(d)?d:[d]:[];for(var y=0,D=d.length;y<D;y++)this.addLayer(d[y])},_addZoomLimit:function(d){(!isNaN(d.options.maxZoom)||!isNaN(d.options.minZoom))&&(this._zoomBoundLayers[b(d)]=d,this._updateZoomLevels())},_removeZoomLimit:function(d){var y=b(d);this._zoomBoundLayers[y]&&(delete this._zoomBoundLayers[y],this._updateZoomLevels())},_updateZoomLevels:function(){var d=1/0,y=-1/0,D=this._getZoomSpan();for(var F in this._zoomBoundLayers){var Q=this._zoomBoundLayers[F].options;d=Q.minZoom===void 0?d:Math.min(d,Q.minZoom),y=Q.maxZoom===void 0?y:Math.max(y,Q.maxZoom)}this._layersMaxZoom=y===-1/0?void 0:y,this._layersMinZoom=d===1/0?void 0:d,D!==this._getZoomSpan()&&this.fire("zoomlevelschange"),this.options.maxZoom===void 0&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var el=bi.extend({initialize:function(d,y){R(this,y),this._layers={};var D,F;if(d)for(D=0,F=d.length;D<F;D++)this.addLayer(d[D])},addLayer:function(d){var y=this.getLayerId(d);return this._layers[y]=d,this._map&&this._map.addLayer(d),this},removeLayer:function(d){var y=d in this._layers?d:this.getLayerId(d);return this._map&&this._layers[y]&&this._map.removeLayer(this._layers[y]),delete this._layers[y],this},hasLayer:function(d){var y=typeof d=="number"?d:this.getLayerId(d);return y in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(d){var y=Array.prototype.slice.call(arguments,1),D,F;for(D in this._layers)F=this._layers[D],F[d]&&F[d].apply(F,y);return this},onAdd:function(d){this.eachLayer(d.addLayer,d)},onRemove:function(d){this.eachLayer(d.removeLayer,d)},eachLayer:function(d,y){for(var D in this._layers)d.call(y,this._layers[D]);return this},getLayer:function(d){return this._layers[d]},getLayers:function(){var d=[];return this.eachLayer(d.push,d),d},setZIndex:function(d){return this.invoke("setZIndex",d)},getLayerId:function(d){return b(d)}}),Ou=function(d,y){return new el(d,y)},Ss=el.extend({addLayer:function(d){return this.hasLayer(d)?this:(d.addEventParent(this),el.prototype.addLayer.call(this,d),this.fire("layeradd",{layer:d}))},removeLayer:function(d){return this.hasLayer(d)?(d in this._layers&&(d=this._layers[d]),d.removeEventParent(this),el.prototype.removeLayer.call(this,d),this.fire("layerremove",{layer:d})):this},setStyle:function(d){return this.invoke("setStyle",d)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var d=new pe;for(var y in this._layers){var D=this._layers[y];d.extend(D.getBounds?D.getBounds():D.getLatLng())}return d}}),Ru=function(d,y){return new Ss(d,y)},Un=fe.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(d){R(this,d)},createIcon:function(d){return this._createIcon("icon",d)},createShadow:function(d){return this._createIcon("shadow",d)},_createIcon:function(d,y){var D=this._getIconUrl(d);if(!D){if(d==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var F=this._createImg(D,y&&y.tagName==="IMG"?y:null);return this._setIconStyles(F,d),(this.options.crossOrigin||this.options.crossOrigin==="")&&(F.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),F},_setIconStyles:function(d,y){var D=this.options,F=D[y+"Size"];typeof F=="number"&&(F=[F,F]);var Q=ve(F),ce=ve(y==="shadow"&&D.shadowAnchor||D.iconAnchor||Q&&Q.divideBy(2,!0));d.className="leaflet-marker-"+y+" "+(D.className||""),ce&&(d.style.marginLeft=-ce.x+"px",d.style.marginTop=-ce.y+"px"),Q&&(d.style.width=Q.x+"px",d.style.height=Q.y+"px")},_createImg:function(d,y){return y=y||document.createElement("img"),y.src=d,y},_getIconUrl:function(d){return rr.retina&&this.options[d+"RetinaUrl"]||this.options[d+"Url"]}});function we(d){return new Un(d)}var tt=Un.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(d){return typeof tt.imagePath!="string"&&(tt.imagePath=this._detectIconPath()),(this.options.imagePath||tt.imagePath)+Un.prototype._getIconUrl.call(this,d)},_stripUrl:function(d){var y=function(D,F,Q){var ce=F.exec(D);return ce&&ce[Q]};return d=y(d,/^url\((['"])?(.+)\1\)$/,2),d&&y(d,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var d=nr("div","leaflet-default-icon-path",document.body),y=Pr(d,"background-image")||Pr(d,"backgroundImage");if(document.body.removeChild(d),y=this._stripUrl(y),y)return y;var D=document.querySelector('link[href$="leaflet.css"]');return D?D.href.substring(0,D.href.length-11-1):""}}),Jt=Wa.extend({initialize:function(d){this._marker=d},addHooks:function(){var d=this._marker._icon;this._draggable||(this._draggable=new ps(d,d,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),Rt(d,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&Yr(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(d){var y=this._marker,D=y._map,F=this._marker.options.autoPanSpeed,Q=this._marker.options.autoPanPadding,ce=ia(y._icon),Ae=D.getPixelBounds(),Qe=D.getPixelOrigin(),dt=Ce(Ae.min._subtract(Qe).add(Q),Ae.max._subtract(Qe).subtract(Q));if(!dt.contains(ce)){var Ht=ve((Math.max(dt.max.x,ce.x)-dt.max.x)/(Ae.max.x-dt.max.x)-(Math.min(dt.min.x,ce.x)-dt.min.x)/(Ae.min.x-dt.min.x),(Math.max(dt.max.y,ce.y)-dt.max.y)/(Ae.max.y-dt.max.y)-(Math.min(dt.min.y,ce.y)-dt.min.y)/(Ae.min.y-dt.min.y)).multiplyBy(F);D.panBy(Ht,{animate:!1}),this._draggable._newPos._add(Ht),this._draggable._startPos._add(Ht),xa(y._icon,this._draggable._newPos),this._onDrag(d),this._panRequest=J(this._adjustPan.bind(this,d))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(d){this._marker.options.autoPan&&(ee(this._panRequest),this._panRequest=J(this._adjustPan.bind(this,d)))},_onDrag:function(d){var y=this._marker,D=y._shadow,F=ia(y._icon),Q=y._map.layerPointToLatLng(F);D&&xa(D,F),y._latlng=Q,d.latlng=Q,d.oldLatLng=this._oldLatLng,y.fire("move",d).fire("drag",d)},_onDragEnd:function(d){ee(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",d)}}),br=bi.extend({options:{icon:new tt,interactive:!0,keyboard:!0,title:"",alt:"Marker",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(d,y){R(this,y),this._latlng=Ne(d)},onAdd:function(d){this._zoomAnimated=this._zoomAnimated&&d.options.markerZoomAnimation,this._zoomAnimated&&d.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(d){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&d.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(d){var y=this._latlng;return this._latlng=Ne(d),this.update(),this.fire("move",{oldLatLng:y,latlng:this._latlng})},setZIndexOffset:function(d){return this.options.zIndexOffset=d,this.update()},getIcon:function(){return this.options.icon},setIcon:function(d){return this.options.icon=d,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var d=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(d)}return this},_initIcon:function(){var d=this.options,y="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),D=d.icon.createIcon(this._icon),F=!1;D!==this._icon&&(this._icon&&this._removeIcon(),F=!0,d.title&&(D.title=d.title),D.tagName==="IMG"&&(D.alt=d.alt||"")),Rt(D,y),d.keyboard&&(D.tabIndex="0",D.setAttribute("role","button")),this._icon=D,d.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&nt(D,"focus",this._panOnFocus,this);var Q=d.icon.createShadow(this._shadow),ce=!1;Q!==this._shadow&&(this._removeShadow(),ce=!0),Q&&(Rt(Q,y),Q.alt=""),this._shadow=Q,d.opacity<1&&this._updateOpacity(),F&&this.getPane().appendChild(this._icon),this._initInteraction(),Q&&ce&&this.getPane(d.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&at(this._icon,"focus",this._panOnFocus,this),Wt(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&Wt(this._shadow),this._shadow=null},_setPos:function(d){this._icon&&xa(this._icon,d),this._shadow&&xa(this._shadow,d),this._zIndex=d.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(d){this._icon&&(this._icon.style.zIndex=this._zIndex+d)},_animateZoom:function(d){var y=this._map._latLngToNewLayerPoint(this._latlng,d.zoom,d.center).round();this._setPos(y)},_initInteraction:function(){if(this.options.interactive&&(Rt(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Jt)){var d=this.options.draggable;this.dragging&&(d=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Jt(this),d&&this.dragging.enable()}},setOpacity:function(d){return this.options.opacity=d,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var d=this.options.opacity;this._icon&&ea(this._icon,d),this._shadow&&ea(this._shadow,d)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var d=this._map;if(d){var y=this.options.icon.options,D=y.iconSize?ve(y.iconSize):ve(0,0),F=y.iconAnchor?ve(y.iconAnchor):ve(0,0);d.panInside(this._latlng,{paddingTopLeft:F,paddingBottomRight:D.subtract(F)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function Er(d,y){return new br(d,y)}var Sr=bi.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(d){this._renderer=d.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(d){return R(this,d),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&d&&Object.prototype.hasOwnProperty.call(d,"weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),Xr=Sr.extend({options:{fill:!0,radius:10},initialize:function(d,y){R(this,y),this._latlng=Ne(d),this._radius=this.options.radius},setLatLng:function(d){var y=this._latlng;return this._latlng=Ne(d),this.redraw(),this.fire("move",{oldLatLng:y,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(d){return this.options.radius=this._radius=d,this.redraw()},getRadius:function(){return this._radius},setStyle:function(d){var y=d&&d.radius||this._radius;return Sr.prototype.setStyle.call(this,d),this.setRadius(y),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var d=this._radius,y=this._radiusY||d,D=this._clickTolerance(),F=[d+D,y+D];this._pxBounds=new Le(this._point.subtract(F),this._point.add(F))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(d){return d.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function Cn(d,y){return new Xr(d,y)}var Nn=Xr.extend({initialize:function(d,y,D){if(typeof y=="number"&&(y=c({},D,{radius:y})),R(this,y),this._latlng=Ne(d),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(d){return this._mRadius=d,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var d=[this._radius,this._radiusY||this._radius];return new pe(this._map.layerPointToLatLng(this._point.subtract(d)),this._map.layerPointToLatLng(this._point.add(d)))},setStyle:Sr.prototype.setStyle,_project:function(){var d=this._latlng.lng,y=this._latlng.lat,D=this._map,F=D.options.crs;if(F.distance===me.distance){var Q=Math.PI/180,ce=this._mRadius/me.R/Q,Ae=D.project([y+ce,d]),Qe=D.project([y-ce,d]),dt=Ae.add(Qe).divideBy(2),Ht=D.unproject(dt).lat,vr=Math.acos((Math.cos(ce*Q)-Math.sin(y*Q)*Math.sin(Ht*Q))/(Math.cos(y*Q)*Math.cos(Ht*Q)))/Q;(isNaN(vr)||vr===0)&&(vr=ce/Math.cos(Math.PI/180*y)),this._point=dt.subtract(D.getPixelOrigin()),this._radius=isNaN(vr)?0:dt.x-D.project([Ht,d-vr]).x,this._radiusY=dt.y-Ae.y}else{var na=F.unproject(F.project(this._latlng).subtract([this._mRadius,0]));this._point=D.latLngToLayerPoint(this._latlng),this._radius=this._point.x-D.latLngToLayerPoint(na).x}this._updateBounds()}});function Dn(d,y,D){return new Nn(d,y,D)}var $i=Sr.extend({options:{smoothFactor:1,noClip:!1},initialize:function(d,y){R(this,y),this._setLatLngs(d)},getLatLngs:function(){return this._latlngs},setLatLngs:function(d){return this._setLatLngs(d),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(d){for(var y=1/0,D=null,F=En,Q,ce,Ae=0,Qe=this._parts.length;Ae<Qe;Ae++)for(var dt=this._parts[Ae],Ht=1,vr=dt.length;Ht<vr;Ht++){Q=dt[Ht-1],ce=dt[Ht];var na=F(d,Q,ce,!0);na<y&&(y=na,D=F(d,Q,ce))}return D&&(D.distance=Math.sqrt(y)),D},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return zi(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(d,y){return y=y||this._defaultShape(),d=Ne(d),y.push(d),this._bounds.extend(d),this.redraw()},_setLatLngs:function(d){this._bounds=new pe,this._latlngs=this._convertLatLngs(d)},_defaultShape:function(){return gs(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(d){for(var y=[],D=gs(d),F=0,Q=d.length;F<Q;F++)D?(y[F]=Ne(d[F]),this._bounds.extend(y[F])):y[F]=this._convertLatLngs(d[F]);return y},_project:function(){var d=new Le;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,d),this._bounds.isValid()&&d.isValid()&&(this._rawPxBounds=d,this._updateBounds())},_updateBounds:function(){var d=this._clickTolerance(),y=new ne(d,d);this._rawPxBounds&&(this._pxBounds=new Le([this._rawPxBounds.min.subtract(y),this._rawPxBounds.max.add(y)]))},_projectLatlngs:function(d,y,D){var F=d[0]instanceof ye,Q=d.length,ce,Ae;if(F){for(Ae=[],ce=0;ce<Q;ce++)Ae[ce]=this._map.latLngToLayerPoint(d[ce]),D.extend(Ae[ce]);y.push(Ae)}else for(ce=0;ce<Q;ce++)this._projectLatlngs(d[ce],y,D)},_clipPoints:function(){var d=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(d))){if(this.options.noClip){this._parts=this._rings;return}var y=this._parts,D,F,Q,ce,Ae,Qe,dt;for(D=0,Q=0,ce=this._rings.length;D<ce;D++)for(dt=this._rings[D],F=0,Ae=dt.length;F<Ae-1;F++)Qe=aa(dt[F],dt[F+1],d,F,!0),Qe&&(y[Q]=y[Q]||[],y[Q].push(Qe[0]),(Qe[1]!==dt[F+1]||F===Ae-2)&&(y[Q].push(Qe[1]),Q++))}},_simplifyPoints:function(){for(var d=this._parts,y=this.options.smoothFactor,D=0,F=d.length;D<F;D++)d[D]=to(d[D],y)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(d,y){var D,F,Q,ce,Ae,Qe,dt=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(d))return!1;for(D=0,ce=this._parts.length;D<ce;D++)for(Qe=this._parts[D],F=0,Ae=Qe.length,Q=Ae-1;F<Ae;Q=F++)if(!(!y&&F===0)&&Fs(d,Qe[Q],Qe[F])<=dt)return!0;return!1}});function Gl(d,y){return new $i(d,y)}$i._flat=ss;var Pi=$i.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Ao(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(d){var y=$i.prototype._convertLatLngs.call(this,d),D=y.length;return D>=2&&y[0]instanceof ye&&y[0].equals(y[D-1])&&y.pop(),y},_setLatLngs:function(d){$i.prototype._setLatLngs.call(this,d),gs(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return gs(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var d=this._renderer._bounds,y=this.options.weight,D=new ne(y,y);if(d=new Le(d.min.subtract(D),d.max.add(D)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(d))){if(this.options.noClip){this._parts=this._rings;return}for(var F=0,Q=this._rings.length,ce;F<Q;F++)ce=Vs(this._rings[F],d,!0),ce.length&&this._parts.push(ce)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(d){var y=!1,D,F,Q,ce,Ae,Qe,dt,Ht;if(!this._pxBounds||!this._pxBounds.contains(d))return!1;for(ce=0,dt=this._parts.length;ce<dt;ce++)for(D=this._parts[ce],Ae=0,Ht=D.length,Qe=Ht-1;Ae<Ht;Qe=Ae++)F=D[Ae],Q=D[Qe],F.y>d.y!=Q.y>d.y&&d.x<(Q.x-F.x)*(d.y-F.y)/(Q.y-F.y)+F.x&&(y=!y);return y||$i.prototype._containsPoint.call(this,d,!0)}});function Rs(d,y){return new Pi(d,y)}var li=Ss.extend({initialize:function(d,y){R(this,y),this._layers={},d&&this.addData(d)},addData:function(d){var y=V(d)?d:d.features,D,F,Q;if(y){for(D=0,F=y.length;D<F;D++)Q=y[D],(Q.geometries||Q.geometry||Q.features||Q.coordinates)&&this.addData(Q);return this}var ce=this.options;if(ce.filter&&!ce.filter(d))return this;var Ae=Ls(d,ce);return Ae?(Ae.feature=ft(d),Ae.defaultOptions=Ae.options,this.resetStyle(Ae),ce.onEachFeature&&ce.onEachFeature(d,Ae),this.addLayer(Ae)):this},resetStyle:function(d){return d===void 0?this.eachLayer(this.resetStyle,this):(d.options=c({},d.defaultOptions),this._setLayerStyle(d,this.options.style),this)},setStyle:function(d){return this.eachLayer(function(y){this._setLayerStyle(y,d)},this)},_setLayerStyle:function(d,y){d.setStyle&&(typeof y=="function"&&(y=y(d.feature)),d.setStyle(y))}});function Ls(d,y){var D=d.type==="Feature"?d.geometry:d,F=D?D.coordinates:null,Q=[],ce=y&&y.pointToLayer,Ae=y&&y.coordsToLatLng||Zl,Qe,dt,Ht,vr;if(!F&&!D)return null;switch(D.type){case"Point":return Qe=Ae(F),vi(ce,d,Qe,y);case"MultiPoint":for(Ht=0,vr=F.length;Ht<vr;Ht++)Qe=Ae(F[Ht]),Q.push(vi(ce,d,Qe,y));return new Ss(Q);case"LineString":case"MultiLineString":return dt=Yl(F,D.type==="LineString"?0:1,Ae),new $i(dt,y);case"Polygon":case"MultiPolygon":return dt=Yl(F,D.type==="Polygon"?1:2,Ae),new Pi(dt,y);case"GeometryCollection":for(Ht=0,vr=D.geometries.length;Ht<vr;Ht++){var na=Ls({geometry:D.geometries[Ht],type:"Feature",properties:d.properties},y);na&&Q.push(na)}return new Ss(Q);case"FeatureCollection":for(Ht=0,vr=D.features.length;Ht<vr;Ht++){var an=Ls(D.features[Ht],y);an&&Q.push(an)}return new Ss(Q);default:throw new Error("Invalid GeoJSON object.")}}function vi(d,y,D,F){return d?d(y,D):new br(D,F&&F.markersInheritOptions&&F)}function Zl(d){return new ye(d[1],d[0],d[2])}function Yl(d,y,D){for(var F=[],Q=0,ce=d.length,Ae;Q<ce;Q++)Ae=y?Yl(d[Q],y-1,D):(D||Zl)(d[Q]),F.push(Ae);return F}function Zi(d,y){return d=Ne(d),d.alt!==void 0?[v(d.lng,y),v(d.lat,y),v(d.alt,y)]:[v(d.lng,y),v(d.lat,y)]}function re(d,y,D,F){for(var Q=[],ce=0,Ae=d.length;ce<Ae;ce++)Q.push(y?re(d[ce],gs(d[ce])?0:y-1,D,F):Zi(d[ce],F));return!y&&D&&Q.length>0&&Q.push(Q[0].slice()),Q}function Fe(d,y){return d.feature?c({},d.feature,{geometry:y}):ft(y)}function ft(d){return d.type==="Feature"||d.type==="FeatureCollection"?d:{type:"Feature",properties:{},geometry:d}}var tr={toGeoJSON:function(d){return Fe(this,{type:"Point",coordinates:Zi(this.getLatLng(),d)})}};br.include(tr),Nn.include(tr),Xr.include(tr),$i.include({toGeoJSON:function(d){var y=!gs(this._latlngs),D=re(this._latlngs,y?1:0,!1,d);return Fe(this,{type:(y?"Multi":"")+"LineString",coordinates:D})}}),Pi.include({toGeoJSON:function(d){var y=!gs(this._latlngs),D=y&&!gs(this._latlngs[0]),F=re(this._latlngs,D?2:y?1:0,!0,d);return y||(F=[F]),Fe(this,{type:(D?"Multi":"")+"Polygon",coordinates:F})}}),el.include({toMultiPoint:function(d){var y=[];return this.eachLayer(function(D){y.push(D.toGeoJSON(d).geometry.coordinates)}),Fe(this,{type:"MultiPoint",coordinates:y})},toGeoJSON:function(d){var y=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(y==="MultiPoint")return this.toMultiPoint(d);var D=y==="GeometryCollection",F=[];return this.eachLayer(function(Q){if(Q.toGeoJSON){var ce=Q.toGeoJSON(d);if(D)F.push(ce.geometry);else{var Ae=ft(ce);Ae.type==="FeatureCollection"?F.push.apply(F,Ae.features):F.push(Ae)}}}),D?Fe(this,{geometries:F,type:"GeometryCollection"}):{type:"FeatureCollection",features:F}}});function _t(d,y){return new li(d,y)}var jr=_t,ha=bi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(d,y,D){this._url=d,this._bounds=ie(y),R(this,D)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Rt(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Wt(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(d){return this.options.opacity=d,this._image&&this._updateOpacity(),this},setStyle:function(d){return d.opacity&&this.setOpacity(d.opacity),this},bringToFront:function(){return this._map&&hr(this._image),this},bringToBack:function(){return this._map&&Rr(this._image),this},setUrl:function(d){return this._url=d,this._image&&(this._image.src=d),this},setBounds:function(d){return this._bounds=ie(d),this._map&&this._reset(),this},getEvents:function(){var d={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(d.zoomanim=this._animateZoom),d},setZIndex:function(d){return this.options.zIndex=d,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var d=this._url.tagName==="IMG",y=this._image=d?this._url:nr("img");if(Rt(y,"leaflet-image-layer"),this._zoomAnimated&&Rt(y,"leaflet-zoom-animated"),this.options.className&&Rt(y,this.options.className),y.onselectstart=_,y.onmousemove=_,y.onload=h(this.fire,this,"load"),y.onerror=h(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(y.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),d){this._url=y.src;return}y.src=this._url,y.alt=this.options.alt},_animateZoom:function(d){var y=this._map.getZoomScale(d.zoom),D=this._map._latLngBoundsToNewLayerBounds(this._bounds,d.zoom,d.center).min;$a(this._image,D,y)},_reset:function(){var d=this._image,y=new Le(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),D=y.getSize();xa(d,y.min),d.style.width=D.x+"px",d.style.height=D.y+"px"},_updateOpacity:function(){ea(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var d=this.options.errorOverlayUrl;d&&this._url!==d&&(this._url=d,this._image.src=d)},getCenter:function(){return this._bounds.getCenter()}}),ns=function(d,y,D){return new ha(d,y,D)},Fa=ha.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var d=this._url.tagName==="VIDEO",y=this._image=d?this._url:nr("video");if(Rt(y,"leaflet-image-layer"),this._zoomAnimated&&Rt(y,"leaflet-zoom-animated"),this.options.className&&Rt(y,this.options.className),y.onselectstart=_,y.onmousemove=_,y.onloadeddata=h(this.fire,this,"load"),d){for(var D=y.getElementsByTagName("source"),F=[],Q=0;Q<D.length;Q++)F.push(D[Q].src);this._url=D.length>0?F:[y.src];return}V(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(y.style,"objectFit")&&(y.style.objectFit="fill"),y.autoplay=!!this.options.autoplay,y.loop=!!this.options.loop,y.muted=!!this.options.muted,y.playsInline=!!this.options.playsInline;for(var ce=0;ce<this._url.length;ce++){var Ae=nr("source");Ae.src=this._url[ce],y.appendChild(Ae)}}});function Mn(d,y,D){return new Fa(d,y,D)}var Ya=ha.extend({_initImage:function(){var d=this._image=this._url;Rt(d,"leaflet-image-layer"),this._zoomAnimated&&Rt(d,"leaflet-zoom-animated"),this.options.className&&Rt(d,this.options.className),d.onselectstart=_,d.onmousemove=_}});function Wn(d,y,D){return new Ya(d,y,D)}var ca=bi.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(d,y){d&&(d instanceof ye||V(d))?(this._latlng=Ne(d),R(this,y)):(R(this,d),this._source=y),this.options.content&&(this._content=this.options.content)},openOn:function(d){return d=arguments.length?d:this._source._map,d.hasLayer(this)||d.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(d){return this._map?this.close():(arguments.length?this._source=d:d=this._source,this._prepareOpen(),this.openOn(d._map)),this},onAdd:function(d){this._zoomAnimated=d._zoomAnimated,this._container||this._initLayout(),d._fadeAnimated&&ea(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),d._fadeAnimated&&ea(this._container,1),this.bringToFront(),this.options.interactive&&(Rt(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(d){d._fadeAnimated?(ea(this._container,0),this._removeTimeout=setTimeout(h(Wt,void 0,this._container),200)):Wt(this._container),this.options.interactive&&(Yr(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(d){return this._latlng=Ne(d),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(d){return this._content=d,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var d={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(d.zoomanim=this._animateZoom),d},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&hr(this._container),this},bringToBack:function(){return this._map&&Rr(this._container),this},_prepareOpen:function(d){var y=this._source;if(!y._map)return!1;if(y instanceof Ss){y=null;var D=this._source._layers;for(var F in D)if(D[F]._map){y=D[F];break}if(!y)return!1;this._source=y}if(!d)if(y.getCenter)d=y.getCenter();else if(y.getLatLng)d=y.getLatLng();else if(y.getBounds)d=y.getBounds().getCenter();else throw new Error("Unable to get source layer LatLng.");return this.setLatLng(d),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var d=this._contentNode,y=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof y=="string")d.innerHTML=y;else{for(;d.hasChildNodes();)d.removeChild(d.firstChild);d.appendChild(y)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var d=this._map.latLngToLayerPoint(this._latlng),y=ve(this.options.offset),D=this._getAnchor();this._zoomAnimated?xa(this._container,d.add(D)):y=y.add(d).add(D);var F=this._containerBottom=-y.y,Q=this._containerLeft=-Math.round(this._containerWidth/2)+y.x;this._container.style.bottom=F+"px",this._container.style.left=Q+"px"}},_getAnchor:function(){return[0,0]}});kr.include({_initOverlay:function(d,y,D,F){var Q=y;return Q instanceof d||(Q=new d(F).setContent(y)),D&&Q.setLatLng(D),Q}}),bi.include({_initOverlay:function(d,y,D,F){var Q=D;return Q instanceof d?(R(Q,F),Q._source=this):(Q=y&&!F?y:new d(F,this),Q.setContent(D)),Q}});var On=ca.extend({options:{pane:"popupPane",offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(d){return d=arguments.length?d:this._source._map,!d.hasLayer(this)&&d._popup&&d._popup.options.autoClose&&d.removeLayer(d._popup),d._popup=this,ca.prototype.openOn.call(this,d)},onAdd:function(d){ca.prototype.onAdd.call(this,d),d.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof Sr||this._source.on("preclick",Dr))},onRemove:function(d){ca.prototype.onRemove.call(this,d),d.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof Sr||this._source.off("preclick",Dr))},getEvents:function(){var d=ca.prototype.getEvents.call(this);return(this.options.closeOnClick!==void 0?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(d.preclick=this.close),this.options.keepInView&&(d.moveend=this._adjustPan),d},_initLayout:function(){var d="leaflet-popup",y=this._container=nr("div",d+" "+(this.options.className||"")+" leaflet-zoom-animated"),D=this._wrapper=nr("div",d+"-content-wrapper",y);if(this._contentNode=nr("div",d+"-content",D),Aa(y),ba(this._contentNode),nt(y,"contextmenu",Dr),this._tipContainer=nr("div",d+"-tip-container",y),this._tip=nr("div",d+"-tip",this._tipContainer),this.options.closeButton){var F=this._closeButton=nr("a",d+"-close-button",y);F.setAttribute("role","button"),F.setAttribute("aria-label","Close popup"),F.href="#close",F.innerHTML='<span aria-hidden="true">×</span>',nt(F,"click",function(Q){va(Q),this.close()},this)}},_updateLayout:function(){var d=this._contentNode,y=d.style;y.width="",y.whiteSpace="nowrap";var D=d.offsetWidth;D=Math.min(D,this.options.maxWidth),D=Math.max(D,this.options.minWidth),y.width=D+1+"px",y.whiteSpace="",y.height="";var F=d.offsetHeight,Q=this.options.maxHeight,ce="leaflet-popup-scrolled";Q&&F>Q?(y.height=Q+"px",Rt(d,ce)):Yr(d,ce),this._containerWidth=this._container.offsetWidth},_animateZoom:function(d){var y=this._map._latLngToNewLayerPoint(this._latlng,d.zoom,d.center),D=this._getAnchor();xa(this._container,y.add(D))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var d=this._map,y=parseInt(Pr(this._container,"marginBottom"),10)||0,D=this._container.offsetHeight+y,F=this._containerWidth,Q=new ne(this._containerLeft,-D-this._containerBottom);Q._add(ia(this._container));var ce=d.layerPointToContainerPoint(Q),Ae=ve(this.options.autoPanPadding),Qe=ve(this.options.autoPanPaddingTopLeft||Ae),dt=ve(this.options.autoPanPaddingBottomRight||Ae),Ht=d.getSize(),vr=0,na=0;ce.x+F+dt.x>Ht.x&&(vr=ce.x+F-Ht.x+dt.x),ce.x-vr-Qe.x<0&&(vr=ce.x-Qe.x),ce.y+D+dt.y>Ht.y&&(na=ce.y+D-Ht.y+dt.y),ce.y-na-Qe.y<0&&(na=ce.y-Qe.y),(vr||na)&&(this.options.keepInView&&(this._autopanning=!0),d.fire("autopanstart").panBy([vr,na]))}},_getAnchor:function(){return ve(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),hs=function(d,y){return new On(d,y)};kr.mergeOptions({closePopupOnClick:!0}),kr.include({openPopup:function(d,y,D){return this._initOverlay(On,d,y,D).openOn(this),this},closePopup:function(d){return d=arguments.length?d:this._popup,d&&d.close(),this}}),bi.include({bindPopup:function(d,y){return this._popup=this._initOverlay(On,this._popup,d,y),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(d){return this._popup&&(this instanceof Ss||(this._popup._source=this),this._popup._prepareOpen(d||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(d){return this._popup&&this._popup.setContent(d),this},getPopup:function(){return this._popup},_openPopup:function(d){if(!(!this._popup||!this._map)){Pa(d);var y=d.layer||d.target;if(this._popup._source===y&&!(y instanceof Sr)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(d.latlng);return}this._popup._source=y,this.openPopup(d.latlng)}},_movePopup:function(d){this._popup.setLatLng(d.latlng)},_onKeyPress:function(d){d.originalEvent.keyCode===13&&this._openPopup(d)}});var Es=ca.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(d){ca.prototype.onAdd.call(this,d),this.setOpacity(this.options.opacity),d.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(d){ca.prototype.onRemove.call(this,d),d.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var d=ca.prototype.getEvents.call(this);return this.options.permanent||(d.preclick=this.close),d},_initLayout:function(){var d="leaflet-tooltip",y=d+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=nr("div",y),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+b(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(d){var y,D,F=this._map,Q=this._container,ce=F.latLngToContainerPoint(F.getCenter()),Ae=F.layerPointToContainerPoint(d),Qe=this.options.direction,dt=Q.offsetWidth,Ht=Q.offsetHeight,vr=ve(this.options.offset),na=this._getAnchor();Qe==="top"?(y=dt/2,D=Ht):Qe==="bottom"?(y=dt/2,D=0):Qe==="center"?(y=dt/2,D=Ht/2):Qe==="right"?(y=0,D=Ht/2):Qe==="left"?(y=dt,D=Ht/2):Ae.x<ce.x?(Qe="right",y=0,D=Ht/2):(Qe="left",y=dt+(vr.x+na.x)*2,D=Ht/2),d=d.subtract(ve(y,D,!0)).add(vr).add(na),Yr(Q,"leaflet-tooltip-right"),Yr(Q,"leaflet-tooltip-left"),Yr(Q,"leaflet-tooltip-top"),Yr(Q,"leaflet-tooltip-bottom"),Rt(Q,"leaflet-tooltip-"+Qe),xa(Q,d)},_updatePosition:function(){var d=this._map.latLngToLayerPoint(this._latlng);this._setPosition(d)},setOpacity:function(d){this.options.opacity=d,this._container&&ea(this._container,d)},_animateZoom:function(d){var y=this._map._latLngToNewLayerPoint(this._latlng,d.zoom,d.center);this._setPosition(y)},_getAnchor:function(){return ve(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),is=function(d,y){return new Es(d,y)};kr.include({openTooltip:function(d,y,D){return this._initOverlay(Es,d,y,D).openOn(this),this},closeTooltip:function(d){return d.close(),this}}),bi.include({bindTooltip:function(d,y){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(Es,this._tooltip,d,y),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(d){if(!(!d&&this._tooltipHandlersAdded)){var y=d?"off":"on",D={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?D.add=this._openTooltip:(D.mouseover=this._openTooltip,D.mouseout=this.closeTooltip,D.click=this._openTooltip,this._map?this._addFocusListeners():D.add=this._addFocusListeners),this._tooltip.options.sticky&&(D.mousemove=this._moveTooltip),this[y](D),this._tooltipHandlersAdded=!d}},openTooltip:function(d){return this._tooltip&&(this instanceof Ss||(this._tooltip._source=this),this._tooltip._prepareOpen(d)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(d){return this._tooltip&&this._tooltip.setContent(d),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(d){var y=typeof d.getElement=="function"&&d.getElement();y&&(nt(y,"focus",function(){this._tooltip._source=d,this.openTooltip()},this),nt(y,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(d){var y=typeof d.getElement=="function"&&d.getElement();y&&y.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(d){if(!(!this._tooltip||!this._map)){if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var y=this;this._map.once("moveend",function(){y._openOnceFlag=!1,y._openTooltip(d)});return}this._tooltip._source=d.layer||d.target,this.openTooltip(this._tooltip.options.sticky?d.latlng:void 0)}},_moveTooltip:function(d){var y=d.latlng,D,F;this._tooltip.options.sticky&&d.originalEvent&&(D=this._map.mouseEventToContainerPoint(d.originalEvent),F=this._map.containerPointToLayerPoint(D),y=this._map.layerPointToLatLng(F)),this._tooltip.setLatLng(y)}});var tl=Un.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(d){var y=d&&d.tagName==="DIV"?d:document.createElement("div"),D=this.options;if(D.html instanceof Element?(Or(y),y.appendChild(D.html)):y.innerHTML=D.html!==!1?D.html:"",D.bgPos){var F=ve(D.bgPos);y.style.backgroundPosition=-F.x+"px "+-F.y+"px"}return this._setIconStyles(y,"icon"),y},createShadow:function(){return null}});function yi(d){return new tl(d)}Un.Default=tt;var Do=bi.extend({options:{tileSize:256,opacity:1,updateWhenIdle:rr.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(d){R(this,d)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(d){d._addZoomLimit(this)},onRemove:function(d){this._removeAllTiles(),Wt(this._container),d._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(hr(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(Rr(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(d){return this.options.opacity=d,this._updateOpacity(),this},setZIndex:function(d){return this.options.zIndex=d,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var d=this._clampZoom(this._map.getZoom());d!==this._tileZoom&&(this._tileZoom=d,this._updateLevels()),this._update()}return this},getEvents:function(){var d={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=w(this._onMoveEnd,this.options.updateInterval,this)),d.move=this._onMove),this._zoomAnimated&&(d.zoomanim=this._animateZoom),d},createTile:function(){return document.createElement("div")},getTileSize:function(){var d=this.options.tileSize;return d instanceof ne?d:new ne(d,d)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(d){for(var y=this.getPane().children,D=-d(-1/0,1/0),F=0,Q=y.length,ce;F<Q;F++)ce=y[F].style.zIndex,y[F]!==this._container&&ce&&(D=d(D,+ce));isFinite(D)&&(this.options.zIndex=D+d(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!rr.ielt9){ea(this._container,this.options.opacity);var d=+new Date,y=!1,D=!1;for(var F in this._tiles){var Q=this._tiles[F];if(!(!Q.current||!Q.loaded)){var ce=Math.min(1,(d-Q.loaded)/200);ea(Q.el,ce),ce<1?y=!0:(Q.active?D=!0:this._onOpaqueTile(Q),Q.active=!0)}}D&&!this._noPrune&&this._pruneTiles(),y&&(ee(this._fadeFrame),this._fadeFrame=J(this._updateOpacity,this))}},_onOpaqueTile:_,_initContainer:function(){this._container||(this._container=nr("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var d=this._tileZoom,y=this.options.maxZoom;if(d!==void 0){for(var D in this._levels)D=Number(D),this._levels[D].el.children.length||D===d?(this._levels[D].el.style.zIndex=y-Math.abs(d-D),this._onUpdateLevel(D)):(Wt(this._levels[D].el),this._removeTilesAtZoom(D),this._onRemoveLevel(D),delete this._levels[D]);var F=this._levels[d],Q=this._map;return F||(F=this._levels[d]={},F.el=nr("div","leaflet-tile-container leaflet-zoom-animated",this._container),F.el.style.zIndex=y,F.origin=Q.project(Q.unproject(Q.getPixelOrigin()),d).round(),F.zoom=d,this._setZoomTransform(F,Q.getCenter(),Q.getZoom()),_(F.el.offsetWidth),this._onCreateLevel(F)),this._level=F,F}},_onUpdateLevel:_,_onRemoveLevel:_,_onCreateLevel:_,_pruneTiles:function(){if(this._map){var d,y,D=this._map.getZoom();if(D>this.options.maxZoom||D<this.options.minZoom){this._removeAllTiles();return}for(d in this._tiles)y=this._tiles[d],y.retain=y.current;for(d in this._tiles)if(y=this._tiles[d],y.current&&!y.active){var F=y.coords;this._retainParent(F.x,F.y,F.z,F.z-5)||this._retainChildren(F.x,F.y,F.z,F.z+2)}for(d in this._tiles)this._tiles[d].retain||this._removeTile(d)}},_removeTilesAtZoom:function(d){for(var y in this._tiles)this._tiles[y].coords.z===d&&this._removeTile(y)},_removeAllTiles:function(){for(var d in this._tiles)this._removeTile(d)},_invalidateAll:function(){for(var d in this._levels)Wt(this._levels[d].el),this._onRemoveLevel(Number(d)),delete this._levels[d];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(d,y,D,F){var Q=Math.floor(d/2),ce=Math.floor(y/2),Ae=D-1,Qe=new ne(+Q,+ce);Qe.z=+Ae;var dt=this._tileCoordsToKey(Qe),Ht=this._tiles[dt];return Ht&&Ht.active?(Ht.retain=!0,!0):(Ht&&Ht.loaded&&(Ht.retain=!0),Ae>F?this._retainParent(Q,ce,Ae,F):!1)},_retainChildren:function(d,y,D,F){for(var Q=2*d;Q<2*d+2;Q++)for(var ce=2*y;ce<2*y+2;ce++){var Ae=new ne(Q,ce);Ae.z=D+1;var Qe=this._tileCoordsToKey(Ae),dt=this._tiles[Qe];if(dt&&dt.active){dt.retain=!0;continue}else dt&&dt.loaded&&(dt.retain=!0);D+1<F&&this._retainChildren(Q,ce,D+1,F)}},_resetView:function(d){var y=d&&(d.pinch||d.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),y,y)},_animateZoom:function(d){this._setView(d.center,d.zoom,!0,d.noUpdate)},_clampZoom:function(d){var y=this.options;return y.minNativeZoom!==void 0&&d<y.minNativeZoom?y.minNativeZoom:y.maxNativeZoom!==void 0&&y.maxNativeZoom<d?y.maxNativeZoom:d},_setView:function(d,y,D,F){var Q=Math.round(y);this.options.maxZoom!==void 0&&Q>this.options.maxZoom||this.options.minZoom!==void 0&&Q<this.options.minZoom?Q=void 0:Q=this._clampZoom(Q);var ce=this.options.updateWhenZooming&&Q!==this._tileZoom;(!F||ce)&&(this._tileZoom=Q,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),Q!==void 0&&this._update(d),D||this._pruneTiles(),this._noPrune=!!D),this._setZoomTransforms(d,y)},_setZoomTransforms:function(d,y){for(var D in this._levels)this._setZoomTransform(this._levels[D],d,y)},_setZoomTransform:function(d,y,D){var F=this._map.getZoomScale(D,d.zoom),Q=d.origin.multiplyBy(F).subtract(this._map._getNewPixelOrigin(y,D)).round();rr.any3d?$a(d.el,Q,F):xa(d.el,Q)},_resetGrid:function(){var d=this._map,y=d.options.crs,D=this._tileSize=this.getTileSize(),F=this._tileZoom,Q=this._map.getPixelWorldBounds(this._tileZoom);Q&&(this._globalTileRange=this._pxBoundsToTileRange(Q)),this._wrapX=y.wrapLng&&!this.options.noWrap&&[Math.floor(d.project([0,y.wrapLng[0]],F).x/D.x),Math.ceil(d.project([0,y.wrapLng[1]],F).x/D.y)],this._wrapY=y.wrapLat&&!this.options.noWrap&&[Math.floor(d.project([y.wrapLat[0],0],F).y/D.x),Math.ceil(d.project([y.wrapLat[1],0],F).y/D.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(d){var y=this._map,D=y._animatingZoom?Math.max(y._animateToZoom,y.getZoom()):y.getZoom(),F=y.getZoomScale(D,this._tileZoom),Q=y.project(d,this._tileZoom).floor(),ce=y.getSize().divideBy(F*2);return new Le(Q.subtract(ce),Q.add(ce))},_update:function(d){var y=this._map;if(y){var D=this._clampZoom(y.getZoom());if(d===void 0&&(d=y.getCenter()),this._tileZoom!==void 0){var F=this._getTiledPixelBounds(d),Q=this._pxBoundsToTileRange(F),ce=Q.getCenter(),Ae=[],Qe=this.options.keepBuffer,dt=new Le(Q.getBottomLeft().subtract([Qe,-Qe]),Q.getTopRight().add([Qe,-Qe]));if(!(isFinite(Q.min.x)&&isFinite(Q.min.y)&&isFinite(Q.max.x)&&isFinite(Q.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var Ht in this._tiles){var vr=this._tiles[Ht].coords;(vr.z!==this._tileZoom||!dt.contains(new ne(vr.x,vr.y)))&&(this._tiles[Ht].current=!1)}if(Math.abs(D-this._tileZoom)>1){this._setView(d,D);return}for(var na=Q.min.y;na<=Q.max.y;na++)for(var an=Q.min.x;an<=Q.max.x;an++){var qs=new ne(an,na);if(qs.z=this._tileZoom,!!this._isValidTile(qs)){var zs=this._tiles[this._tileCoordsToKey(qs)];zs?zs.current=!0:Ae.push(qs)}}if(Ae.sort(function(Hn,Vn){return Hn.distanceTo(ce)-Vn.distanceTo(ce)}),Ae.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var _i=document.createDocumentFragment();for(an=0;an<Ae.length;an++)this._addTile(Ae[an],_i);this._level.el.appendChild(_i)}}}},_isValidTile:function(d){var y=this._map.options.crs;if(!y.infinite){var D=this._globalTileRange;if(!y.wrapLng&&(d.x<D.min.x||d.x>D.max.x)||!y.wrapLat&&(d.y<D.min.y||d.y>D.max.y))return!1}if(!this.options.bounds)return!0;var F=this._tileCoordsToBounds(d);return ie(this.options.bounds).overlaps(F)},_keyToBounds:function(d){return this._tileCoordsToBounds(this._keyToTileCoords(d))},_tileCoordsToNwSe:function(d){var y=this._map,D=this.getTileSize(),F=d.scaleBy(D),Q=F.add(D),ce=y.unproject(F,d.z),Ae=y.unproject(Q,d.z);return[ce,Ae]},_tileCoordsToBounds:function(d){var y=this._tileCoordsToNwSe(d),D=new pe(y[0],y[1]);return this.options.noWrap||(D=this._map.wrapLatLngBounds(D)),D},_tileCoordsToKey:function(d){return d.x+":"+d.y+":"+d.z},_keyToTileCoords:function(d){var y=d.split(":"),D=new ne(+y[0],+y[1]);return D.z=+y[2],D},_removeTile:function(d){var y=this._tiles[d];y&&(Wt(y.el),delete this._tiles[d],this.fire("tileunload",{tile:y.el,coords:this._keyToTileCoords(d)}))},_initTile:function(d){Rt(d,"leaflet-tile");var y=this.getTileSize();d.style.width=y.x+"px",d.style.height=y.y+"px",d.onselectstart=_,d.onmousemove=_,rr.ielt9&&this.options.opacity<1&&ea(d,this.options.opacity)},_addTile:function(d,y){var D=this._getTilePos(d),F=this._tileCoordsToKey(d),Q=this.createTile(this._wrapCoords(d),h(this._tileReady,this,d));this._initTile(Q),this.createTile.length<2&&J(h(this._tileReady,this,d,null,Q)),xa(Q,D),this._tiles[F]={el:Q,coords:d,current:!0},y.appendChild(Q),this.fire("tileloadstart",{tile:Q,coords:d})},_tileReady:function(d,y,D){y&&this.fire("tileerror",{error:y,tile:D,coords:d});var F=this._tileCoordsToKey(d);D=this._tiles[F],D&&(D.loaded=+new Date,this._map._fadeAnimated?(ea(D.el,0),ee(this._fadeFrame),this._fadeFrame=J(this._updateOpacity,this)):(D.active=!0,this._pruneTiles()),y||(Rt(D.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:D.el,coords:d})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),rr.ielt9||!this._map._fadeAnimated?J(this._pruneTiles,this):setTimeout(h(this._pruneTiles,this),250)))},_getTilePos:function(d){return d.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(d){var y=new ne(this._wrapX?x(d.x,this._wrapX):d.x,this._wrapY?x(d.y,this._wrapY):d.y);return y.z=d.z,y},_pxBoundsToTileRange:function(d){var y=this.getTileSize();return new Le(d.min.unscaleBy(y).floor(),d.max.unscaleBy(y).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var d in this._tiles)if(!this._tiles[d].loaded)return!1;return!0}});function hn(d){return new Do(d)}var Is=Do.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(d,y){this._url=d,y=R(this,y),y.detectRetina&&rr.retina&&y.maxZoom>0?(y.tileSize=Math.floor(y.tileSize/2),y.zoomReverse?(y.zoomOffset--,y.minZoom=Math.min(y.maxZoom,y.minZoom+1)):(y.zoomOffset++,y.maxZoom=Math.max(y.minZoom,y.maxZoom-1)),y.minZoom=Math.max(0,y.minZoom)):y.zoomReverse?y.minZoom=Math.min(y.maxZoom,y.minZoom):y.maxZoom=Math.max(y.minZoom,y.maxZoom),typeof y.subdomains=="string"&&(y.subdomains=y.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(d,y){return this._url===d&&y===void 0&&(y=!0),this._url=d,y||this.redraw(),this},createTile:function(d,y){var D=document.createElement("img");return nt(D,"load",h(this._tileOnLoad,this,y,D)),nt(D,"error",h(this._tileOnError,this,y,D)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(D.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(D.referrerPolicy=this.options.referrerPolicy),D.alt="",D.src=this.getTileUrl(d),D},getTileUrl:function(d){var y={r:rr.retina?"@2x":"",s:this._getSubdomain(d),x:d.x,y:d.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var D=this._globalTileRange.max.y-d.y;this.options.tms&&(y.y=D),y["-y"]=D}return $(this._url,c(y,this.options))},_tileOnLoad:function(d,y){rr.ielt9?setTimeout(h(d,this,null,y),0):d(null,y)},_tileOnError:function(d,y,D){var F=this.options.errorTileUrl;F&&y.getAttribute("src")!==F&&(y.src=F),d(D,y)},_onTileRemove:function(d){d.tile.onload=null},_getZoomForUrl:function(){var d=this._tileZoom,y=this.options.maxZoom,D=this.options.zoomReverse,F=this.options.zoomOffset;return D&&(d=y-d),d+F},_getSubdomain:function(d){var y=Math.abs(d.x+d.y)%this.options.subdomains.length;return this.options.subdomains[y]},_abortLoading:function(){var d,y;for(d in this._tiles)if(this._tiles[d].coords.z!==this._tileZoom&&(y=this._tiles[d].el,y.onload=_,y.onerror=_,!y.complete)){y.src=z;var D=this._tiles[d].coords;Wt(y),delete this._tiles[d],this.fire("tileabort",{tile:y,coords:D})}},_removeTile:function(d){var y=this._tiles[d];if(y)return y.el.setAttribute("src",z),Do.prototype._removeTile.call(this,d)},_tileReady:function(d,y,D){if(!(!this._map||D&&D.getAttribute("src")===z))return Do.prototype._tileReady.call(this,d,y,D)}});function os(d,y){return new Is(d,y)}var Ws=Is.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(d,y){this._url=d;var D=c({},this.defaultWmsParams);for(var F in y)F in this.options||(D[F]=y[F]);y=R(this,y);var Q=y.detectRetina&&rr.retina?2:1,ce=this.getTileSize();D.width=ce.x*Q,D.height=ce.y*Q,this.wmsParams=D},onAdd:function(d){this._crs=this.options.crs||d.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var y=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[y]=this._crs.code,Is.prototype.onAdd.call(this,d)},getTileUrl:function(d){var y=this._tileCoordsToNwSe(d),D=this._crs,F=Ce(D.project(y[0]),D.project(y[1])),Q=F.min,ce=F.max,Ae=(this._wmsVersion>=1.3&&this._crs===ql?[Q.y,Q.x,ce.y,ce.x]:[Q.x,Q.y,ce.x,ce.y]).join(","),Qe=Is.prototype.getTileUrl.call(this,d);return Qe+O(this.wmsParams,Qe,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+Ae},setParams:function(d,y){return c(this.wmsParams,d),y||this.redraw(),this}});function $n(d,y){return new Ws(d,y)}Is.WMS=Ws,os.wms=$n;var mn=bi.extend({options:{padding:.1},initialize:function(d){R(this,d),b(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Rt(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var d={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(d.zoomanim=this._onAnimZoom),d},_onAnimZoom:function(d){this._updateTransform(d.center,d.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(d,y){var D=this._map.getZoomScale(y,this._zoom),F=this._map.getSize().multiplyBy(.5+this.options.padding),Q=this._map.project(this._center,y),ce=F.multiplyBy(-D).add(Q).subtract(this._map._getNewPixelOrigin(d,y));rr.any3d?$a(this._container,ce,D):xa(this._container,ce)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var d in this._layers)this._layers[d]._reset()},_onZoomEnd:function(){for(var d in this._layers)this._layers[d]._project()},_updatePaths:function(){for(var d in this._layers)this._layers[d]._update()},_update:function(){var d=this.options.padding,y=this._map.getSize(),D=this._map.containerPointToLayerPoint(y.multiplyBy(-d)).round();this._bounds=new Le(D,D.add(y.multiplyBy(1+d*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),ui=mn.extend({options:{tolerance:0},getEvents:function(){var d=mn.prototype.getEvents.call(this);return d.viewprereset=this._onViewPreReset,d},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){mn.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var d=this._container=document.createElement("canvas");nt(d,"mousemove",this._onMouseMove,this),nt(d,"click dblclick mousedown mouseup contextmenu",this._onClick,this),nt(d,"mouseout",this._handleMouseOut,this),d._leaflet_disable_events=!0,this._ctx=d.getContext("2d")},_destroyContainer:function(){ee(this._redrawRequest),delete this._ctx,Wt(this._container),at(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var d;this._redrawBounds=null;for(var y in this._layers)d=this._layers[y],d._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){mn.prototype._update.call(this);var d=this._bounds,y=this._container,D=d.getSize(),F=rr.retina?2:1;xa(y,d.min),y.width=F*D.x,y.height=F*D.y,y.style.width=D.x+"px",y.style.height=D.y+"px",rr.retina&&this._ctx.scale(2,2),this._ctx.translate(-d.min.x,-d.min.y),this.fire("update")}},_reset:function(){mn.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(d){this._updateDashArray(d),this._layers[b(d)]=d;var y=d._order={layer:d,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=y),this._drawLast=y,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(d){this._requestRedraw(d)},_removePath:function(d){var y=d._order,D=y.next,F=y.prev;D?D.prev=F:this._drawLast=F,F?F.next=D:this._drawFirst=D,delete d._order,delete this._layers[b(d)],this._requestRedraw(d)},_updatePath:function(d){this._extendRedrawBounds(d),d._project(),d._update(),this._requestRedraw(d)},_updateStyle:function(d){this._updateDashArray(d),this._requestRedraw(d)},_updateDashArray:function(d){if(typeof d.options.dashArray=="string"){var y=d.options.dashArray.split(/[, ]+/),D=[],F,Q;for(Q=0;Q<y.length;Q++){if(F=Number(y[Q]),isNaN(F))return;D.push(F)}d.options._dashArray=D}else d.options._dashArray=d.options.dashArray},_requestRedraw:function(d){this._map&&(this._extendRedrawBounds(d),this._redrawRequest=this._redrawRequest||J(this._redraw,this))},_extendRedrawBounds:function(d){if(d._pxBounds){var y=(d.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new Le,this._redrawBounds.extend(d._pxBounds.min.subtract([y,y])),this._redrawBounds.extend(d._pxBounds.max.add([y,y]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var d=this._redrawBounds;if(d){var y=d.getSize();this._ctx.clearRect(d.min.x,d.min.y,y.x,y.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var d,y=this._redrawBounds;if(this._ctx.save(),y){var D=y.getSize();this._ctx.beginPath(),this._ctx.rect(y.min.x,y.min.y,D.x,D.y),this._ctx.clip()}this._drawing=!0;for(var F=this._drawFirst;F;F=F.next)d=F.layer,(!y||d._pxBounds&&d._pxBounds.intersects(y))&&d._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(d,y){if(this._drawing){var D,F,Q,ce,Ae=d._parts,Qe=Ae.length,dt=this._ctx;if(Qe){for(dt.beginPath(),D=0;D<Qe;D++){for(F=0,Q=Ae[D].length;F<Q;F++)ce=Ae[D][F],dt[F?"lineTo":"moveTo"](ce.x,ce.y);y&&dt.closePath()}this._fillStroke(dt,d)}}},_updateCircle:function(d){if(!(!this._drawing||d._empty())){var y=d._point,D=this._ctx,F=Math.max(Math.round(d._radius),1),Q=(Math.max(Math.round(d._radiusY),1)||F)/F;Q!==1&&(D.save(),D.scale(1,Q)),D.beginPath(),D.arc(y.x,y.y/Q,F,0,Math.PI*2,!1),Q!==1&&D.restore(),this._fillStroke(D,d)}},_fillStroke:function(d,y){var D=y.options;D.fill&&(d.globalAlpha=D.fillOpacity,d.fillStyle=D.fillColor||D.color,d.fill(D.fillRule||"evenodd")),D.stroke&&D.weight!==0&&(d.setLineDash&&d.setLineDash(y.options&&y.options._dashArray||[]),d.globalAlpha=D.opacity,d.lineWidth=D.weight,d.strokeStyle=D.color,d.lineCap=D.lineCap,d.lineJoin=D.lineJoin,d.stroke())},_onClick:function(d){for(var y=this._map.mouseEventToLayerPoint(d),D,F,Q=this._drawFirst;Q;Q=Q.next)D=Q.layer,D.options.interactive&&D._containsPoint(y)&&(!(d.type==="click"||d.type==="preclick")||!this._map._draggableMoved(D))&&(F=D);this._fireEvent(F?[F]:!1,d)},_onMouseMove:function(d){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var y=this._map.mouseEventToLayerPoint(d);this._handleMouseHover(d,y)}},_handleMouseOut:function(d){var y=this._hoveredLayer;y&&(Yr(this._container,"leaflet-interactive"),this._fireEvent([y],d,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(d,y){if(!this._mouseHoverThrottled){for(var D,F,Q=this._drawFirst;Q;Q=Q.next)D=Q.layer,D.options.interactive&&D._containsPoint(y)&&(F=D);F!==this._hoveredLayer&&(this._handleMouseOut(d),F&&(Rt(this._container,"leaflet-interactive"),this._fireEvent([F],d,"mouseover"),this._hoveredLayer=F)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,d),this._mouseHoverThrottled=!0,setTimeout(h(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(d,y,D){this._map._fireDOMEvent(y,D||y.type,d)},_bringToFront:function(d){var y=d._order;if(y){var D=y.next,F=y.prev;if(D)D.prev=F;else return;F?F.next=D:D&&(this._drawFirst=D),y.prev=this._drawLast,this._drawLast.next=y,y.next=null,this._drawLast=y,this._requestRedraw(d)}},_bringToBack:function(d){var y=d._order;if(y){var D=y.next,F=y.prev;if(F)F.next=D;else return;D?D.prev=F:F&&(this._drawLast=F),y.prev=null,y.next=this._drawFirst,this._drawFirst.prev=y,this._drawFirst=y,this._requestRedraw(d)}}});function ci(d){return rr.canvas?new ui(d):null}var di=(function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(d){return document.createElement("<lvml:"+d+' class="lvml">')}}catch{}return function(d){return document.createElement("<"+d+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),bo={_initContainer:function(){this._container=nr("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(mn.prototype._update.call(this),this.fire("update"))},_initPath:function(d){var y=d._container=di("shape");Rt(y,"leaflet-vml-shape "+(this.options.className||"")),y.coordsize="1 1",d._path=di("path"),y.appendChild(d._path),this._updateStyle(d),this._layers[b(d)]=d},_addPath:function(d){var y=d._container;this._container.appendChild(y),d.options.interactive&&d.addInteractiveTarget(y)},_removePath:function(d){var y=d._container;Wt(y),d.removeInteractiveTarget(y),delete this._layers[b(d)]},_updateStyle:function(d){var y=d._stroke,D=d._fill,F=d.options,Q=d._container;Q.stroked=!!F.stroke,Q.filled=!!F.fill,F.stroke?(y||(y=d._stroke=di("stroke")),Q.appendChild(y),y.weight=F.weight+"px",y.color=F.color,y.opacity=F.opacity,F.dashArray?y.dashStyle=V(F.dashArray)?F.dashArray.join(" "):F.dashArray.replace(/( *, *)/g," "):y.dashStyle="",y.endcap=F.lineCap.replace("butt","flat"),y.joinstyle=F.lineJoin):y&&(Q.removeChild(y),d._stroke=null),F.fill?(D||(D=d._fill=di("fill")),Q.appendChild(D),D.color=F.fillColor||F.color,D.opacity=F.fillOpacity):D&&(Q.removeChild(D),d._fill=null)},_updateCircle:function(d){var y=d._point.round(),D=Math.round(d._radius),F=Math.round(d._radiusY||D);this._setPath(d,d._empty()?"M0 0":"AL "+y.x+","+y.y+" "+D+","+F+" 0,"+65535*360)},_setPath:function(d,y){d._path.v=y},_bringToFront:function(d){hr(d._container)},_bringToBack:function(d){Rr(d._container)}},vo=rr.vml?di:qe,Xl=mn.extend({_initContainer:function(){this._container=vo("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=vo("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Wt(this._container),at(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){mn.prototype._update.call(this);var d=this._bounds,y=d.getSize(),D=this._container;(!this._svgSize||!this._svgSize.equals(y))&&(this._svgSize=y,D.setAttribute("width",y.x),D.setAttribute("height",y.y)),xa(D,d.min),D.setAttribute("viewBox",[d.min.x,d.min.y,y.x,y.y].join(" ")),this.fire("update")}},_initPath:function(d){var y=d._path=vo("path");d.options.className&&Rt(y,d.options.className),d.options.interactive&&Rt(y,"leaflet-interactive"),this._updateStyle(d),this._layers[b(d)]=d},_addPath:function(d){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(d._path),d.addInteractiveTarget(d._path)},_removePath:function(d){Wt(d._path),d.removeInteractiveTarget(d._path),delete this._layers[b(d)]},_updatePath:function(d){d._project(),d._update()},_updateStyle:function(d){var y=d._path,D=d.options;y&&(D.stroke?(y.setAttribute("stroke",D.color),y.setAttribute("stroke-opacity",D.opacity),y.setAttribute("stroke-width",D.weight),y.setAttribute("stroke-linecap",D.lineCap),y.setAttribute("stroke-linejoin",D.lineJoin),D.dashArray?y.setAttribute("stroke-dasharray",D.dashArray):y.removeAttribute("stroke-dasharray"),D.dashOffset?y.setAttribute("stroke-dashoffset",D.dashOffset):y.removeAttribute("stroke-dashoffset")):y.setAttribute("stroke","none"),D.fill?(y.setAttribute("fill",D.fillColor||D.color),y.setAttribute("fill-opacity",D.fillOpacity),y.setAttribute("fill-rule",D.fillRule||"evenodd")):y.setAttribute("fill","none"))},_updatePoly:function(d,y){this._setPath(d,Xe(d._parts,y))},_updateCircle:function(d){var y=d._point,D=Math.max(Math.round(d._radius),1),F=Math.max(Math.round(d._radiusY),1)||D,Q="a"+D+","+F+" 0 1,0 ",ce=d._empty()?"M0 0":"M"+(y.x-D)+","+y.y+Q+D*2+",0 "+Q+-D*2+",0 ";this._setPath(d,ce)},_setPath:function(d,y){d._path.setAttribute("d",y)},_bringToFront:function(d){hr(d._path)},_bringToBack:function(d){Rr(d._path)}});rr.vml&&Xl.include(bo);function lc(d){return rr.svg||rr.vml?new Xl(d):null}kr.include({getRenderer:function(d){var y=d.options.renderer||this._getPaneRenderer(d.options.pane)||this.options.renderer||this._renderer;return y||(y=this._renderer=this._createRenderer()),this.hasLayer(y)||this.addLayer(y),y},_getPaneRenderer:function(d){if(d==="overlayPane"||d===void 0)return!1;var y=this._paneRenderers[d];return y===void 0&&(y=this._createRenderer({pane:d}),this._paneRenderers[d]=y),y},_createRenderer:function(d){return this.options.preferCanvas&&ci(d)||lc(d)}});var wi=Pi.extend({initialize:function(d,y){Pi.prototype.initialize.call(this,this._boundsToLatLngs(d),y)},setBounds:function(d){return this.setLatLngs(this._boundsToLatLngs(d))},_boundsToLatLngs:function(d){return d=ie(d),[d.getSouthWest(),d.getNorthWest(),d.getNorthEast(),d.getSouthEast()]}});function Ap(d,y){return new wi(d,y)}Xl.create=vo,Xl.pointsToPath=Xe,li.geometryToLayer=Ls,li.coordsToLatLng=Zl,li.coordsToLatLngs=Yl,li.latLngToCoords=Zi,li.latLngsToCoords=re,li.getFeature=Fe,li.asFeature=ft,kr.mergeOptions({boxZoom:!0});var ws=Wa.extend({initialize:function(d){this._map=d,this._container=d._container,this._pane=d._panes.overlayPane,this._resetStateTimeout=0,d.on("unload",this._destroy,this)},addHooks:function(){nt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){at(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Wt(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(d){if(!d.shiftKey||d.which!==1&&d.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),oa(),ua(),this._startPoint=this._map.mouseEventToContainerPoint(d),nt(document,{contextmenu:Pa,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(d){this._moved||(this._moved=!0,this._box=nr("div","leaflet-zoom-box",this._container),Rt(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(d);var y=new Le(this._point,this._startPoint),D=y.getSize();xa(this._box,y.min),this._box.style.width=D.x+"px",this._box.style.height=D.y+"px"},_finish:function(){this._moved&&(Wt(this._box),Yr(this._container,"leaflet-crosshair")),Qa(),Xa(),at(document,{contextmenu:Pa,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(d){if(!(d.which!==1&&d.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(h(this._resetState,this),0);var y=new pe(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(y).fire("boxzoomend",{boxZoomBounds:y})}},_onKeyDown:function(d){d.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});kr.addInitHook("addHandler","boxZoom",ws),kr.mergeOptions({doubleClickZoom:!0});var Wl=Wa.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(d){var y=this._map,D=y.getZoom(),F=y.options.zoomDelta,Q=d.originalEvent.shiftKey?D-F:D+F;y.options.doubleClickZoom==="center"?y.setZoom(Q):y.setZoomAround(d.containerPoint,Q)}});kr.addInitHook("addHandler","doubleClickZoom",Wl),kr.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var rl=Wa.extend({addHooks:function(){if(!this._draggable){var d=this._map;this._draggable=new ps(d._mapPane,d._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),d.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),d.on("zoomend",this._onZoomEnd,this),d.whenReady(this._onZoomEnd,this))}Rt(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Yr(this._map._container,"leaflet-grab"),Yr(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var d=this._map;if(d._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var y=ie(this._map.options.maxBounds);this._offsetLimit=Ce(this._map.latLngToContainerPoint(y.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(y.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;d.fire("movestart").fire("dragstart"),d.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(d){if(this._map.options.inertia){var y=this._lastTime=+new Date,D=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(D),this._times.push(y),this._prunePositions(y)}this._map.fire("move",d).fire("drag",d)},_prunePositions:function(d){for(;this._positions.length>1&&d-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var d=this._map.getSize().divideBy(2),y=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=y.subtract(d).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(d,y){return d-(d-y)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var d=this._draggable._newPos.subtract(this._draggable._startPos),y=this._offsetLimit;d.x<y.min.x&&(d.x=this._viscousLimit(d.x,y.min.x)),d.y<y.min.y&&(d.y=this._viscousLimit(d.y,y.min.y)),d.x>y.max.x&&(d.x=this._viscousLimit(d.x,y.max.x)),d.y>y.max.y&&(d.y=this._viscousLimit(d.y,y.max.y)),this._draggable._newPos=this._draggable._startPos.add(d)}},_onPreDragWrap:function(){var d=this._worldWidth,y=Math.round(d/2),D=this._initialWorldOffset,F=this._draggable._newPos.x,Q=(F-y+D)%d+y-D,ce=(F+y+D)%d-y-D,Ae=Math.abs(Q+D)<Math.abs(ce+D)?Q:ce;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=Ae},_onDragEnd:function(d){var y=this._map,D=y.options,F=!D.inertia||d.noInertia||this._times.length<2;if(y.fire("dragend",d),F)y.fire("moveend");else{this._prunePositions(+new Date);var Q=this._lastPos.subtract(this._positions[0]),ce=(this._lastTime-this._times[0])/1e3,Ae=D.easeLinearity,Qe=Q.multiplyBy(Ae/ce),dt=Qe.distanceTo([0,0]),Ht=Math.min(D.inertiaMaxSpeed,dt),vr=Qe.multiplyBy(Ht/dt),na=Ht/(D.inertiaDeceleration*Ae),an=vr.multiplyBy(-na/2).round();!an.x&&!an.y?y.fire("moveend"):(an=y._limitOffset(an,y.options.maxBounds),J(function(){y.panBy(an,{duration:na,easeLinearity:Ae,noMoveStart:!0,animate:!0})}))}}});kr.addInitHook("addHandler","dragging",rl),kr.mergeOptions({keyboard:!0,keyboardPanDelta:80});var rf=Wa.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(d){this._map=d,this._setPanDelta(d.options.keyboardPanDelta),this._setZoomDelta(d.options.zoomDelta)},addHooks:function(){var d=this._map._container;d.tabIndex<=0&&(d.tabIndex="0"),nt(d,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),at(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var d=document.body,y=document.documentElement,D=d.scrollTop||y.scrollTop,F=d.scrollLeft||y.scrollLeft;this._map._container.focus(),window.scrollTo(F,D)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(d){var y=this._panKeys={},D=this.keyCodes,F,Q;for(F=0,Q=D.left.length;F<Q;F++)y[D.left[F]]=[-1*d,0];for(F=0,Q=D.right.length;F<Q;F++)y[D.right[F]]=[d,0];for(F=0,Q=D.down.length;F<Q;F++)y[D.down[F]]=[0,d];for(F=0,Q=D.up.length;F<Q;F++)y[D.up[F]]=[0,-1*d]},_setZoomDelta:function(d){var y=this._zoomKeys={},D=this.keyCodes,F,Q;for(F=0,Q=D.zoomIn.length;F<Q;F++)y[D.zoomIn[F]]=d;for(F=0,Q=D.zoomOut.length;F<Q;F++)y[D.zoomOut[F]]=-d},_addHooks:function(){nt(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){at(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(d){if(!(d.altKey||d.ctrlKey||d.metaKey)){var y=d.keyCode,D=this._map,F;if(y in this._panKeys){if(!D._panAnim||!D._panAnim._inProgress)if(F=this._panKeys[y],d.shiftKey&&(F=ve(F).multiplyBy(3)),D.options.maxBounds&&(F=D._limitOffset(ve(F),D.options.maxBounds)),D.options.worldCopyJump){var Q=D.wrapLatLng(D.unproject(D.project(D.getCenter()).add(F)));D.panTo(Q)}else D.panBy(F)}else if(y in this._zoomKeys)D.setZoom(D.getZoom()+(d.shiftKey?3:1)*this._zoomKeys[y]);else if(y===27&&D._popup&&D._popup.options.closeOnEscapeKey)D.closePopup();else return;Pa(d)}}});kr.addInitHook("addHandler","keyboard",rf),kr.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var Yc=Wa.extend({addHooks:function(){nt(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){at(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(d){var y=Tt(d),D=this._map.options.wheelDebounceTime;this._delta+=y,this._lastMousePos=this._map.mouseEventToContainerPoint(d),this._startTime||(this._startTime=+new Date);var F=Math.max(D-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(h(this._performZoom,this),F),Pa(d)},_performZoom:function(){var d=this._map,y=d.getZoom(),D=this._map.options.zoomSnap||0;d._stop();var F=this._delta/(this._map.options.wheelPxPerZoomLevel*4),Q=4*Math.log(2/(1+Math.exp(-Math.abs(F))))/Math.LN2,ce=D?Math.ceil(Q/D)*D:Q,Ae=d._limitZoom(y+(this._delta>0?ce:-ce))-y;this._delta=0,this._startTime=null,Ae&&(d.options.scrollWheelZoom==="center"?d.setZoom(y+Ae):d.setZoomAround(this._lastMousePos,y+Ae))}});kr.addInitHook("addHandler","scrollWheelZoom",Yc);var bl=600;kr.mergeOptions({tapHold:rr.touchNative&&rr.safari&&rr.mobile,tapTolerance:15});var Lu=Wa.extend({addHooks:function(){nt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){at(this._map._container,"touchstart",this._onDown,this)},_onDown:function(d){if(clearTimeout(this._holdTimeout),d.touches.length===1){var y=d.touches[0];this._startPos=this._newPos=new ne(y.clientX,y.clientY),this._holdTimeout=setTimeout(h(function(){this._cancel(),this._isTapValid()&&(nt(document,"touchend",va),nt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",y))},this),bl),nt(document,"touchend touchcancel contextmenu",this._cancel,this),nt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function d(){at(document,"touchend",va),at(document,"touchend touchcancel",d)},_cancel:function(){clearTimeout(this._holdTimeout),at(document,"touchend touchcancel contextmenu",this._cancel,this),at(document,"touchmove",this._onMove,this)},_onMove:function(d){var y=d.touches[0];this._newPos=new ne(y.clientX,y.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(d,y){var D=new MouseEvent(d,{bubbles:!0,cancelable:!0,view:window,screenX:y.screenX,screenY:y.screenY,clientX:y.clientX,clientY:y.clientY});D._simulated=!0,y.target.dispatchEvent(D)}});kr.addInitHook("addHandler","tapHold",Lu),kr.mergeOptions({touchZoom:rr.touch,bounceAtZoomLimits:!0});var af=Wa.extend({addHooks:function(){Rt(this._map._container,"leaflet-touch-zoom"),nt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Yr(this._map._container,"leaflet-touch-zoom"),at(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(d){var y=this._map;if(!(!d.touches||d.touches.length!==2||y._animatingZoom||this._zooming)){var D=y.mouseEventToContainerPoint(d.touches[0]),F=y.mouseEventToContainerPoint(d.touches[1]);this._centerPoint=y.getSize()._divideBy(2),this._startLatLng=y.containerPointToLatLng(this._centerPoint),y.options.touchZoom!=="center"&&(this._pinchStartLatLng=y.containerPointToLatLng(D.add(F)._divideBy(2))),this._startDist=D.distanceTo(F),this._startZoom=y.getZoom(),this._moved=!1,this._zooming=!0,y._stop(),nt(document,"touchmove",this._onTouchMove,this),nt(document,"touchend touchcancel",this._onTouchEnd,this),va(d)}},_onTouchMove:function(d){if(!(!d.touches||d.touches.length!==2||!this._zooming)){var y=this._map,D=y.mouseEventToContainerPoint(d.touches[0]),F=y.mouseEventToContainerPoint(d.touches[1]),Q=D.distanceTo(F)/this._startDist;if(this._zoom=y.getScaleZoom(Q,this._startZoom),!y.options.bounceAtZoomLimits&&(this._zoom<y.getMinZoom()&&Q<1||this._zoom>y.getMaxZoom()&&Q>1)&&(this._zoom=y._limitZoom(this._zoom)),y.options.touchZoom==="center"){if(this._center=this._startLatLng,Q===1)return}else{var ce=D._add(F)._divideBy(2)._subtract(this._centerPoint);if(Q===1&&ce.x===0&&ce.y===0)return;this._center=y.unproject(y.project(this._pinchStartLatLng,this._zoom).subtract(ce),this._zoom)}this._moved||(y._moveStart(!0,!1),this._moved=!0),ee(this._animRequest);var Ae=h(y._move,y,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=J(Ae,this,!0),va(d)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,ee(this._animRequest),at(document,"touchmove",this._onTouchMove,this),at(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});kr.addInitHook("addHandler","touchZoom",af),kr.BoxZoom=ws,kr.DoubleClickZoom=Wl,kr.Drag=rl,kr.Keyboard=rf,kr.ScrollWheelZoom=Yc,kr.TapHold=Lu,kr.TouchZoom=af,l.Bounds=Le,l.Browser=rr,l.CRS=Ge,l.Canvas=ui,l.Circle=Nn,l.CircleMarker=Xr,l.Class=fe,l.Control=Na,l.DivIcon=tl,l.DivOverlay=ca,l.DomEvent=qr,l.DomUtil=Et,l.Draggable=ps,l.Evented=W,l.FeatureGroup=Ss,l.GeoJSON=li,l.GridLayer=Do,l.Handler=Wa,l.Icon=Un,l.ImageOverlay=ha,l.LatLng=ye,l.LatLngBounds=pe,l.Layer=bi,l.LayerGroup=el,l.LineUtil=Xn,l.Map=kr,l.Marker=br,l.Mixin=ln,l.Path=Sr,l.Point=ne,l.PolyUtil=js,l.Polygon=Pi,l.Polyline=$i,l.Popup=On,l.PosAnimation=Ra,l.Projection=ro,l.Rectangle=wi,l.Renderer=mn,l.SVG=Xl,l.SVGOverlay=Ya,l.TileLayer=Is,l.Tooltip=Es,l.Transformation=ue,l.Util=se,l.VideoOverlay=Fa,l.bind=h,l.bounds=Ce,l.canvas=ci,l.circle=Dn,l.circleMarker=Cn,l.control=on,l.divIcon=yi,l.extend=c,l.featureGroup=Ru,l.geoJSON=_t,l.geoJson=jr,l.gridLayer=hn,l.icon=we,l.imageOverlay=ns,l.latLng=Ne,l.latLngBounds=ie,l.layerGroup=Ou,l.map=ja,l.marker=Er,l.point=ve,l.polygon=Rs,l.polyline=Gl,l.popup=hs,l.rectangle=Ap,l.setOptions=R,l.stamp=b,l.svg=lc,l.svgOverlay=Wn,l.tileLayer=os,l.tooltip=is,l.transformation=Pe,l.version=u,l.videoOverlay=Mn;var nf=window.L;l.noConflict=function(){return window.L=nf,this},window.L=l}))})(Uv,Uv.exports)),Uv.exports}var Rg=xz();const bz=nT(Rg);function zC(a,o){const l=T.useRef(o);T.useEffect(function(){o!==l.current&&a.attributionControl!=null&&(l.current!=null&&a.attributionControl.removeAttribution(l.current),o!=null&&a.attributionControl.addAttribution(o)),l.current=o},[a,o])}const vz=1;function yz(a){return Object.freeze({__version:vz,map:a})}function wz(a,o){return Object.freeze({...a,...o})}const AN=T.createContext(null);function TN(){const a=T.use(AN);if(a==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return a}function _z(a){function o(l,u){const{instance:c,context:f}=a(l).current;T.useImperativeHandle(u,()=>c);const{children:h}=l;return h==null?null:T.createElement(AN,{value:f},h)}return T.forwardRef(o)}function kz(a){function o(l,u){const[c,f]=T.useState(!1),{instance:h}=a(l,f).current;T.useImperativeHandle(u,()=>h),T.useEffect(function(){c&&h.update()},[h,c,l.children]);const g=h._contentNode;return g?Mu.createPortal(l.children,g):null}return T.forwardRef(o)}function $C(a){function o(l,u){const{instance:c}=a(l).current;return T.useImperativeHandle(u,()=>c),null}return T.forwardRef(o)}function jz(a){return function(l){const u=TN(),c=a(l,u),{instance:f}=c.current,h=T.useRef(l.position),{position:g}=l;return T.useEffect(function(){return f.addTo(u.map),function(){f.remove()}},[u.map,f]),T.useEffect(function(){g!=null&&g!==h.current&&(f.setPosition(g),h.current=g)},[f,g]),c}}function PC(a,o){const l=T.useRef(void 0);T.useEffect(function(){return o!=null&&a.instance.on(o),l.current=o,function(){l.current!=null&&a.instance.off(l.current),l.current=null}},[a,o])}function CN(a,o){const l=a.pane??o.pane;return l?{...a,pane:l}:a}function Nz(a,o){return function(u,c){const f=TN(),h=a(CN(u,f),f);return zC(f.map,u.attribution),PC(h.current,u.eventHandlers),o(h.current,f,u,c),h}}function i_(a,o,l){return Object.freeze({instance:a,context:o,container:l})}function o_(a,o){return o==null?function(u,c){const f=T.useRef(void 0);return f.current||(f.current=a(u,c)),f}:function(u,c){const f=T.useRef(void 0);f.current||(f.current=a(u,c));const h=T.useRef(u),{instance:g}=f.current;return T.useEffect(function(){h.current!==u&&(o(g,u,h.current),h.current=u)},[g,u,o]),f}}function Sz(a,o){T.useEffect(function(){return(o.layerContainer??o.map).addLayer(a.instance),function(){o.layerContainer?.removeLayer(a.instance),o.map.removeLayer(a.instance)}},[o,a])}function BC(a){return function(l){const u=TN(),c=a(CN(l,u),u);return zC(u.map,l.attribution),PC(c.current,l.eventHandlers),Sz(c.current,u),c}}function Ez(a){function o(c,f){return i_(a(c),f)}const l=o_(o),u=jz(l);return $C(u)}function Az(a,o){const l=o_(a,o),u=BC(l);return _z(u)}function Tz(a,o){const l=o_(a),u=Nz(l,o);return kz(u)}function Cz(a,o){const l=o_(a,o),u=BC(l);return $C(u)}function Dz(a,o,l){const{opacity:u,zIndex:c}=o;u!=null&&u!==l.opacity&&a.setOpacity(u),c!=null&&c!==l.zIndex&&a.setZIndex(c)}function Mz({bounds:a,boundsOptions:o,center:l,children:u,className:c,id:f,placeholder:h,style:g,whenReady:b,zoom:w,...x},_){const[v]=T.useState({className:c,id:f,style:g}),[N,C]=T.useState(null),R=T.useRef(void 0);T.useImperativeHandle(_,()=>N?.map??null,[N]);const O=T.useCallback($=>{if($!==null&&!R.current){const V=new Rg.Map($,x);R.current=V,l!=null&&w!=null?V.setView(l,w):a!=null&&V.fitBounds(a,o),b!=null&&V.whenReady(b),C(yz(V))}},[]);T.useEffect(()=>()=>{N?.map.remove()},[N]);const E=N?T.createElement(AN,{value:N},u):h??null;return T.createElement("div",{...v,ref:O},E)}const Oz=T.forwardRef(Mz),Rz=Az(function({position:o,...l},u){const c=new Rg.Marker(o,l);return i_(c,wz(u,{overlayContainer:c}))},function(o,l,u){l.position!==u.position&&o.setLatLng(l.position),l.icon!=null&&l.icon!==u.icon&&o.setIcon(l.icon),l.zIndexOffset!=null&&l.zIndexOffset!==u.zIndexOffset&&o.setZIndexOffset(l.zIndexOffset),l.opacity!=null&&l.opacity!==u.opacity&&o.setOpacity(l.opacity),o.dragging!=null&&l.draggable!==u.draggable&&(l.draggable===!0?o.dragging.enable():o.dragging.disable())}),Lz=Tz(function(o,l){const u=new Rg.Popup(o,l.overlayContainer);return i_(u,l)},function(o,l,{position:u},c){T.useEffect(function(){const{instance:h}=o;function g(w){w.popup===h&&(h.update(),c(!0))}function b(w){w.popup===h&&c(!1)}return l.map.on({popupopen:g,popupclose:b}),l.overlayContainer==null?(u!=null&&h.setLatLng(u),h.openOn(l.map)):l.overlayContainer.bindPopup(h),function(){l.map.off({popupopen:g,popupclose:b}),l.overlayContainer?.unbindPopup(),l.map.removeLayer(h)}},[o,l,c,u])}),zz=Cz(function({url:o,...l},u){const c=new Rg.TileLayer(o,CN(l,u));return i_(c,u)},function(o,l,u){Dz(o,l,u);const{url:c}=l;c!=null&&c!==u.url&&o.setUrl(c)}),$z=Ez(function(o){return new Rg.Control.Zoom(o)}),N6="hive-worldmappin-styles",Pz=`
|
|
1126
|
+
`),ar(!1)},youtubeApiKey:v}),e.jsx(xN,{isOpen:xt,onClose:()=>St(!1),onSelectMeme:Ee=>{ut(``),St(!1)},ecencyToken:g,onSignMessage:b,signingUsername:w,onSigningStateChange:Vr}),e.jsx(vN,{isOpen:Jr,onClose:()=>ct(!1),onSelectMeme:(Ee,Ut)=>{ut(``),Ut&&dr(mr=>[...mr,Ut]),ct(!1)},ecencyToken:g,onSignMessage:b,signingUsername:w,onSigningStateChange:Vr,appAccount:se,theme:fe}),e.jsx(pN,{isOpen:Lr,onClose:()=>pa(!1),onSelectEmoji:Ee=>{ut(Ee),pa(!1)}}),e.jsx(gN,{isOpen:rr,onClose:()=>_a(!1),onSelectTemplate:ut,templates:Ur,authorFromUrl:c}),e.jsx(_N,{isOpen:Wt,onClose:()=>Or(!1),onSave:Ee=>{nr(Ee),ne?.(Ee)},initialData:Pr}),e.jsx(kN,{isOpen:Pa,onClose:()=>ge(!1),onSave:Ue,initialBeneficiaries:Aa,hasVideo:at,lockedAccounts:ir,lockReasons:Hr,favorites:ue}),e.jsx(yN,{isOpen:Ct,onClose:()=>Xt(!1),title:"Toolbar help",entries:(()=>{const Ee=[];return X||Ee.push({icon:e.jsx(Y.Eye,{className:"h-4 w-4"}),label:"Preview",description:"Toggle the rendered preview of your post above the textarea."}),R||Ee.push({icon:e.jsx(Y.Bold,{className:"h-4 w-4"}),label:"Bold",description:"Wrap the selected text in ** ** for bold."}),O||Ee.push({icon:e.jsx(Y.Italic,{className:"h-4 w-4"}),label:"Italic",description:"Wrap the selected text in * * for italic."}),E||Ee.push({icon:e.jsx(Y.Link,{className:"h-4 w-4"}),label:"Link",description:"Insert a markdown link — `[text](url)` — around the selection."}),I||Ee.push({icon:e.jsx(Y.Code,{className:"h-4 w-4"}),label:"Code",description:"Insert an inline `code` span or a fenced ``` block depending on the selection."}),q||Ee.push({icon:e.jsx(Y.AtSign,{className:"h-4 w-4"}),label:"Mention",description:c?`Insert @${c} at the cursor.`:"Insert @ at the cursor to mention a Hive account."}),!$&&Ba&&Ee.push({icon:e.jsx(Y.Image,{className:"h-4 w-4"}),label:"Image",description:"Upload an image — also works by drag-and-drop or paste into the textarea."}),!V&&x&&Ee.push({icon:e.jsx(Y.Mic,{className:"h-4 w-4"}),label:"Audio",description:"Upload an audio file via 3Speak — embedded as a player when published."}),!U&&x&&Ee.push({icon:e.jsx(Y.Video,{className:"h-4 w-4"}),label:"Video",description:"Upload a video via 3Speak — the 10% threespeakfund beneficiary is auto-attached."}),z||Ee.push({icon:e.jsx(Y.Smile,{className:"h-4 w-4"}),label:"Emoji",description:"Open a searchable emoji picker and insert at the cursor."}),!A&&_&&Ee.push({icon:e.jsx("span",{className:"text-[10px] font-bold",children:"GIF"}),label:"GIF",description:"Search GIPHY and insert an animated GIF inline."}),!H&&v&&Ee.push({icon:e.jsx(Y.Play,{className:"h-3 w-3 fill-current"}),label:"YouTube",description:"Search YouTube and insert a video link — auto-embeds when rendered."}),!J&&(g||b&&w)&&Ee.push({icon:e.jsx("span",{className:"text-[10px] font-bold",children:"MEME"}),label:"Meme",description:"Build a meme on a memegen.link template with Top/Bottom captions and insert as an image."}),!ee&&(g||b&&w)&&Ee.push({icon:e.jsx("img",{src:"https://decentmemes.com/svg/DM.svg",alt:"DM",className:"h-4 w-4"}),label:"DecentMemes",description:`Open the DecentMemes widget — auto-attaches template creator beneficiaries. Limit: ${Qv(ur)} per ${ur}.`}),!Z&&N&&Ur.length>0&&Ee.push({icon:e.jsx(Y.FileText,{className:"h-4 w-4"}),label:"Template",description:"Insert a saved reply/post template, with @author placeholders resolved."}),W||Ee.push({icon:e.jsx(Y.BarChart3,{className:"h-4 w-4"}),label:"Poll",description:"Attach a Hive poll (question + choices + end time) to this post."}),pe||Ee.push({icon:e.jsx(Y.Tag,{className:"h-4 w-4"}),label:"Tags",description:`Edit the tag list — locked defaults stay first, you can add up to ${Le} total.`}),Ge||Ee.push({icon:e.jsx(Y.Coins,{className:"h-4 w-4"}),label:"Reward",description:"Choose reward routing: 50/50 (default), 100% Hive Power, burn, or decline rewards."}),Pe||Ee.push({icon:e.jsx(Y.Users,{className:"h-4 w-4"}),label:"Beneficiaries",description:"Send a share of the post rewards to other Hive accounts. Auto-attached entries (threespeakfund, DecentMemes creators) show a lock icon."}),xe&&Ee.push({icon:e.jsx(Y.ThumbsUp,{className:"h-4 w-4"}),label:"Upvote on publish",description:"Cast your upvote on the parent post the moment this comment broadcasts. Slider controls the weight."}),Ee})()}),Et&&xr&&Mu.createPortal(e.jsx("div",{ref:Tt,style:{position:"fixed",top:xr.top,left:xr.left,width:xr.width},className:"z-[9999] rounded-lg border border-[var(--hrk-border-subtle)] bg-[var(--hrk-bg-app)] py-1 shadow-xl",children:uN.map(Ee=>e.jsxs("button",{type:"button",onClick:()=>Ft(Ee),className:"flex w-full items-center justify-between px-3 py-2 text-left text-sm text-[var(--hrk-text-primary)] hover:bg-[var(--hrk-bg-surface)]",children:[e.jsx("span",{children:Wv[Ee]}),Mt===Ee&&e.jsx(Y.Check,{className:"h-4 w-4 text-[var(--hrk-info)]"})]},Ee))}),document.body)]})},ey=Kv,l7=({parentAuthor:a,parentPermlink:o,onClose:l,onCommentSubmitted:u,currentUser:c,ecencyToken:f,threeSpeakApiKey:h,giphyApiKey:g,templateToken:b,templateApiBaseUrl:w})=>{const[x,_]=T.useState(!1),v=async N=>{if(!(!N.trim()||x)){_(!0);try{await u(a,o,N),l()}catch(C){console.error("Failed to submit reply:",C)}finally{_(!1)}}};return T.useEffect(()=>{const N=C=>{C.key==="Escape"&&l()};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[l]),e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-gray-700 bg-gray-900/50",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"p-2 bg-blue-900 rounded-lg",children:e.jsx(Y.Send,{className:"w-5 h-5 text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-white",children:"Reply to Comment"}),e.jsxs("p",{className:"text-sm text-gray-400",children:["@",a]})]})]}),e.jsx("button",{onClick:l,disabled:x,className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200 disabled:opacity-50",children:e.jsx(Y.X,{className:"w-6 h-6 text-gray-400"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(ey,{onSubmit:v,onCancel:l,currentUser:c,parentAuthor:a,parentPermlink:o,placeholder:`Reply to @${a}...`,ecencyToken:f,threeSpeakApiKey:h,giphyApiKey:g,templateToken:b,templateApiBaseUrl:w})}),e.jsx("div",{className:"p-4 md:p-6 border-t border-gray-700 bg-gray-900/50",children:e.jsxs("div",{className:"flex items-center justify-between text-xs md:text-sm text-gray-400",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("span",{children:"• Markdown supported"}),e.jsx("span",{children:"• Be respectful"})]}),e.jsx("div",{className:"hidden md:block",children:"Press Esc to close"})]})})]})})},u7=({isVisible:a,searchQuery:o,onSearchChange:l,onClose:u})=>{const c=T.useRef(null);T.useEffect(()=>{a&&c.current&&c.current.focus()},[a]);const f=()=>{l(""),u()};return e.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-in-out ${a?"max-h-20 opacity-100":"max-h-0 opacity-0"}`,children:e.jsx("div",{className:"p-4 border-b border-gray-700 bg-gray-900/30",children:e.jsxs("div",{className:"relative",children:[e.jsx(Y.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx("input",{ref:c,type:"text",value:o,onChange:h=>l(h.target.value),placeholder:"Search comments and authors...",className:"w-full pl-10 pr-10 py-2 bg-gray-800 border border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-white placeholder-gray-400 transition-colors duration-200"}),o&&e.jsx("button",{onClick:()=>l(""),className:"absolute right-8 top-1/2 transform -translate-y-1/2 p-1 rounded-full hover:bg-gray-700 transition-colors duration-200",children:e.jsx(Y.X,{className:"w-4 h-4 text-gray-400"})}),e.jsx("button",{onClick:f,className:"absolute right-3 top-1/2 transform -translate-y-1/2 p-1 rounded-full hover:bg-gray-700 transition-colors duration-200",children:e.jsx(Y.X,{className:"w-4 h-4 text-gray-400"})})]})})})},Bj=768;function NN(){const[a,o]=Tw.useState(void 0);return Tw.useEffect(()=>{const l=window.matchMedia(`(max-width: ${Bj-1}px)`),u=()=>{o(window.innerWidth<Bj)};return l.addEventListener("change",u),o(window.innerWidth<Bj),()=>l.removeEventListener("change",u)},[]),!!a}const c7=1,d7=1e6;let Uj=0;function f7(){return Uj=(Uj+1)%Number.MAX_SAFE_INTEGER,Uj.toString()}const Hj=new Map,d6=a=>{if(Hj.has(a))return;const o=setTimeout(()=>{Hj.delete(a),Vv({type:"REMOVE_TOAST",toastId:a})},d7);Hj.set(a,o)},kC=(a,o)=>{switch(o.type){case"ADD_TOAST":return{...a,toasts:[o.toast,...a.toasts].slice(0,c7)};case"UPDATE_TOAST":return{...a,toasts:a.toasts.map(l=>l.id===o.toast.id?{...l,...o.toast}:l)};case"DISMISS_TOAST":{const{toastId:l}=o;return l?d6(l):a.toasts.forEach(u=>{d6(u.id)}),{...a,toasts:a.toasts.map(u=>u.id===l||l===void 0?{...u,open:!1}:u)}}case"REMOVE_TOAST":return o.toastId===void 0?{...a,toasts:[]}:{...a,toasts:a.toasts.filter(l=>l.id!==o.toastId)}}},Sw=[];let Ew={toasts:[]};function Vv(a){Ew=kC(Ew,a),Sw.forEach(o=>{o(Ew)})}function Fl({...a}){const o=f7(),l=c=>Vv({type:"UPDATE_TOAST",toast:{...c,id:o}}),u=()=>Vv({type:"DISMISS_TOAST",toastId:o});return Vv({type:"ADD_TOAST",toast:{...a,id:o,open:!0,onOpenChange:c=>{c||u()}}}),{id:o,dismiss:u,update:l}}function h7(){const[a,o]=Tw.useState(Ew);return Tw.useEffect(()=>(Sw.push(o),()=>{const l=Sw.indexOf(o);l>-1&&Sw.splice(l,1)}),[a]),{...a,toast:Fl,dismiss:l=>Vv({type:"DISMISS_TOAST",toastId:l})}}const m7=new Set(["keychain","peakvault","hiveauth"]);function f6(a){if(a==null)return"";if(typeof a=="string")return a;if(a instanceof Error)return a.message;if(typeof a=="object"){if(typeof a.message=="string")return a.message;if(typeof a.error=="string")return a.error;if(a.data&&typeof a.data.msg=="string")return a.data.msg;try{return JSON.stringify(a)}catch{}}return String(a)}function h6(a){const o=a.toLowerCase();return o==="user_cancel"||o==="[object object]"||o.includes("cancelled")||o.includes("canceled")||o.includes("rejected")?"Image signing was cancelled":o.includes("expired")?"Wallet request expired. Please try again.":o.includes("not installed")?"Wallet extension is not installed":o==="incomplete"?"Wallet request was incomplete":a}function p7(a={}){const{signer:o,user:l,walletSupportedProviders:u=m7}=a;return T.useCallback(async c=>{const f=l?.privatePostingKey;if(f){const b=JSON.parse(c);if(b?.type!=="Buffer"||!Array.isArray(b.data))throw new Error("Unexpected signing payload shape");const w=new Uint8Array(b.data),x=await crypto.subtle.digest("SHA-256",w),_=K6.PrivateKey.fromString(f),v=globalThis.Buffer;if(!v)throw new Error("Buffer polyfill is not available — import buffer in your app entry");return _.sign(v.from(new Uint8Array(x))).toString()}const h=(l?.provider||"").toLowerCase();if(!u.has(h))throw new Error(`Signed image upload is not supported for provider "${h||"unknown"}".`);if(!o)throw new Error("Wallet signer is not ready");let g;try{g=await o.signMessage(c,"posting")}catch(b){throw new Error(h6(f6(b)||"signMessage failed"))}if(!g.success)throw new Error(h6(f6(g.error)||"signMessage failed"));if(!g.result)throw new Error("signMessage returned empty result");return g.result},[o,l,u])}const SN=({author:a,permlink:o,onClose:l,currentUser:u,token:c,onClickCommentUpvote:f,onClickCommentReply:h,onClickUpvoteButton:g,onSubmitComment:b,ecencyToken:w,threeSpeakApiKey:x,giphyApiKey:_,templateToken:v,templateApiBaseUrl:N,showVoteButton:C,parentTags:R,defaultReward:O,defaultBeneficiaries:E,beneficiaryFavorites:$,defaultVotePercent:V,voteWeightStep:U,allowLandscapeVideos:z,awaitingWalletApproval:A})=>{const[H,I]=T.useState([]),[q,Z]=T.useState([]),[J,ee]=T.useState(!0),[se,fe]=T.useState(null),[he,X]=T.useState(null),[W,ne]=T.useState(!1),[be,ve]=T.useState(""),[Le,Ce]=T.useState(!1),[pe,ie]=T.useState(!1),ye=T.useRef({enabled:!1,percent:100}),Ne=T.useRef(E??[]),Ge=T.useCallback(async(xe=!1)=>{xe?ie(!0):ee(!0),fe(null);try{const We=await qn.getCommentsList(a,o,u??"");I(We),Z(We)}catch(We){fe(We instanceof Error?We.message:"Failed to load comments")}finally{ee(!1),ie(!1)}},[a,o]);T.useEffect(()=>{Ge()},[Ge]),T.useEffect(()=>{if(!be.trim())Z(H);else{const xe=H.filter(We=>We.body?.toLowerCase().includes(be.toLowerCase())||We.author.toLowerCase().includes(be.toLowerCase()));Z(xe)}},[be,H]);const me=(xe,We)=>{X({author:xe,permlink:We})},rt=xe=>{xe.target===xe.currentTarget&&l()},Oe=async(xe,We,qe)=>{if(b){try{const{enabled:Xe,percent:pt}=ye.current,Vt=Xe?pt:null;if(await Promise.resolve(b(xe,We,qe,Vt,Ne.current))===!1)return;Ce(!1),ie(!0),setTimeout(async()=>{await Ge(!0),ie(!1)},3e3)}catch(Xe){const pt=Xe instanceof Error?Xe.message:"Failed to post comment";Fl({title:"Error",description:pt}),ie(!1)}return}if(!c){alert("Please login to comment");return}try{await qn.handleComment({author:xe,permlink:We,body:qe,authToken:c}),Ce(!1),ie(!0),setTimeout(async()=>{await Ge(!0),ie(!1)},3e3)}catch(Xe){const pt=Xe instanceof Error?Xe.message:"Failed to post comment";Fl({title:"Error",description:pt}),ie(!1)}},ue=T.useMemo(()=>{if(!u?.trim())return q;const xe=u.toLowerCase();return[...q].sort((We,qe)=>{const Xe=We.author?.toLowerCase()===xe,pt=qe.author?.toLowerCase()===xe;return Xe&&!pt?-1:!Xe&&pt?1:0})},[q,u]),Pe=ue.filter(xe=>xe.parent_author===a&&xe.parent_permlink===o);return J?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4 h-screen",children:e.jsx("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl h-[90vh] flex flex-col",children:e.jsx("div",{className:"flex justify-center items-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Y.Loader2,{className:"w-12 h-12 animate-spin text-blue-500 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-300",children:"Loading comments..."})]})})})}):se?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-40 p-4 h-screen",onClick:rt,children:e.jsx("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-4xl h-[90vh] flex flex-col overflow-hidden",children:e.jsx("div",{className:"flex justify-center items-center h-full",children:e.jsxs("div",{className:"text-center p-6",children:[e.jsx(Y.AlertCircle,{className:"w-16 h-16 text-red-500 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"Failed to load comments"}),e.jsx("p",{className:"text-gray-300 mb-6",children:se}),e.jsx("button",{onClick:()=>Ge(),className:"px-6 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg transition-colors duration-200",children:"Try Again"})]})})})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-40 p-4 h-screen",onClick:rt,children:e.jsxs("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-4xl h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex justify-between items-center p-4 md:p-6 border-b border-gray-700 bg-gray-900/50",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs("h2",{className:"text-lg md:text-xl font-bold text-white",children:["Comments (",H.length,")"]}),pe&&e.jsx(Y.Loader2,{className:"w-5 h-5 animate-spin text-blue-500"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>Ge(!0),disabled:pe,className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200 disabled:opacity-50",title:"Refresh comments",children:e.jsx(Y.RefreshCw,{className:`w-5 h-5 text-gray-400 ${pe?"animate-spin":""}`})}),e.jsx("button",{onClick:()=>ne(!W),className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200",title:"Search comments",children:e.jsx(Y.Search,{className:"w-5 h-5 text-gray-400"})}),e.jsx("button",{onClick:l,className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200",children:e.jsx(Y.X,{className:"w-6 h-6 text-gray-400"})})]})]}),e.jsx(u7,{isVisible:W,searchQuery:be,onSearchChange:ve,onClose:()=>ne(!1)}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[Le&&e.jsx("div",{className:"border-b border-gray-700",children:e.jsx(ey,{onSubmit:xe=>Oe(a,o,xe),onCancel:()=>Ce(!1),currentUser:u,placeholder:"Add a comment...",ecencyToken:w,threeSpeakApiKey:x,giphyApiKey:_,templateToken:v,templateApiBaseUrl:N,showVoteButton:C,onVoteChange:(xe,We)=>{ye.current={enabled:xe,percent:We}},defaultTags:R,defaultReward:O,defaultBeneficiaries:E,beneficiaryFavorites:$,onBeneficiariesChange:xe=>{Ne.current=xe},defaultVotePercent:V,voteWeightStep:U,allowLandscapeVideos:z,awaitingWalletApproval:A})}),Pe.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8 text-center",children:[e.jsx(Y.MessageCirclePlus,{className:"w-16 h-16 text-gray-600 mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:be?"No comments found":"No comments yet"}),e.jsx("p",{className:"text-gray-400 mb-6",children:be?"Try adjusting your search terms":"Be the first to share your thoughts!"}),!be&&u&&e.jsx("button",{onClick:()=>Ce(!0),className:"px-6 py-3 bg-blue-500 hover:bg-blue-600 text-white rounded-lg font-medium transition-colors duration-200",children:"Add Comment"})]}):e.jsx("div",{className:"divide-y divide-gray-700",children:Pe.map(xe=>e.jsx(lN,{comment:xe,allComments:ue,onReply:me,currentUser:u,token:c,searchQuery:be,depth:0,onVotedRefresh:()=>Ge(!0),onClickCommentUpvote:f,onClickCommentReply:h,onClickUpvoteButton:g},xe.permlink))})]}),!Le&&u&&Pe.length>0&&e.jsx("div",{className:"p-4 md:p-6 border-t border-gray-700 bg-gray-900/50",children:e.jsxs("button",{onClick:()=>Ce(!0),className:"w-full md:w-auto px-6 py-3 bg-blue-500 hover:bg-blue-600 text-white rounded-lg font-medium transition-all duration-200 transform hover:scale-[1.02] flex items-center justify-center space-x-2",children:[e.jsx(Y.MessageCirclePlus,{className:"w-5 h-5"}),e.jsx("span",{children:"Add Comment"})]})})]})}),he&&e.jsx(l7,{parentAuthor:he.author,parentPermlink:he.permlink,onClose:()=>X(null),onCommentSubmitted:Oe,currentUser:u,ecencyToken:w,threeSpeakApiKey:x,giphyApiKey:_,templateToken:v,templateApiBaseUrl:N})]})};function ty(a){const o=Number(a.rshares??0);if(Number.isFinite(o)&&o<0)return!0;const l=Number(a.percent??0);return Number.isFinite(l)&&l<0}const Og="sagarkothari88";function hy(a){return a?.length?a.some(o=>o.voter?.toLowerCase()===Og):!1}function my(a,o){if(!a?.length||!o)return!1;const l=o.toLowerCase();return a.some(u=>u.voter?.toLowerCase()===l)}function py(a){let o={};if(typeof a=="string")try{o=JSON.parse(a)}catch{o={}}else a&&typeof a=="object"&&(o=a);return(typeof o.app=="string"?o.app.toLowerCase():"").includes("hivesuite")||o.developer==="sagarkothari88"?!0:(Array.isArray(o.tags)?o.tags:[]).some(c=>typeof c=="string"&&c.toLowerCase()==="hivesuite")}function g7(a,o){return typeof o=="number"&&Number.isFinite(o)&&o>0?!0:a?.length?a.some(ty):!1}function x7(a){const o=typeof a=="string"?/Z|[+-]\d{2}:?\d{2}$/.test(a)?a:`${a}Z`:a,l=typeof o=="string"?new Date(o):o,u=Math.floor((Date.now()-l.getTime())/1e3),c={year:31536e3,month:2628e3,day:86400,hour:3600,minute:60};for(const[f,h]of Object.entries(c)){const g=Math.floor(u/h);if(g>1)return`${g} ${f}s ago`;if(g===1)return`${g} ${f} ago`}return"just now"}function b7(a){if(!a||a===0)return"25";const o=a<0,l=Math.abs(a);if(l<1e3)return Math.floor(l).toString();let u=Math.log10(l);return u=Math.max(u-9,0),((o?-1:1)*u*9+25).toFixed(0)}function Vj(a){if(typeof a=="number")return a;if(typeof a!="string")return 0;const o=parseFloat(a);return Number.isFinite(o)?o:0}const dw=["var(--hrk-brand)","#f59e0b","#facc15","#22c55e","#10b981","#06b6d4","#3b82f6","#6366f1","#8b5cf6","#ec4899"],Fj={value:"Vote Value",voter:"Voter",newest:"Newest",oldest:"Oldest",curation:"Curation Rewards"},Ij={value:"Flag Weight",voter:"Voter",newest:"Newest",oldest:"Oldest"},ry=({author:a,permlink:o,onClose:l,currentUser:u,token:c,onClickUpvoteButton:f,hiveIconUrl:h,voters:g,fetchVoters:b,valueUnit:w,title:x,voteFilter:_="upvotes",onUserClick:v,getUserUrl:N,totalVoteCount:C})=>{const R=_==="downvotes",O=x??(R?"Downvotes":"Votes (Hive Rewards)"),E=Array.isArray(g)||typeof b=="function",[$,V]=T.useState(g?.map(De=>({account:De}))??[]),U=h&&h.length>0?h:"https://hive.io/images/hive-logo.png",[z,A]=T.useState([]),[H,I]=T.useState(null),[q,Z]=T.useState(!0),[J,ee]=T.useState(!1),[se,fe]=T.useState(!1),[he,X]=T.useState(""),[W,ne]=T.useState(!1),[be,ve]=T.useState("value"),[Le,Ce]=T.useState(!1),[pe,ie]=T.useState(!1),[ye,Ne]=T.useState(""),[Ge,me]=T.useState(!1),rt=T.useMemo(()=>z.filter(De=>R?ty(De):!ty(De)),[z,R]),Oe=!R&&!!u&&rt.some(De=>De.voter===u),ue=De=>{X(De),fe(!0),setTimeout(()=>fe(!1),2500)},Pe=async()=>{if(E||!a||!o)return;Z(!0);const[De,Ot]=await Promise.all([qn.getActiveVotes(a,o),qn.getPostContent(a,o)]);A(De),I(Ot),Z(!1)};T.useEffect(()=>{if(E){if(b){let De=!1;return Z(!0),b().then(Ot=>{De||(V(Ot),Z(!1))}).catch(()=>{De||(V([]),Z(!1))}),()=>{De=!0}}V((g??[]).map(De=>({account:De}))),Z(!1);return}Pe()},[a,o,E]);const{totalPayout:xe,totalCurationPool:We}=T.useMemo(()=>{if(!H)return{totalPayout:0,totalCurationPool:0};const De=Vj(H.pending_payout_value),Ot=Vj(H.author_payout_value),ot=Vj(H.curator_payout_value),Re=De>0?De:Ot+ot,Je=ot>0?ot:Re/2;return{totalPayout:Re,totalCurationPool:Je}},[H]),qe=T.useMemo(()=>rt.reduce((De,Ot)=>De+(R?Math.abs(Number(Ot.rshares)||0):Math.max(0,Number(Ot.rshares)||0)),0),[rt,R]),Xe=T.useMemo(()=>rt.reduce((De,Ot)=>De+(R?Math.abs(Number(Ot.weight)||0):Math.max(0,Number(Ot.weight)||0)),0),[rt,R]),pt=T.useMemo(()=>rt.map(De=>{const Ot=Number(De.rshares)||0,ot=Number(De.weight)||0,Re=R?Math.abs(Ot):Math.max(0,Ot),Je=R?Math.abs(ot):Math.max(0,ot),kt=R?Re:qe>0?Re/qe*xe:0,it=R?0:Xe>0?Je/Xe*We:0;return{...De,value:kt,curation:it}}),[rt,R,qe,Xe,xe,We]),Vt=T.useMemo(()=>{const De=pt.slice();return De.sort((Ot,ot)=>{switch(be){case"value":return ot.value-Ot.value;case"voter":return Ot.voter.localeCompare(ot.voter);case"newest":return new Date(ot.time??0).getTime()-new Date(Ot.time??0).getTime();case"oldest":return new Date(Ot.time??0).getTime()-new Date(ot.time??0).getTime();case"curation":return ot.curation-Ot.curation}return 0}),De},[pt,be]),Tr=T.useMemo(()=>{const De=R?qe:xe;if(De<=0)return[];const Ot=pt.slice().sort((it,Pt)=>Pt.value-it.value),ot=9,Re=Ot.slice(0,ot),Je=Ot.slice(ot),kt=Re.map((it,Pt)=>({color:R?"#f87171":dw[Pt%dw.length],widthPct:it.value/De*100,voter:it.voter}));if(Je.length>0){const it=Je.reduce((Pt,Yt)=>Pt+Yt.value,0);kt.push({color:"var(--hrk-border-strong)",widthPct:it/De*100,voter:`+${Je.length} more`})}return kt},[pt,xe,qe,R]),jt=T.useMemo(()=>$.reduce((De,Ot)=>De+Math.max(0,Ot.value??0),0),[$]),Nt=jt>0,fr=T.useMemo(()=>{const De=$.slice();return De.sort((Ot,ot)=>Nt?(ot.value??0)-(Ot.value??0):Ot.account.localeCompare(ot.account)),De},[$,Nt]),Mr=T.useMemo(()=>{if(jt<=0)return[];const De=9,Ot=fr.slice(0,De),ot=fr.slice(De),Re=Ot.map((Je,kt)=>({color:dw[kt%dw.length],widthPct:(Je.value??0)/jt*100,voter:Je.account}));if(ot.length>0){const Je=ot.reduce((kt,it)=>kt+(it.value??0),0);Re.push({color:"var(--hrk-border-strong)",widthPct:Je/jt*100,voter:`+${ot.length} more`})}return Re},[fr,jt]),Zt=async()=>{if(!(!a||!o||pe)){ie(!0);try{const De=Ge?ye:"",Ot=await qn.listVotes(a,o,De,1e3),ot=Ot.map(it=>({voter:it.voter,percent:it.vote_percent,rshares:parseInt(it.rshares)||0,time:it.last_update,weight:parseInt(it.weight)||0})),Re=new Map;z.forEach(it=>Re.set(it.voter,it));const Je=ot.map(it=>it.voter).filter(it=>!Re.has(it));if(Je.length>0)for(let Pt=0;Pt<Je.length;Pt+=100){const Yt=Je.slice(Pt,Pt+100);(await qn.getAccounts(Yt)).forEach(ma=>{const Zr=ot.findIndex(Wr=>Wr.voter===ma.name);Zr!==-1&&(ot[Zr].reputation=ma.reputation)})}ot.forEach(it=>{Re.has(it.voter)||Re.set(it.voter,it)});const kt=Array.from(Re.values());A(kt),Ot.length>0&&Ne(Ot[Ot.length-1].voter),me(!0)}catch(De){console.error("Failed to load more votes:",De)}finally{ie(!1)}}},He=De=>{De.target===De.currentTarget&&l()},Kt=async De=>{if(!c||!u){alert("Please login to upvote");return}try{const Ot=Math.round(De*100);await qn.handleUpvote({author:a,permlink:o,weight:Ot,authToken:c}),ee(!1),ne(!0),setTimeout(async()=>{await Pe(),ne(!1),ue("Vote submitted successfully ✅"),l()},3e3)}catch(Ot){const ot=Ot instanceof Error?Ot.message:"Failed to upvote";Fl({title:"Error",description:ot}),ne(!1)}};return e.jsxs("div",{className:"fixed inset-0 bg-black/60 flex items-end items-center justify-center z-50 px-3 sm:items-center sm:px-4 h-screen",onClick:He,children:[e.jsxs("div",{className:"relative bg-[var(--hrk-bg-surface-raised)] rounded-t-[16px] sm:rounded-[16px] shadow-[var(--hrk-shadow-lg)] w-full max-w-4xl max-h-[85vh] flex flex-col overflow-hidden border border-[var(--hrk-border-default)]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[var(--hrk-border-subtle)] px-4 py-3 sm:px-5 sm:py-4",children:[e.jsxs("div",{className:"flex flex-1 items-center gap-3 min-w-0",children:[e.jsx("h2",{className:"text-base sm:text-lg font-semibold text-white truncate",children:O}),!E&&!q&&(rt.length>0||(C??0)>0)&&e.jsx("span",{className:"shrink-0 rounded bg-[var(--hrk-bg-surface)] px-1.5 py-0.5 text-[11px] font-medium text-[var(--hrk-text-tertiary)]",children:Math.max(rt.length,C??0).toLocaleString()}),E&&!q&&e.jsx("span",{className:"shrink-0 rounded bg-[var(--hrk-bg-surface)] px-1.5 py-0.5 text-[11px] font-medium text-[var(--hrk-text-tertiary)]",children:$.length.toLocaleString()}),W&&e.jsx("span",{className:"inline-flex items-center","aria-label":"Refreshing",children:e.jsx("span",{className:"w-3.5 h-3.5 border-2 border-[var(--hrk-brand)] border-t-transparent rounded-full animate-spin"})})]}),!E&&e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>Ce(De=>!De),className:"inline-flex items-center gap-1.5 rounded-md border border-[var(--hrk-border-default)] bg-[var(--hrk-bg-surface)] px-2.5 py-1 text-xs font-medium text-[var(--hrk-text-secondary)] hover:bg-[var(--hrk-bg-hover)]","aria-haspopup":"menu","aria-expanded":Le,children:[e.jsx("span",{className:"hidden sm:inline",children:(R?Ij[be]:Fj[be])?.toUpperCase()??"SORT"}),e.jsx("span",{className:"sm:hidden",children:"SORT"}),e.jsx(Y.ChevronDown,{className:"w-3.5 h-3.5"})]}),Le&&e.jsx("ul",{role:"menu",className:"absolute right-0 top-full z-10 mt-1 w-44 overflow-hidden rounded-md border border-[var(--hrk-border-default)] bg-[var(--hrk-bg-surface-sunken)] shadow-xl",onClick:De=>De.stopPropagation(),children:Object.keys(R?Ij:Fj).map(De=>e.jsx("li",{children:e.jsx("button",{type:"button",role:"menuitem",onClick:()=>{ve(De),Ce(!1)},className:`w-full px-3 py-2 text-left text-xs hover:bg-[var(--hrk-bg-hover)] ${be===De?"text-[var(--hrk-brand)]":"text-[var(--hrk-text-secondary)]"}`,children:R?Ij[De]:Fj[De]})},De))})]}),!E&&!R&&!J&&e.jsx("button",{onClick:()=>{if(f){f(u,c);return}if(!u||!c){ue("Please login to upvote");return}Oe?ue("You have already upvoted this post"):ee(!0)},"aria-label":"Upvote this post",className:"rounded p-1 hover:bg-[var(--hrk-bg-hover)]",type:"button",children:e.jsx(Y.ThumbsUp,{className:`w-4 h-4 ${Oe?"text-[var(--hrk-brand)] fill-current":"text-[var(--hrk-text-secondary)]"}`})}),e.jsx("button",{type:"button",onClick:l,"aria-label":"Close",className:"rounded p-1 hover:bg-[var(--hrk-bg-hover)]",children:e.jsx(Y.X,{className:"w-4 h-4 text-[var(--hrk-text-secondary)]"})})]}),E&&!q&&Mr.length>0&&e.jsxs("div",{className:"border-b border-[var(--hrk-border-default)] bg-[var(--hrk-bg-surface-sunken)]/40 px-4 py-3 sm:px-5",children:[e.jsxs("p",{className:"text-xs text-[var(--hrk-text-tertiary)] mb-1.5",children:["Breakdown for ",$.length.toLocaleString()," ",$.length===1?"voter":"voters"]}),e.jsx("div",{className:"flex h-2.5 w-full overflow-hidden rounded-md bg-[var(--hrk-bg-surface)]",role:"img","aria-label":"Voter weight distribution",children:Mr.map((De,Ot)=>e.jsx("span",{title:`${De.voter} · ${De.widthPct.toFixed(1)}%`,style:{width:`${De.widthPct}%`,backgroundColor:De.color},className:"h-full"},`${De.voter}-${Ot}`))})]}),!E&&!q&&!J&&(rt.length>0||(C??0)>0)&&e.jsxs("div",{className:"border-b border-[var(--hrk-border-default)] bg-[var(--hrk-bg-surface-sunken)]/40 px-4 py-3 sm:px-5",children:[e.jsxs("p",{className:"text-xs text-[var(--hrk-text-tertiary)] mb-1.5",children:["Breakdown for ",Math.max(rt.length,C??0).toLocaleString()," ",Math.max(rt.length,C??0)===1?R?"downvote":"vote":R?"downvotes":"votes"]}),e.jsx("div",{className:"flex h-2.5 w-full overflow-hidden rounded-md bg-[var(--hrk-bg-surface)]",role:"img","aria-label":"Vote value distribution",children:Tr.map((De,Ot)=>e.jsx("span",{title:`${De.voter} · ${De.widthPct.toFixed(1)}%`,style:{width:`${De.widthPct}%`,backgroundColor:De.color},className:"h-full"},`${De.voter}-${Ot}`))})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3 sm:px-4 sm:py-4",children:[E?q?e.jsx("div",{className:"flex justify-center items-center h-full p-8",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-[var(--hrk-brand)]"})}):$.length===0?e.jsx("div",{className:"flex flex-col items-center justify-center py-12 text-center text-sm text-[var(--hrk-text-tertiary)]",children:"No voters yet."}):e.jsx("ul",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2 lg:grid-cols-3",children:fr.map(De=>{const Ot=De.account,ot=N?.(Ot),Re=e.jsxs(e.Fragment,{children:[e.jsx("img",{src:`https://images.hive.blog/u/${Ot}/avatar`,alt:Ot,loading:"lazy",className:"w-9 h-9 rounded-full bg-[var(--hrk-bg-surface-raised)] shrink-0",onError:kt=>{kt.target.src=`https://ui-avatars.com/api/?name=${Ot}&background=random`}}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-white",children:Ot}),De.value!=null&&Nt&&e.jsxs("span",{className:"shrink-0 text-xs font-semibold text-[var(--hrk-success)]",children:[De.value.toLocaleString(void 0,{maximumFractionDigits:3}),w?` ${w}`:""]})]}),Je="flex items-center gap-2.5 rounded-md px-2 py-1.5 hover:bg-[var(--hrk-bg-surface)]";return e.jsx("li",{children:ot?e.jsx("a",{href:ot,className:Je,onClick:kt=>{kt.metaKey||kt.ctrlKey||kt.shiftKey||kt.altKey||kt.button!==0||(kt.preventDefault(),v?.(Ot))},children:Re}):v?e.jsx("button",{type:"button",className:`w-full text-left ${Je}`,onClick:()=>v(Ot),children:Re}):e.jsx("div",{className:Je,children:Re})},Ot)})}):q?e.jsx("div",{className:"flex justify-center items-center h-full p-8",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-[var(--hrk-brand)]"})}):J&&!Oe?e.jsx(e_,{author:a,permlink:o,onUpvote:Kt,onCancel:()=>ee(!1)}):rt.length===0?e.jsx("div",{className:"flex flex-col items-center justify-center py-12 text-center text-sm text-[var(--hrk-text-tertiary)]",children:R?"No downvotes yet.":"No votes yet."}):e.jsx("ul",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2 lg:grid-cols-3",children:Vt.map(De=>{const Ot=(Math.abs(De.percent??0)/100).toFixed(2),ot=be==="curation"?De.curation:De.value,Re=N?.(De.voter),Je=e.jsxs(e.Fragment,{children:[e.jsx("img",{src:`https://images.hive.blog/u/${De.voter}/avatar`,alt:De.voter,className:"w-9 h-9 rounded-full bg-[var(--hrk-bg-surface-raised)] shrink-0",onError:it=>{it.target.src=`https://ui-avatars.com/api/?name=${De.voter}&background=random`}}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-sm min-w-0",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-white",children:De.voter}),e.jsx("span",{className:"shrink-0 rounded bg-[var(--hrk-bg-surface)] px-1.5 py-0.5 text-[10px] font-medium text-[var(--hrk-text-tertiary)]",children:b7(De.reputation)}),e.jsxs("span",{className:`shrink-0 inline-flex items-center gap-1 text-xs font-semibold ${R?"text-red-400":"text-[var(--hrk-success)]"}`,children:[R?`-${Ot}%`:ot.toFixed(3),!R&&e.jsx("img",{src:U,alt:"",className:"h-3.5 w-3.5 object-contain","aria-hidden":!0})]})]}),e.jsxs("div",{className:"text-[11px] text-[var(--hrk-text-tertiary)]",children:[R?`Flag weight · ${ot.toLocaleString()}`:`${Ot}%`,De.time&&` · ${x7(De.time+"Z")}`]})]})]}),kt="flex items-center gap-2.5 rounded-md px-2 py-1.5 hover:bg-[var(--hrk-bg-surface)]";return e.jsx("li",{children:Re?e.jsx("a",{href:Re,className:kt,onClick:it=>{it.metaKey||it.ctrlKey||it.shiftKey||it.altKey||it.button!==0||(it.preventDefault(),v?.(De.voter))},children:Je}):v?e.jsx("button",{type:"button",className:`w-full text-left ${kt}`,onClick:()=>v(De.voter),children:Je}):e.jsx("div",{className:kt,children:Je})},De.voter)})}),!E&&!q&&!J&&rt.length<(C??0)&&e.jsx("div",{className:"flex justify-center mt-4 pb-2",children:e.jsx("button",{type:"button",onClick:Zt,disabled:pe,className:"flex items-center gap-2 px-5 py-2.5 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-700 text-white disabled:text-gray-400 text-xs font-semibold rounded-lg transition-colors cursor-pointer",children:pe?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"w-3 h-3 border-2 border-white border-t-transparent rounded-full animate-spin shrink-0"}),"Loading more..."]}):"Load More Votes"})})]})]}),se&&e.jsx("div",{className:"fixed bottom-4 right-4 w-[280px] z-50",children:e.jsx("div",{className:"bg-[var(--hrk-bg-surface-sunken)] border border-[var(--hrk-border-default)] text-white rounded px-3 py-2 shadow-lg text-sm",children:he})})]})},jC=({isOpen:a,onClose:o,title:l,children:u,maxWidth:c="max-w-2xl"})=>a?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:o}),e.jsxs("div",{className:`relative bg-card border border-border rounded-xl shadow-xl w-full mx-4 ${c} max-h-[90vh] overflow-hidden animate-scale-in`,children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[e.jsx("h2",{className:"text-xl font-bold text-card-foreground",children:l}),e.jsx("button",{onClick:o,className:"p-2 rounded-lg hover:bg-muted transition-colors",children:e.jsx(Y.X,{className:"w-5 h-5 text-muted-foreground"})})]}),e.jsx("div",{className:"overflow-y-auto max-h-[calc(90vh-80px)] custom-scrollbar",children:u})]})]}):null,v7=({author:a,permlink:o,content:l,onClose:u})=>e.jsx(jC,{isOpen:!0,onClose:u,title:"Video Description",maxWidth:"max-w-2xl",children:e.jsxs("div",{className:"p-6",children:[l?e.jsx("div",{className:"prose prose-sm max-w-none",children:e.jsx("div",{className:"bg-muted/30 rounded-lg p-4",children:e.jsx("pre",{className:"whitespace-pre-wrap text-sm text-card-foreground font-sans leading-relaxed",children:l})})}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Y.FileText,{className:"w-12 h-12 text-muted-foreground mx-auto mb-2"}),e.jsx("p",{className:"text-muted-foreground",children:"No description available"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"This video doesn't have a description yet."})]}),e.jsx("div",{className:"mt-6 pt-4 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsxs("span",{children:["By @",a]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:["/",o]})]})})]})}),y7=({username:a,permlink:o,onAuthorClick:l,onVideoClick:u,onTagClick:c,onBack:f,onCommentsModal:h,onUpvotesModal:g,onDescriptionModal:b,onVideoInfo:w,onShare:x,onBookmark:_}={})=>{const v=a,N=o,[C,R]=T.useState(null),[O,E]=T.useState(!0),[$,V]=T.useState(null),[U,z]=T.useState(!1),[A,H]=T.useState(null),[I,q]=T.useState(!1),[Z,J]=T.useState(!1),[ee,se]=T.useState(!1),[fe,he]=T.useState(!1),X=T.useRef(null),W=T.useRef(null),ne=T.useRef(null);T.useEffect(()=>{(async()=>{if(!(!v||!N))try{E(!0),V(null);const ye=await qn.getVideoDetails(v,N);R(ye),z(!1),H(null)}catch(ye){V(ye instanceof Error?ye.message:"Failed to load video")}finally{E(!1)}})()},[v,N]);const be=ie=>ie?ie.startsWith("ipfs://")?`https://ipfs-3speak.b-cdn.net/ipfs/${ie.replace("ipfs://","").split("/")[0]}/manifest.m3u8`:ie:"";T.useEffect(()=>((async()=>{const ye=C?.video_v2;if(!U||!ye||!X.current)return;const Ne=X.current,Ge=be(ye);W.current&&(W.current.destroy(),W.current=null),Ne.src="",Ne.load();try{let me=!1;const rt=()=>{me||(me=!0,Ne.play().then(()=>H(null)).catch(qe=>H(`Playback failed: ${qe.message}`)))};if(Gd.isSupported()){const qe=new Gd({debug:!1,enableWorker:!1,lowLatencyMode:!1,backBufferLength:90,maxLoadingDelay:4,maxBufferLength:30,maxMaxBufferLength:600,startLevel:-1});W.current=qe,qe.on(Gd.Events.MANIFEST_PARSED,()=>{}),qe.on(Gd.Events.ERROR,(Xe,pt)=>{if(pt.fatal)switch(pt.type){case Gd.ErrorTypes.NETWORK_ERROR:H("Network error, retrying..."),setTimeout(()=>qe.startLoad(),1e3);break;case Gd.ErrorTypes.MEDIA_ERROR:H("Media error, retrying..."),setTimeout(()=>qe.recoverMediaError(),1e3);break;default:H(`Fatal error: ${pt.details}`),qe.destroy(),W.current=null;break}}),qe.attachMedia(Ne),qe.loadSource(Ge)}else if(Ne.canPlayType("application/vnd.apple.mpegurl"))Ne.src=Ge;else{const qe=Ge.replace("/manifest.m3u8","/480p/index.m3u8");Ne.src=qe}const Oe=()=>q(!0),ue=()=>{q(!1),rt()},Pe=qe=>{const Xe=qe.target;H(`Video error: ${Xe.error?.message||"Unknown error"}`),q(!1)},xe=()=>q(!1);Ne.addEventListener("loadstart",Oe),Ne.addEventListener("canplay",ue),Ne.addEventListener("error",Pe),Ne.addEventListener("loadeddata",xe);const We=async()=>{const qe=!!document.fullscreenElement;try{qe?"orientation"in screen&&await(screen.orientation?.lock?.("landscape")??Promise.resolve()):"orientation"in screen&&screen.orientation?.unlock?.()}catch{}};return document.addEventListener("fullscreenchange",We),ne.current=()=>{document.removeEventListener("fullscreenchange",We)},()=>{Ne.removeEventListener("loadstart",Oe),Ne.removeEventListener("canplay",ue),Ne.removeEventListener("error",Pe),Ne.removeEventListener("loadeddata",xe),ne.current&&ne.current()}}catch(me){H(`Setup error: ${me instanceof Error?me.message:"Unknown"}`)}})(),()=>{W.current&&(W.current.destroy(),W.current=null)}),[U,C?.video_v2]);const ve=()=>{if(!C?.video_v2){H("No video source available");return}z(!0),H(null),q(!0)},Le=ie=>{u&&u(ie)},Ce=ie=>{l&&l(ie)},pe=ie=>{if(!ie)return"00:00";const ye=Math.floor(ie),Ne=Math.floor(ye/3600),Ge=Math.floor(ye%3600/60),me=ye%60,rt=Oe=>Oe.toString().padStart(2,"0");return ye<60?`00:${rt(me)}`:Ne===0?`${rt(Ge)}:${rt(me)}`:`${rt(Ne)}:${rt(Ge)}:${rt(me)}`};return O?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("div",{className:"sticky top-0 z-50 w-full bg-background border-b border-border",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsx("div",{className:"h-8 w-24 bg-muted rounded-full animate-pulse"})})}),e.jsx("div",{className:"container mx-auto px-4 py-8 max-w-6xl",children:e.jsxs("div",{className:"animate-pulse space-y-6",children:[e.jsx("div",{className:"aspect-video bg-muted rounded-xl"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-6 bg-muted rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-muted rounded w-1/2"})]})]})})]}):$||!C?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsxs("div",{className:"text-center max-w-md mx-auto px-4",children:[e.jsx("h2",{className:"text-xl font-semibold text-card-foreground mb-2",children:"Failed to Load Video"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:$||"Video not found"}),e.jsxs("button",{onClick:()=>{f&&f()},className:"inline-flex items-center gap-2 px-4 py-2 bg-card border border-border text-card-foreground rounded-lg hover:bg-card-hover transition-colors",children:[e.jsx(Y.ArrowLeft,{className:"w-4 h-4"}),"Go Back"]})]})}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("div",{className:"sticky top-0 z-50 w-full bg-background/95 backdrop-blur-sm border-b border-border",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsxs("button",{onClick:()=>{f&&f()},className:"inline-flex items-center gap-2 text-muted-foreground hover:text-card-foreground transition-colors",children:[e.jsx(Y.ArrowLeft,{className:"w-4 h-4"}),"Back"]})})}),e.jsx("div",{className:"container mx-auto px-4 py-8 max-w-6xl",children:e.jsxs("div",{className:"flex flex-col gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsx("div",{className:"w-full aspect-video bg-black rounded-xl overflow-hidden relative shadow-card",children:U?e.jsxs("div",{className:"relative w-full h-full",children:[e.jsx("video",{ref:X,controls:!0,poster:yp(C.thumbnail),className:"w-full h-full object-contain bg-black",onDoubleClick:async ie=>{const ye=ie.currentTarget;try{document.fullscreenElement?await document.exitFullscreen():await ye.requestFullscreen()}catch{}}}),I&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary"})}),A&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/80",children:e.jsxs("div",{className:"text-center text-white",children:[e.jsx("p",{className:"mb-4",children:A}),e.jsx("button",{onClick:()=>{z(!1),H(null)},className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary-hover transition-colors",children:"Try Again"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("img",{src:yp(C.thumbnail)||`https://images.hive.blog/u/${C.owner}/avatar`,alt:C.title,className:"w-full h-full object-cover",onError:ie=>{ie.target.src=`https://images.hive.blog/u/${C.owner}/avatar`}}),e.jsx("div",{className:"absolute inset-0 bg-gradient-overlay opacity-30"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("button",{onClick:ve,className:"bg-primary hover:bg-primary-hover rounded-full p-6 transform hover:scale-110 transition-all duration-300 shadow-lg",children:e.jsx(Y.Play,{className:"w-8 h-8 text-primary-foreground ml-1",fill:"currentColor"})})}),C.duration&&e.jsxs("div",{className:"absolute bottom-4 right-4 bg-black/80 text-white text-sm px-3 py-1 rounded-md flex items-center gap-1 backdrop-blur-sm",children:[e.jsx(Y.Clock,{className:"w-3 h-3"}),pe(C.duration)]}),C.views&&e.jsxs("div",{className:"absolute bottom-4 left-4 bg-black/80 text-white text-sm px-3 py-1 rounded-md flex items-center gap-1 backdrop-blur-sm",children:[e.jsx(Y.Eye,{className:"w-3 h-3"}),C.views.toLocaleString()," views"]})]})}),e.jsx(aT,{title:C.title||"",author:C.owner||"",permlink:C.permlink||"",createdAt:C.created,description:C.description||"",video:{title:C.title||"",author:C.owner||"",permlink:C.permlink||"",created:C.created||new Date,category:C.category||"",numOfUpvotes:void 0,numOfComments:void 0,hiveValue:void 0,duration:C.duration,thumbnail:C.thumbnail,views:C.views},onTapComment:()=>{h?h(v,N):J(!0)},onTapUpvote:()=>{g?g(v,N):se(!0)},onTapInfo:()=>{b?b(v,N,C.description||""):he(!0)},onTapAuthor:()=>{l&&l(C.owner)},onTapShare:()=>{x&&x(v,N)},onTapBookmark:()=>{_&&_(v,N)}}),C.tags&&e.jsx("div",{className:"flex flex-wrap gap-2",children:C.tags.split(",").map((ie,ye)=>e.jsxs("span",{className:"bg-primary/10 text-primary px-3 py-1 rounded-full text-sm font-medium hover:bg-primary/20 transition-colors cursor-pointer",onClick:()=>{c&&c(ie.trim())},children:["#",ie.trim()]},ye))})]}),e.jsxs("div",{className:"bg-card border border-border rounded-xl p-6 sticky top-24",children:[e.jsx("h3",{className:"font-semibold text-card-foreground mb-4 text-lg",children:"Related Videos"}),e.jsx("div",{className:"space-y-4",children:e.jsx(U3,{feedType:xo.RELATED,username:C.owner,onVideoClick:Le,onAuthorClick:Ce})})]})]})}),Z&&v&&N&&e.jsx(SN,{author:v,permlink:N,onClose:()=>J(!1)}),ee&&v&&N&&e.jsx(ry,{author:v,permlink:N,onClose:()=>se(!1),onUserClick:l,totalVoteCount:C?.numOfUpvotes??void 0}),fe&&v&&N&&e.jsx(v7,{author:v,permlink:N,content:C.description||"",onClose:()=>he(!1)})]})};var NC={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},m6=T.createContext&&T.createContext(NC),w7=["attr","size","title"];function _7(a,o){if(a==null)return{};var l=k7(a,o),u,c;if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(c=0;c<f.length;c++)u=f[c],!(o.indexOf(u)>=0)&&Object.prototype.propertyIsEnumerable.call(a,u)&&(l[u]=a[u])}return l}function k7(a,o){if(a==null)return{};var l={};for(var u in a)if(Object.prototype.hasOwnProperty.call(a,u)){if(o.indexOf(u)>=0)continue;l[u]=a[u]}return l}function Rw(){return Rw=Object.assign?Object.assign.bind():function(a){for(var o=1;o<arguments.length;o++){var l=arguments[o];for(var u in l)Object.prototype.hasOwnProperty.call(l,u)&&(a[u]=l[u])}return a},Rw.apply(this,arguments)}function p6(a,o){var l=Object.keys(a);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(a);o&&(u=u.filter(function(c){return Object.getOwnPropertyDescriptor(a,c).enumerable})),l.push.apply(l,u)}return l}function Lw(a){for(var o=1;o<arguments.length;o++){var l=arguments[o]!=null?arguments[o]:{};o%2?p6(Object(l),!0).forEach(function(u){j7(a,u,l[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(l)):p6(Object(l)).forEach(function(u){Object.defineProperty(a,u,Object.getOwnPropertyDescriptor(l,u))})}return a}function j7(a,o,l){return o=N7(o),o in a?Object.defineProperty(a,o,{value:l,enumerable:!0,configurable:!0,writable:!0}):a[o]=l,a}function N7(a){var o=S7(a,"string");return typeof o=="symbol"?o:o+""}function S7(a,o){if(typeof a!="object"||!a)return a;var l=a[Symbol.toPrimitive];if(l!==void 0){var u=l.call(a,o);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(a)}function SC(a){return a&&a.map((o,l)=>T.createElement(o.tag,Lw({key:l},o.attr),SC(o.child)))}function Hs(a){return o=>T.createElement(E7,Rw({attr:Lw({},a.attr)},o),SC(a.child))}function E7(a){var o=l=>{var{attr:u,size:c,title:f}=a,h=_7(a,w7),g=c||l.size||"1em",b;return l.className&&(b=l.className),a.className&&(b=(b?b+" ":"")+a.className),T.createElement("svg",Rw({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},l.attr,u,h,{className:b,style:Lw(Lw({color:a.color||l.color},l.style),a.style),height:g,width:g,xmlns:"http://www.w3.org/2000/svg"}),f&&T.createElement("title",null,f),a.children)};return m6!==void 0?T.createElement(m6.Consumer,null,l=>o(l)):o(NC)}function A7(a){return Hs({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z"},child:[]}]})(a)}function T7(a){return Hs({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"},child:[]}]})(a)}function C7(a){return Hs({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z"},child:[]}]})(a)}function EC(a){return Hs({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M296 160H180.6l42.6-129.8C227.2 15 215.7 0 200 0H56C44 0 33.8 8.9 32.2 20.8l-32 240C-1.7 275.2 9.5 288 24 288h118.7L96.6 482.5c-3.6 15.2 8 29.5 23.3 29.5 8.4 0 16.4-4.4 20.8-12l176-304c9.3-15.9-2.2-36-20.7-36z"},child:[]}]})(a)}function D7(a){return Hs({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M436 480h-20V24c0-13.255-10.745-24-24-24H56C42.745 0 32 10.745 32 24v456H12c-6.627 0-12 5.373-12 12v20h448v-20c0-6.627-5.373-12-12-12zM128 76c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12V76zm0 96c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40zm52 148h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12zm76 160h-64v-84c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v84zm64-172c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40zm0-96c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40zm0-96c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12V76c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40z"},child:[]}]})(a)}function g6(a){return Hs({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 384H64V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-32c0-8.84-7.16-16-16-16zM464 96H345.94c-21.38 0-32.09 25.85-16.97 40.97l32.4 32.4L288 242.75l-73.37-73.37c-12.5-12.5-32.76-12.5-45.25 0l-68.69 68.69c-6.25 6.25-6.25 16.38 0 22.63l22.62 22.62c6.25 6.25 16.38 6.25 22.63 0L192 237.25l73.37 73.37c12.5 12.5 32.76 12.5 45.25 0l96-96 32.4 32.4c15.12 15.12 40.97 4.41 40.97-16.97V112c.01-8.84-7.15-16-15.99-16z"},child:[]}]})(a)}function M7(a){return Hs({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"},child:[]}]})(a)}function AC(a){return Hs({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(a)}function O7(a){return Hs({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 405.3V448c0 35.3 86 64 192 64s192-28.7 192-64v-42.7C342.7 434.4 267.2 448 192 448S41.3 434.4 0 405.3zM320 128c106 0 192-28.7 192-64S426 0 320 0 128 28.7 128 64s86 64 192 64zM0 300.4V352c0 35.3 86 64 192 64s192-28.7 192-64v-51.6c-41.3 34-116.9 51.6-192 51.6S41.3 334.4 0 300.4zm416 11c57.3-11.1 96-31.7 96-55.4v-42.7c-23.2 16.4-57.3 27.6-96 34.5v63.6zM192 160C86 160 0 195.8 0 240s86 80 192 80 192-35.8 192-80-86-80-192-80zm219.3 56.3c60-10.8 100.7-32 100.7-56.3v-42.7c-35.5 25.1-96.5 38.6-160.7 41.8 29.5 14.3 51.2 33.5 60 57.2z"},child:[]}]})(a)}function R7(a){return Hs({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M160 224v64h320v-64c0-35.3 28.7-64 64-64h32c0-53-43-96-96-96H160c-53 0-96 43-96 96h32c35.3 0 64 28.7 64 64zm416-32h-32c-17.7 0-32 14.3-32 32v96H128v-96c0-17.7-14.3-32-32-32H64c-35.3 0-64 28.7-64 64 0 23.6 13 44 32 55.1V432c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16v-16h384v16c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16V311.1c19-11.1 32-31.5 32-55.1 0-35.3-28.7-64-64-64z"},child:[]}]})(a)}function N3(a){return Hs({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"},child:[]}]})(a)}function L7(a){return Hs({attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M336.5 160C322 70.7 287.8 8 248 8s-74 62.7-88.5 152h177zM152 256c0 22.2 1.2 43.5 3.3 64h185.3c2.1-20.5 3.3-41.8 3.3-64s-1.2-43.5-3.3-64H155.3c-2.1 20.5-3.3 41.8-3.3 64zm324.7-96c-28.6-67.9-86.5-120.4-158-141.6 24.4 33.8 41.2 84.7 50 141.6h108zM177.2 18.4C105.8 39.6 47.8 92.1 19.3 160h108c8.7-56.9 25.5-107.8 49.9-141.6zM487.4 192H372.7c2.1 21 3.3 42.5 3.3 64s-1.2 43-3.3 64h114.6c5.5-20.5 8.6-41.8 8.6-64s-3.1-43.5-8.5-64zM120 256c0-21.5 1.2-43 3.3-64H8.6C3.2 212.5 0 233.8 0 256s3.2 43.5 8.6 64h114.6c-2-21-3.2-42.5-3.2-64zm39.5 96c14.5 89.3 48.7 152 88.5 152s74-62.7 88.5-152h-177zm159.3 141.6c71.4-21.2 129.4-73.7 158-141.6h-108c-8.8 56.9-25.6 107.8-50 141.6zM19.3 352c28.6 67.9 86.5 120.4 158 141.6-24.4-33.8-41.2-84.7-50-141.6h-108z"},child:[]}]})(a)}function qj(a){return Hs({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M275.3 250.5c7 7.4 18.4 7.4 25.5 0l108.9-114.2c31.6-33.2 29.8-88.2-5.6-118.8-30.8-26.7-76.7-21.9-104.9 7.7L288 36.9l-11.1-11.6C248.7-4.4 202.8-9.2 172 17.5c-35.3 30.6-37.2 85.6-5.6 118.8l108.9 114.2zm290 77.6c-11.8-10.7-30.2-10-42.6 0L430.3 402c-11.3 9.1-25.4 14-40 14H272c-8.8 0-16-7.2-16-16s7.2-16 16-16h78.3c15.9 0 30.7-10.9 33.3-26.6 3.3-20-12.1-37.4-31.6-37.4H192c-27 0-53.1 9.3-74.1 26.3L71.4 384H16c-8.8 0-16 7.2-16 16v96c0 8.8 7.2 16 16 16h356.8c14.5 0 28.6-4.9 40-14L564 377c15.2-12.1 16.4-35.3 1.3-48.9z"},child:[]}]})(a)}function Gj(a){return Hs({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M624 416H381.54c-.74 19.81-14.71 32-32.74 32H288c-18.69 0-33.02-17.47-32.77-32H16c-8.8 0-16 7.2-16 16v16c0 35.2 28.8 64 64 64h512c35.2 0 64-28.8 64-64v-16c0-8.8-7.2-16-16-16zM576 48c0-26.4-21.6-48-48-48H112C85.6 0 64 21.6 64 48v336h512V48zm-64 272H128V64h384v256z"},child:[]}]})(a)}function z7(a){return Hs({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M621.16 54.46C582.37 38.19 543.55 32 504.75 32c-123.17-.01-246.33 62.34-369.5 62.34-30.89 0-61.76-3.92-92.65-13.72-3.47-1.1-6.95-1.62-10.35-1.62C15.04 79 0 92.32 0 110.81v317.26c0 12.63 7.23 24.6 18.84 29.46C57.63 473.81 96.45 480 135.25 480c123.17 0 246.34-62.35 369.51-62.35 30.89 0 61.76 3.92 92.65 13.72 3.47 1.1 6.95 1.62 10.35 1.62 17.21 0 32.25-13.32 32.25-31.81V83.93c-.01-12.64-7.24-24.6-18.85-29.47zM48 132.22c20.12 5.04 41.12 7.57 62.72 8.93C104.84 170.54 79 192.69 48 192.69v-60.47zm0 285v-47.78c34.37 0 62.18 27.27 63.71 61.4-22.53-1.81-43.59-6.31-63.71-13.62zM320 352c-44.19 0-80-42.99-80-96 0-53.02 35.82-96 80-96s80 42.98 80 96c0 53.03-35.83 96-80 96zm272 27.78c-17.52-4.39-35.71-6.85-54.32-8.44 5.87-26.08 27.5-45.88 54.32-49.28v57.72zm0-236.11c-30.89-3.91-54.86-29.7-55.81-61.55 19.54 2.17 38.09 6.23 55.81 12.66v48.89z"},child:[]}]})(a)}function $7(a){return Hs({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M608 64H32C14.33 64 0 78.33 0 96v320c0 17.67 14.33 32 32 32h576c17.67 0 32-14.33 32-32V96c0-17.67-14.33-32-32-32zM48 400v-64c35.35 0 64 28.65 64 64H48zm0-224v-64h64c0 35.35-28.65 64-64 64zm272 176c-44.19 0-80-42.99-80-96 0-53.02 35.82-96 80-96s80 42.98 80 96c0 53.03-35.83 96-80 96zm272 48h-64c0-35.35 28.65-64 64-64v64zm0-224c-35.35 0-64-28.65-64-64h64v64z"},child:[]}]})(a)}function P7(a){return Hs({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M290.74 93.24l128.02 128.02-277.99 277.99-114.14 12.6C11.35 513.54-1.56 500.62.14 485.34l12.7-114.22 277.9-277.88zm207.2-19.06l-60.11-60.11c-18.75-18.75-49.16-18.75-67.91 0l-56.55 56.55 128.02 128.02 56.55-56.55c18.75-18.76 18.75-49.16 0-67.91z"},child:[]}]})(a)}function B7(a){return Hs({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"},child:[]}]})(a)}function U7(a){return Hs({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"},child:[]}]})(a)}function H7(a){return Hs({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M480 160H32c-17.673 0-32-14.327-32-32V64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24z"},child:[]}]})(a)}function TC(a){return Hs({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(a)}function V7(a){return Hs({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"},child:[]}]})(a)}function F7(a){return Hs({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"},child:[]}]})(a)}function Zj(a){return Hs({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M96 224c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm448 0c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm32 32h-64c-17.6 0-33.5 7.1-45.1 18.6 40.3 22.1 68.9 62 75.1 109.4h66c17.7 0 32-14.3 32-32v-32c0-35.3-28.7-64-64-64zm-256 0c61.9 0 112-50.1 112-112S381.9 32 320 32 208 82.1 208 144s50.1 112 112 112zm76.8 32h-8.3c-20.8 10-43.9 16-68.5 16s-47.6-6-68.5-16h-8.3C179.6 288 128 339.6 128 403.2V432c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48v-28.8c0-63.6-51.6-115.2-115.2-115.2zm-223.7-13.4C161.5 263.1 145.6 256 128 256H64c-35.3 0-64 28.7-64 64v32c0 17.7 14.3 32 32 32h65.9c6.3-47.4 34.9-87.3 75.2-109.4z"},child:[]}]})(a)}function I7(a){return Hs({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M461.2 128H80c-8.84 0-16-7.16-16-16s7.16-16 16-16h384c8.84 0 16-7.16 16-16 0-26.51-21.49-48-48-48H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h397.2c28.02 0 50.8-21.53 50.8-48V176c0-26.47-22.78-48-50.8-48zM416 336c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32z"},child:[]}]})(a)}const r_=Zc(),q7=async a=>{try{const o=await r_.database.getAccounts([a]);if(!o||o.length===0)throw new Error("Account not found");return o[0]}catch(o){return console.error("Error in getWalletDataDetail:",o),{error:o instanceof Error?o.message:"Unknown error"}}},Yj=async a=>{try{const o=await r_.database.getDynamicGlobalProperties(),l=parseFloat(a.split(" ")[0]),u=parseFloat(String(o.total_vesting_shares).split(" ")[0]),c=parseFloat(String(o.total_vesting_fund_hive).split(" ")[0]);return(l*c/u).toFixed(3)}catch(o){return console.error("Error in convertVestingSharesToHiveData:",o),"0"}},CC=async()=>{const o=(await r_.database.call("get_feed_history",[])).current_median_history,l=parseFloat(o.base.split(" ")[0]),u=parseFloat(o.quote.split(" ")[0]);return{baseAmount:l,quoteAmount:u}},G7=async a=>{try{const{baseAmount:o}=await CC(),l=typeof a=="string"?parseFloat(a):a;return(o*l).toFixed(2)}catch(o){return console.error("Error in convertHivetoUSDData:",o),"0"}},Z7=async a=>{try{const{baseAmount:o,quoteAmount:l}=await CC();return o===0?0:a*l/o}catch(o){return console.error("Error in convertHBDtoHive:",o),0}},DC=()=>{try{const a=Intl.DateTimeFormat().resolvedOptions().timeZone||"",o={"Asia/Kolkata":"INR","Asia/Calcutta":"INR","Asia/Chennai":"INR","Asia/Mumbai":"INR","Asia/Karachi":"PKR","Asia/Dhaka":"BDT","Asia/Colombo":"LKR","Asia/Kathmandu":"NPR","Asia/Rangoon":"MMK","Asia/Yangon":"MMK","Asia/Bangkok":"THB","Asia/Ho_Chi_Minh":"VND","Asia/Saigon":"VND","Asia/Jakarta":"IDR","Asia/Kuala_Lumpur":"MYR","Asia/Singapore":"SGD","Asia/Manila":"PHP","Asia/Hong_Kong":"HKD","Asia/Taipei":"TWD","Asia/Shanghai":"CNY","Asia/Chongqing":"CNY","Asia/Beijing":"CNY","Asia/Tokyo":"JPY","Asia/Seoul":"KRW","Asia/Dubai":"AED","Asia/Riyadh":"SAR","Asia/Jerusalem":"ILS","Asia/Tel_Aviv":"ILS","Asia/Phnom_Penh":"KHR","Asia/Vientiane":"LAK","America/New_York":"USD","America/Chicago":"USD","America/Denver":"USD","America/Los_Angeles":"USD","America/Phoenix":"USD","America/Anchorage":"USD","Pacific/Honolulu":"USD","America/Toronto":"CAD","America/Vancouver":"CAD","America/Montreal":"CAD","America/Edmonton":"CAD","America/Sao_Paulo":"BRL","America/Rio_Branco":"BRL","America/Mexico_City":"MXN","America/Cancun":"MXN","America/Argentina/Buenos_Aires":"ARS","America/Bogota":"COP","America/Lima":"PEN","America/Santiago":"CLP","Europe/London":"GBP","Europe/Dublin":"EUR","Europe/Berlin":"EUR","Europe/Paris":"EUR","Europe/Rome":"EUR","Europe/Madrid":"EUR","Europe/Lisbon":"EUR","Europe/Amsterdam":"EUR","Europe/Brussels":"EUR","Europe/Vienna":"EUR","Europe/Helsinki":"EUR","Europe/Athens":"EUR","Europe/Bratislava":"EUR","Europe/Ljubljana":"EUR","Europe/Vilnius":"EUR","Europe/Riga":"EUR","Europe/Tallinn":"EUR","Europe/Malta":"EUR","Europe/Nicosia":"EUR","Europe/Luxembourg":"EUR","Europe/Zagreb":"EUR","Europe/Zurich":"CHF","Europe/Stockholm":"SEK","Europe/Oslo":"NOK","Europe/Copenhagen":"DKK","Europe/Warsaw":"PLN","Europe/Prague":"CZK","Europe/Budapest":"HUF","Europe/Bucharest":"RON","Europe/Moscow":"RUB","Europe/Kiev":"UAH","Europe/Kyiv":"UAH","Europe/Istanbul":"TRY","Africa/Lagos":"NGN","Africa/Johannesburg":"ZAR","Africa/Nairobi":"KES","Africa/Accra":"GHS","Africa/Cairo":"EGP","Australia/Sydney":"AUD","Australia/Melbourne":"AUD","Australia/Brisbane":"AUD","Australia/Perth":"AUD","Pacific/Auckland":"NZD"};if(o[a])return o[a];const l=navigator.language||"en-US",u={US:"USD",GB:"GBP",IN:"INR",JP:"JPY",CN:"CNY",KR:"KRW",AU:"AUD",CA:"CAD",BR:"BRL",MX:"MXN",DE:"EUR",FR:"EUR",IT:"EUR",ES:"EUR",NL:"EUR"},c=l.split("-")[1]?.toUpperCase();return c&&u[c]||"USD"}catch{return"USD"}},Y7=async()=>{try{const o=await(await fetch("https://open.er-api.com/v6/latest/USD")).json();return o?.rates?o.rates:{USD:1}}catch{return{USD:1}}},Bv=[{code:"USD",name:"US Dollar"},{code:"EUR",name:"Euro"},{code:"GBP",name:"British Pound"},{code:"INR",name:"Indian Rupee"},{code:"JPY",name:"Japanese Yen"},{code:"CNY",name:"Chinese Yuan"},{code:"KRW",name:"South Korean Won"},{code:"AUD",name:"Australian Dollar"},{code:"CAD",name:"Canadian Dollar"},{code:"BRL",name:"Brazilian Real"},{code:"MXN",name:"Mexican Peso"},{code:"CHF",name:"Swiss Franc"},{code:"SGD",name:"Singapore Dollar"},{code:"HKD",name:"Hong Kong Dollar"},{code:"SEK",name:"Swedish Krona"},{code:"NOK",name:"Norwegian Krone"},{code:"DKK",name:"Danish Krone"},{code:"PLN",name:"Polish Zloty"},{code:"TRY",name:"Turkish Lira"},{code:"RUB",name:"Russian Ruble"},{code:"ZAR",name:"South African Rand"},{code:"AED",name:"UAE Dirham"},{code:"SAR",name:"Saudi Riyal"},{code:"THB",name:"Thai Baht"},{code:"IDR",name:"Indonesian Rupiah"},{code:"MYR",name:"Malaysian Ringgit"},{code:"PHP",name:"Philippine Peso"},{code:"VND",name:"Vietnamese Dong"},{code:"PKR",name:"Pakistani Rupee"},{code:"BDT",name:"Bangladeshi Taka"},{code:"GTQ",name:"Guatemalan Quetzal"},{code:"NGN",name:"Nigerian Naira"},{code:"EGP",name:"Egyptian Pound"},{code:"KES",name:"Kenyan Shilling"},{code:"NZD",name:"New Zealand Dollar"},{code:"TWD",name:"Taiwan Dollar"},{code:"CZK",name:"Czech Koruna"},{code:"HUF",name:"Hungarian Forint"},{code:"ILS",name:"Israeli Shekel"},{code:"CLP",name:"Chilean Peso"},{code:"ARS",name:"Argentine Peso"},{code:"COP",name:"Colombian Peso"},{code:"LKR",name:"Sri Lankan Rupee"},{code:"NPR",name:"Nepalese Rupee"},{code:"UAH",name:"Ukrainian Hryvnia"},{code:"RON",name:"Romanian Leu"},{code:"GHS",name:"Ghanaian Cedi"}],fw=(a,o)=>{try{const l=navigator.language||"en-US";return new Intl.NumberFormat(l,{style:"currency",currency:o,minimumFractionDigits:2,maximumFractionDigits:2,currencyDisplay:"narrowSymbol"}).formatToParts(a).map(c=>c.value).join("")}catch{try{return new Intl.NumberFormat("en-US",{style:"currency",currency:o,minimumFractionDigits:2,maximumFractionDigits:2}).format(a)}catch{return`$${a.toFixed(2)}`}}},x6=async a=>{try{const l=await(await fetch(Hl(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:0,jsonrpc:"2.0",method:"condenser_api.get_savings_withdraw_from",params:[a]})})).json();return l.error?[]:(l.result||[]).map(u=>({request_id:u.request_id,from:u.from,to:u.to,amount:u.amount,memo:u.memo||"",complete:u.complete}))}catch(o){return console.error("fetchPendingSavingsWithdrawals failed:",o),[]}},X7="848647637693366652",W7="129639434";let Ng=0,b6=0;const J7=300*1e3;async function v6(a=!1){const o=Date.now();if(!a&&Ng>0&&o-b6<J7)return Ng;try{const l=await r_.database.getDynamicGlobalProperties(),u=parseFloat(String(l.total_vesting_shares).split(" ")[0]),c=parseFloat(String(l.total_vesting_fund_hive).split(" ")[0]);u>0&&c>0&&(Ng=c/u,b6=o)}catch{}return Ng}function wh(a){if(!a||!a.includes("VESTS"))return a;const o=parseFloat(a.split(" ")[0]);return!Number.isFinite(o)||Ng<=0?a:`${(o*Ng).toFixed(3)} HP`}function Q7(a,o){const[l,u]=a,[c,f]=u.op,h={id:l,timestamp:u.timestamp,trx_id:u.trx_id};switch(c){case"transfer":return{...h,type:f.from===o?"sent":"received",amount:String(f.amount),from:f.from,to:f.to,memo:f.memo||""};case"transfer_to_vesting":return{...h,type:f.from===o?"sent":"received",amount:String(f.amount),from:f.from,to:f.to,memo:f.from===f.to?"Power up":`Power up → @${f.to}`};case"transfer_to_savings":return{...h,type:f.from===o?"sent":"received",amount:String(f.amount),from:f.from,to:f.to,memo:f.memo?`Savings deposit · ${f.memo}`:"Savings deposit"};case"transfer_from_savings":return{...h,type:f.from===o?"sent":"received",amount:String(f.amount),from:f.from,to:f.to,memo:f.memo?`Savings withdraw · ${f.memo}`:"Savings withdraw"};case"fill_transfer_from_savings":return{...h,type:"received",amount:String(f.amount),from:f.from,to:f.to,memo:"Savings withdraw fill"};case"cancel_transfer_from_savings":return{...h,type:"received",amount:"—",from:f.from,to:f.from,memo:`Cancelled savings withdrawal #${f.request_id}`};case"fill_vesting_withdraw":return{...h,type:f.to_account===o?"received":"sent",amount:String(f.deposited),from:f.from_account,to:f.to_account,memo:"Power down"};case"claim_reward_balance":{const g=[];return f.reward_hive&&parseFloat(f.reward_hive)>0&&g.push(String(f.reward_hive)),f.reward_hbd&&parseFloat(f.reward_hbd)>0&&g.push(String(f.reward_hbd)),f.reward_vests&&parseFloat(f.reward_vests)>0&&g.push(wh(String(f.reward_vests))),{...h,type:"received",amount:g.join(", ")||"—",from:f.account,to:f.account,memo:"Claimed rewards"}}case"delegate_vesting_shares":return{...h,type:f.delegator===o?"sent":"received",amount:wh(String(f.vesting_shares)),from:f.delegator,to:f.delegatee,memo:`Delegate HP → @${f.delegatee}`};case"return_vesting_delegation":return{...h,type:"received",amount:wh(String(f.vesting_shares)),from:"delegation",to:f.account,memo:"Delegation returned"};case"withdraw_vesting":{const g=parseFloat(String(f.vesting_shares).split(" ")[0]),b=!Number.isFinite(g)||g===0;return{...h,type:"sent",amount:b?"0.000 HP":wh(String(f.vesting_shares)),from:f.account,to:f.account,memo:b?"Stopped power down":"Started power down"}}case"author_reward":{const g=[];return f.hive_payout&&parseFloat(f.hive_payout)>0&&g.push(String(f.hive_payout)),f.hbd_payout&&parseFloat(f.hbd_payout)>0&&g.push(String(f.hbd_payout)),f.vesting_payout&&parseFloat(f.vesting_payout)>0&&g.push(wh(String(f.vesting_payout))),{...h,type:"received",amount:g.join(", ")||"—",from:"author_reward",to:f.author,memo:`Author reward · ${f.permlink}`}}case"curation_reward":return{...h,type:"received",amount:wh(String(f.reward)),from:"curation",to:f.curator,memo:`Curation · @${f.comment_author}/${f.permlink}`};case"comment_benefactor_reward":{const g=[];return f.hive_payout&&parseFloat(f.hive_payout)>0&&g.push(String(f.hive_payout)),f.hbd_payout&&parseFloat(f.hbd_payout)>0&&g.push(String(f.hbd_payout)),f.vesting_payout&&parseFloat(f.vesting_payout)>0&&g.push(wh(String(f.vesting_payout))),{...h,type:"received",amount:g.join(", ")||"—",from:f.author,to:f.benefactor,memo:"Benefactor reward"}}case"producer_reward":return{...h,type:"received",amount:wh(String(f.vesting_shares)),from:"producer",to:f.producer,memo:"Producer reward"};case"fill_order":return{...h,type:"received",amount:`${f.current_pays} → ${f.open_pays}`,from:f.current_owner,to:f.open_owner,memo:"Market fill"};case"recurrent_transfer":return{...h,type:f.from===o?"sent":"received",amount:String(f.amount),from:f.from,to:f.to,memo:f.memo?`Recurrent · ${f.memo}`:"Recurrent transfer"};case"fill_recurrent_transfer":return{...h,type:f.from===o?"sent":"received",amount:String(f.amount),from:f.from,to:f.to,memo:"Recurrent fill"};default:return null}}const y6=async(a,o=100,l=-1)=>{const c=await(await fetch(Hl(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:0,jsonrpc:"2.0",method:"condenser_api.get_account_history",params:[a,l,o,X7,W7]})})).json();if(c.error)throw new Error(c.error.message||"Failed to fetch transactions");const f=c.result||[];let h=null;return f.length>0&&(h=f.reduce((b,w)=>w[0]<b?w[0]:b,f[0][0])),{transactions:f.map(b=>Q7(b,a)).filter(b=>b!==null).reverse(),rawCount:f.length,oldestIndex:h}},K7=DC(),EN=eT.create((a,o)=>({walletData:null,isLoading:!1,error:null,transactions:[],isLoadingTransactions:!1,transactionError:null,hasMoreTransactions:!0,isLoadingMoreTransactions:!1,selectedCurrency:"USD",localCurrency:K7,exchangeRates:{USD:1},setWalletData:l=>a({walletData:l}),clearWalletData:()=>a({walletData:null,error:null,transactions:[],transactionError:null}),setSelectedCurrency:l=>{const{walletData:u,exchangeRates:c}=o();if(!u){a({selectedCurrency:l});return}const f=c[l]||1,h=u.estimated_value_usd*f,g=fw(h,l);a({selectedCurrency:l,walletData:{...u,estimated_value:g}})},getFormattedEstimatedValue:()=>{const{walletData:l,selectedCurrency:u,exchangeRates:c}=o();if(!l)return"-";const f=c[u]||1,h=l.estimated_value_usd*f;return fw(h,u)},fetchWalletData:async l=>{a({isLoading:!0,error:null});try{const u=await q7(l),c=ve=>"error"in ve;if(!u||c(u))throw new Error(c(u)?u.error:"Account not found");const f=typeof u.vesting_shares=="string"?u.vesting_shares:"0.000000 VESTS",h=typeof u.balance=="string"?u.balance:u.balance.toString(),g=typeof u.hbd_balance=="string"?u.hbd_balance:u.hbd_balance.toString(),b=typeof u.savings_balance=="string"?u.savings_balance:u.savings_balance.toString(),w=typeof u.savings_hbd_balance=="string"?u.savings_hbd_balance:u.savings_hbd_balance.toString(),x=await Yj(f),_=typeof u.reward_hive_balance=="string"?u.reward_hive_balance:"0.000 HIVE",v=typeof u.reward_hbd_balance=="string"?u.reward_hbd_balance:"0.000 HBD",N=typeof u.reward_vesting_balance=="string"?u.reward_vesting_balance:"0.000000 VESTS";let C=typeof u.reward_vesting_hive=="string"?u.reward_vesting_hive:void 0;!C&&parseFloat(N.split(" ")[0]||"0")>0&&(C=`${await Yj(N)} HIVE`);const R=typeof u.vesting_withdraw_rate=="string"?u.vesting_withdraw_rate:"0.000000 VESTS",E=parseFloat(R.split(" ")[0]||"0")>0,$=E?await Yj(R):void 0,V=E&&u.next_vesting_withdrawal?String(u.next_vesting_withdrawal):void 0,U=parseFloat(h.split(" ")[0]||"0"),z=parseFloat(x),A=parseFloat(g.split(" ")[0]||"0"),H=parseFloat(w.split(" ")[0]||"0"),I=A+H,q=await Z7(I),Z=(U+z+q).toFixed(3),J=await G7(Z),ee=parseFloat(J),se=await Y7(),{selectedCurrency:fe}=o(),he=se[fe]||1,X=ee*he,W=fw(X,fe),ne=await x6(l),be={balance:h,hbd_balance:g,savings_balance:b,savings_hbd_balance:w,hive_power:`${x} HP`,estimated_value:W,estimated_value_usd:ee,power_down_active:E,power_down_hp_per_week:$,next_vesting_withdrawal:V,pending_savings_withdrawals:ne,reward_hive_balance:_,reward_hbd_balance:v,reward_vesting_balance:N,reward_vesting_hive:C};return a({walletData:be,exchangeRates:se}),be}catch(u){const c=u instanceof Error?u.message:"Failed to fetch wallet data";console.error("Wallet fetch error:",c);const f={balance:"0.000 HIVE",hbd_balance:"0.000 HBD",savings_balance:"0.000 HIVE",savings_hbd_balance:"0.000 HBD",hive_power:"0 HP",estimated_value:fw(0,"USD"),estimated_value_usd:0,error:c};return a({walletData:f,error:c}),f}finally{a({isLoading:!1})}},fetchSavingsWithdrawals:async l=>{const u=await x6(l),{walletData:c}=o();return c&&a({walletData:{...c,pending_savings_withdrawals:u}}),u},fetchTransactions:async(l,u=100)=>{a({isLoadingTransactions:!0,transactionError:null});try{await v6();const{transactions:c,oldestIndex:f}=await y6(l,u,-1);return a({transactions:c,hasMoreTransactions:f!==null&&f>0}),c}catch(c){const f=c instanceof Error?c.message:"Failed to fetch transactions";return console.error("Transaction fetch error:",f),a({transactionError:f,hasMoreTransactions:!1}),[]}finally{a({isLoadingTransactions:!1})}},fetchMoreTransactions:async(l,u=100)=>{const{transactions:c,isLoadingMoreTransactions:f,hasMoreTransactions:h}=o();if(f||!h)return[];a({isLoadingMoreTransactions:!0});try{await v6();const g=c.reduce((N,C)=>C.id<N?C.id:N,c[0]?.id??-1);if(g<=0)return a({hasMoreTransactions:!1}),[];const b=g-1,{transactions:w,oldestIndex:x}=await y6(l,u,b),_=new Set(c.map(N=>`${N.trx_id}:${N.id}`)),v=w.filter(N=>!_.has(`${N.trx_id}:${N.id}`));return a({transactions:[...c,...v],hasMoreTransactions:x!==null&&x>0}),v}catch(g){const b=g instanceof Error?g.message:"Failed to fetch more transactions";return console.error("Transaction paginate error:",b),[]}finally{a({isLoadingMoreTransactions:!1})}}})),MC="https://api.hive.blog/balance-api",ez=a=>{const o=Number(a);return Number.isFinite(o)?`${(o/1e9).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}b RC`:a},tz=a=>`${a.toLocaleString("en-US",{minimumFractionDigits:3,maximumFractionDigits:3})} HP`,rz=async a=>{const o=await fetch(`${MC}/accounts/${a}/delegations`);if(!o.ok)throw new Error(`HP delegations: ${o.status}`);return o.json()},az=async a=>{const o=await fetch(`${MC}/accounts/${a}/rc-delegations`);if(!o.ok)throw new Error(`RC delegations: ${o.status}`);return o.json()},nz=async()=>{try{const o=await Zc().database.getDynamicGlobalProperties(),l=parseFloat(String(o.total_vesting_shares).split(" ")[0]),u=parseFloat(String(o.total_vesting_fund_hive).split(" ")[0]);return l?u/l/1e6:0}catch(a){return console.error("Delegations: failed to load global props:",a),0}},ay=({name:a,size:o=24})=>{const l=a.trim().toLowerCase(),u=/^[a-z][a-z0-9-.]{2,15}$/.test(l),[c,f]=T.useState(!1);return T.useEffect(()=>{f(!1)},[l]),!u||c?e.jsx("div",{style:{width:o,height:o},className:"rounded-full flex-shrink-0 border border-gray-700 bg-gray-700 flex items-center justify-center text-gray-400",title:l?`@${l}`:"No account",children:e.jsx(F7,{size:Math.max(8,o*.45)})}):e.jsx("img",{src:`https://images.hive.blog/u/${l}/avatar`,alt:l,style:{width:o,height:o},className:"rounded-full flex-shrink-0 border border-gray-700 bg-gray-800 object-cover",onError:()=>f(!0)})},hw=({direction:a,total:o,count:l,search:u,onSearch:c,onCreate:f,createLabel:h})=>e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 mb-2 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs sm:text-sm font-semibold text-gray-200 min-w-0",children:[e.jsx("span",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${a==="outgoing"?"bg-orange-400":"bg-emerald-400"}`}),e.jsxs("span",{className:"truncate",children:[a==="outgoing"?"Delegated:":"Received:"," ",o,l>0&&e.jsxs("span",{className:"text-gray-400 font-normal",children:[" (",l,")"]})]})]}),a==="outgoing"&&e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsxs("div",{className:"relative flex-1 sm:flex-none min-w-0",children:[e.jsx(U7,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500 text-xs"}),e.jsx("input",{type:"text",value:u,onChange:g=>c(g.target.value),placeholder:"Search",className:"pl-8 pr-2 py-1 text-xs bg-gray-900 border border-gray-700 rounded text-gray-200 focus:outline-none focus:border-blue-500 w-full sm:w-40"})]}),f&&e.jsxs("button",{onClick:f,className:"flex items-center gap-1.5 px-2 sm:px-2.5 py-1 text-[11px] font-semibold tracking-wide rounded bg-teal-600 hover:bg-teal-500 text-white transition-colors flex-shrink-0",title:h,children:[e.jsx(B7,{size:10}),e.jsx("span",{className:"hidden sm:inline",children:h})]})]})]}),sz=({kind:a,delegator:o,onClose:l,onSubmit:u})=>{const[c,f]=T.useState(""),[h,g]=T.useState(""),[b,w]=T.useState(!1),[x,_]=T.useState(null),v=async()=>{_(null);const O=c.trim().replace(/^@/,"").toLowerCase();if(!O){_("Enter a delegatee account.");return}const E=parseFloat(h);if(!Number.isFinite(E)||E<=0){_("Enter a valid amount.");return}w(!0);try{const $=a==="rc"?Math.round(E*1e9).toString():E.toString();await u(O,$)}catch($){_($ instanceof Error?$.message:"Failed to delegate")}finally{w(!1)}},N=a==="hp"?"Delegate HP":"Delegate RC",C=a==="hp"?"Delegate Hive Power to another account. Updating an existing delegation replaces the previous amount; reducing it locks the difference for 5 days.":"Delegate Resource Credits (RC) to another account. Updating an existing delegation replaces the previous amount.",R=a==="hp"?"HP":"B (BILLION) RC";return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 px-4",children:e.jsxs("div",{className:"w-full max-w-md rounded-xl border border-gray-700 bg-gray-900 p-5 shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-base font-bold text-white",children:N}),e.jsx("button",{onClick:l,className:"text-gray-400 hover:text-white",children:e.jsx(TC,{size:14})})]}),e.jsx("p",{className:"text-xs text-gray-400 mb-4 leading-relaxed border border-gray-700 rounded-md p-2.5 bg-gray-800/40",children:C}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] font-semibold text-gray-400 uppercase tracking-wide",children:"Delegator"}),e.jsxs("div",{className:"mt-1 flex items-center gap-2 px-3 py-2 rounded-md bg-gray-800 border border-gray-700",children:[e.jsx(ay,{name:o,size:22}),e.jsx("span",{className:"text-sm text-gray-200 truncate",children:o})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] font-semibold text-gray-400 uppercase tracking-wide",children:"Delegatee"}),e.jsxs("div",{className:"mt-1 flex items-center gap-2 px-2 py-1.5 rounded-md bg-gray-800 border border-gray-700 focus-within:border-teal-500",children:[e.jsx(ay,{name:c.replace(/^@/,""),size:22}),e.jsx("input",{type:"text",value:c,onChange:O=>f(O.target.value.toLowerCase()),placeholder:"username",className:"flex-1 min-w-0 bg-transparent text-sm text-gray-100 focus:outline-none placeholder-gray-500",autoFocus:!0,spellCheck:!1,autoComplete:"off",autoCapitalize:"none"})]})]})]}),e.jsxs("label",{className:"text-[11px] font-semibold text-gray-400 uppercase tracking-wide",children:["Amount (",R,")"]}),e.jsx("input",{type:"number",min:"0",step:a==="hp"?"0.001":"0.01",value:h,onChange:O=>g(O.target.value),placeholder:a==="hp"?"1000":"50",className:"mt-1 w-full px-3 py-2 rounded-md bg-gray-800 border border-gray-700 text-sm text-gray-100 focus:outline-none focus:border-teal-500"}),x&&e.jsx("div",{className:"mt-3 text-xs text-red-400",children:x}),e.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[e.jsx("button",{onClick:l,disabled:b,className:"px-4 py-2 text-sm rounded-md border border-gray-700 text-gray-200 hover:bg-gray-800 disabled:opacity-50",children:"Cancel"}),e.jsx("button",{onClick:v,disabled:b,className:"px-4 py-2 text-sm font-semibold rounded-md bg-teal-600 hover:bg-teal-500 text-white disabled:opacity-50",children:b?"Submitting…":"Confirm"})]})]})})},iz=({delegatee:a,initialBillions:o,onCancel:l,onSubmit:u})=>{const[c,f]=T.useState(o.toString()),[h,g]=T.useState(!1),b=async()=>{const w=parseFloat(c);if(!(!Number.isFinite(w)||w<0)){g(!0);try{const x=Math.round(w*1e9).toString();await u(x)}finally{g(!1)}}};return e.jsxs("div",{className:"px-2 sm:px-3 py-2 bg-gray-900 border border-blue-500/40 rounded-md min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5 min-w-0",children:[e.jsx(ay,{name:a,size:20}),e.jsxs("span",{className:"text-[11px] text-gray-300 truncate",children:["@",a]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 min-w-0",children:[e.jsx("input",{type:"number",min:"0",step:"0.01",value:c,onChange:w=>f(w.target.value),className:"flex-1 min-w-0 px-2 py-1 text-sm bg-gray-800 border border-gray-700 rounded text-gray-100 focus:outline-none focus:border-blue-500",autoFocus:!0}),e.jsx("span",{className:"text-[11px] text-gray-400 whitespace-nowrap",children:"b RC"}),e.jsx("button",{onClick:b,disabled:h,className:"p-1.5 rounded bg-blue-600/80 hover:bg-blue-500 text-white disabled:opacity-50 flex-shrink-0",title:"Confirm",children:e.jsx(M7,{size:11})}),e.jsx("button",{onClick:l,disabled:h,className:"p-1.5 rounded bg-gray-700 hover:bg-gray-600 text-gray-200 disabled:opacity-50 flex-shrink-0",title:"Cancel",children:e.jsx(TC,{size:11})})]})]})},OC=({username:a,currentUsername:o,className:l="",onUpdateRcDelegation:u,onDeleteRcDelegation:c,onCreateHpDelegation:f,onCreateRcDelegation:h})=>{const[g,b]=T.useState("hp"),[w,x]=T.useState({hp:{outgoing:[],incoming:[]},rc:{outgoing:[],incoming:[]}}),[_,v]=T.useState(!1),[N,C]=T.useState(null),[R,O]=T.useState(""),[E,$]=T.useState(null),[V,U]=T.useState(null),[z,A]=T.useState(null),H=o===a,I=H&&(!!u||!!c),q=H&&!!f,Z=H&&!!h,J=T.useCallback(async()=>{if(a){v(!0),C(null);try{const[pe,ie,ye]=await Promise.all([rz(a),az(a),nz()]),Ne=Ge=>{const me=parseFloat(Ge);return!Number.isFinite(me)||!ye?0:me*ye};x({hp:{outgoing:pe.outgoing_delegations.map(Ge=>({account:Ge.delegatee,vests:Ge.amount,hp:Ne(Ge.amount),operation_id:Ge.operation_id,block_num:Ge.block_num})),incoming:pe.incoming_delegations.map(Ge=>({account:Ge.delegator,vests:Ge.amount,hp:Ne(Ge.amount),operation_id:Ge.operation_id,block_num:Ge.block_num}))},rc:{outgoing:ie.outgoing_delegations.map(Ge=>({account:Ge.delegatee,max_rc:Ge.max_rc,operation_id:Ge.operation_id,block_num:Ge.block_num})),incoming:ie.incoming_delegations.map(Ge=>({account:Ge.delegator,max_rc:Ge.max_rc,operation_id:Ge.operation_id,block_num:Ge.block_num}))}})}catch(pe){const ie=pe instanceof Error?pe.message:"Failed to load delegations";console.error("Delegations load error:",ie),C(ie)}finally{v(!1)}}},[a]);T.useEffect(()=>{J()},[J]),T.useEffect(()=>{O(""),$(null),U(null)},[a,g]);const ee=T.useMemo(()=>w.hp.outgoing.reduce((pe,ie)=>pe+ie.hp,0),[w.hp.outgoing]),se=T.useMemo(()=>w.hp.incoming.reduce((pe,ie)=>pe+ie.hp,0),[w.hp.incoming]),fe=T.useMemo(()=>w.rc.outgoing.reduce((pe,ie)=>pe+Number(ie.max_rc),0)/1e9,[w.rc.outgoing]),he=T.useMemo(()=>w.rc.incoming.reduce((pe,ie)=>pe+Number(ie.max_rc),0)/1e9,[w.rc.incoming]),X=T.useCallback(pe=>{const ie=R.trim().toLowerCase();return ie?pe.filter(ye=>ye.account.toLowerCase().includes(ie)):pe},[R]),W=async(pe,ie)=>{if(u){U(pe);try{if(await u(pe,ie)===!1)return;$(null),x(Ne=>({...Ne,rc:{...Ne.rc,outgoing:Ne.rc.outgoing.map(Ge=>Ge.account===pe?{...Ge,max_rc:ie}:Ge)}})),setTimeout(()=>{J()},4e3)}finally{U(null)}}},ne=async pe=>{if(c){U(pe);try{if(await c(pe)===!1)return;x(ye=>({...ye,rc:{...ye.rc,outgoing:ye.rc.outgoing.filter(Ne=>Ne.account!==pe)}})),setTimeout(()=>{J()},4e3)}finally{U(null)}}},be=async(pe,ie)=>{const ye=z==="hp"?f:h;!ye||await ye(pe,ie)===!1||(A(null),setTimeout(()=>{J()},4e3))},ve=(pe,ie)=>e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 py-2 border-b border-gray-800 last:border-b-0 min-w-0",children:[e.jsx(ay,{name:pe.account}),e.jsxs("span",{className:"text-sm text-gray-200 flex-1 truncate min-w-0",title:`@${pe.account}`,children:["@",pe.account]}),e.jsx("span",{className:"text-sm text-gray-300 font-medium whitespace-nowrap",children:tz(pe.hp)}),e.jsx("div",{className:"hidden md:flex w-20 h-2 rounded-full bg-gray-800 overflow-hidden",children:e.jsx("div",{className:"h-full bg-emerald-500",style:{width:`${Math.max(2,Math.min(100,ie))}%`}})})]},`${pe.account}-${pe.operation_id??""}`),Le=(pe,ie,ye)=>E===pe.account?e.jsx("div",{className:"py-2 border-b border-gray-800 last:border-b-0",children:e.jsx(iz,{delegatee:pe.account,initialBillions:Number(pe.max_rc)/1e9,onCancel:()=>$(null),onSubmit:Ne=>W(pe.account,Ne)})},pe.account):e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 py-2 border-b border-gray-800 last:border-b-0 min-w-0",children:[e.jsx(ay,{name:pe.account}),e.jsxs("span",{className:"text-sm text-gray-200 flex-1 truncate min-w-0",title:`@${pe.account}`,children:["@",pe.account]}),e.jsx("span",{className:"text-sm text-gray-300 font-medium whitespace-nowrap",children:ez(pe.max_rc)}),e.jsx("div",{className:"hidden md:flex w-20 h-2 rounded-full bg-gray-800 overflow-hidden",children:e.jsx("div",{className:"h-full bg-emerald-500",style:{width:`${Math.max(2,Math.min(100,ie))}%`}})}),ye&&e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[u&&e.jsx("button",{onClick:()=>$(pe.account),disabled:V===pe.account,className:"p-1.5 rounded border border-gray-700 text-gray-300 hover:bg-gray-800 hover:text-white disabled:opacity-50",title:"Update delegation",children:e.jsx(P7,{size:10})}),c&&e.jsx("button",{onClick:()=>ne(pe.account),disabled:V===pe.account,className:"p-1.5 rounded border border-red-500/40 text-red-400 hover:bg-red-500/10 disabled:opacity-50",title:"Remove delegation",children:e.jsx(V7,{size:10})})]})]},`${pe.account}-${pe.operation_id??""}`),Ce=pe=>`flex-1 py-2 sm:py-2.5 px-2 text-[11px] sm:text-xs font-semibold tracking-wide rounded transition-colors whitespace-nowrap ${pe?"bg-teal-600 text-white":"bg-gray-800 text-gray-300 hover:bg-gray-700"}`;return e.jsxs("div",{className:`rounded-xl bg-gray-800 border border-gray-700 ${l}`,children:[e.jsxs("div",{className:"px-3 sm:px-4 pt-3 pb-2 border-b border-gray-700",children:[e.jsx("div",{className:"text-sm font-bold text-white",children:"Delegated HIVE"}),e.jsx("div",{className:"text-xs text-gray-400",children:"Staked tokens delegated between users."})]}),e.jsxs("div",{className:"flex gap-2 p-2 sm:p-3 border-b border-gray-700",children:[e.jsxs("button",{onClick:()=>b("hp"),className:Ce(g==="hp"),children:[e.jsx("span",{className:"sm:hidden",children:"HP"}),e.jsx("span",{className:"hidden sm:inline",children:"HP DELEGATIONS"})]}),e.jsxs("button",{onClick:()=>b("rc"),className:Ce(g==="rc"),children:[e.jsx("span",{className:"sm:hidden",children:"RC"}),e.jsx("span",{className:"hidden sm:inline",children:"RC DELEGATIONS"})]})]}),e.jsxs("div",{className:"p-2 sm:p-4",children:[N&&e.jsx("div",{className:"text-xs text-red-400 mb-2",children:N}),_?e.jsx("div",{className:"space-y-2 animate-pulse",children:[1,2,3].map(pe=>e.jsx("div",{className:"h-9 bg-gray-900 rounded"},pe))}):g==="hp"?e.jsxs(e.Fragment,{children:[e.jsx(hw,{direction:"outgoing",total:`${ee.toLocaleString("en-US",{maximumFractionDigits:3})} HP`,count:w.hp.outgoing.length,search:R,onSearch:O,onCreate:q?()=>A("hp"):void 0,createLabel:"Delegate HP"}),w.hp.outgoing.length===0?e.jsx("p",{className:"text-xs text-gray-500 text-center py-4",children:"No outgoing delegations"}):e.jsx("div",{className:"mb-4",children:X(w.hp.outgoing).map(pe=>ve(pe,ee>0?pe.hp/ee*100:0))}),e.jsx(hw,{direction:"incoming",total:`${se.toLocaleString("en-US",{maximumFractionDigits:3})} HP`,count:w.hp.incoming.length,search:"",onSearch:()=>{}}),w.hp.incoming.length===0?e.jsx("p",{className:"text-xs text-gray-500 text-center py-4",children:"No incoming delegations"}):e.jsx("div",{children:w.hp.incoming.map(pe=>ve(pe,se>0?pe.hp/se*100:0))})]}):e.jsxs(e.Fragment,{children:[e.jsx(hw,{direction:"outgoing",total:`${fe.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}b RC`,count:w.rc.outgoing.length,search:R,onSearch:O,onCreate:Z?()=>A("rc"):void 0,createLabel:"Delegate RC"}),w.rc.outgoing.length===0?e.jsx("p",{className:"text-xs text-gray-500 text-center py-4",children:"No outgoing RC delegations"}):e.jsx("div",{className:"mb-4",children:X(w.rc.outgoing).map(pe=>{const ie=Number(pe.max_rc)/1e9,ye=fe>0?ie/fe*100:0;return Le(pe,ye,I)})}),e.jsx(hw,{direction:"incoming",total:`${he.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}b RC`,count:w.rc.incoming.length,search:"",onSearch:()=>{}}),w.rc.incoming.length===0?e.jsx("p",{className:"text-xs text-gray-500 text-center py-4",children:"No incoming RC delegations"}):e.jsx("div",{children:w.rc.incoming.map(pe=>{const ie=Number(pe.max_rc)/1e9,ye=he>0?ie/he*100:0;return Le(pe,ye,!1)})})]})]}),z&&e.jsx(sz,{kind:z,delegator:a,onClose:()=>A(null),onSubmit:be})]})},gy="fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-3 sm:p-4",xy="w-full max-w-md sm:max-w-lg rounded-xl bg-[#181d23] border border-[var(--hrk-border-subtle)] shadow-2xl overflow-hidden",by="flex items-center justify-between px-4 sm:px-5 py-3.5 border-b border-[var(--hrk-border-subtle)]",vy="text-base sm:text-lg font-semibold text-white",yy="p-4 sm:p-5 space-y-4",a_="rounded-md border border-[var(--hrk-border-subtle)] bg-[#1e242c] px-3 py-2.5 text-xs text-[var(--hrk-text-tertiary)]",Qd="w-full bg-transparent border-b border-[var(--hrk-border-default)] px-1 py-1.5 text-sm text-white placeholder-[var(--hrk-text-tertiary)] focus:outline-none focus:border-[var(--hrk-info)] transition-colors",Vl="text-xs text-[var(--hrk-text-tertiary)] mb-1",wy="flex justify-end gap-2 px-4 sm:px-5 py-3 border-t border-[var(--hrk-border-subtle)] bg-[#15191e]",_y="px-4 py-2 rounded-md text-xs font-semibold tracking-wide bg-[var(--hrk-bg-surface-raised)] text-[var(--hrk-text-primary)] hover:bg-[var(--hrk-bg-hover)] transition-colors",ky="px-4 py-2 rounded-md text-xs font-semibold tracking-wide bg-blue-600 text-white hover:bg-blue-500 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",ny=({username:a})=>e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("img",{src:`https://images.hive.blog/u/${a}/avatar`,alt:a,className:"w-7 h-7 rounded-full border border-[var(--hrk-border-subtle)] flex-shrink-0",onError:o=>{o.target.src=`https://ui-avatars.com/api/?name=${a}&background=random&size=28`}}),e.jsx("span",{className:"text-sm text-[var(--hrk-text-primary)] truncate",children:a})]});function n_(a){if(a===void 0)return 1/0;if(!a)return 0;const o=parseFloat(a.split(" ")[0]);return Number.isFinite(o)?o:0}function s_(a,o,l=3){if(a===""||a===".")return a;let u=a.replace(",",".");u=u.replace(/[^0-9.]/g,"");const c=u.split(".");if(c.length>2&&(u=c[0]+"."+c.slice(1).join("")),u.includes(".")){const[h,g]=u.split(".");u=h+"."+g.slice(0,l)}const f=parseFloat(u);return Number.isFinite(f)&&f>o?o.toFixed(l):u}const oz=({from:a,toDefault:o="",hiveBalance:l,hbdBalance:u,initialCurrency:c="HIVE",hidePicker:f=!1,onClose:h,onSubmit:g})=>{const[b,w]=T.useState(o),[x,_]=T.useState(""),[v,N]=T.useState(""),[C,R]=T.useState(c),[O,E]=T.useState(!1),[$,V]=T.useState(!1),U=T.useMemo(()=>n_(C==="HIVE"?l:u),[C,l,u]),z=()=>{U!==1/0&&_(U.toFixed(3))},A=!!b.trim()&&parseFloat(x)>0&&parseFloat(x)<=U&&!$,H=async()=>{if(A){V(!0);try{await g(b.trim(),x,C,v)!==!1&&h()}finally{V(!1)}}};return e.jsx("div",{className:gy,onClick:h,children:e.jsxs("div",{className:xy,onClick:I=>I.stopPropagation(),children:[e.jsxs("div",{className:by,children:[e.jsxs("h3",{className:vy,children:["Transfer ",C]}),e.jsx("button",{onClick:h,className:"text-[var(--hrk-text-tertiary)] hover:text-[var(--hrk-text-primary)] text-lg",children:"×"})]}),e.jsxs("div",{className:yy,children:[e.jsx("div",{className:a_,children:"Transfer funds to another Hive account."}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"From:"}),e.jsx(ny,{username:a})]}),e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"To:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[b.trim()&&e.jsx("img",{src:`https://images.hive.blog/u/${b.trim()}/avatar`,alt:b,className:"w-7 h-7 rounded-full border border-[var(--hrk-border-subtle)] flex-shrink-0",onError:I=>{I.target.src=`https://ui-avatars.com/api/?name=${b.trim()}&background=random&size=28`}}),e.jsx("input",{type:"text",value:b,onChange:I=>w(I.target.value.replace(/^@/,"").trim()),placeholder:"username",className:`${Qd} flex-1`})]})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center justify-between mb-1",children:e.jsxs("span",{className:Vl,children:["Amount (Balance:"," ",e.jsxs("button",{type:"button",onClick:z,className:`text-blue-400 ${U===1/0?"cursor-default opacity-50":"hover:text-blue-300 hover:underline cursor-pointer"}`,title:U===1/0?"Balance unknown":"Click to use full balance",disabled:U===1/0,children:[U===1/0?"?":U.toFixed(3)," ",C]}),")"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",inputMode:"decimal",value:x,onChange:I=>_(s_(I.target.value,U,3)),placeholder:"0",className:`${Qd} flex-1`}),f?e.jsx("span",{className:"px-3 py-1.5 rounded-md bg-[var(--hrk-bg-surface-raised)] text-xs text-[var(--hrk-text-primary)] font-semibold",children:C}):e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>E(I=>!I),className:"px-3 py-1.5 rounded-md bg-[var(--hrk-bg-surface-raised)] hover:bg-[var(--hrk-bg-hover)] text-xs text-[var(--hrk-text-primary)] font-semibold flex items-center gap-1",children:[C," ",e.jsx("span",{className:"text-[10px]",children:"▾"})]}),O&&e.jsx("div",{className:"absolute right-0 mt-1 rounded-md bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-subtle)] shadow-lg z-10 min-w-[80px]",children:["HIVE","HBD"].map(I=>e.jsx("button",{type:"button",onClick:()=>{R(I),_(""),E(!1)},className:"block w-full text-left px-3 py-1.5 text-xs text-[var(--hrk-text-primary)] hover:bg-[var(--hrk-bg-surface-raised)]",children:I},I))})]})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"Memo:"}),e.jsx("input",{type:"text",value:v,onChange:I=>N(I.target.value),placeholder:"A message to include in the transfer",className:Qd})]})]}),e.jsxs("div",{className:wy,children:[e.jsx("button",{onClick:h,className:_y,children:"CANCEL"}),e.jsx("button",{onClick:H,disabled:!A,className:ky,children:$?"...":"CONTINUE"})]})]})})},lz=({from:a,toDefault:o,hiveBalance:l,onClose:u,onSubmit:c})=>{const f=n_(l),[h,g]=T.useState(o||a),[b,w]=T.useState("0"),[x,_]=T.useState(!1),v=parseFloat(b)>0&&parseFloat(b)<=f&&!!h.trim()&&!x,N=async()=>{if(v){_(!0);try{await c(h.trim(),b)!==!1&&u()}finally{_(!1)}}};return e.jsx("div",{className:gy,onClick:u,children:e.jsxs("div",{className:xy,onClick:C=>C.stopPropagation(),children:[e.jsxs("div",{className:by,children:[e.jsx("h3",{className:vy,children:"Stake HIVE (Power Up)"}),e.jsx("button",{onClick:u,className:"text-[var(--hrk-text-tertiary)] hover:text-[var(--hrk-text-primary)] text-lg",children:"×"})]}),e.jsxs("div",{className:yy,children:[e.jsxs("div",{className:a_,children:["Influence tokens which give you more control over post payouts and allow you to earn on curation rewards.",e.jsx("br",{}),e.jsx("br",{}),"Hive Power is non-transferable and requires 3 months (13 payments) to convert back to Hive."]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"From:"}),e.jsx(ny,{username:a})]}),e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"To (usually your own account):"}),e.jsxs("div",{className:"flex items-center gap-2",children:[h.trim()&&e.jsx("img",{src:`https://images.hive.blog/u/${h.trim()}/avatar`,alt:h,className:"w-7 h-7 rounded-full border border-[var(--hrk-border-subtle)] flex-shrink-0",onError:C=>{C.target.src=`https://ui-avatars.com/api/?name=${h.trim()}&background=random&size=28`}}),e.jsx("input",{type:"text",value:h,onChange:C=>g(C.target.value.replace(/^@/,"").trim()),placeholder:"username",className:`${Qd} flex-1`})]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:Vl,children:["Amount (Max"," ",e.jsxs("button",{type:"button",onClick:()=>{f!==1/0&&w(f.toFixed(3))},className:`text-blue-400 ${f===1/0?"cursor-default opacity-50":"hover:text-blue-300 hover:underline cursor-pointer"}`,title:f===1/0?"Balance unknown":"Click to use max balance",disabled:f===1/0,children:[f===1/0?"?":f.toFixed(3)," HIVE"]}),"):"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",inputMode:"decimal",value:b,onChange:C=>w(s_(C.target.value,f,3)),className:`${Qd} flex-1`}),e.jsx("span",{className:"px-3 py-1.5 rounded-md bg-[var(--hrk-bg-surface-raised)] text-xs text-[var(--hrk-text-primary)] font-semibold",children:"HIVE"})]}),f!==1/0&&e.jsx("input",{type:"range",min:0,max:Math.max(.001,f),step:.001,value:parseFloat(b)||0,onChange:C=>w(parseFloat(C.target.value).toFixed(3)),className:"w-full mt-3 accent-blue-500"})]})]}),e.jsxs("div",{className:wy,children:[e.jsx("button",{onClick:u,className:_y,children:"CANCEL"}),e.jsx("button",{onClick:N,disabled:!v,className:ky,children:x?"...":"CONTINUE"})]})]})})},uz=({from:a,hivePower:o,onClose:l,onSubmit:u})=>{const c=n_(o),[f,h]=T.useState("0"),[g,b]=T.useState(!1),w=T.useMemo(()=>{const v=parseFloat(f);return!Number.isFinite(v)||v<=0?"0.000":(v/13).toFixed(3)},[f]),x=parseFloat(f)>=0&&parseFloat(f)<=c&&!g,_=async()=>{if(x){b(!0);try{await u(f)!==!1&&l()}finally{b(!1)}}};return e.jsx("div",{className:gy,onClick:l,children:e.jsxs("div",{className:xy,onClick:v=>v.stopPropagation(),children:[e.jsxs("div",{className:by,children:[e.jsx("h3",{className:vy,children:"Unstake HIVE (Power Down)"}),e.jsx("button",{onClick:l,className:"text-[var(--hrk-text-tertiary)] hover:text-[var(--hrk-text-primary)] text-lg",children:"×"})]}),e.jsxs("div",{className:yy,children:[e.jsx("div",{className:a_,children:"Create a Hive Power unstake request. The request is fulfilled once a week over the next 13 weeks."}),e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"Account:"}),e.jsx(ny,{username:a})]}),e.jsxs("div",{children:[e.jsxs("div",{className:Vl,children:["Amount (Max"," ",e.jsxs("button",{type:"button",onClick:()=>{c!==1/0&&h(c.toFixed(3))},className:`text-blue-400 ${c===1/0?"cursor-default opacity-50":"hover:text-blue-300 hover:underline cursor-pointer"}`,title:c===1/0?"Balance unknown":"Click to use max balance",disabled:c===1/0,children:[c===1/0?"?":c.toFixed(3)," HP"]}),"):"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",inputMode:"decimal",value:f,onChange:v=>h(s_(v.target.value,c,3)),className:`${Qd} flex-1`}),e.jsx("span",{className:"px-3 py-1.5 rounded-md bg-[var(--hrk-bg-surface-raised)] text-xs text-[var(--hrk-text-primary)] font-semibold",children:"HP"})]}),c!==1/0&&e.jsx("input",{type:"range",min:0,max:Math.max(.001,c),step:.001,value:parseFloat(f)||0,onChange:v=>h(parseFloat(v.target.value).toFixed(3)),className:"w-full mt-3 accent-blue-500"}),e.jsxs("div",{className:"text-xs text-[var(--hrk-text-tertiary)] mt-2",children:["You will receive ",e.jsxs("span",{className:"text-[var(--hrk-text-primary)]",children:[w," HIVE"]})," per week"]})]})]}),e.jsxs("div",{className:wy,children:[e.jsx("button",{onClick:l,className:_y,children:"CANCEL"}),e.jsx("button",{onClick:_,disabled:!x,className:ky,children:g?"...":"CONTINUE"})]})]})})},w6=({mode:a,from:o,toDefault:l,currency:u,availableBalance:c,onClose:f,onSubmit:h})=>{const g=n_(c),[b,w]=T.useState(l||o),[x,_]=T.useState("0"),[v,N]=T.useState(""),[C,R]=T.useState(!1);T.useEffect(()=>{_("0")},[u]);const O=parseFloat(x)>0&&parseFloat(x)<=g&&!C,E=async()=>{if(O){R(!0);try{await h(a==="add"?b.trim():u,a==="add"?u:x,a==="add"?x:v,a==="add"?v:void 0)!==!1&&f()}finally{R(!1)}}},$=a==="add"?`Stake ${u} (Transfer to Savings)`:`Unstake ${u} (Withdraw Savings)`,V=a==="add"?"Stake/Move funds to savings. Funds will be subject to 3 days unstake/withdraw waiting period.":"Withdraw funds from savings. Funds are released after a 3-day waiting period.";return e.jsx("div",{className:gy,onClick:f,children:e.jsxs("div",{className:xy,onClick:U=>U.stopPropagation(),children:[e.jsxs("div",{className:by,children:[e.jsx("h3",{className:vy,children:$}),e.jsx("button",{onClick:f,className:"text-[var(--hrk-text-tertiary)] hover:text-[var(--hrk-text-primary)] text-lg",children:"×"})]}),e.jsxs("div",{className:yy,children:[e.jsx("div",{className:a_,children:V}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"From:"}),e.jsx(ny,{username:o})]}),e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"To:"}),a==="add"?e.jsxs("div",{className:"flex items-center gap-2",children:[b.trim()&&e.jsx("img",{src:`https://images.hive.blog/u/${b.trim()}/avatar`,alt:b,className:"w-7 h-7 rounded-full border border-[var(--hrk-border-subtle)] flex-shrink-0",onError:U=>{U.target.src=`https://ui-avatars.com/api/?name=${b.trim()}&background=random&size=28`}}),e.jsx("input",{type:"text",value:b,onChange:U=>w(U.target.value.replace(/^@/,"").trim()),placeholder:"username",className:`${Qd} flex-1`})]}):e.jsx(ny,{username:o})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:Vl,children:["Amount (Balance:"," ",e.jsxs("button",{type:"button",onClick:()=>{g!==1/0&&_(g.toFixed(3))},className:`text-blue-400 ${g===1/0?"cursor-default opacity-50":"hover:text-blue-300 hover:underline cursor-pointer"}`,title:g===1/0?"Balance unknown":"Click to use full balance",disabled:g===1/0,children:[g===1/0?"?":g.toFixed(3)," ",u]}),"):"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",inputMode:"decimal",value:x,onChange:U=>_(s_(U.target.value,g,3)),className:`${Qd} flex-1`}),e.jsx("span",{className:"px-3 py-1.5 rounded-md bg-[var(--hrk-bg-surface-raised)] text-xs text-[var(--hrk-text-primary)] font-semibold",children:u})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:Vl,children:"Memo:"}),e.jsx("input",{type:"text",value:v,onChange:U=>N(U.target.value),placeholder:"A message to include in the transaction",className:Qd})]})]}),e.jsxs("div",{className:wy,children:[e.jsx("button",{onClick:f,className:_y,children:"CANCEL"}),e.jsx("button",{onClick:E,disabled:!O,className:ky,children:C?"...":"CONTINUE"})]})]})})},_6=({title:a,message:o,confirmLabel:l="CONFIRM",onClose:u,onConfirm:c})=>{const[f,h]=T.useState(!1),g=async()=>{h(!0);try{await c()!==!1&&u()}finally{h(!1)}};return e.jsx("div",{className:gy,onClick:u,children:e.jsxs("div",{className:xy,onClick:b=>b.stopPropagation(),children:[e.jsxs("div",{className:by,children:[e.jsx("h3",{className:vy,children:a}),e.jsx("button",{onClick:u,className:"text-[var(--hrk-text-tertiary)] hover:text-[var(--hrk-text-primary)] text-lg",children:"×"})]}),e.jsx("div",{className:yy,children:e.jsx("p",{className:"text-sm text-[var(--hrk-text-primary)]",children:o})}),e.jsxs("div",{className:wy,children:[e.jsx("button",{onClick:u,disabled:f,className:_y,children:"CANCEL"}),e.jsx("button",{onClick:g,disabled:f,className:ky,children:f?"...":l})]})]})})};function cz(a){const o=new Date,l=new Date(a+"Z"),u=o.getTime()-l.getTime(),c=Math.floor(u/1e3),f=Math.floor(c/60),h=Math.floor(f/60),g=Math.floor(h/24);return g>30?l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):g>0?`${g}d ago`:h>0?`${h}h ago`:f>0?`${f}m ago`:"just now"}function dz(a){if(!a||a.indexOf(":")===-1)return null;const o=a.split(/\r?\n/).map(u=>u.trim()).filter(Boolean),l={};for(const u of o){const c=u.indexOf(":");if(c===-1)continue;const f=u.slice(0,c).trim().toLowerCase(),h=u.slice(c+1).trim();!f||!h||["author","post","sender","app","message"].includes(f)&&(l[f]=h)}return!l.author||!l.sender&&!l.app?null:l}function RC(a){const o=a.memo||"";if(o==="Stopped power down"||o==="Started power down")return{title:o,kind:"power"};if(o.startsWith("Power up")||o.startsWith("Power down"))return{title:o,kind:"power",badge:a.type==="sent"?"out":"in"};if(o==="Claimed rewards")return{title:"Claimed rewards",kind:"reward"};if(o.startsWith("Author reward"))return{title:"Author reward",kind:"reward"};if(o==="Producer reward")return{title:"Producer reward",kind:"reward"};if(o==="Benefactor reward")return{title:"Benefactor reward",kind:"reward"};if(o.startsWith("Curation"))return{title:"Curation reward",kind:"reward"};if(o==="Market fill")return{title:"Market fill",kind:"market"};if(o.startsWith("Delegate HP")||o==="Delegation returned")return{title:o,kind:"delegation"};if(o==="Recurrent fill"||o.startsWith("Recurrent"))return{title:a.type==="sent"?`Recurrent sent to ${a.to}`:`Recurrent received from ${a.from}`,kind:"transfer",badge:a.type==="sent"?"out":"in"};if(o.startsWith("Savings deposit"))return{title:"Savings deposit",kind:"transfer",badge:"out"};if(o.startsWith("Savings withdraw"))return{title:"Savings withdraw",kind:"transfer",badge:"in"};const l=dz(o);if(l){const u=l.sender||a.from;return{title:a.type==="received"?`Tip received from ${u}`:`Tip sent to ${a.to}`,kind:"tip",tipData:l,badge:a.type==="sent"?"out":"in"}}return{title:a.type==="sent"?`Sent to ${a.to}`:`Received from ${a.from}`,kind:"transfer",badge:a.type==="sent"?"out":"in"}}const fz=({tx:a})=>{const o=a.type==="sent",l=o?a.to:a.from,u=RC(a),c=u.tipData;return e.jsxs("div",{className:"flex items-start gap-2.5 p-2.5 sm:p-3.5 rounded-lg bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-subtle)] mb-2 transition-all duration-200 hover:bg-[var(--hrk-bg-surface-raised)] hover:border-[var(--hrk-border-default)] min-w-0",children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx("img",{src:`https://images.hive.blog/u/${l}/avatar`,alt:l,className:"w-9 h-9 rounded-full border border-[var(--hrk-border-subtle)]",onError:f=>{f.target.src=`https://ui-avatars.com/api/?name=${l}&background=random&size=36`}}),e.jsx("span",{className:`absolute -bottom-1 -right-1 w-4 h-4 rounded-full border-2 border-[var(--hrk-border-subtle)] flex items-center justify-center ${o?"bg-red-500/90 text-white":"bg-emerald-500/90 text-white"}`,children:o?e.jsx(C7,{size:7}):e.jsx(A7,{size:7})})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2 min-w-0",children:[e.jsx("span",{className:"text-sm font-semibold text-[var(--hrk-text-primary)] truncate",children:u.title}),e.jsxs("span",{className:`text-xs sm:text-sm font-bold whitespace-nowrap ${o?"text-red-400":"text-emerald-400"}`,children:[o?"-":"+",a.amount]})]}),e.jsx("div",{className:"text-[11px] text-[var(--hrk-text-tertiary)] mt-0.5 truncate",children:cz(a.timestamp)}),c?e.jsx("pre",{className:"mt-2 max-w-full overflow-x-auto rounded-md border border-[var(--hrk-border-subtle)] bg-[var(--hrk-bg-app)] px-2.5 py-2 font-mono text-[11px] leading-relaxed text-[var(--hrk-text-tertiary)] whitespace-pre-wrap break-words",children:["author","post","sender","app","message"].map(f=>c[f]?e.jsxs("div",{children:[e.jsxs("span",{className:"text-[var(--hrk-text-tertiary)]",children:[f,":"]})," ",e.jsx("span",{className:"text-blue-400",children:c[f]})]},f):null)}):a.memo&&u.kind==="transfer"?e.jsx("p",{className:"mt-1 text-[11px] text-[var(--hrk-text-tertiary)] line-clamp-2",children:a.memo}):null]})]})},hz=()=>{const{selectedCurrency:a,localCurrency:o,setSelectedCurrency:l,exchangeRates:u}=EN(),[c,f]=T.useState(!1),h=T.useRef(null);T.useEffect(()=>{const x=_=>{h.current&&!h.current.contains(_.target)&&f(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[]);const g=["USD",o,"GTQ"],b=T.useMemo(()=>{const x=Bv.find(C=>C.code==="USD"),_=o!=="USD"?Bv.find(C=>C.code===o):null,v=o!=="GTQ"?Bv.find(C=>C.code==="GTQ"):null,N=Bv.filter(C=>!g.includes(C.code)&&u[C.code]);return[x,..._?[_]:[],...v?[v]:[],...N]},[o,u]),w=x=>{try{return new Intl.NumberFormat("en",{style:"currency",currency:x}).formatToParts(0).find(v=>v.type==="currency")?.value||x}catch{return x}};return e.jsxs("div",{ref:h,className:"relative inline-block",children:[e.jsxs("button",{onClick:()=>f(!c),className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-white/15 hover:bg-white/25 transition-colors text-white text-xs font-medium border border-white/20",children:[e.jsx("span",{children:w(a)}),e.jsx("span",{children:a}),e.jsx(AC,{size:8,className:`transition-transform ${c?"rotate-180":""}`})]}),c&&e.jsx("div",{className:"absolute top-full mt-1 right-0 w-56 max-h-64 overflow-y-auto rounded-lg bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-default)] shadow-xl z-50 scrollbar-hide",children:b.map((x,_)=>e.jsxs(T.Fragment,{children:[_===(o!=="USD"?3:2)&&e.jsx("div",{className:"border-t border-[var(--hrk-border-default)] my-1"}),e.jsxs("button",{onClick:()=>{l(x.code),f(!1)},className:`w-full flex items-center gap-2.5 px-3 py-2 text-left text-sm transition-colors hover:bg-[var(--hrk-bg-surface-raised)] ${a===x.code?"bg-blue-500/20 text-blue-300":"text-[var(--hrk-text-secondary)]"}`,children:[e.jsx("span",{className:"w-6 text-center font-medium text-[var(--hrk-text-tertiary)]",children:w(x.code)}),e.jsx("span",{className:"font-medium",children:x.code}),e.jsx("span",{className:"text-xs text-[var(--hrk-text-tertiary)] truncate",children:x.name})]})]},x.code))})]})},Xj=({icon:a,iconBg:o,iconText:l,label:u,value:c,valueText:f,actions:h})=>e.jsx("div",{className:"p-3 sm:p-3.5 rounded-lg bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-subtle)] mb-2.5 transition-all duration-200 hover:bg-[var(--hrk-bg-surface-raised)] hover:border-[var(--hrk-border-default)] min-w-0",children:e.jsxs("div",{className:"flex items-center justify-between gap-2 min-w-0 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[e.jsx("div",{className:`p-2 rounded-full flex items-center justify-center flex-shrink-0 ${o} ${l}`,children:a}),e.jsx("span",{className:"font-semibold text-xs sm:text-sm text-[var(--hrk-text-secondary)] truncate",children:u})]}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 ml-auto flex-wrap justify-end",children:[e.jsx("span",{className:`font-medium text-xs sm:text-sm whitespace-nowrap ${f}`,children:c}),h&&h.length>0&&e.jsx("div",{className:"flex gap-2 flex-wrap justify-end",children:h.map(g=>e.jsx("button",{onClick:g.onClick,className:`px-3 py-1.5 rounded-[10px] text-[11px] sm:text-xs font-semibold tracking-wide transition-colors ${g.variant==="secondary"?"bg-[var(--hrk-bg-surface-sunken)] border border-[var(--hrk-border-subtle)] text-[var(--hrk-text-primary)] hover:bg-[var(--hrk-bg-surface-raised)] hover:border-[var(--hrk-border-default)]":"bg-[var(--hrk-info)] text-[var(--hrk-text-on-brand)] hover:brightness-110"}`,children:g.label},g.label))})]})]})}),mz=({label:a,value:o,icon:l,iconBgClass:u="bg-blue-500/15",iconTextClass:c="text-blue-400",valueClass:f="text-[var(--hrk-text-primary)]",actions:h})=>e.jsx("div",{className:"p-3 sm:p-3.5 rounded-lg bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-subtle)] mb-2.5 transition-all duration-200 hover:bg-[var(--hrk-bg-surface-raised)] hover:border-[var(--hrk-border-default)] min-w-0",children:e.jsxs("div",{className:"flex items-center justify-between gap-2 min-w-0 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[l&&e.jsx("div",{className:`p-2 rounded-full flex items-center justify-center flex-shrink-0 ${u} ${c}`,children:l}),e.jsx("span",{className:"font-semibold text-xs sm:text-sm text-[var(--hrk-text-secondary)] truncate",children:a})]}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 ml-auto flex-wrap justify-end",children:[e.jsx("span",{className:`font-medium text-xs sm:text-sm whitespace-nowrap ${f}`,children:o??"-"}),h&&h.length>0&&e.jsx("div",{className:"flex gap-2 flex-wrap justify-end",children:h.map(g=>e.jsx("button",{onClick:g.onClick,className:`px-3 py-1.5 rounded-md text-[11px] sm:text-xs font-semibold tracking-wide transition-colors ${g.variant==="secondary"?"bg-[var(--hrk-bg-surface-raised)] text-[var(--hrk-text-primary)] hover:bg-[var(--hrk-bg-hover)]":"bg-blue-600 text-white hover:bg-blue-500"}`,children:g.label},g.label))})]})]})});function k6(a){if(!a)return"";const l=new Date(/Z|[+-]\d{2}:?\d{2}$/.test(a)?a:`${a}Z`).getTime()-Date.now();if(l<=0)return"any moment";const u=Math.floor(l/864e5),c=Math.floor(l%864e5/36e5);if(u>0)return`${u}d ${c}h`;const f=Math.floor(l%36e5/6e4);return`${c}h ${f}m`}const pz=({walletData:a,isOwn:o,currentUsername:l,onTransferHive:u,onPowerUp:c,onAddSavingsHbd:f,onRemoveSavingsHbd:h,onPowerDown:g,onStopPowerDown:b,onCancelSavingsWithdrawal:w})=>{const[x,_]=T.useState(!0),v=a?.pending_savings_withdrawals??[],N=!!a?.power_down_active;return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>_(!x),className:"w-full flex items-center justify-between p-3 rounded-lg bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-subtle)] mb-2.5 transition-all duration-200 hover:bg-[var(--hrk-bg-surface-raised)] hover:border-[var(--hrk-border-default)]",children:[e.jsx("span",{className:"font-semibold text-sm text-[var(--hrk-text-secondary)]",children:"All Balances"}),e.jsx(AC,{size:12,className:`text-[var(--hrk-text-tertiary)] transition-transform duration-200 ${x?"rotate-180":""}`})]}),x&&e.jsxs("div",{className:"ml-2 border-l-2 border-[var(--hrk-border-subtle)] pl-2 space-y-0",children:[e.jsx(Xj,{icon:e.jsx(I7,{}),iconBg:"bg-blue-500/15",iconText:"text-blue-400",label:"Balance",value:a?.balance??"-",valueText:"text-blue-300",actions:(o||!o&&l)&&u?[...u?[{label:"Transfer",onClick:u}]:[],...o&&c?[{label:"Power Up",onClick:c,variant:"secondary"}]:[]]:void 0}),e.jsx(Xj,{icon:e.jsx(O7,{}),iconBg:"bg-purple-500/15",iconText:"text-purple-400",label:"Savings HBD",value:a?.savings_hbd_balance??"-",valueText:"text-purple-300",actions:(o||!o&&l)&&(f||h)?[...f?[{label:o?"Add":"Send HBD Savings",onClick:f}]:[],...o&&h?[{label:"Remove",onClick:h,variant:"secondary"}]:[]]:void 0}),v.length>0&&e.jsxs("div",{className:"ml-2 p-3 rounded-lg bg-[var(--hrk-bg-app)] border border-[var(--hrk-border-subtle)] mb-2.5",children:[e.jsx("div",{className:"text-xs font-semibold text-[var(--hrk-text-secondary)] mb-2",children:"Pending withdraws from savings"}),e.jsx("div",{className:"space-y-2",children:v.map(C=>e.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs text-[var(--hrk-text-secondary)] flex-wrap",children:[e.jsxs("span",{children:[e.jsx("span",{className:"text-purple-300",children:C.amount})," ","withdraw will complete in"," ",e.jsx("span",{className:"text-[var(--hrk-text-primary)]",children:k6(C.complete)})]}),o&&w&&e.jsx("button",{onClick:()=>w(C.request_id),className:"px-2.5 py-1 rounded-md text-[11px] font-semibold tracking-wide bg-red-600/20 text-red-300 border border-red-500/40 hover:bg-red-600/30 transition-colors",children:"STOP"})]},C.request_id))})]}),e.jsx(Xj,{icon:e.jsx(EC,{}),iconBg:"bg-orange-500/15",iconText:"text-orange-400",label:"Hive Power",value:a?.hive_power??"-",valueText:"text-orange-300",actions:o||!o&&l?[...!o&&c?[{label:"Send Power Up",onClick:c,variant:"secondary"}]:[],...o&&g?[{label:"Power Down",onClick:g,variant:"secondary"}]:[],...o&&N&&b?[{label:"Stop Power Down",onClick:b}]:[]]:void 0}),N&&a?.power_down_hp_per_week&&e.jsxs("div",{className:"ml-2 p-3 rounded-lg bg-[var(--hrk-bg-app)] border border-orange-500/30 mb-2.5 text-xs text-[var(--hrk-text-secondary)]",children:["An unstake (power down) is in progress —"," ",e.jsxs("span",{className:"text-orange-300",children:["~",a.power_down_hp_per_week," HIVE / week"]}),a.next_vesting_withdrawal&&e.jsxs(e.Fragment,{children:["; next payout in"," ",e.jsx("span",{className:"text-[var(--hrk-text-primary)]",children:k6(a.next_vesting_withdrawal)})]}),"."]})]})]})},LC=({username:a,className:o="",scrollRootRef:l,currentUsername:u,onUpdateRcDelegation:c,onDeleteRcDelegation:f,onCreateHpDelegation:h,onCreateRcDelegation:g,hideDelegations:b=!1,onTransfer:w,onPowerUp:x,onPowerDown:_,onTransferToSavings:v,onTransferFromSavings:N,onStopPowerDown:C,onCancelSavingsWithdrawal:R,onClaimRewards:O})=>{const{walletData:E,fetchWalletData:$,isLoading:V,error:U,transactions:z,fetchTransactions:A,fetchMoreTransactions:H,hasMoreTransactions:I,isLoadingMoreTransactions:q,isLoadingTransactions:Z,transactionError:J}=EN(),[ee,se]=T.useState(!1),[fe,he]=T.useState(!1),[X,W]=T.useState(!1),[ne,be]=T.useState(!1),ve=T.useMemo(()=>z.filter(xe=>{const We=xe.type==="sent";if((ee||fe)&&(We&&!ee||!We&&!fe)||X&&(xe.amount.startsWith("0.001 ")||xe.amount==="0.001"))return!1;if(ne){const qe=RC(xe);if(!(qe.kind==="transfer"||qe.kind==="tip"))return!1}return!0}),[z,ee,fe,X,ne]),Le=T.useRef(null);T.useEffect(()=>{a&&($(a),A(a))},[a,$,A]);const Ce=T.useCallback(()=>{const xe=l?.current;if(xe)return xe;let We=Le.current?.parentElement||null;for(;We&&We!==document.body&&We!==document.documentElement;){const{overflowY:qe}=window.getComputedStyle(We);if((qe==="auto"||qe==="scroll")&&We.scrollHeight>We.clientHeight)return We;We=We.parentElement}return null},[l]);T.useEffect(()=>{if(!a||!I)return;const xe=Ce(),We=600,qe=()=>{if(xe)return xe.scrollTop+xe.clientHeight>=xe.scrollHeight-We;const Tr=document.scrollingElement??document.documentElement;return window.scrollY+window.innerHeight>=Tr.scrollHeight-We};let Xe=!1;const pt=()=>{Xe||(Xe=!0,requestAnimationFrame(()=>{Xe=!1,!q&&qe()&&H(a)}))},Vt=xe??window;return Vt.addEventListener("scroll",pt,{passive:!0}),()=>Vt.removeEventListener("scroll",pt)},[a,I,q,H,Ce]),T.useEffect(()=>{if(!a||!I||q)return;const xe=Ce(),We=600;(xe?xe.scrollTop+xe.clientHeight>=xe.scrollHeight-We:window.scrollY+window.innerHeight>=(document.scrollingElement??document.documentElement).scrollHeight-We)&&H(a)},[a,I,q,z.length,H,Ce]);const pe=!!a&&!!u&&a.toLowerCase()===u.toLowerCase(),ie=T.useCallback(()=>{a&&setTimeout(()=>{$(a),A(a)},4e3)},[a,$,A]),ye=xe=>xe?async(...We)=>{const qe=await xe(...We);return qe!==!1&&ie(),qe}:void 0,[Ne,Ge]=T.useState(null),[me,rt]=T.useState(!1),[Oe,ue]=T.useState("delegations");T.useEffect(()=>{b&&Oe==="delegations"&&ue("transactions")},[b,Oe]);const Pe=xe=>`flex-1 py-2 sm:py-2.5 px-2 text-[11px] sm:text-xs font-semibold tracking-wide rounded transition-colors whitespace-nowrap ${xe?"bg-teal-600 text-white":"bg-[var(--hrk-bg-surface)] text-[var(--hrk-text-secondary)] hover:bg-[var(--hrk-bg-surface-raised)]"}`;return e.jsxs("div",{className:`p-2 sm:p-4 transition-all duration-300 min-w-0 ${o}`,children:[e.jsxs("div",{className:"max-w-3xl mx-auto min-w-0",children:[e.jsxs("div",{className:"flex flex-col items-center p-4 sm:p-5 mb-4 sm:mb-5 rounded-xl bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-subtle)]",children:[a&&e.jsx("img",{src:`https://images.hive.blog/u/${a}/avatar`,alt:`${a} avatar`,className:"w-16 h-16 rounded-full border-3 border-blue-500/30 mb-2.5 transition-transform hover:scale-105",onError:xe=>{xe.target.src=`https://ui-avatars.com/api/?name=${a}&background=random`}}),e.jsx("div",{className:"text-base font-bold text-white",children:a}),e.jsx("div",{className:"text-xs text-[var(--hrk-text-tertiary)]",children:"Hive Wallet Overview"})]}),e.jsxs("div",{className:"rounded-xl bg-gradient-to-r from-blue-600 to-purple-600 p-4 sm:p-5 mb-4 sm:mb-5 transition-all duration-300 hover:from-blue-500 hover:to-purple-500 shadow-lg shadow-blue-500/10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("div",{className:"text-xs font-semibold text-blue-100/80",children:"Estimated Value"}),e.jsx(hz,{})]}),e.jsx("div",{className:"text-2xl font-bold text-white text-center",children:V?e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),e.jsx("span",{className:"text-lg",children:"Loading..."})]}):E?.estimated_value??"-"})]}),U&&e.jsxs("div",{className:"flex items-center p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 mb-4 text-sm",children:[e.jsx(N3,{className:"mr-2 flex-shrink-0"}),e.jsx("span",{children:U})]}),pe&&O&&(()=>{const xe=parseFloat((E?.reward_hive_balance??"0").split(" ")[0]||"0"),We=parseFloat((E?.reward_hbd_balance??"0").split(" ")[0]||"0"),qe=parseFloat((E?.reward_vesting_balance??"0").split(" ")[0]||"0"),Xe=parseFloat((E?.reward_vesting_hive??"0").split(" ")[0]||"0");if(xe<=0&&We<=0&&qe<=0)return null;const pt=[];return xe>0&&pt.push(E?.reward_hive_balance??""),We>0&&pt.push(E?.reward_hbd_balance??""),qe>0&&Xe>0&&pt.push(`${Xe.toFixed(3)} HP`),e.jsxs("div",{className:"p-3 sm:p-4 rounded-lg bg-gradient-to-r from-amber-900/30 to-orange-900/30 border border-amber-700/40 mb-3 flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold text-amber-300 flex items-center gap-1.5",children:"Pending Rewards"}),e.jsx("div",{className:"text-xs text-amber-200/80 mt-0.5",children:pt.length>0?pt.join(" · "):"You have some pending rewards to claim."})]}),e.jsx("button",{disabled:me,onClick:async()=>{rt(!0);try{await O({hive:E?.reward_hive_balance??"0.000 HIVE",hbd:E?.reward_hbd_balance??"0.000 HBD",vests:E?.reward_vesting_balance??"0.000000 VESTS"})!==!1&&ie()}finally{rt(!1)}},className:"px-3.5 py-1.5 rounded-md text-xs font-semibold tracking-wide bg-blue-600 text-white hover:bg-blue-500 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center gap-1.5",children:me?"Claiming…":"CLAIM"})]})})(),e.jsx(mz,{label:"HBD Balance",value:E?.hbd_balance,icon:e.jsx($7,{}),iconBgClass:"bg-emerald-500/15",iconTextClass:"text-emerald-400",valueClass:"text-emerald-300",actions:(pe||!pe&&u)&&w?[{label:"Transfer",onClick:()=>Ge({kind:"transfer",initialCurrency:"HBD"})}]:void 0}),e.jsx(pz,{walletData:E,isOwn:pe,currentUsername:u,onTransferHive:w?()=>Ge({kind:"transfer",initialCurrency:"HIVE"}):void 0,onPowerUp:x?()=>Ge({kind:"powerUp"}):void 0,onAddSavingsHbd:v?()=>Ge({kind:"savingsAdd",currency:"HBD"}):void 0,onRemoveSavingsHbd:N?()=>Ge({kind:"savingsRemove",currency:"HBD"}):void 0,onPowerDown:_?()=>Ge({kind:"powerDown"}):void 0,onStopPowerDown:C?()=>Ge({kind:"stopPowerDown"}):void 0,onCancelSavingsWithdrawal:R?xe=>{const We=E?.pending_savings_withdrawals?.find(qe=>qe.request_id===xe);Ge({kind:"cancelSavingsWithdrawal",requestId:xe,amount:We?.amount??""})}:void 0}),e.jsxs("div",{className:"mt-4 sm:mt-5 flex gap-2 mb-3",children:[!b&&e.jsxs("button",{onClick:()=>ue("delegations"),className:Pe(Oe==="delegations"),children:[e.jsx("span",{className:"sm:hidden",children:"Delegations"}),e.jsx("span",{className:"hidden sm:inline",children:"DELEGATIONS"})]}),e.jsxs("button",{onClick:()=>ue("transactions"),className:Pe(Oe==="transactions"),children:[e.jsx("span",{className:"sm:hidden",children:"Transactions"}),e.jsx("span",{className:"hidden sm:inline",children:"TRANSACTION HISTORY"})]})]}),Oe==="delegations"&&!b&&a&&e.jsx(OC,{username:a,currentUsername:u,onUpdateRcDelegation:c,onDeleteRcDelegation:f,onCreateHpDelegation:h,onCreateRcDelegation:g}),Oe==="transactions"&&e.jsxs("div",{className:"rounded-xl bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-subtle)] p-2 sm:p-4 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 px-1",children:[e.jsx("h3",{className:"text-sm font-bold text-[var(--hrk-text-secondary)] tracking-wide uppercase",children:"Transaction History"}),ve.length!==z.length?e.jsxs("span",{className:"text-xs text-[var(--hrk-text-tertiary)]",children:["Showing ",ve.length," of ",z.length]}):z.length>0?e.jsxs("span",{className:"text-xs text-[var(--hrk-text-tertiary)]",children:[z.length," transactions"]}):null]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 mb-4 px-2 py-2 bg-[var(--hrk-bg-surface-raised)]/35 rounded-lg border border-[var(--hrk-border-subtle)]/50 text-xs text-[var(--hrk-text-secondary)] font-medium",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none hover:text-white transition-colors",children:[e.jsx("input",{type:"checkbox",checked:ee,onChange:xe=>se(xe.target.checked),className:"rounded border-[var(--hrk-border-default)] bg-[var(--hrk-bg-surface)] text-blue-500 focus:ring-blue-500 focus:ring-offset-[var(--hrk-bg-surface)] cursor-pointer w-3.5 h-3.5"}),e.jsx("span",{children:"Outgoing"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none hover:text-white transition-colors",children:[e.jsx("input",{type:"checkbox",checked:fe,onChange:xe=>he(xe.target.checked),className:"rounded border-[var(--hrk-border-default)] bg-[var(--hrk-bg-surface)] text-blue-500 focus:ring-blue-500 focus:ring-offset-[var(--hrk-bg-surface)] cursor-pointer w-3.5 h-3.5"}),e.jsx("span",{children:"Incoming"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none hover:text-white transition-colors",children:[e.jsx("input",{type:"checkbox",checked:X,onChange:xe=>W(xe.target.checked),className:"rounded border-[var(--hrk-border-default)] bg-[var(--hrk-bg-surface)] text-blue-500 focus:ring-blue-500 focus:ring-offset-[var(--hrk-bg-surface)] cursor-pointer w-3.5 h-3.5"}),e.jsx("span",{children:"Exclude 0.001"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none hover:text-white transition-colors",children:[e.jsx("input",{type:"checkbox",checked:ne,onChange:xe=>be(xe.target.checked),className:"rounded border-[var(--hrk-border-default)] bg-[var(--hrk-bg-surface)] text-blue-500 focus:ring-blue-500 focus:ring-offset-[var(--hrk-bg-surface)] cursor-pointer w-3.5 h-3.5"}),e.jsx("span",{children:"Transfers"})]})]}),Z&&e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-[var(--hrk-border-default)] border-t-blue-400 rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-[var(--hrk-text-tertiary)]",children:"Loading transactions..."})]})}),J&&e.jsxs("div",{className:"flex items-center p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 mb-4 text-sm",children:[e.jsx(N3,{className:"mr-2 flex-shrink-0"}),e.jsx("span",{children:J})]}),!Z&&!J&&ve.length===0&&e.jsx("div",{className:"text-center p-8 rounded-lg bg-[var(--hrk-bg-app)] border border-[var(--hrk-border-subtle)]",children:e.jsx("p",{className:"text-sm text-[var(--hrk-text-tertiary)]",children:"No transactions found"})}),!Z&&a&&ve.map(xe=>e.jsx(fz,{tx:xe},xe.trx_id+xe.id)),!Z&&z.length>0&&I&&e.jsx("div",{ref:Le,className:"py-4 flex items-center justify-center",children:q?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-[var(--hrk-border-default)] border-t-blue-400 rounded-full animate-spin"}),e.jsx("span",{className:"text-xs text-[var(--hrk-text-tertiary)]",children:"Loading more transactions…"})]}):e.jsx("button",{type:"button",onClick:()=>a&&H(a),className:"px-4 py-2 rounded-lg text-xs font-medium bg-[var(--hrk-bg-surface)] border border-[var(--hrk-border-default)] text-[var(--hrk-text-secondary)] hover:text-[var(--hrk-text-primary)] hover:border-blue-400/50 transition-colors",children:"Load more transactions"})}),!Z&&z.length>0&&!I&&e.jsx("div",{className:"py-3 text-center text-[11px] text-[var(--hrk-text-tertiary)]",children:"No more transactions"})]})]}),(pe||u)&&a&&Ne?.kind==="transfer"&&w&&e.jsx(oz,{from:pe?a:u,toDefault:pe?"":a,hiveBalance:pe?E?.balance:void 0,hbdBalance:pe?E?.hbd_balance:void 0,initialCurrency:Ne.initialCurrency,onClose:()=>Ge(null),onSubmit:ye(w)}),(pe||u)&&a&&Ne?.kind==="powerUp"&&x&&e.jsx(lz,{from:pe?a:u,toDefault:pe?void 0:a,hiveBalance:pe?E?.balance:void 0,onClose:()=>Ge(null),onSubmit:ye(x)}),pe&&a&&Ne?.kind==="powerDown"&&_&&e.jsx(uz,{from:a,hivePower:E?.hive_power,onClose:()=>Ge(null),onSubmit:ye(_)}),(pe||u)&&a&&Ne?.kind==="savingsAdd"&&v&&e.jsx(w6,{mode:"add",from:pe?a:u,toDefault:pe?void 0:a,currency:Ne.currency,availableBalance:pe?Ne.currency==="HIVE"?E?.balance:E?.hbd_balance:void 0,onClose:()=>Ge(null),onSubmit:ye(v)}),pe&&a&&Ne?.kind==="savingsRemove"&&N&&e.jsx(w6,{mode:"remove",from:a,currency:Ne.currency,availableBalance:Ne.currency==="HIVE"?E?.savings_balance:E?.savings_hbd_balance,onClose:()=>Ge(null),onSubmit:ye(N)}),pe&&a&&Ne?.kind==="stopPowerDown"&&C&&e.jsx(_6,{title:"Cancel Unstake (Power Down)?",message:"This will cancel the current unstake (power down) request. Are you sure?",onClose:()=>Ge(null),onConfirm:ye(C)}),pe&&a&&Ne?.kind==="cancelSavingsWithdrawal"&&R&&e.jsx(_6,{title:"Cancel Unstake (Withdraw) From Savings?",message:`This will cancel the selected unstake (withdraw) request${Ne.amount?` of ${Ne.amount}`:""}. Are you sure?`,onClose:()=>Ge(null),onConfirm:ye(()=>R(Ne.requestId))})]})};var Uv={exports:{}};var gz=Uv.exports,j6;function xz(){return j6||(j6=1,(function(a,o){(function(l,u){u(o)})(gz,(function(l){var u="1.9.4";function c(d){var y,D,F,Q;for(D=1,F=arguments.length;D<F;D++){Q=arguments[D];for(y in Q)d[y]=Q[y]}return d}var f=Object.create||(function(){function d(){}return function(y){return d.prototype=y,new d}})();function h(d,y){var D=Array.prototype.slice;if(d.bind)return d.bind.apply(d,D.call(arguments,1));var F=D.call(arguments,2);return function(){return d.apply(y,F.length?F.concat(D.call(arguments)):arguments)}}var g=0;function b(d){return"_leaflet_id"in d||(d._leaflet_id=++g),d._leaflet_id}function w(d,y,D){var F,Q,ce,Ae;return Ae=function(){F=!1,Q&&(ce.apply(D,Q),Q=!1)},ce=function(){F?Q=arguments:(d.apply(D,arguments),setTimeout(Ae,y),F=!0)},ce}function x(d,y,D){var F=y[1],Q=y[0],ce=F-Q;return d===F&&D?d:((d-Q)%ce+ce)%ce+Q}function _(){return!1}function v(d,y){if(y===!1)return d;var D=Math.pow(10,y===void 0?6:y);return Math.round(d*D)/D}function N(d){return d.trim?d.trim():d.replace(/^\s+|\s+$/g,"")}function C(d){return N(d).split(/\s+/)}function R(d,y){Object.prototype.hasOwnProperty.call(d,"options")||(d.options=d.options?f(d.options):{});for(var D in y)d.options[D]=y[D];return d.options}function O(d,y,D){var F=[];for(var Q in d)F.push(encodeURIComponent(D?Q.toUpperCase():Q)+"="+encodeURIComponent(d[Q]));return(!y||y.indexOf("?")===-1?"?":"&")+F.join("&")}var E=/\{ *([\w_ -]+) *\}/g;function $(d,y){return d.replace(E,function(D,F){var Q=y[F];if(Q===void 0)throw new Error("No value provided for variable "+D);return typeof Q=="function"&&(Q=Q(y)),Q})}var V=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"};function U(d,y){for(var D=0;D<d.length;D++)if(d[D]===y)return D;return-1}var z="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function A(d){return window["webkit"+d]||window["moz"+d]||window["ms"+d]}var H=0;function I(d){var y=+new Date,D=Math.max(0,16-(y-H));return H=y+D,window.setTimeout(d,D)}var q=window.requestAnimationFrame||A("RequestAnimationFrame")||I,Z=window.cancelAnimationFrame||A("CancelAnimationFrame")||A("CancelRequestAnimationFrame")||function(d){window.clearTimeout(d)};function J(d,y,D){if(D&&q===I)d.call(y);else return q.call(window,h(d,y))}function ee(d){d&&Z.call(window,d)}var se={__proto__:null,extend:c,create:f,bind:h,get lastId(){return g},stamp:b,throttle:w,wrapNum:x,falseFn:_,formatNum:v,trim:N,splitWords:C,setOptions:R,getParamString:O,template:$,isArray:V,indexOf:U,emptyImageUrl:z,requestFn:q,cancelFn:Z,requestAnimFrame:J,cancelAnimFrame:ee};function fe(){}fe.extend=function(d){var y=function(){R(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},D=y.__super__=this.prototype,F=f(D);F.constructor=y,y.prototype=F;for(var Q in this)Object.prototype.hasOwnProperty.call(this,Q)&&Q!=="prototype"&&Q!=="__super__"&&(y[Q]=this[Q]);return d.statics&&c(y,d.statics),d.includes&&(he(d.includes),c.apply(null,[F].concat(d.includes))),c(F,d),delete F.statics,delete F.includes,F.options&&(F.options=D.options?f(D.options):{},c(F.options,d.options)),F._initHooks=[],F.callInitHooks=function(){if(!this._initHooksCalled){D.callInitHooks&&D.callInitHooks.call(this),this._initHooksCalled=!0;for(var ce=0,Ae=F._initHooks.length;ce<Ae;ce++)F._initHooks[ce].call(this)}},y},fe.include=function(d){var y=this.prototype.options;return c(this.prototype,d),d.options&&(this.prototype.options=y,this.mergeOptions(d.options)),this},fe.mergeOptions=function(d){return c(this.prototype.options,d),this},fe.addInitHook=function(d){var y=Array.prototype.slice.call(arguments,1),D=typeof d=="function"?d:function(){this[d].apply(this,y)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(D),this};function he(d){if(!(typeof L>"u"||!L||!L.Mixin)){d=V(d)?d:[d];for(var y=0;y<d.length;y++)d[y]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",new Error().stack)}}var X={on:function(d,y,D){if(typeof d=="object")for(var F in d)this._on(F,d[F],y);else{d=C(d);for(var Q=0,ce=d.length;Q<ce;Q++)this._on(d[Q],y,D)}return this},off:function(d,y,D){if(!arguments.length)delete this._events;else if(typeof d=="object")for(var F in d)this._off(F,d[F],y);else{d=C(d);for(var Q=arguments.length===1,ce=0,Ae=d.length;ce<Ae;ce++)Q?this._off(d[ce]):this._off(d[ce],y,D)}return this},_on:function(d,y,D,F){if(typeof y!="function"){console.warn("wrong listener type: "+typeof y);return}if(this._listens(d,y,D)===!1){D===this&&(D=void 0);var Q={fn:y,ctx:D};F&&(Q.once=!0),this._events=this._events||{},this._events[d]=this._events[d]||[],this._events[d].push(Q)}},_off:function(d,y,D){var F,Q,ce;if(this._events&&(F=this._events[d],!!F)){if(arguments.length===1){if(this._firingCount)for(Q=0,ce=F.length;Q<ce;Q++)F[Q].fn=_;delete this._events[d];return}if(typeof y!="function"){console.warn("wrong listener type: "+typeof y);return}var Ae=this._listens(d,y,D);if(Ae!==!1){var Qe=F[Ae];this._firingCount&&(Qe.fn=_,this._events[d]=F=F.slice()),F.splice(Ae,1)}}},fire:function(d,y,D){if(!this.listens(d,D))return this;var F=c({},y,{type:d,target:this,sourceTarget:y&&y.sourceTarget||this});if(this._events){var Q=this._events[d];if(Q){this._firingCount=this._firingCount+1||1;for(var ce=0,Ae=Q.length;ce<Ae;ce++){var Qe=Q[ce],dt=Qe.fn;Qe.once&&this.off(d,dt,Qe.ctx),dt.call(Qe.ctx||this,F)}this._firingCount--}}return D&&this._propagateEvent(F),this},listens:function(d,y,D,F){typeof d!="string"&&console.warn('"string" type argument expected');var Q=y;typeof y!="function"&&(F=!!y,Q=void 0,D=void 0);var ce=this._events&&this._events[d];if(ce&&ce.length&&this._listens(d,Q,D)!==!1)return!0;if(F){for(var Ae in this._eventParents)if(this._eventParents[Ae].listens(d,y,D,F))return!0}return!1},_listens:function(d,y,D){if(!this._events)return!1;var F=this._events[d]||[];if(!y)return!!F.length;D===this&&(D=void 0);for(var Q=0,ce=F.length;Q<ce;Q++)if(F[Q].fn===y&&F[Q].ctx===D)return Q;return!1},once:function(d,y,D){if(typeof d=="object")for(var F in d)this._on(F,d[F],y,!0);else{d=C(d);for(var Q=0,ce=d.length;Q<ce;Q++)this._on(d[Q],y,D,!0)}return this},addEventParent:function(d){return this._eventParents=this._eventParents||{},this._eventParents[b(d)]=d,this},removeEventParent:function(d){return this._eventParents&&delete this._eventParents[b(d)],this},_propagateEvent:function(d){for(var y in this._eventParents)this._eventParents[y].fire(d.type,c({layer:d.target,propagatedFrom:d.target},d),!0)}};X.addEventListener=X.on,X.removeEventListener=X.clearAllEventListeners=X.off,X.addOneTimeEventListener=X.once,X.fireEvent=X.fire,X.hasEventListeners=X.listens;var W=fe.extend(X);function ne(d,y,D){this.x=D?Math.round(d):d,this.y=D?Math.round(y):y}var be=Math.trunc||function(d){return d>0?Math.floor(d):Math.ceil(d)};ne.prototype={clone:function(){return new ne(this.x,this.y)},add:function(d){return this.clone()._add(ve(d))},_add:function(d){return this.x+=d.x,this.y+=d.y,this},subtract:function(d){return this.clone()._subtract(ve(d))},_subtract:function(d){return this.x-=d.x,this.y-=d.y,this},divideBy:function(d){return this.clone()._divideBy(d)},_divideBy:function(d){return this.x/=d,this.y/=d,this},multiplyBy:function(d){return this.clone()._multiplyBy(d)},_multiplyBy:function(d){return this.x*=d,this.y*=d,this},scaleBy:function(d){return new ne(this.x*d.x,this.y*d.y)},unscaleBy:function(d){return new ne(this.x/d.x,this.y/d.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=be(this.x),this.y=be(this.y),this},distanceTo:function(d){d=ve(d);var y=d.x-this.x,D=d.y-this.y;return Math.sqrt(y*y+D*D)},equals:function(d){return d=ve(d),d.x===this.x&&d.y===this.y},contains:function(d){return d=ve(d),Math.abs(d.x)<=Math.abs(this.x)&&Math.abs(d.y)<=Math.abs(this.y)},toString:function(){return"Point("+v(this.x)+", "+v(this.y)+")"}};function ve(d,y,D){return d instanceof ne?d:V(d)?new ne(d[0],d[1]):d==null?d:typeof d=="object"&&"x"in d&&"y"in d?new ne(d.x,d.y):new ne(d,y,D)}function Le(d,y){if(d)for(var D=y?[d,y]:d,F=0,Q=D.length;F<Q;F++)this.extend(D[F])}Le.prototype={extend:function(d){var y,D;if(!d)return this;if(d instanceof ne||typeof d[0]=="number"||"x"in d)y=D=ve(d);else if(d=Ce(d),y=d.min,D=d.max,!y||!D)return this;return!this.min&&!this.max?(this.min=y.clone(),this.max=D.clone()):(this.min.x=Math.min(y.x,this.min.x),this.max.x=Math.max(D.x,this.max.x),this.min.y=Math.min(y.y,this.min.y),this.max.y=Math.max(D.y,this.max.y)),this},getCenter:function(d){return ve((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,d)},getBottomLeft:function(){return ve(this.min.x,this.max.y)},getTopRight:function(){return ve(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(d){var y,D;return typeof d[0]=="number"||d instanceof ne?d=ve(d):d=Ce(d),d instanceof Le?(y=d.min,D=d.max):y=D=d,y.x>=this.min.x&&D.x<=this.max.x&&y.y>=this.min.y&&D.y<=this.max.y},intersects:function(d){d=Ce(d);var y=this.min,D=this.max,F=d.min,Q=d.max,ce=Q.x>=y.x&&F.x<=D.x,Ae=Q.y>=y.y&&F.y<=D.y;return ce&&Ae},overlaps:function(d){d=Ce(d);var y=this.min,D=this.max,F=d.min,Q=d.max,ce=Q.x>y.x&&F.x<D.x,Ae=Q.y>y.y&&F.y<D.y;return ce&&Ae},isValid:function(){return!!(this.min&&this.max)},pad:function(d){var y=this.min,D=this.max,F=Math.abs(y.x-D.x)*d,Q=Math.abs(y.y-D.y)*d;return Ce(ve(y.x-F,y.y-Q),ve(D.x+F,D.y+Q))},equals:function(d){return d?(d=Ce(d),this.min.equals(d.getTopLeft())&&this.max.equals(d.getBottomRight())):!1}};function Ce(d,y){return!d||d instanceof Le?d:new Le(d,y)}function pe(d,y){if(d)for(var D=y?[d,y]:d,F=0,Q=D.length;F<Q;F++)this.extend(D[F])}pe.prototype={extend:function(d){var y=this._southWest,D=this._northEast,F,Q;if(d instanceof ye)F=d,Q=d;else if(d instanceof pe){if(F=d._southWest,Q=d._northEast,!F||!Q)return this}else return d?this.extend(Ne(d)||ie(d)):this;return!y&&!D?(this._southWest=new ye(F.lat,F.lng),this._northEast=new ye(Q.lat,Q.lng)):(y.lat=Math.min(F.lat,y.lat),y.lng=Math.min(F.lng,y.lng),D.lat=Math.max(Q.lat,D.lat),D.lng=Math.max(Q.lng,D.lng)),this},pad:function(d){var y=this._southWest,D=this._northEast,F=Math.abs(y.lat-D.lat)*d,Q=Math.abs(y.lng-D.lng)*d;return new pe(new ye(y.lat-F,y.lng-Q),new ye(D.lat+F,D.lng+Q))},getCenter:function(){return new ye((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new ye(this.getNorth(),this.getWest())},getSouthEast:function(){return new ye(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(d){typeof d[0]=="number"||d instanceof ye||"lat"in d?d=Ne(d):d=ie(d);var y=this._southWest,D=this._northEast,F,Q;return d instanceof pe?(F=d.getSouthWest(),Q=d.getNorthEast()):F=Q=d,F.lat>=y.lat&&Q.lat<=D.lat&&F.lng>=y.lng&&Q.lng<=D.lng},intersects:function(d){d=ie(d);var y=this._southWest,D=this._northEast,F=d.getSouthWest(),Q=d.getNorthEast(),ce=Q.lat>=y.lat&&F.lat<=D.lat,Ae=Q.lng>=y.lng&&F.lng<=D.lng;return ce&&Ae},overlaps:function(d){d=ie(d);var y=this._southWest,D=this._northEast,F=d.getSouthWest(),Q=d.getNorthEast(),ce=Q.lat>y.lat&&F.lat<D.lat,Ae=Q.lng>y.lng&&F.lng<D.lng;return ce&&Ae},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(d,y){return d?(d=ie(d),this._southWest.equals(d.getSouthWest(),y)&&this._northEast.equals(d.getNorthEast(),y)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function ie(d,y){return d instanceof pe?d:new pe(d,y)}function ye(d,y,D){if(isNaN(d)||isNaN(y))throw new Error("Invalid LatLng object: ("+d+", "+y+")");this.lat=+d,this.lng=+y,D!==void 0&&(this.alt=+D)}ye.prototype={equals:function(d,y){if(!d)return!1;d=Ne(d);var D=Math.max(Math.abs(this.lat-d.lat),Math.abs(this.lng-d.lng));return D<=(y===void 0?1e-9:y)},toString:function(d){return"LatLng("+v(this.lat,d)+", "+v(this.lng,d)+")"},distanceTo:function(d){return me.distance(this,Ne(d))},wrap:function(){return me.wrapLatLng(this)},toBounds:function(d){var y=180*d/40075017,D=y/Math.cos(Math.PI/180*this.lat);return ie([this.lat-y,this.lng-D],[this.lat+y,this.lng+D])},clone:function(){return new ye(this.lat,this.lng,this.alt)}};function Ne(d,y,D){return d instanceof ye?d:V(d)&&typeof d[0]!="object"?d.length===3?new ye(d[0],d[1],d[2]):d.length===2?new ye(d[0],d[1]):null:d==null?d:typeof d=="object"&&"lat"in d?new ye(d.lat,"lng"in d?d.lng:d.lon,d.alt):y===void 0?null:new ye(d,y,D)}var Ge={latLngToPoint:function(d,y){var D=this.projection.project(d),F=this.scale(y);return this.transformation._transform(D,F)},pointToLatLng:function(d,y){var D=this.scale(y),F=this.transformation.untransform(d,D);return this.projection.unproject(F)},project:function(d){return this.projection.project(d)},unproject:function(d){return this.projection.unproject(d)},scale:function(d){return 256*Math.pow(2,d)},zoom:function(d){return Math.log(d/256)/Math.LN2},getProjectedBounds:function(d){if(this.infinite)return null;var y=this.projection.bounds,D=this.scale(d),F=this.transformation.transform(y.min,D),Q=this.transformation.transform(y.max,D);return new Le(F,Q)},infinite:!1,wrapLatLng:function(d){var y=this.wrapLng?x(d.lng,this.wrapLng,!0):d.lng,D=this.wrapLat?x(d.lat,this.wrapLat,!0):d.lat,F=d.alt;return new ye(D,y,F)},wrapLatLngBounds:function(d){var y=d.getCenter(),D=this.wrapLatLng(y),F=y.lat-D.lat,Q=y.lng-D.lng;if(F===0&&Q===0)return d;var ce=d.getSouthWest(),Ae=d.getNorthEast(),Qe=new ye(ce.lat-F,ce.lng-Q),dt=new ye(Ae.lat-F,Ae.lng-Q);return new pe(Qe,dt)}},me=c({},Ge,{wrapLng:[-180,180],R:6371e3,distance:function(d,y){var D=Math.PI/180,F=d.lat*D,Q=y.lat*D,ce=Math.sin((y.lat-d.lat)*D/2),Ae=Math.sin((y.lng-d.lng)*D/2),Qe=ce*ce+Math.cos(F)*Math.cos(Q)*Ae*Ae,dt=2*Math.atan2(Math.sqrt(Qe),Math.sqrt(1-Qe));return this.R*dt}}),rt=6378137,Oe={R:rt,MAX_LATITUDE:85.0511287798,project:function(d){var y=Math.PI/180,D=this.MAX_LATITUDE,F=Math.max(Math.min(D,d.lat),-D),Q=Math.sin(F*y);return new ne(this.R*d.lng*y,this.R*Math.log((1+Q)/(1-Q))/2)},unproject:function(d){var y=180/Math.PI;return new ye((2*Math.atan(Math.exp(d.y/this.R))-Math.PI/2)*y,d.x*y/this.R)},bounds:(function(){var d=rt*Math.PI;return new Le([-d,-d],[d,d])})()};function ue(d,y,D,F){if(V(d)){this._a=d[0],this._b=d[1],this._c=d[2],this._d=d[3];return}this._a=d,this._b=y,this._c=D,this._d=F}ue.prototype={transform:function(d,y){return this._transform(d.clone(),y)},_transform:function(d,y){return y=y||1,d.x=y*(this._a*d.x+this._b),d.y=y*(this._c*d.y+this._d),d},untransform:function(d,y){return y=y||1,new ne((d.x/y-this._b)/this._a,(d.y/y-this._d)/this._c)}};function Pe(d,y,D,F){return new ue(d,y,D,F)}var xe=c({},me,{code:"EPSG:3857",projection:Oe,transformation:(function(){var d=.5/(Math.PI*Oe.R);return Pe(d,.5,-d,.5)})()}),We=c({},xe,{code:"EPSG:900913"});function qe(d){return document.createElementNS("http://www.w3.org/2000/svg",d)}function Xe(d,y){var D="",F,Q,ce,Ae,Qe,dt;for(F=0,ce=d.length;F<ce;F++){for(Qe=d[F],Q=0,Ae=Qe.length;Q<Ae;Q++)dt=Qe[Q],D+=(Q?"L":"M")+dt.x+" "+dt.y;D+=y?rr.svg?"z":"x":""}return D||"M0 0"}var pt=document.documentElement.style,Vt="ActiveXObject"in window,Tr=Vt&&!document.addEventListener,jt="msLaunchUri"in navigator&&!("documentMode"in document),Nt=pa("webkit"),fr=pa("android"),Mr=pa("android 2")||pa("android 3"),Zt=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),He=fr&&pa("Google")&&Zt<537&&!("AudioNode"in window),Kt=!!window.opera,De=!jt&&pa("chrome"),Ot=pa("gecko")&&!Nt&&!Kt&&!Vt,ot=!De&&pa("safari"),Re=pa("phantom"),Je="OTransition"in pt,kt=navigator.platform.indexOf("Win")===0,it=Vt&&"transition"in pt,Pt="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!Mr,Yt="MozPerspective"in pt,Ir=!window.L_DISABLE_3D&&(it||Pt||Yt)&&!Je&&!Re,ma=typeof orientation<"u"||pa("mobile"),Zr=ma&&Nt,Wr=ma&&Pt,da=!window.PointerEvent&&window.MSPointerEvent,ae=!!(window.PointerEvent||da),oe="ontouchstart"in window||!!window.TouchEvent,_e=!window.L_NO_TOUCH&&(oe||ae),Be=ma&&Kt,wt=ma&&Ot,ar=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,xt=(function(){var d=!1;try{var y=Object.defineProperty({},"passive",{get:function(){d=!0}});window.addEventListener("testPassiveEventSupport",_,y),window.removeEventListener("testPassiveEventSupport",_,y)}catch{}return d})(),St=(function(){return!!document.createElement("canvas").getContext})(),Jr=!!(document.createElementNS&&qe("svg").createSVGRect),ct=!!Jr&&(function(){var d=document.createElement("div");return d.innerHTML="<svg/>",(d.firstChild&&d.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),cr=!Jr&&(function(){try{var d=document.createElement("div");d.innerHTML='<v:shape adj="1"/>';var y=d.firstChild;return y.style.behavior="url(#default#VML)",y&&typeof y.adj=="object"}catch{return!1}})(),dr=navigator.platform.indexOf("Mac")===0,Lr=navigator.platform.indexOf("Linux")===0;function pa(d){return navigator.userAgent.toLowerCase().indexOf(d)>=0}var rr={ie:Vt,ielt9:Tr,edge:jt,webkit:Nt,android:fr,android23:Mr,androidStock:He,opera:Kt,chrome:De,gecko:Ot,safari:ot,phantom:Re,opera12:Je,win:kt,ie3d:it,webkit3d:Pt,gecko3d:Yt,any3d:Ir,mobile:ma,mobileWebkit:Zr,mobileWebkit3d:Wr,msPointer:da,pointer:ae,touch:_e,touchNative:oe,mobileOpera:Be,mobileGecko:wt,retina:ar,passiveEvents:xt,canvas:St,svg:Jr,vml:cr,inlineSvg:ct,mac:dr,linux:Lr},_a=rr.msPointer?"MSPointerDown":"pointerdown",Ct=rr.msPointer?"MSPointerMove":"pointermove",Xt=rr.msPointer?"MSPointerUp":"pointerup",er=rr.msPointer?"MSPointerCancel":"pointercancel",pr={touchstart:_a,touchmove:Ct,touchend:Xt,touchcancel:er},Qr={touchstart:Ur,touchmove:fa,touchend:fa,touchcancel:fa},Kr={},Da=!1;function Bn(d,y,D){return y==="touchstart"&&Br(),Qr[y]?(D=Qr[y].bind(this,D),d.addEventListener(pr[y],D,!1),D):(console.warn("wrong event specified:",y),_)}function Cr(d,y,D){if(!pr[y]){console.warn("wrong event specified:",y);return}d.removeEventListener(pr[y],D,!1)}function Dt(d){Kr[d.pointerId]=d}function sr(d){Kr[d.pointerId]&&(Kr[d.pointerId]=d)}function Nr(d){delete Kr[d.pointerId]}function Br(){Da||(document.addEventListener(_a,Dt,!0),document.addEventListener(Ct,sr,!0),document.addEventListener(Xt,Nr,!0),document.addEventListener(er,Nr,!0),Da=!0)}function fa(d,y){if(y.pointerType!==(y.MSPOINTER_TYPE_MOUSE||"mouse")){y.touches=[];for(var D in Kr)y.touches.push(Kr[D]);y.changedTouches=[y],d(y)}}function Ur(d,y){y.MSPOINTER_TYPE_TOUCH&&y.pointerType===y.MSPOINTER_TYPE_TOUCH&&va(y),fa(d,y)}function gr(d){var y={},D,F;for(F in d)D=d[F],y[F]=D&&D.bind?D.bind(d):D;return d=y,y.type="dblclick",y.detail=2,y.isTrusted=!1,y._simulated=!0,y}var zr=200;function Se(d,y){d.addEventListener("dblclick",y);var D=0,F;function Q(ce){if(ce.detail!==1){F=ce.detail;return}if(!(ce.pointerType==="mouse"||ce.sourceCapabilities&&!ce.sourceCapabilities.firesTouchEvents)){var Ae=ge(ce);if(!(Ae.some(function(dt){return dt instanceof HTMLLabelElement&&dt.attributes.for})&&!Ae.some(function(dt){return dt instanceof HTMLInputElement||dt instanceof HTMLSelectElement}))){var Qe=Date.now();Qe-D<=zr?(F++,F===2&&y(gr(ce))):F=1,D=Qe}}}return d.addEventListener("click",Q),{dblclick:y,simDblclick:Q}}function et(d,y){d.removeEventListener("dblclick",y.dblclick),d.removeEventListener("click",y.simDblclick)}var At=Oa(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),$t=Oa(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Vr=$t==="webkitTransition"||$t==="OTransition"?$t+"End":"transitionend";function lr(d){return typeof d=="string"?document.getElementById(d):d}function Pr(d,y){var D=d.style[y]||d.currentStyle&&d.currentStyle[y];if((!D||D==="auto")&&document.defaultView){var F=document.defaultView.getComputedStyle(d,null);D=F?F[y]:null}return D==="auto"?null:D}function nr(d,y,D){var F=document.createElement(d);return F.className=y||"",D&&D.appendChild(F),F}function Wt(d){var y=d.parentNode;y&&y.removeChild(d)}function Or(d){for(;d.firstChild;)d.removeChild(d.firstChild)}function hr(d){var y=d.parentNode;y&&y.lastChild!==d&&y.appendChild(d)}function Rr(d){var y=d.parentNode;y&&y.firstChild!==d&&y.insertBefore(d,y.firstChild)}function ga(d,y){if(d.classList!==void 0)return d.classList.contains(y);var D=jn(d);return D.length>0&&new RegExp("(^|\\s)"+y+"(\\s|$)").test(D)}function Rt(d,y){if(d.classList!==void 0)for(var D=C(y),F=0,Q=D.length;F<Q;F++)d.classList.add(D[F]);else if(!ga(d,y)){var ce=jn(d);Fr(d,(ce?ce+" ":"")+y)}}function Yr(d,y){d.classList!==void 0?d.classList.remove(y):Fr(d,N((" "+jn(d)+" ").replace(" "+y+" "," ")))}function Fr(d,y){d.className.baseVal===void 0?d.className=y:d.className.baseVal=y}function jn(d){return d.correspondingElement&&(d=d.correspondingElement),d.className.baseVal===void 0?d.className:d.className.baseVal}function ea(d,y){"opacity"in d.style?d.style.opacity=y:"filter"in d.style&&fn(d,y)}function fn(d,y){var D=!1,F="DXImageTransform.Microsoft.Alpha";try{D=d.filters.item(F)}catch{if(y===1)return}y=Math.round(y*100),D?(D.Enabled=y!==100,D.Opacity=y):d.style.filter+=" progid:"+F+"(opacity="+y+")"}function Oa(d){for(var y=document.documentElement.style,D=0;D<d.length;D++)if(d[D]in y)return d[D];return!1}function $a(d,y,D){var F=y||new ne(0,0);d.style[At]=(rr.ie3d?"translate("+F.x+"px,"+F.y+"px)":"translate3d("+F.x+"px,"+F.y+"px,0)")+(D?" scale("+D+")":"")}function xa(d,y){d._leaflet_pos=y,rr.any3d?$a(d,y):(d.style.left=y.x+"px",d.style.top=y.y+"px")}function ia(d){return d._leaflet_pos||new ne(0,0)}var oa,Qa,Ha;if("onselectstart"in document)oa=function(){nt(window,"selectstart",va)},Qa=function(){at(window,"selectstart",va)};else{var Gn=Oa(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);oa=function(){if(Gn){var d=document.documentElement.style;Ha=d[Gn],d[Gn]="none"}},Qa=function(){Gn&&(document.documentElement.style[Gn]=Ha,Ha=void 0)}}function ua(){nt(window,"dragstart",va)}function Xa(){at(window,"dragstart",va)}var nn,sn;function Za(d){for(;d.tabIndex===-1;)d=d.parentNode;d.style&&(Ka(),nn=d,sn=d.style.outlineStyle,d.style.outlineStyle="none",nt(window,"keydown",Ka))}function Ka(){nn&&(nn.style.outlineStyle=sn,nn=void 0,sn=void 0,at(window,"keydown",Ka))}function ke(d){do d=d.parentNode;while((!d.offsetWidth||!d.offsetHeight)&&d!==document.body);return d}function Mt(d){var y=d.getBoundingClientRect();return{x:y.width/d.offsetWidth||1,y:y.height/d.offsetHeight||1,boundingClientRect:y}}var Et={__proto__:null,TRANSFORM:At,TRANSITION:$t,TRANSITION_END:Vr,get:lr,getStyle:Pr,create:nr,remove:Wt,empty:Or,toFront:hr,toBack:Rr,hasClass:ga,addClass:Rt,removeClass:Yr,setClass:Fr,getClass:jn,setOpacity:ea,testProp:Oa,setTransform:$a,setPosition:xa,getPosition:ia,get disableTextSelection(){return oa},get enableTextSelection(){return Qa},disableImageDrag:ua,enableImageDrag:Xa,preventOutline:Za,restoreOutline:Ka,getSizedParentNode:ke,getScale:Mt};function nt(d,y,D,F){if(y&&typeof y=="object")for(var Q in y)ir(d,Q,y[Q],D);else{y=C(y);for(var ce=0,Ae=y.length;ce<Ae;ce++)ir(d,y[ce],D,F)}return this}var Ft="_leaflet_events";function at(d,y,D,F){if(arguments.length===1)ur(d),delete d[Ft];else if(y&&typeof y=="object")for(var Q in y)Hr(d,Q,y[Q],D);else if(y=C(y),arguments.length===2)ur(d,function(Qe){return U(y,Qe)!==-1});else for(var ce=0,Ae=y.length;ce<Ae;ce++)Hr(d,y[ce],D,F);return this}function ur(d,y){for(var D in d[Ft]){var F=D.split(/\d/)[0];(!y||y(F))&&Hr(d,F,null,null,D)}}var Gt={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function ir(d,y,D,F){var Q=y+b(D)+(F?"_"+b(F):"");if(d[Ft]&&d[Ft][Q])return this;var ce=function(Qe){return D.call(F||d,Qe||window.event)},Ae=ce;!rr.touchNative&&rr.pointer&&y.indexOf("touch")===0?ce=Bn(d,y,ce):rr.touch&&y==="dblclick"?ce=Se(d,ce):"addEventListener"in d?y==="touchstart"||y==="touchmove"||y==="wheel"||y==="mousewheel"?d.addEventListener(Gt[y]||y,ce,rr.passiveEvents?{passive:!1}:!1):y==="mouseenter"||y==="mouseleave"?(ce=function(Qe){Qe=Qe||window.event,xr(d,Qe)&&Ae(Qe)},d.addEventListener(Gt[y],ce,!1)):d.addEventListener(y,Ae,!1):d.attachEvent("on"+y,ce),d[Ft]=d[Ft]||{},d[Ft][Q]=ce}function Hr(d,y,D,F,Q){Q=Q||y+b(D)+(F?"_"+b(F):"");var ce=d[Ft]&&d[Ft][Q];if(!ce)return this;!rr.touchNative&&rr.pointer&&y.indexOf("touch")===0?Cr(d,y,ce):rr.touch&&y==="dblclick"?et(d,ce):"removeEventListener"in d?d.removeEventListener(Gt[y]||y,ce,!1):d.detachEvent("on"+y,ce),d[Ft][Q]=null}function Dr(d){return d.stopPropagation?d.stopPropagation():d.originalEvent?d.originalEvent._stopped=!0:d.cancelBubble=!0,this}function ba(d){return ir(d,"wheel",Dr),this}function Aa(d){return nt(d,"mousedown touchstart dblclick contextmenu",Dr),d._leaflet_disable_click=!0,this}function va(d){return d.preventDefault?d.preventDefault():d.returnValue=!1,this}function Pa(d){return va(d),Dr(d),this}function ge(d){if(d.composedPath)return d.composedPath();for(var y=[],D=d.target;D;)y.push(D),D=D.parentNode;return y}function Ue(d,y){if(!y)return new ne(d.clientX,d.clientY);var D=Mt(y),F=D.boundingClientRect;return new ne((d.clientX-F.left)/D.x-y.clientLeft,(d.clientY-F.top)/D.y-y.clientTop)}var gt=rr.linux&&rr.chrome?window.devicePixelRatio:rr.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function Tt(d){return rr.edge?d.wheelDeltaY/2:d.deltaY&&d.deltaMode===0?-d.deltaY/gt:d.deltaY&&d.deltaMode===1?-d.deltaY*20:d.deltaY&&d.deltaMode===2?-d.deltaY*60:d.deltaX||d.deltaZ?0:d.wheelDelta?(d.wheelDeltaY||d.wheelDelta)/2:d.detail&&Math.abs(d.detail)<32765?-d.detail*20:d.detail?d.detail/-32765*60:0}function xr(d,y){var D=y.relatedTarget;if(!D)return!0;try{for(;D&&D!==d;)D=D.parentNode}catch{return!1}return D!==d}var qr={__proto__:null,on:nt,off:at,stopPropagation:Dr,disableScrollPropagation:ba,disableClickPropagation:Aa,preventDefault:va,stop:Pa,getPropagationPath:ge,getMousePosition:Ue,getWheelDelta:Tt,isExternalTarget:xr,addListener:nt,removeListener:at},Ra=W.extend({run:function(d,y,D,F){this.stop(),this._el=d,this._inProgress=!0,this._duration=D||.25,this._easeOutPower=1/Math.max(F||.5,.2),this._startPos=ia(d),this._offset=y.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=J(this._animate,this),this._step()},_step:function(d){var y=+new Date-this._startTime,D=this._duration*1e3;y<D?this._runFrame(this._easeOut(y/D),d):(this._runFrame(1),this._complete())},_runFrame:function(d,y){var D=this._startPos.add(this._offset.multiplyBy(d));y&&D._round(),xa(this._el,D),this.fire("step")},_complete:function(){ee(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(d){return 1-Math.pow(1-d,this._easeOutPower)}}),kr=W.extend({options:{crs:xe,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(d,y){y=R(this,y),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(d),this._initLayout(),this._onResize=h(this._onResize,this),this._initEvents(),y.maxBounds&&this.setMaxBounds(y.maxBounds),y.zoom!==void 0&&(this._zoom=this._limitZoom(y.zoom)),y.center&&y.zoom!==void 0&&this.setView(Ne(y.center),y.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=$t&&rr.any3d&&!rr.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),nt(this._proxy,Vr,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(d,y,D){if(y=y===void 0?this._zoom:this._limitZoom(y),d=this._limitCenter(Ne(d),y,this.options.maxBounds),D=D||{},this._stop(),this._loaded&&!D.reset&&D!==!0){D.animate!==void 0&&(D.zoom=c({animate:D.animate},D.zoom),D.pan=c({animate:D.animate,duration:D.duration},D.pan));var F=this._zoom!==y?this._tryAnimatedZoom&&this._tryAnimatedZoom(d,y,D.zoom):this._tryAnimatedPan(d,D.pan);if(F)return clearTimeout(this._sizeTimer),this}return this._resetView(d,y,D.pan&&D.pan.noMoveStart),this},setZoom:function(d,y){return this._loaded?this.setView(this.getCenter(),d,{zoom:y}):(this._zoom=d,this)},zoomIn:function(d,y){return d=d||(rr.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+d,y)},zoomOut:function(d,y){return d=d||(rr.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-d,y)},setZoomAround:function(d,y,D){var F=this.getZoomScale(y),Q=this.getSize().divideBy(2),ce=d instanceof ne?d:this.latLngToContainerPoint(d),Ae=ce.subtract(Q).multiplyBy(1-1/F),Qe=this.containerPointToLatLng(Q.add(Ae));return this.setView(Qe,y,{zoom:D})},_getBoundsCenterZoom:function(d,y){y=y||{},d=d.getBounds?d.getBounds():ie(d);var D=ve(y.paddingTopLeft||y.padding||[0,0]),F=ve(y.paddingBottomRight||y.padding||[0,0]),Q=this.getBoundsZoom(d,!1,D.add(F));if(Q=typeof y.maxZoom=="number"?Math.min(y.maxZoom,Q):Q,Q===1/0)return{center:d.getCenter(),zoom:Q};var ce=F.subtract(D).divideBy(2),Ae=this.project(d.getSouthWest(),Q),Qe=this.project(d.getNorthEast(),Q),dt=this.unproject(Ae.add(Qe).divideBy(2).add(ce),Q);return{center:dt,zoom:Q}},fitBounds:function(d,y){if(d=ie(d),!d.isValid())throw new Error("Bounds are not valid.");var D=this._getBoundsCenterZoom(d,y);return this.setView(D.center,D.zoom,y)},fitWorld:function(d){return this.fitBounds([[-90,-180],[90,180]],d)},panTo:function(d,y){return this.setView(d,this._zoom,{pan:y})},panBy:function(d,y){if(d=ve(d).round(),y=y||{},!d.x&&!d.y)return this.fire("moveend");if(y.animate!==!0&&!this.getSize().contains(d))return this._resetView(this.unproject(this.project(this.getCenter()).add(d)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new Ra,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),y.noMoveStart||this.fire("movestart"),y.animate!==!1){Rt(this._mapPane,"leaflet-pan-anim");var D=this._getMapPanePos().subtract(d).round();this._panAnim.run(this._mapPane,D,y.duration||.25,y.easeLinearity)}else this._rawPanBy(d),this.fire("move").fire("moveend");return this},flyTo:function(d,y,D){if(D=D||{},D.animate===!1||!rr.any3d)return this.setView(d,y,D);this._stop();var F=this.project(this.getCenter()),Q=this.project(d),ce=this.getSize(),Ae=this._zoom;d=Ne(d),y=y===void 0?Ae:y;var Qe=Math.max(ce.x,ce.y),dt=Qe*this.getZoomScale(Ae,y),Ht=Q.distanceTo(F)||1,vr=1.42,na=vr*vr;function an(ms){var ao=ms?-1:1,Jl=ms?dt:Qe,Lh=dt*dt-Qe*Qe+ao*na*na*Ht*Ht,cc=2*Jl*na*Ht,dc=Lh/cc,nl=Math.sqrt(dc*dc+1)-dc,Oo=nl<1e-9?-18:Math.log(nl);return Oo}function qs(ms){return(Math.exp(ms)-Math.exp(-ms))/2}function zs(ms){return(Math.exp(ms)+Math.exp(-ms))/2}function _i(ms){return qs(ms)/zs(ms)}var Hn=an(0);function Vn(ms){return Qe*(zs(Hn)/zs(Hn+vr*ms))}function vn(ms){return Qe*(zs(Hn)*_i(Hn+vr*ms)-qs(Hn))/na}function al(ms){return 1-Math.pow(1-ms,1.5)}var Js=Date.now(),Mo=(an(1)-Hn)/vr,yo=D.duration?1e3*D.duration:1e3*Mo*.8;function uc(){var ms=(Date.now()-Js)/yo,ao=al(ms)*Mo;ms<=1?(this._flyToFrame=J(uc,this),this._move(this.unproject(F.add(Q.subtract(F).multiplyBy(vn(ao)/Ht)),Ae),this.getScaleZoom(Qe/Vn(ao),Ae),{flyTo:!0})):this._move(d,y)._moveEnd(!0)}return this._moveStart(!0,D.noMoveStart),uc.call(this),this},flyToBounds:function(d,y){var D=this._getBoundsCenterZoom(d,y);return this.flyTo(D.center,D.zoom,y)},setMaxBounds:function(d){return d=ie(d),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),d.isValid()?(this.options.maxBounds=d,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(d){var y=this.options.minZoom;return this.options.minZoom=d,this._loaded&&y!==d&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(d):this},setMaxZoom:function(d){var y=this.options.maxZoom;return this.options.maxZoom=d,this._loaded&&y!==d&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(d):this},panInsideBounds:function(d,y){this._enforcingBounds=!0;var D=this.getCenter(),F=this._limitCenter(D,this._zoom,ie(d));return D.equals(F)||this.panTo(F,y),this._enforcingBounds=!1,this},panInside:function(d,y){y=y||{};var D=ve(y.paddingTopLeft||y.padding||[0,0]),F=ve(y.paddingBottomRight||y.padding||[0,0]),Q=this.project(this.getCenter()),ce=this.project(d),Ae=this.getPixelBounds(),Qe=Ce([Ae.min.add(D),Ae.max.subtract(F)]),dt=Qe.getSize();if(!Qe.contains(ce)){this._enforcingBounds=!0;var Ht=ce.subtract(Qe.getCenter()),vr=Qe.extend(ce).getSize().subtract(dt);Q.x+=Ht.x<0?-vr.x:vr.x,Q.y+=Ht.y<0?-vr.y:vr.y,this.panTo(this.unproject(Q),y),this._enforcingBounds=!1}return this},invalidateSize:function(d){if(!this._loaded)return this;d=c({animate:!1,pan:!0},d===!0?{animate:!0}:d);var y=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var D=this.getSize(),F=y.divideBy(2).round(),Q=D.divideBy(2).round(),ce=F.subtract(Q);return!ce.x&&!ce.y?this:(d.animate&&d.pan?this.panBy(ce):(d.pan&&this._rawPanBy(ce),this.fire("move"),d.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(h(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:y,newSize:D}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(d){if(d=this._locateOptions=c({timeout:1e4,watch:!1},d),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var y=h(this._handleGeolocationResponse,this),D=h(this._handleGeolocationError,this);return d.watch?this._locationWatchId=navigator.geolocation.watchPosition(y,D,d):navigator.geolocation.getCurrentPosition(y,D,d),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(d){if(this._container._leaflet_id){var y=d.code,D=d.message||(y===1?"permission denied":y===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:y,message:"Geolocation error: "+D+"."})}},_handleGeolocationResponse:function(d){if(this._container._leaflet_id){var y=d.coords.latitude,D=d.coords.longitude,F=new ye(y,D),Q=F.toBounds(d.coords.accuracy*2),ce=this._locateOptions;if(ce.setView){var Ae=this.getBoundsZoom(Q);this.setView(F,ce.maxZoom?Math.min(Ae,ce.maxZoom):Ae)}var Qe={latlng:F,bounds:Q,timestamp:d.timestamp};for(var dt in d.coords)typeof d.coords[dt]=="number"&&(Qe[dt]=d.coords[dt]);this.fire("locationfound",Qe)}},addHandler:function(d,y){if(!y)return this;var D=this[d]=new y(this);return this._handlers.push(D),this.options[d]&&D.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),Wt(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(ee(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var d;for(d in this._layers)this._layers[d].remove();for(d in this._panes)Wt(this._panes[d]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(d,y){var D="leaflet-pane"+(d?" leaflet-"+d.replace("Pane","")+"-pane":""),F=nr("div",D,y||this._mapPane);return d&&(this._panes[d]=F),F},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var d=this.getPixelBounds(),y=this.unproject(d.getBottomLeft()),D=this.unproject(d.getTopRight());return new pe(y,D)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(d,y,D){d=ie(d),D=ve(D||[0,0]);var F=this.getZoom()||0,Q=this.getMinZoom(),ce=this.getMaxZoom(),Ae=d.getNorthWest(),Qe=d.getSouthEast(),dt=this.getSize().subtract(D),Ht=Ce(this.project(Qe,F),this.project(Ae,F)).getSize(),vr=rr.any3d?this.options.zoomSnap:1,na=dt.x/Ht.x,an=dt.y/Ht.y,qs=y?Math.max(na,an):Math.min(na,an);return F=this.getScaleZoom(qs,F),vr&&(F=Math.round(F/(vr/100))*(vr/100),F=y?Math.ceil(F/vr)*vr:Math.floor(F/vr)*vr),Math.max(Q,Math.min(ce,F))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new ne(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(d,y){var D=this._getTopLeftPoint(d,y);return new Le(D,D.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(d){return this.options.crs.getProjectedBounds(d===void 0?this.getZoom():d)},getPane:function(d){return typeof d=="string"?this._panes[d]:d},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(d,y){var D=this.options.crs;return y=y===void 0?this._zoom:y,D.scale(d)/D.scale(y)},getScaleZoom:function(d,y){var D=this.options.crs;y=y===void 0?this._zoom:y;var F=D.zoom(d*D.scale(y));return isNaN(F)?1/0:F},project:function(d,y){return y=y===void 0?this._zoom:y,this.options.crs.latLngToPoint(Ne(d),y)},unproject:function(d,y){return y=y===void 0?this._zoom:y,this.options.crs.pointToLatLng(ve(d),y)},layerPointToLatLng:function(d){var y=ve(d).add(this.getPixelOrigin());return this.unproject(y)},latLngToLayerPoint:function(d){var y=this.project(Ne(d))._round();return y._subtract(this.getPixelOrigin())},wrapLatLng:function(d){return this.options.crs.wrapLatLng(Ne(d))},wrapLatLngBounds:function(d){return this.options.crs.wrapLatLngBounds(ie(d))},distance:function(d,y){return this.options.crs.distance(Ne(d),Ne(y))},containerPointToLayerPoint:function(d){return ve(d).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(d){return ve(d).add(this._getMapPanePos())},containerPointToLatLng:function(d){var y=this.containerPointToLayerPoint(ve(d));return this.layerPointToLatLng(y)},latLngToContainerPoint:function(d){return this.layerPointToContainerPoint(this.latLngToLayerPoint(Ne(d)))},mouseEventToContainerPoint:function(d){return Ue(d,this._container)},mouseEventToLayerPoint:function(d){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(d))},mouseEventToLatLng:function(d){return this.layerPointToLatLng(this.mouseEventToLayerPoint(d))},_initContainer:function(d){var y=this._container=lr(d);if(y){if(y._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");nt(y,"scroll",this._onScroll,this),this._containerId=b(y)},_initLayout:function(){var d=this._container;this._fadeAnimated=this.options.fadeAnimation&&rr.any3d,Rt(d,"leaflet-container"+(rr.touch?" leaflet-touch":"")+(rr.retina?" leaflet-retina":"")+(rr.ielt9?" leaflet-oldie":"")+(rr.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var y=Pr(d,"position");y!=="absolute"&&y!=="relative"&&y!=="fixed"&&y!=="sticky"&&(d.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var d=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),xa(this._mapPane,new ne(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Rt(d.markerPane,"leaflet-zoom-hide"),Rt(d.shadowPane,"leaflet-zoom-hide"))},_resetView:function(d,y,D){xa(this._mapPane,new ne(0,0));var F=!this._loaded;this._loaded=!0,y=this._limitZoom(y),this.fire("viewprereset");var Q=this._zoom!==y;this._moveStart(Q,D)._move(d,y)._moveEnd(Q),this.fire("viewreset"),F&&this.fire("load")},_moveStart:function(d,y){return d&&this.fire("zoomstart"),y||this.fire("movestart"),this},_move:function(d,y,D,F){y===void 0&&(y=this._zoom);var Q=this._zoom!==y;return this._zoom=y,this._lastCenter=d,this._pixelOrigin=this._getNewPixelOrigin(d),F?D&&D.pinch&&this.fire("zoom",D):((Q||D&&D.pinch)&&this.fire("zoom",D),this.fire("move",D)),this},_moveEnd:function(d){return d&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return ee(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(d){xa(this._mapPane,this._getMapPanePos().subtract(d))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(d){this._targets={},this._targets[b(this._container)]=this;var y=d?at:nt;y(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&y(window,"resize",this._onResize,this),rr.any3d&&this.options.transform3DLimit&&(d?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){ee(this._resizeRequest),this._resizeRequest=J(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var d=this._getMapPanePos();Math.max(Math.abs(d.x),Math.abs(d.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(d,y){for(var D=[],F,Q=y==="mouseout"||y==="mouseover",ce=d.target||d.srcElement,Ae=!1;ce;){if(F=this._targets[b(ce)],F&&(y==="click"||y==="preclick")&&this._draggableMoved(F)){Ae=!0;break}if(F&&F.listens(y,!0)&&(Q&&!xr(ce,d)||(D.push(F),Q))||ce===this._container)break;ce=ce.parentNode}return!D.length&&!Ae&&!Q&&this.listens(y,!0)&&(D=[this]),D},_isClickDisabled:function(d){for(;d&&d!==this._container;){if(d._leaflet_disable_click)return!0;d=d.parentNode}},_handleDOMEvent:function(d){var y=d.target||d.srcElement;if(!(!this._loaded||y._leaflet_disable_events||d.type==="click"&&this._isClickDisabled(y))){var D=d.type;D==="mousedown"&&Za(y),this._fireDOMEvent(d,D)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(d,y,D){if(d.type==="click"){var F=c({},d);F.type="preclick",this._fireDOMEvent(F,F.type,D)}var Q=this._findEventTargets(d,y);if(D){for(var ce=[],Ae=0;Ae<D.length;Ae++)D[Ae].listens(y,!0)&&ce.push(D[Ae]);Q=ce.concat(Q)}if(Q.length){y==="contextmenu"&&va(d);var Qe=Q[0],dt={originalEvent:d};if(d.type!=="keypress"&&d.type!=="keydown"&&d.type!=="keyup"){var Ht=Qe.getLatLng&&(!Qe._radius||Qe._radius<=10);dt.containerPoint=Ht?this.latLngToContainerPoint(Qe.getLatLng()):this.mouseEventToContainerPoint(d),dt.layerPoint=this.containerPointToLayerPoint(dt.containerPoint),dt.latlng=Ht?Qe.getLatLng():this.layerPointToLatLng(dt.layerPoint)}for(Ae=0;Ae<Q.length;Ae++)if(Q[Ae].fire(y,dt,!0),dt.originalEvent._stopped||Q[Ae].options.bubblingMouseEvents===!1&&U(this._mouseEvents,y)!==-1)return}},_draggableMoved:function(d){return d=d.dragging&&d.dragging.enabled()?d:this,d.dragging&&d.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var d=0,y=this._handlers.length;d<y;d++)this._handlers[d].disable()},whenReady:function(d,y){return this._loaded?d.call(y||this,{target:this}):this.on("load",d,y),this},_getMapPanePos:function(){return ia(this._mapPane)||new ne(0,0)},_moved:function(){var d=this._getMapPanePos();return d&&!d.equals([0,0])},_getTopLeftPoint:function(d,y){var D=d&&y!==void 0?this._getNewPixelOrigin(d,y):this.getPixelOrigin();return D.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(d,y){var D=this.getSize()._divideBy(2);return this.project(d,y)._subtract(D)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(d,y,D){var F=this._getNewPixelOrigin(D,y);return this.project(d,y)._subtract(F)},_latLngBoundsToNewLayerBounds:function(d,y,D){var F=this._getNewPixelOrigin(D,y);return Ce([this.project(d.getSouthWest(),y)._subtract(F),this.project(d.getNorthWest(),y)._subtract(F),this.project(d.getSouthEast(),y)._subtract(F),this.project(d.getNorthEast(),y)._subtract(F)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(d){return this.latLngToLayerPoint(d).subtract(this._getCenterLayerPoint())},_limitCenter:function(d,y,D){if(!D)return d;var F=this.project(d,y),Q=this.getSize().divideBy(2),ce=new Le(F.subtract(Q),F.add(Q)),Ae=this._getBoundsOffset(ce,D,y);return Math.abs(Ae.x)<=1&&Math.abs(Ae.y)<=1?d:this.unproject(F.add(Ae),y)},_limitOffset:function(d,y){if(!y)return d;var D=this.getPixelBounds(),F=new Le(D.min.add(d),D.max.add(d));return d.add(this._getBoundsOffset(F,y))},_getBoundsOffset:function(d,y,D){var F=Ce(this.project(y.getNorthEast(),D),this.project(y.getSouthWest(),D)),Q=F.min.subtract(d.min),ce=F.max.subtract(d.max),Ae=this._rebound(Q.x,-ce.x),Qe=this._rebound(Q.y,-ce.y);return new ne(Ae,Qe)},_rebound:function(d,y){return d+y>0?Math.round(d-y)/2:Math.max(0,Math.ceil(d))-Math.max(0,Math.floor(y))},_limitZoom:function(d){var y=this.getMinZoom(),D=this.getMaxZoom(),F=rr.any3d?this.options.zoomSnap:1;return F&&(d=Math.round(d/F)*F),Math.max(y,Math.min(D,d))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Yr(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(d,y){var D=this._getCenterOffset(d)._trunc();return(y&&y.animate)!==!0&&!this.getSize().contains(D)?!1:(this.panBy(D,y),!0)},_createAnimProxy:function(){var d=this._proxy=nr("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(d),this.on("zoomanim",function(y){var D=At,F=this._proxy.style[D];$a(this._proxy,this.project(y.center,y.zoom),this.getZoomScale(y.zoom,1)),F===this._proxy.style[D]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){Wt(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var d=this.getCenter(),y=this.getZoom();$a(this._proxy,this.project(d,y),this.getZoomScale(y,1))},_catchTransitionEnd:function(d){this._animatingZoom&&d.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(d,y,D){if(this._animatingZoom)return!0;if(D=D||{},!this._zoomAnimated||D.animate===!1||this._nothingToAnimate()||Math.abs(y-this._zoom)>this.options.zoomAnimationThreshold)return!1;var F=this.getZoomScale(y),Q=this._getCenterOffset(d)._divideBy(1-1/F);return D.animate!==!0&&!this.getSize().contains(Q)?!1:(J(function(){this._moveStart(!0,D.noMoveStart||!1)._animateZoom(d,y,!0)},this),!0)},_animateZoom:function(d,y,D,F){this._mapPane&&(D&&(this._animatingZoom=!0,this._animateToCenter=d,this._animateToZoom=y,Rt(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:d,zoom:y,noUpdate:F}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(h(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&Yr(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function ja(d,y){return new kr(d,y)}var Na=fe.extend({options:{position:"topright"},initialize:function(d){R(this,d)},getPosition:function(){return this.options.position},setPosition:function(d){var y=this._map;return y&&y.removeControl(this),this.options.position=d,y&&y.addControl(this),this},getContainer:function(){return this._container},addTo:function(d){this.remove(),this._map=d;var y=this._container=this.onAdd(d),D=this.getPosition(),F=d._controlCorners[D];return Rt(y,"leaflet-control"),D.indexOf("bottom")!==-1?F.insertBefore(y,F.firstChild):F.appendChild(y),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(Wt(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(d){this._map&&d&&d.screenX>0&&d.screenY>0&&this._map.getContainer().focus()}}),on=function(d){return new Na(d)};kr.include({addControl:function(d){return d.addTo(this),this},removeControl:function(d){return d.remove(),this},_initControlPos:function(){var d=this._controlCorners={},y="leaflet-",D=this._controlContainer=nr("div",y+"control-container",this._container);function F(Q,ce){var Ae=y+Q+" "+y+ce;d[Q+ce]=nr("div",Ae,D)}F("top","left"),F("top","right"),F("bottom","left"),F("bottom","right")},_clearControlPos:function(){for(var d in this._controlCorners)Wt(this._controlCorners[d]);Wt(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var or=Na.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(d,y,D,F){return D<F?-1:F<D?1:0}},initialize:function(d,y,D){R(this,D),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var F in d)this._addLayer(d[F],F);for(F in y)this._addLayer(y[F],F,!0)},onAdd:function(d){this._initLayout(),this._update(),this._map=d,d.on("zoomend",this._checkDisabledLayers,this);for(var y=0;y<this._layers.length;y++)this._layers[y].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(d){return Na.prototype.addTo.call(this,d),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var d=0;d<this._layers.length;d++)this._layers[d].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(d,y){return this._addLayer(d,y),this._map?this._update():this},addOverlay:function(d,y){return this._addLayer(d,y,!0),this._map?this._update():this},removeLayer:function(d){d.off("add remove",this._onLayerChange,this);var y=this._getLayer(b(d));return y&&this._layers.splice(this._layers.indexOf(y),1),this._map?this._update():this},expand:function(){Rt(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var d=this._map.getSize().y-(this._container.offsetTop+50);return d<this._section.clientHeight?(Rt(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=d+"px"):Yr(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return Yr(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var d="leaflet-control-layers",y=this._container=nr("div",d),D=this.options.collapsed;y.setAttribute("aria-haspopup",!0),Aa(y),ba(y);var F=this._section=nr("section",d+"-list");D&&(this._map.on("click",this.collapse,this),nt(y,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var Q=this._layersLink=nr("a",d+"-toggle",y);Q.href="#",Q.title="Layers",Q.setAttribute("role","button"),nt(Q,{keydown:function(ce){ce.keyCode===13&&this._expandSafely()},click:function(ce){va(ce),this._expandSafely()}},this),D||this.expand(),this._baseLayersList=nr("div",d+"-base",F),this._separator=nr("div",d+"-separator",F),this._overlaysList=nr("div",d+"-overlays",F),y.appendChild(F)},_getLayer:function(d){for(var y=0;y<this._layers.length;y++)if(this._layers[y]&&b(this._layers[y].layer)===d)return this._layers[y]},_addLayer:function(d,y,D){this._map&&d.on("add remove",this._onLayerChange,this),this._layers.push({layer:d,name:y,overlay:D}),this.options.sortLayers&&this._layers.sort(h(function(F,Q){return this.options.sortFunction(F.layer,Q.layer,F.name,Q.name)},this)),this.options.autoZIndex&&d.setZIndex&&(this._lastZIndex++,d.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;Or(this._baseLayersList),Or(this._overlaysList),this._layerControlInputs=[];var d,y,D,F,Q=0;for(D=0;D<this._layers.length;D++)F=this._layers[D],this._addItem(F),y=y||F.overlay,d=d||!F.overlay,Q+=F.overlay?0:1;return this.options.hideSingleBase&&(d=d&&Q>1,this._baseLayersList.style.display=d?"":"none"),this._separator.style.display=y&&d?"":"none",this},_onLayerChange:function(d){this._handlingClick||this._update();var y=this._getLayer(b(d.target)),D=y.overlay?d.type==="add"?"overlayadd":"overlayremove":d.type==="add"?"baselayerchange":null;D&&this._map.fire(D,y)},_createRadioElement:function(d,y){var D='<input type="radio" class="leaflet-control-layers-selector" name="'+d+'"'+(y?' checked="checked"':"")+"/>",F=document.createElement("div");return F.innerHTML=D,F.firstChild},_addItem:function(d){var y=document.createElement("label"),D=this._map.hasLayer(d.layer),F;d.overlay?(F=document.createElement("input"),F.type="checkbox",F.className="leaflet-control-layers-selector",F.defaultChecked=D):F=this._createRadioElement("leaflet-base-layers_"+b(this),D),this._layerControlInputs.push(F),F.layerId=b(d.layer),nt(F,"click",this._onInputClick,this);var Q=document.createElement("span");Q.innerHTML=" "+d.name;var ce=document.createElement("span");y.appendChild(ce),ce.appendChild(F),ce.appendChild(Q);var Ae=d.overlay?this._overlaysList:this._baseLayersList;return Ae.appendChild(y),this._checkDisabledLayers(),y},_onInputClick:function(){if(!this._preventClick){var d=this._layerControlInputs,y,D,F=[],Q=[];this._handlingClick=!0;for(var ce=d.length-1;ce>=0;ce--)y=d[ce],D=this._getLayer(y.layerId).layer,y.checked?F.push(D):y.checked||Q.push(D);for(ce=0;ce<Q.length;ce++)this._map.hasLayer(Q[ce])&&this._map.removeLayer(Q[ce]);for(ce=0;ce<F.length;ce++)this._map.hasLayer(F[ce])||this._map.addLayer(F[ce]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var d=this._layerControlInputs,y,D,F=this._map.getZoom(),Q=d.length-1;Q>=0;Q--)y=d[Q],D=this._getLayer(y.layerId).layer,y.disabled=D.options.minZoom!==void 0&&F<D.options.minZoom||D.options.maxZoom!==void 0&&F>D.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var d=this._section;this._preventClick=!0,nt(d,"click",va),this.expand();var y=this;setTimeout(function(){at(d,"click",va),y._preventClick=!1})}}),je=function(d,y,D){return new or(d,y,D)},ut=Na.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">−</span>',zoomOutTitle:"Zoom out"},onAdd:function(d){var y="leaflet-control-zoom",D=nr("div",y+" leaflet-bar"),F=this.options;return this._zoomInButton=this._createButton(F.zoomInText,F.zoomInTitle,y+"-in",D,this._zoomIn),this._zoomOutButton=this._createButton(F.zoomOutText,F.zoomOutTitle,y+"-out",D,this._zoomOut),this._updateDisabled(),d.on("zoomend zoomlevelschange",this._updateDisabled,this),D},onRemove:function(d){d.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(d){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(d.shiftKey?3:1))},_zoomOut:function(d){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(d.shiftKey?3:1))},_createButton:function(d,y,D,F,Q){var ce=nr("a",D,F);return ce.innerHTML=d,ce.href="#",ce.title=y,ce.setAttribute("role","button"),ce.setAttribute("aria-label",y),Aa(ce),nt(ce,"click",Pa),nt(ce,"click",Q,this),nt(ce,"click",this._refocusOnMap,this),ce},_updateDisabled:function(){var d=this._map,y="leaflet-disabled";Yr(this._zoomInButton,y),Yr(this._zoomOutButton,y),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||d._zoom===d.getMinZoom())&&(Rt(this._zoomOutButton,y),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||d._zoom===d.getMaxZoom())&&(Rt(this._zoomInButton,y),this._zoomInButton.setAttribute("aria-disabled","true"))}});kr.mergeOptions({zoomControl:!0}),kr.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new ut,this.addControl(this.zoomControl))});var Qt=function(d){return new ut(d)},ra=Na.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(d){var y="leaflet-control-scale",D=nr("div",y),F=this.options;return this._addScales(F,y+"-line",D),d.on(F.updateWhenIdle?"moveend":"move",this._update,this),d.whenReady(this._update,this),D},onRemove:function(d){d.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(d,y,D){d.metric&&(this._mScale=nr("div",y,D)),d.imperial&&(this._iScale=nr("div",y,D))},_update:function(){var d=this._map,y=d.getSize().y/2,D=d.distance(d.containerPointToLatLng([0,y]),d.containerPointToLatLng([this.options.maxWidth,y]));this._updateScales(D)},_updateScales:function(d){this.options.metric&&d&&this._updateMetric(d),this.options.imperial&&d&&this._updateImperial(d)},_updateMetric:function(d){var y=this._getRoundNum(d),D=y<1e3?y+" m":y/1e3+" km";this._updateScale(this._mScale,D,y/d)},_updateImperial:function(d){var y=d*3.2808399,D,F,Q;y>5280?(D=y/5280,F=this._getRoundNum(D),this._updateScale(this._iScale,F+" mi",F/D)):(Q=this._getRoundNum(y),this._updateScale(this._iScale,Q+" ft",Q/y))},_updateScale:function(d,y,D){d.style.width=Math.round(this.options.maxWidth*D)+"px",d.innerHTML=y},_getRoundNum:function(d){var y=Math.pow(10,(Math.floor(d)+"").length-1),D=d/y;return D=D>=10?10:D>=5?5:D>=3?3:D>=2?2:1,y*D}}),Sa=function(d){return new ra(d)},tn='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg>',Ba=Na.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(rr.inlineSvg?tn+" ":"")+"Leaflet</a>"},initialize:function(d){R(this,d),this._attributions={}},onAdd:function(d){d.attributionControl=this,this._container=nr("div","leaflet-control-attribution"),Aa(this._container);for(var y in d._layers)d._layers[y].getAttribution&&this.addAttribution(d._layers[y].getAttribution());return this._update(),d.on("layeradd",this._addAttribution,this),this._container},onRemove:function(d){d.off("layeradd",this._addAttribution,this)},_addAttribution:function(d){d.layer.getAttribution&&(this.addAttribution(d.layer.getAttribution()),d.layer.once("remove",function(){this.removeAttribution(d.layer.getAttribution())},this))},setPrefix:function(d){return this.options.prefix=d,this._update(),this},addAttribution:function(d){return d?(this._attributions[d]||(this._attributions[d]=0),this._attributions[d]++,this._update(),this):this},removeAttribution:function(d){return d?(this._attributions[d]&&(this._attributions[d]--,this._update()),this):this},_update:function(){if(this._map){var d=[];for(var y in this._attributions)this._attributions[y]&&d.push(y);var D=[];this.options.prefix&&D.push(this.options.prefix),d.length&&D.push(d.join(", ")),this._container.innerHTML=D.join(' <span aria-hidden="true">|</span> ')}}});kr.mergeOptions({attributionControl:!0}),kr.addInitHook(function(){this.options.attributionControl&&new Ba().addTo(this)});var Va=function(d){return new Ba(d)};Na.Layers=or,Na.Zoom=ut,Na.Scale=ra,Na.Attribution=Ba,on.layers=je,on.zoom=Qt,on.scale=Sa,on.attribution=Va;var Wa=fe.extend({initialize:function(d){this._map=d},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Wa.addTo=function(d,y){return d.addHandler(y,this),this};var ln={Events:X},rn=rr.touch?"touchstart mousedown":"mousedown",ps=W.extend({options:{clickTolerance:3},initialize:function(d,y,D,F){R(this,F),this._element=d,this._dragStartTarget=y||d,this._preventOutline=D},enable:function(){this._enabled||(nt(this._dragStartTarget,rn,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(ps._dragging===this&&this.finishDrag(!0),at(this._dragStartTarget,rn,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(d){if(this._enabled&&(this._moved=!1,!ga(this._element,"leaflet-zoom-anim"))){if(d.touches&&d.touches.length!==1){ps._dragging===this&&this.finishDrag();return}if(!(ps._dragging||d.shiftKey||d.which!==1&&d.button!==1&&!d.touches)&&(ps._dragging=this,this._preventOutline&&Za(this._element),ua(),oa(),!this._moving)){this.fire("down");var y=d.touches?d.touches[0]:d,D=ke(this._element);this._startPoint=new ne(y.clientX,y.clientY),this._startPos=ia(this._element),this._parentScale=Mt(D);var F=d.type==="mousedown";nt(document,F?"mousemove":"touchmove",this._onMove,this),nt(document,F?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(d){if(this._enabled){if(d.touches&&d.touches.length>1){this._moved=!0;return}var y=d.touches&&d.touches.length===1?d.touches[0]:d,D=new ne(y.clientX,y.clientY)._subtract(this._startPoint);!D.x&&!D.y||Math.abs(D.x)+Math.abs(D.y)<this.options.clickTolerance||(D.x/=this._parentScale.x,D.y/=this._parentScale.y,va(d),this._moved||(this.fire("dragstart"),this._moved=!0,Rt(document.body,"leaflet-dragging"),this._lastTarget=d.target||d.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),Rt(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(D),this._moving=!0,this._lastEvent=d,this._updatePosition())}},_updatePosition:function(){var d={originalEvent:this._lastEvent};this.fire("predrag",d),xa(this._element,this._newPos),this.fire("drag",d)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(d){Yr(document.body,"leaflet-dragging"),this._lastTarget&&(Yr(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),at(document,"mousemove touchmove",this._onMove,this),at(document,"mouseup touchend touchcancel",this._onUp,this),Xa(),Qa();var y=this._moved&&this._moving;this._moving=!1,ps._dragging=!1,y&&this.fire("dragend",{noInertia:d,distance:this._newPos.distanceTo(this._startPos)})}});function Vs(d,y,D){var F,Q=[1,4,2,8],ce,Ae,Qe,dt,Ht,vr,na,an;for(ce=0,vr=d.length;ce<vr;ce++)d[ce]._code=La(d[ce],y);for(Qe=0;Qe<4;Qe++){for(na=Q[Qe],F=[],ce=0,vr=d.length,Ae=vr-1;ce<vr;Ae=ce++)dt=d[ce],Ht=d[Ae],dt._code&na?Ht._code&na||(an=Ta(Ht,dt,na,y,D),an._code=La(an,y),F.push(an)):(Ht._code&na&&(an=Ta(Ht,dt,na,y,D),an._code=La(an,y),F.push(an)),F.push(dt));d=F}return d}function Ao(d,y){var D,F,Q,ce,Ae,Qe,dt,Ht,vr;if(!d||d.length===0)throw new Error("latlngs not passed");gs(d)||(console.warn("latlngs are not flat! Only the first ring will be used"),d=d[0]);var na=Ne([0,0]),an=ie(d),qs=an.getNorthWest().distanceTo(an.getSouthWest())*an.getNorthEast().distanceTo(an.getNorthWest());qs<1700&&(na=Kn(d));var zs=d.length,_i=[];for(D=0;D<zs;D++){var Hn=Ne(d[D]);_i.push(y.project(Ne([Hn.lat-na.lat,Hn.lng-na.lng])))}for(Qe=dt=Ht=0,D=0,F=zs-1;D<zs;F=D++)Q=_i[D],ce=_i[F],Ae=Q.y*ce.x-ce.y*Q.x,dt+=(Q.x+ce.x)*Ae,Ht+=(Q.y+ce.y)*Ae,Qe+=Ae*3;Qe===0?vr=_i[0]:vr=[dt/Qe,Ht/Qe];var Vn=y.unproject(ve(vr));return Ne([Vn.lat+na.lat,Vn.lng+na.lng])}function Kn(d){for(var y=0,D=0,F=0,Q=0;Q<d.length;Q++){var ce=Ne(d[Q]);y+=ce.lat,D+=ce.lng,F++}return Ne([y/F,D/F])}var js={__proto__:null,clipPolygon:Vs,polygonCenter:Ao,centroid:Kn};function to(d,y){if(!y||!d.length)return d.slice();var D=y*y;return d=Ut(d,D),d=Tn(d,D),d}function Fs(d,y,D){return Math.sqrt(En(d,y,D,!0))}function gl(d,y,D){return En(d,y,D)}function Tn(d,y){var D=d.length,F=typeof Uint8Array<"u"?Uint8Array:Array,Q=new F(D);Q[0]=Q[D-1]=1,Ee(d,Q,y,0,D-1);var ce,Ae=[];for(ce=0;ce<D;ce++)Q[ce]&&Ae.push(d[ce]);return Ae}function Ee(d,y,D,F,Q){var ce=0,Ae,Qe,dt;for(Qe=F+1;Qe<=Q-1;Qe++)dt=En(d[Qe],d[F],d[Q],!0),dt>ce&&(Ae=Qe,ce=dt);ce>D&&(y[Ae]=1,Ee(d,y,D,F,Ae),Ee(d,y,D,Ae,Q))}function Ut(d,y){for(var D=[d[0]],F=1,Q=0,ce=d.length;F<ce;F++)Ns(d[F],d[Q])>y&&(D.push(d[F]),Q=F);return Q<ce-1&&D.push(d[ce-1]),D}var mr;function aa(d,y,D,F,Q){var ce=F?mr:La(d,D),Ae=La(y,D),Qe,dt,Ht;for(mr=Ae;;){if(!(ce|Ae))return[d,y];if(ce&Ae)return!1;Qe=ce||Ae,dt=Ta(d,y,Qe,D,Q),Ht=La(dt,D),Qe===ce?(d=dt,ce=Ht):(y=dt,Ae=Ht)}}function Ta(d,y,D,F,Q){var ce=y.x-d.x,Ae=y.y-d.y,Qe=F.min,dt=F.max,Ht,vr;return D&8?(Ht=d.x+ce*(dt.y-d.y)/Ae,vr=dt.y):D&4?(Ht=d.x+ce*(Qe.y-d.y)/Ae,vr=Qe.y):D&2?(Ht=dt.x,vr=d.y+Ae*(dt.x-d.x)/ce):D&1&&(Ht=Qe.x,vr=d.y+Ae*(Qe.x-d.x)/ce),new ne(Ht,vr,Q)}function La(d,y){var D=0;return d.x<y.min.x?D|=1:d.x>y.max.x&&(D|=2),d.y<y.min.y?D|=4:d.y>y.max.y&&(D|=8),D}function Ns(d,y){var D=y.x-d.x,F=y.y-d.y;return D*D+F*F}function En(d,y,D,F){var Q=y.x,ce=y.y,Ae=D.x-Q,Qe=D.y-ce,dt=Ae*Ae+Qe*Qe,Ht;return dt>0&&(Ht=((d.x-Q)*Ae+(d.y-ce)*Qe)/dt,Ht>1?(Q=D.x,ce=D.y):Ht>0&&(Q+=Ae*Ht,ce+=Qe*Ht)),Ae=d.x-Q,Qe=d.y-ce,F?Ae*Ae+Qe*Qe:new ne(Q,ce)}function gs(d){return!V(d[0])||typeof d[0][0]!="object"&&typeof d[0][0]<"u"}function ss(d){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),gs(d)}function zi(d,y){var D,F,Q,ce,Ae,Qe,dt,Ht;if(!d||d.length===0)throw new Error("latlngs not passed");gs(d)||(console.warn("latlngs are not flat! Only the first ring will be used"),d=d[0]);var vr=Ne([0,0]),na=ie(d),an=na.getNorthWest().distanceTo(na.getSouthWest())*na.getNorthEast().distanceTo(na.getNorthWest());an<1700&&(vr=Kn(d));var qs=d.length,zs=[];for(D=0;D<qs;D++){var _i=Ne(d[D]);zs.push(y.project(Ne([_i.lat-vr.lat,_i.lng-vr.lng])))}for(D=0,F=0;D<qs-1;D++)F+=zs[D].distanceTo(zs[D+1])/2;if(F===0)Ht=zs[0];else for(D=0,ce=0;D<qs-1;D++)if(Ae=zs[D],Qe=zs[D+1],Q=Ae.distanceTo(Qe),ce+=Q,ce>F){dt=(ce-F)/Q,Ht=[Qe.x-dt*(Qe.x-Ae.x),Qe.y-dt*(Qe.y-Ae.y)];break}var Hn=y.unproject(ve(Ht));return Ne([Hn.lat+vr.lat,Hn.lng+vr.lng])}var Xn={__proto__:null,simplify:to,pointToSegmentDistance:Fs,closestPointOnSegment:gl,clipSegment:aa,_getEdgeIntersection:Ta,_getBitCode:La,_sqClosestPointOnSegment:En,isFlat:gs,_flat:ss,polylineCenter:zi},xl={project:function(d){return new ne(d.lng,d.lat)},unproject:function(d){return new ye(d.y,d.x)},bounds:new Le([-180,-90],[180,90])},Gi={R:6378137,R_MINOR:6356752314245179e-9,bounds:new Le([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(d){var y=Math.PI/180,D=this.R,F=d.lat*y,Q=this.R_MINOR/D,ce=Math.sqrt(1-Q*Q),Ae=ce*Math.sin(F),Qe=Math.tan(Math.PI/4-F/2)/Math.pow((1-Ae)/(1+Ae),ce/2);return F=-D*Math.log(Math.max(Qe,1e-10)),new ne(d.lng*y*D,F)},unproject:function(d){for(var y=180/Math.PI,D=this.R,F=this.R_MINOR/D,Q=Math.sqrt(1-F*F),ce=Math.exp(-d.y/D),Ae=Math.PI/2-2*Math.atan(ce),Qe=0,dt=.1,Ht;Qe<15&&Math.abs(dt)>1e-7;Qe++)Ht=Q*Math.sin(Ae),Ht=Math.pow((1-Ht)/(1+Ht),Q/2),dt=Math.PI/2-2*Math.atan(ce*Ht)-Ae,Ae+=dt;return new ye(Ae*y,d.x*y/D)}},ro={__proto__:null,LonLat:xl,Mercator:Gi,SphericalMercator:Oe},To=c({},me,{code:"EPSG:3395",projection:Gi,transformation:(function(){var d=.5/(Math.PI*Gi.R);return Pe(d,.5,-d,.5)})()}),ql=c({},me,{code:"EPSG:4326",projection:xl,transformation:Pe(1/180,1,-1/180,.5)}),Co=c({},Ge,{projection:xl,transformation:Pe(1,0,-1,0),scale:function(d){return Math.pow(2,d)},zoom:function(d){return Math.log(d)/Math.LN2},distance:function(d,y){var D=y.lng-d.lng,F=y.lat-d.lat;return Math.sqrt(D*D+F*F)},infinite:!0});Ge.Earth=me,Ge.EPSG3395=To,Ge.EPSG3857=xe,Ge.EPSG900913=We,Ge.EPSG4326=ql,Ge.Simple=Co;var bi=W.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(d){return d.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(d){return d&&d.removeLayer(this),this},getPane:function(d){return this._map.getPane(d?this.options[d]||d:this.options.pane)},addInteractiveTarget:function(d){return this._map._targets[b(d)]=this,this},removeInteractiveTarget:function(d){return delete this._map._targets[b(d)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(d){var y=d.target;if(y.hasLayer(this)){if(this._map=y,this._zoomAnimated=y._zoomAnimated,this.getEvents){var D=this.getEvents();y.on(D,this),this.once("remove",function(){y.off(D,this)},this)}this.onAdd(y),this.fire("add"),y.fire("layeradd",{layer:this})}}});kr.include({addLayer:function(d){if(!d._layerAdd)throw new Error("The provided object is not a Layer.");var y=b(d);return this._layers[y]?this:(this._layers[y]=d,d._mapToAdd=this,d.beforeAdd&&d.beforeAdd(this),this.whenReady(d._layerAdd,d),this)},removeLayer:function(d){var y=b(d);return this._layers[y]?(this._loaded&&d.onRemove(this),delete this._layers[y],this._loaded&&(this.fire("layerremove",{layer:d}),d.fire("remove")),d._map=d._mapToAdd=null,this):this},hasLayer:function(d){return b(d)in this._layers},eachLayer:function(d,y){for(var D in this._layers)d.call(y,this._layers[D]);return this},_addLayers:function(d){d=d?V(d)?d:[d]:[];for(var y=0,D=d.length;y<D;y++)this.addLayer(d[y])},_addZoomLimit:function(d){(!isNaN(d.options.maxZoom)||!isNaN(d.options.minZoom))&&(this._zoomBoundLayers[b(d)]=d,this._updateZoomLevels())},_removeZoomLimit:function(d){var y=b(d);this._zoomBoundLayers[y]&&(delete this._zoomBoundLayers[y],this._updateZoomLevels())},_updateZoomLevels:function(){var d=1/0,y=-1/0,D=this._getZoomSpan();for(var F in this._zoomBoundLayers){var Q=this._zoomBoundLayers[F].options;d=Q.minZoom===void 0?d:Math.min(d,Q.minZoom),y=Q.maxZoom===void 0?y:Math.max(y,Q.maxZoom)}this._layersMaxZoom=y===-1/0?void 0:y,this._layersMinZoom=d===1/0?void 0:d,D!==this._getZoomSpan()&&this.fire("zoomlevelschange"),this.options.maxZoom===void 0&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var el=bi.extend({initialize:function(d,y){R(this,y),this._layers={};var D,F;if(d)for(D=0,F=d.length;D<F;D++)this.addLayer(d[D])},addLayer:function(d){var y=this.getLayerId(d);return this._layers[y]=d,this._map&&this._map.addLayer(d),this},removeLayer:function(d){var y=d in this._layers?d:this.getLayerId(d);return this._map&&this._layers[y]&&this._map.removeLayer(this._layers[y]),delete this._layers[y],this},hasLayer:function(d){var y=typeof d=="number"?d:this.getLayerId(d);return y in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(d){var y=Array.prototype.slice.call(arguments,1),D,F;for(D in this._layers)F=this._layers[D],F[d]&&F[d].apply(F,y);return this},onAdd:function(d){this.eachLayer(d.addLayer,d)},onRemove:function(d){this.eachLayer(d.removeLayer,d)},eachLayer:function(d,y){for(var D in this._layers)d.call(y,this._layers[D]);return this},getLayer:function(d){return this._layers[d]},getLayers:function(){var d=[];return this.eachLayer(d.push,d),d},setZIndex:function(d){return this.invoke("setZIndex",d)},getLayerId:function(d){return b(d)}}),Ou=function(d,y){return new el(d,y)},Ss=el.extend({addLayer:function(d){return this.hasLayer(d)?this:(d.addEventParent(this),el.prototype.addLayer.call(this,d),this.fire("layeradd",{layer:d}))},removeLayer:function(d){return this.hasLayer(d)?(d in this._layers&&(d=this._layers[d]),d.removeEventParent(this),el.prototype.removeLayer.call(this,d),this.fire("layerremove",{layer:d})):this},setStyle:function(d){return this.invoke("setStyle",d)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var d=new pe;for(var y in this._layers){var D=this._layers[y];d.extend(D.getBounds?D.getBounds():D.getLatLng())}return d}}),Ru=function(d,y){return new Ss(d,y)},Un=fe.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(d){R(this,d)},createIcon:function(d){return this._createIcon("icon",d)},createShadow:function(d){return this._createIcon("shadow",d)},_createIcon:function(d,y){var D=this._getIconUrl(d);if(!D){if(d==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var F=this._createImg(D,y&&y.tagName==="IMG"?y:null);return this._setIconStyles(F,d),(this.options.crossOrigin||this.options.crossOrigin==="")&&(F.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),F},_setIconStyles:function(d,y){var D=this.options,F=D[y+"Size"];typeof F=="number"&&(F=[F,F]);var Q=ve(F),ce=ve(y==="shadow"&&D.shadowAnchor||D.iconAnchor||Q&&Q.divideBy(2,!0));d.className="leaflet-marker-"+y+" "+(D.className||""),ce&&(d.style.marginLeft=-ce.x+"px",d.style.marginTop=-ce.y+"px"),Q&&(d.style.width=Q.x+"px",d.style.height=Q.y+"px")},_createImg:function(d,y){return y=y||document.createElement("img"),y.src=d,y},_getIconUrl:function(d){return rr.retina&&this.options[d+"RetinaUrl"]||this.options[d+"Url"]}});function we(d){return new Un(d)}var tt=Un.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(d){return typeof tt.imagePath!="string"&&(tt.imagePath=this._detectIconPath()),(this.options.imagePath||tt.imagePath)+Un.prototype._getIconUrl.call(this,d)},_stripUrl:function(d){var y=function(D,F,Q){var ce=F.exec(D);return ce&&ce[Q]};return d=y(d,/^url\((['"])?(.+)\1\)$/,2),d&&y(d,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var d=nr("div","leaflet-default-icon-path",document.body),y=Pr(d,"background-image")||Pr(d,"backgroundImage");if(document.body.removeChild(d),y=this._stripUrl(y),y)return y;var D=document.querySelector('link[href$="leaflet.css"]');return D?D.href.substring(0,D.href.length-11-1):""}}),Jt=Wa.extend({initialize:function(d){this._marker=d},addHooks:function(){var d=this._marker._icon;this._draggable||(this._draggable=new ps(d,d,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),Rt(d,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&Yr(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(d){var y=this._marker,D=y._map,F=this._marker.options.autoPanSpeed,Q=this._marker.options.autoPanPadding,ce=ia(y._icon),Ae=D.getPixelBounds(),Qe=D.getPixelOrigin(),dt=Ce(Ae.min._subtract(Qe).add(Q),Ae.max._subtract(Qe).subtract(Q));if(!dt.contains(ce)){var Ht=ve((Math.max(dt.max.x,ce.x)-dt.max.x)/(Ae.max.x-dt.max.x)-(Math.min(dt.min.x,ce.x)-dt.min.x)/(Ae.min.x-dt.min.x),(Math.max(dt.max.y,ce.y)-dt.max.y)/(Ae.max.y-dt.max.y)-(Math.min(dt.min.y,ce.y)-dt.min.y)/(Ae.min.y-dt.min.y)).multiplyBy(F);D.panBy(Ht,{animate:!1}),this._draggable._newPos._add(Ht),this._draggable._startPos._add(Ht),xa(y._icon,this._draggable._newPos),this._onDrag(d),this._panRequest=J(this._adjustPan.bind(this,d))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(d){this._marker.options.autoPan&&(ee(this._panRequest),this._panRequest=J(this._adjustPan.bind(this,d)))},_onDrag:function(d){var y=this._marker,D=y._shadow,F=ia(y._icon),Q=y._map.layerPointToLatLng(F);D&&xa(D,F),y._latlng=Q,d.latlng=Q,d.oldLatLng=this._oldLatLng,y.fire("move",d).fire("drag",d)},_onDragEnd:function(d){ee(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",d)}}),br=bi.extend({options:{icon:new tt,interactive:!0,keyboard:!0,title:"",alt:"Marker",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(d,y){R(this,y),this._latlng=Ne(d)},onAdd:function(d){this._zoomAnimated=this._zoomAnimated&&d.options.markerZoomAnimation,this._zoomAnimated&&d.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(d){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&d.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(d){var y=this._latlng;return this._latlng=Ne(d),this.update(),this.fire("move",{oldLatLng:y,latlng:this._latlng})},setZIndexOffset:function(d){return this.options.zIndexOffset=d,this.update()},getIcon:function(){return this.options.icon},setIcon:function(d){return this.options.icon=d,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var d=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(d)}return this},_initIcon:function(){var d=this.options,y="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),D=d.icon.createIcon(this._icon),F=!1;D!==this._icon&&(this._icon&&this._removeIcon(),F=!0,d.title&&(D.title=d.title),D.tagName==="IMG"&&(D.alt=d.alt||"")),Rt(D,y),d.keyboard&&(D.tabIndex="0",D.setAttribute("role","button")),this._icon=D,d.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&nt(D,"focus",this._panOnFocus,this);var Q=d.icon.createShadow(this._shadow),ce=!1;Q!==this._shadow&&(this._removeShadow(),ce=!0),Q&&(Rt(Q,y),Q.alt=""),this._shadow=Q,d.opacity<1&&this._updateOpacity(),F&&this.getPane().appendChild(this._icon),this._initInteraction(),Q&&ce&&this.getPane(d.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&at(this._icon,"focus",this._panOnFocus,this),Wt(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&Wt(this._shadow),this._shadow=null},_setPos:function(d){this._icon&&xa(this._icon,d),this._shadow&&xa(this._shadow,d),this._zIndex=d.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(d){this._icon&&(this._icon.style.zIndex=this._zIndex+d)},_animateZoom:function(d){var y=this._map._latLngToNewLayerPoint(this._latlng,d.zoom,d.center).round();this._setPos(y)},_initInteraction:function(){if(this.options.interactive&&(Rt(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Jt)){var d=this.options.draggable;this.dragging&&(d=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Jt(this),d&&this.dragging.enable()}},setOpacity:function(d){return this.options.opacity=d,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var d=this.options.opacity;this._icon&&ea(this._icon,d),this._shadow&&ea(this._shadow,d)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var d=this._map;if(d){var y=this.options.icon.options,D=y.iconSize?ve(y.iconSize):ve(0,0),F=y.iconAnchor?ve(y.iconAnchor):ve(0,0);d.panInside(this._latlng,{paddingTopLeft:F,paddingBottomRight:D.subtract(F)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function Er(d,y){return new br(d,y)}var Sr=bi.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(d){this._renderer=d.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(d){return R(this,d),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&d&&Object.prototype.hasOwnProperty.call(d,"weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),Xr=Sr.extend({options:{fill:!0,radius:10},initialize:function(d,y){R(this,y),this._latlng=Ne(d),this._radius=this.options.radius},setLatLng:function(d){var y=this._latlng;return this._latlng=Ne(d),this.redraw(),this.fire("move",{oldLatLng:y,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(d){return this.options.radius=this._radius=d,this.redraw()},getRadius:function(){return this._radius},setStyle:function(d){var y=d&&d.radius||this._radius;return Sr.prototype.setStyle.call(this,d),this.setRadius(y),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var d=this._radius,y=this._radiusY||d,D=this._clickTolerance(),F=[d+D,y+D];this._pxBounds=new Le(this._point.subtract(F),this._point.add(F))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(d){return d.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function Cn(d,y){return new Xr(d,y)}var Nn=Xr.extend({initialize:function(d,y,D){if(typeof y=="number"&&(y=c({},D,{radius:y})),R(this,y),this._latlng=Ne(d),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(d){return this._mRadius=d,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var d=[this._radius,this._radiusY||this._radius];return new pe(this._map.layerPointToLatLng(this._point.subtract(d)),this._map.layerPointToLatLng(this._point.add(d)))},setStyle:Sr.prototype.setStyle,_project:function(){var d=this._latlng.lng,y=this._latlng.lat,D=this._map,F=D.options.crs;if(F.distance===me.distance){var Q=Math.PI/180,ce=this._mRadius/me.R/Q,Ae=D.project([y+ce,d]),Qe=D.project([y-ce,d]),dt=Ae.add(Qe).divideBy(2),Ht=D.unproject(dt).lat,vr=Math.acos((Math.cos(ce*Q)-Math.sin(y*Q)*Math.sin(Ht*Q))/(Math.cos(y*Q)*Math.cos(Ht*Q)))/Q;(isNaN(vr)||vr===0)&&(vr=ce/Math.cos(Math.PI/180*y)),this._point=dt.subtract(D.getPixelOrigin()),this._radius=isNaN(vr)?0:dt.x-D.project([Ht,d-vr]).x,this._radiusY=dt.y-Ae.y}else{var na=F.unproject(F.project(this._latlng).subtract([this._mRadius,0]));this._point=D.latLngToLayerPoint(this._latlng),this._radius=this._point.x-D.latLngToLayerPoint(na).x}this._updateBounds()}});function Dn(d,y,D){return new Nn(d,y,D)}var $i=Sr.extend({options:{smoothFactor:1,noClip:!1},initialize:function(d,y){R(this,y),this._setLatLngs(d)},getLatLngs:function(){return this._latlngs},setLatLngs:function(d){return this._setLatLngs(d),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(d){for(var y=1/0,D=null,F=En,Q,ce,Ae=0,Qe=this._parts.length;Ae<Qe;Ae++)for(var dt=this._parts[Ae],Ht=1,vr=dt.length;Ht<vr;Ht++){Q=dt[Ht-1],ce=dt[Ht];var na=F(d,Q,ce,!0);na<y&&(y=na,D=F(d,Q,ce))}return D&&(D.distance=Math.sqrt(y)),D},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return zi(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(d,y){return y=y||this._defaultShape(),d=Ne(d),y.push(d),this._bounds.extend(d),this.redraw()},_setLatLngs:function(d){this._bounds=new pe,this._latlngs=this._convertLatLngs(d)},_defaultShape:function(){return gs(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(d){for(var y=[],D=gs(d),F=0,Q=d.length;F<Q;F++)D?(y[F]=Ne(d[F]),this._bounds.extend(y[F])):y[F]=this._convertLatLngs(d[F]);return y},_project:function(){var d=new Le;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,d),this._bounds.isValid()&&d.isValid()&&(this._rawPxBounds=d,this._updateBounds())},_updateBounds:function(){var d=this._clickTolerance(),y=new ne(d,d);this._rawPxBounds&&(this._pxBounds=new Le([this._rawPxBounds.min.subtract(y),this._rawPxBounds.max.add(y)]))},_projectLatlngs:function(d,y,D){var F=d[0]instanceof ye,Q=d.length,ce,Ae;if(F){for(Ae=[],ce=0;ce<Q;ce++)Ae[ce]=this._map.latLngToLayerPoint(d[ce]),D.extend(Ae[ce]);y.push(Ae)}else for(ce=0;ce<Q;ce++)this._projectLatlngs(d[ce],y,D)},_clipPoints:function(){var d=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(d))){if(this.options.noClip){this._parts=this._rings;return}var y=this._parts,D,F,Q,ce,Ae,Qe,dt;for(D=0,Q=0,ce=this._rings.length;D<ce;D++)for(dt=this._rings[D],F=0,Ae=dt.length;F<Ae-1;F++)Qe=aa(dt[F],dt[F+1],d,F,!0),Qe&&(y[Q]=y[Q]||[],y[Q].push(Qe[0]),(Qe[1]!==dt[F+1]||F===Ae-2)&&(y[Q].push(Qe[1]),Q++))}},_simplifyPoints:function(){for(var d=this._parts,y=this.options.smoothFactor,D=0,F=d.length;D<F;D++)d[D]=to(d[D],y)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(d,y){var D,F,Q,ce,Ae,Qe,dt=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(d))return!1;for(D=0,ce=this._parts.length;D<ce;D++)for(Qe=this._parts[D],F=0,Ae=Qe.length,Q=Ae-1;F<Ae;Q=F++)if(!(!y&&F===0)&&Fs(d,Qe[Q],Qe[F])<=dt)return!0;return!1}});function Gl(d,y){return new $i(d,y)}$i._flat=ss;var Pi=$i.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Ao(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(d){var y=$i.prototype._convertLatLngs.call(this,d),D=y.length;return D>=2&&y[0]instanceof ye&&y[0].equals(y[D-1])&&y.pop(),y},_setLatLngs:function(d){$i.prototype._setLatLngs.call(this,d),gs(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return gs(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var d=this._renderer._bounds,y=this.options.weight,D=new ne(y,y);if(d=new Le(d.min.subtract(D),d.max.add(D)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(d))){if(this.options.noClip){this._parts=this._rings;return}for(var F=0,Q=this._rings.length,ce;F<Q;F++)ce=Vs(this._rings[F],d,!0),ce.length&&this._parts.push(ce)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(d){var y=!1,D,F,Q,ce,Ae,Qe,dt,Ht;if(!this._pxBounds||!this._pxBounds.contains(d))return!1;for(ce=0,dt=this._parts.length;ce<dt;ce++)for(D=this._parts[ce],Ae=0,Ht=D.length,Qe=Ht-1;Ae<Ht;Qe=Ae++)F=D[Ae],Q=D[Qe],F.y>d.y!=Q.y>d.y&&d.x<(Q.x-F.x)*(d.y-F.y)/(Q.y-F.y)+F.x&&(y=!y);return y||$i.prototype._containsPoint.call(this,d,!0)}});function Rs(d,y){return new Pi(d,y)}var li=Ss.extend({initialize:function(d,y){R(this,y),this._layers={},d&&this.addData(d)},addData:function(d){var y=V(d)?d:d.features,D,F,Q;if(y){for(D=0,F=y.length;D<F;D++)Q=y[D],(Q.geometries||Q.geometry||Q.features||Q.coordinates)&&this.addData(Q);return this}var ce=this.options;if(ce.filter&&!ce.filter(d))return this;var Ae=Ls(d,ce);return Ae?(Ae.feature=ft(d),Ae.defaultOptions=Ae.options,this.resetStyle(Ae),ce.onEachFeature&&ce.onEachFeature(d,Ae),this.addLayer(Ae)):this},resetStyle:function(d){return d===void 0?this.eachLayer(this.resetStyle,this):(d.options=c({},d.defaultOptions),this._setLayerStyle(d,this.options.style),this)},setStyle:function(d){return this.eachLayer(function(y){this._setLayerStyle(y,d)},this)},_setLayerStyle:function(d,y){d.setStyle&&(typeof y=="function"&&(y=y(d.feature)),d.setStyle(y))}});function Ls(d,y){var D=d.type==="Feature"?d.geometry:d,F=D?D.coordinates:null,Q=[],ce=y&&y.pointToLayer,Ae=y&&y.coordsToLatLng||Zl,Qe,dt,Ht,vr;if(!F&&!D)return null;switch(D.type){case"Point":return Qe=Ae(F),vi(ce,d,Qe,y);case"MultiPoint":for(Ht=0,vr=F.length;Ht<vr;Ht++)Qe=Ae(F[Ht]),Q.push(vi(ce,d,Qe,y));return new Ss(Q);case"LineString":case"MultiLineString":return dt=Yl(F,D.type==="LineString"?0:1,Ae),new $i(dt,y);case"Polygon":case"MultiPolygon":return dt=Yl(F,D.type==="Polygon"?1:2,Ae),new Pi(dt,y);case"GeometryCollection":for(Ht=0,vr=D.geometries.length;Ht<vr;Ht++){var na=Ls({geometry:D.geometries[Ht],type:"Feature",properties:d.properties},y);na&&Q.push(na)}return new Ss(Q);case"FeatureCollection":for(Ht=0,vr=D.features.length;Ht<vr;Ht++){var an=Ls(D.features[Ht],y);an&&Q.push(an)}return new Ss(Q);default:throw new Error("Invalid GeoJSON object.")}}function vi(d,y,D,F){return d?d(y,D):new br(D,F&&F.markersInheritOptions&&F)}function Zl(d){return new ye(d[1],d[0],d[2])}function Yl(d,y,D){for(var F=[],Q=0,ce=d.length,Ae;Q<ce;Q++)Ae=y?Yl(d[Q],y-1,D):(D||Zl)(d[Q]),F.push(Ae);return F}function Zi(d,y){return d=Ne(d),d.alt!==void 0?[v(d.lng,y),v(d.lat,y),v(d.alt,y)]:[v(d.lng,y),v(d.lat,y)]}function re(d,y,D,F){for(var Q=[],ce=0,Ae=d.length;ce<Ae;ce++)Q.push(y?re(d[ce],gs(d[ce])?0:y-1,D,F):Zi(d[ce],F));return!y&&D&&Q.length>0&&Q.push(Q[0].slice()),Q}function Fe(d,y){return d.feature?c({},d.feature,{geometry:y}):ft(y)}function ft(d){return d.type==="Feature"||d.type==="FeatureCollection"?d:{type:"Feature",properties:{},geometry:d}}var tr={toGeoJSON:function(d){return Fe(this,{type:"Point",coordinates:Zi(this.getLatLng(),d)})}};br.include(tr),Nn.include(tr),Xr.include(tr),$i.include({toGeoJSON:function(d){var y=!gs(this._latlngs),D=re(this._latlngs,y?1:0,!1,d);return Fe(this,{type:(y?"Multi":"")+"LineString",coordinates:D})}}),Pi.include({toGeoJSON:function(d){var y=!gs(this._latlngs),D=y&&!gs(this._latlngs[0]),F=re(this._latlngs,D?2:y?1:0,!0,d);return y||(F=[F]),Fe(this,{type:(D?"Multi":"")+"Polygon",coordinates:F})}}),el.include({toMultiPoint:function(d){var y=[];return this.eachLayer(function(D){y.push(D.toGeoJSON(d).geometry.coordinates)}),Fe(this,{type:"MultiPoint",coordinates:y})},toGeoJSON:function(d){var y=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(y==="MultiPoint")return this.toMultiPoint(d);var D=y==="GeometryCollection",F=[];return this.eachLayer(function(Q){if(Q.toGeoJSON){var ce=Q.toGeoJSON(d);if(D)F.push(ce.geometry);else{var Ae=ft(ce);Ae.type==="FeatureCollection"?F.push.apply(F,Ae.features):F.push(Ae)}}}),D?Fe(this,{geometries:F,type:"GeometryCollection"}):{type:"FeatureCollection",features:F}}});function _t(d,y){return new li(d,y)}var jr=_t,ha=bi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(d,y,D){this._url=d,this._bounds=ie(y),R(this,D)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Rt(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Wt(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(d){return this.options.opacity=d,this._image&&this._updateOpacity(),this},setStyle:function(d){return d.opacity&&this.setOpacity(d.opacity),this},bringToFront:function(){return this._map&&hr(this._image),this},bringToBack:function(){return this._map&&Rr(this._image),this},setUrl:function(d){return this._url=d,this._image&&(this._image.src=d),this},setBounds:function(d){return this._bounds=ie(d),this._map&&this._reset(),this},getEvents:function(){var d={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(d.zoomanim=this._animateZoom),d},setZIndex:function(d){return this.options.zIndex=d,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var d=this._url.tagName==="IMG",y=this._image=d?this._url:nr("img");if(Rt(y,"leaflet-image-layer"),this._zoomAnimated&&Rt(y,"leaflet-zoom-animated"),this.options.className&&Rt(y,this.options.className),y.onselectstart=_,y.onmousemove=_,y.onload=h(this.fire,this,"load"),y.onerror=h(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(y.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),d){this._url=y.src;return}y.src=this._url,y.alt=this.options.alt},_animateZoom:function(d){var y=this._map.getZoomScale(d.zoom),D=this._map._latLngBoundsToNewLayerBounds(this._bounds,d.zoom,d.center).min;$a(this._image,D,y)},_reset:function(){var d=this._image,y=new Le(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),D=y.getSize();xa(d,y.min),d.style.width=D.x+"px",d.style.height=D.y+"px"},_updateOpacity:function(){ea(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var d=this.options.errorOverlayUrl;d&&this._url!==d&&(this._url=d,this._image.src=d)},getCenter:function(){return this._bounds.getCenter()}}),ns=function(d,y,D){return new ha(d,y,D)},Fa=ha.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var d=this._url.tagName==="VIDEO",y=this._image=d?this._url:nr("video");if(Rt(y,"leaflet-image-layer"),this._zoomAnimated&&Rt(y,"leaflet-zoom-animated"),this.options.className&&Rt(y,this.options.className),y.onselectstart=_,y.onmousemove=_,y.onloadeddata=h(this.fire,this,"load"),d){for(var D=y.getElementsByTagName("source"),F=[],Q=0;Q<D.length;Q++)F.push(D[Q].src);this._url=D.length>0?F:[y.src];return}V(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(y.style,"objectFit")&&(y.style.objectFit="fill"),y.autoplay=!!this.options.autoplay,y.loop=!!this.options.loop,y.muted=!!this.options.muted,y.playsInline=!!this.options.playsInline;for(var ce=0;ce<this._url.length;ce++){var Ae=nr("source");Ae.src=this._url[ce],y.appendChild(Ae)}}});function Mn(d,y,D){return new Fa(d,y,D)}var Ya=ha.extend({_initImage:function(){var d=this._image=this._url;Rt(d,"leaflet-image-layer"),this._zoomAnimated&&Rt(d,"leaflet-zoom-animated"),this.options.className&&Rt(d,this.options.className),d.onselectstart=_,d.onmousemove=_}});function Wn(d,y,D){return new Ya(d,y,D)}var ca=bi.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(d,y){d&&(d instanceof ye||V(d))?(this._latlng=Ne(d),R(this,y)):(R(this,d),this._source=y),this.options.content&&(this._content=this.options.content)},openOn:function(d){return d=arguments.length?d:this._source._map,d.hasLayer(this)||d.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(d){return this._map?this.close():(arguments.length?this._source=d:d=this._source,this._prepareOpen(),this.openOn(d._map)),this},onAdd:function(d){this._zoomAnimated=d._zoomAnimated,this._container||this._initLayout(),d._fadeAnimated&&ea(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),d._fadeAnimated&&ea(this._container,1),this.bringToFront(),this.options.interactive&&(Rt(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(d){d._fadeAnimated?(ea(this._container,0),this._removeTimeout=setTimeout(h(Wt,void 0,this._container),200)):Wt(this._container),this.options.interactive&&(Yr(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(d){return this._latlng=Ne(d),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(d){return this._content=d,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var d={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(d.zoomanim=this._animateZoom),d},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&hr(this._container),this},bringToBack:function(){return this._map&&Rr(this._container),this},_prepareOpen:function(d){var y=this._source;if(!y._map)return!1;if(y instanceof Ss){y=null;var D=this._source._layers;for(var F in D)if(D[F]._map){y=D[F];break}if(!y)return!1;this._source=y}if(!d)if(y.getCenter)d=y.getCenter();else if(y.getLatLng)d=y.getLatLng();else if(y.getBounds)d=y.getBounds().getCenter();else throw new Error("Unable to get source layer LatLng.");return this.setLatLng(d),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var d=this._contentNode,y=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof y=="string")d.innerHTML=y;else{for(;d.hasChildNodes();)d.removeChild(d.firstChild);d.appendChild(y)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var d=this._map.latLngToLayerPoint(this._latlng),y=ve(this.options.offset),D=this._getAnchor();this._zoomAnimated?xa(this._container,d.add(D)):y=y.add(d).add(D);var F=this._containerBottom=-y.y,Q=this._containerLeft=-Math.round(this._containerWidth/2)+y.x;this._container.style.bottom=F+"px",this._container.style.left=Q+"px"}},_getAnchor:function(){return[0,0]}});kr.include({_initOverlay:function(d,y,D,F){var Q=y;return Q instanceof d||(Q=new d(F).setContent(y)),D&&Q.setLatLng(D),Q}}),bi.include({_initOverlay:function(d,y,D,F){var Q=D;return Q instanceof d?(R(Q,F),Q._source=this):(Q=y&&!F?y:new d(F,this),Q.setContent(D)),Q}});var On=ca.extend({options:{pane:"popupPane",offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(d){return d=arguments.length?d:this._source._map,!d.hasLayer(this)&&d._popup&&d._popup.options.autoClose&&d.removeLayer(d._popup),d._popup=this,ca.prototype.openOn.call(this,d)},onAdd:function(d){ca.prototype.onAdd.call(this,d),d.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof Sr||this._source.on("preclick",Dr))},onRemove:function(d){ca.prototype.onRemove.call(this,d),d.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof Sr||this._source.off("preclick",Dr))},getEvents:function(){var d=ca.prototype.getEvents.call(this);return(this.options.closeOnClick!==void 0?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(d.preclick=this.close),this.options.keepInView&&(d.moveend=this._adjustPan),d},_initLayout:function(){var d="leaflet-popup",y=this._container=nr("div",d+" "+(this.options.className||"")+" leaflet-zoom-animated"),D=this._wrapper=nr("div",d+"-content-wrapper",y);if(this._contentNode=nr("div",d+"-content",D),Aa(y),ba(this._contentNode),nt(y,"contextmenu",Dr),this._tipContainer=nr("div",d+"-tip-container",y),this._tip=nr("div",d+"-tip",this._tipContainer),this.options.closeButton){var F=this._closeButton=nr("a",d+"-close-button",y);F.setAttribute("role","button"),F.setAttribute("aria-label","Close popup"),F.href="#close",F.innerHTML='<span aria-hidden="true">×</span>',nt(F,"click",function(Q){va(Q),this.close()},this)}},_updateLayout:function(){var d=this._contentNode,y=d.style;y.width="",y.whiteSpace="nowrap";var D=d.offsetWidth;D=Math.min(D,this.options.maxWidth),D=Math.max(D,this.options.minWidth),y.width=D+1+"px",y.whiteSpace="",y.height="";var F=d.offsetHeight,Q=this.options.maxHeight,ce="leaflet-popup-scrolled";Q&&F>Q?(y.height=Q+"px",Rt(d,ce)):Yr(d,ce),this._containerWidth=this._container.offsetWidth},_animateZoom:function(d){var y=this._map._latLngToNewLayerPoint(this._latlng,d.zoom,d.center),D=this._getAnchor();xa(this._container,y.add(D))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var d=this._map,y=parseInt(Pr(this._container,"marginBottom"),10)||0,D=this._container.offsetHeight+y,F=this._containerWidth,Q=new ne(this._containerLeft,-D-this._containerBottom);Q._add(ia(this._container));var ce=d.layerPointToContainerPoint(Q),Ae=ve(this.options.autoPanPadding),Qe=ve(this.options.autoPanPaddingTopLeft||Ae),dt=ve(this.options.autoPanPaddingBottomRight||Ae),Ht=d.getSize(),vr=0,na=0;ce.x+F+dt.x>Ht.x&&(vr=ce.x+F-Ht.x+dt.x),ce.x-vr-Qe.x<0&&(vr=ce.x-Qe.x),ce.y+D+dt.y>Ht.y&&(na=ce.y+D-Ht.y+dt.y),ce.y-na-Qe.y<0&&(na=ce.y-Qe.y),(vr||na)&&(this.options.keepInView&&(this._autopanning=!0),d.fire("autopanstart").panBy([vr,na]))}},_getAnchor:function(){return ve(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),hs=function(d,y){return new On(d,y)};kr.mergeOptions({closePopupOnClick:!0}),kr.include({openPopup:function(d,y,D){return this._initOverlay(On,d,y,D).openOn(this),this},closePopup:function(d){return d=arguments.length?d:this._popup,d&&d.close(),this}}),bi.include({bindPopup:function(d,y){return this._popup=this._initOverlay(On,this._popup,d,y),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(d){return this._popup&&(this instanceof Ss||(this._popup._source=this),this._popup._prepareOpen(d||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(d){return this._popup&&this._popup.setContent(d),this},getPopup:function(){return this._popup},_openPopup:function(d){if(!(!this._popup||!this._map)){Pa(d);var y=d.layer||d.target;if(this._popup._source===y&&!(y instanceof Sr)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(d.latlng);return}this._popup._source=y,this.openPopup(d.latlng)}},_movePopup:function(d){this._popup.setLatLng(d.latlng)},_onKeyPress:function(d){d.originalEvent.keyCode===13&&this._openPopup(d)}});var Es=ca.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(d){ca.prototype.onAdd.call(this,d),this.setOpacity(this.options.opacity),d.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(d){ca.prototype.onRemove.call(this,d),d.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var d=ca.prototype.getEvents.call(this);return this.options.permanent||(d.preclick=this.close),d},_initLayout:function(){var d="leaflet-tooltip",y=d+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=nr("div",y),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+b(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(d){var y,D,F=this._map,Q=this._container,ce=F.latLngToContainerPoint(F.getCenter()),Ae=F.layerPointToContainerPoint(d),Qe=this.options.direction,dt=Q.offsetWidth,Ht=Q.offsetHeight,vr=ve(this.options.offset),na=this._getAnchor();Qe==="top"?(y=dt/2,D=Ht):Qe==="bottom"?(y=dt/2,D=0):Qe==="center"?(y=dt/2,D=Ht/2):Qe==="right"?(y=0,D=Ht/2):Qe==="left"?(y=dt,D=Ht/2):Ae.x<ce.x?(Qe="right",y=0,D=Ht/2):(Qe="left",y=dt+(vr.x+na.x)*2,D=Ht/2),d=d.subtract(ve(y,D,!0)).add(vr).add(na),Yr(Q,"leaflet-tooltip-right"),Yr(Q,"leaflet-tooltip-left"),Yr(Q,"leaflet-tooltip-top"),Yr(Q,"leaflet-tooltip-bottom"),Rt(Q,"leaflet-tooltip-"+Qe),xa(Q,d)},_updatePosition:function(){var d=this._map.latLngToLayerPoint(this._latlng);this._setPosition(d)},setOpacity:function(d){this.options.opacity=d,this._container&&ea(this._container,d)},_animateZoom:function(d){var y=this._map._latLngToNewLayerPoint(this._latlng,d.zoom,d.center);this._setPosition(y)},_getAnchor:function(){return ve(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),is=function(d,y){return new Es(d,y)};kr.include({openTooltip:function(d,y,D){return this._initOverlay(Es,d,y,D).openOn(this),this},closeTooltip:function(d){return d.close(),this}}),bi.include({bindTooltip:function(d,y){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(Es,this._tooltip,d,y),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(d){if(!(!d&&this._tooltipHandlersAdded)){var y=d?"off":"on",D={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?D.add=this._openTooltip:(D.mouseover=this._openTooltip,D.mouseout=this.closeTooltip,D.click=this._openTooltip,this._map?this._addFocusListeners():D.add=this._addFocusListeners),this._tooltip.options.sticky&&(D.mousemove=this._moveTooltip),this[y](D),this._tooltipHandlersAdded=!d}},openTooltip:function(d){return this._tooltip&&(this instanceof Ss||(this._tooltip._source=this),this._tooltip._prepareOpen(d)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(d){return this._tooltip&&this._tooltip.setContent(d),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(d){var y=typeof d.getElement=="function"&&d.getElement();y&&(nt(y,"focus",function(){this._tooltip._source=d,this.openTooltip()},this),nt(y,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(d){var y=typeof d.getElement=="function"&&d.getElement();y&&y.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(d){if(!(!this._tooltip||!this._map)){if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var y=this;this._map.once("moveend",function(){y._openOnceFlag=!1,y._openTooltip(d)});return}this._tooltip._source=d.layer||d.target,this.openTooltip(this._tooltip.options.sticky?d.latlng:void 0)}},_moveTooltip:function(d){var y=d.latlng,D,F;this._tooltip.options.sticky&&d.originalEvent&&(D=this._map.mouseEventToContainerPoint(d.originalEvent),F=this._map.containerPointToLayerPoint(D),y=this._map.layerPointToLatLng(F)),this._tooltip.setLatLng(y)}});var tl=Un.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(d){var y=d&&d.tagName==="DIV"?d:document.createElement("div"),D=this.options;if(D.html instanceof Element?(Or(y),y.appendChild(D.html)):y.innerHTML=D.html!==!1?D.html:"",D.bgPos){var F=ve(D.bgPos);y.style.backgroundPosition=-F.x+"px "+-F.y+"px"}return this._setIconStyles(y,"icon"),y},createShadow:function(){return null}});function yi(d){return new tl(d)}Un.Default=tt;var Do=bi.extend({options:{tileSize:256,opacity:1,updateWhenIdle:rr.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(d){R(this,d)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(d){d._addZoomLimit(this)},onRemove:function(d){this._removeAllTiles(),Wt(this._container),d._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(hr(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(Rr(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(d){return this.options.opacity=d,this._updateOpacity(),this},setZIndex:function(d){return this.options.zIndex=d,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var d=this._clampZoom(this._map.getZoom());d!==this._tileZoom&&(this._tileZoom=d,this._updateLevels()),this._update()}return this},getEvents:function(){var d={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=w(this._onMoveEnd,this.options.updateInterval,this)),d.move=this._onMove),this._zoomAnimated&&(d.zoomanim=this._animateZoom),d},createTile:function(){return document.createElement("div")},getTileSize:function(){var d=this.options.tileSize;return d instanceof ne?d:new ne(d,d)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(d){for(var y=this.getPane().children,D=-d(-1/0,1/0),F=0,Q=y.length,ce;F<Q;F++)ce=y[F].style.zIndex,y[F]!==this._container&&ce&&(D=d(D,+ce));isFinite(D)&&(this.options.zIndex=D+d(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!rr.ielt9){ea(this._container,this.options.opacity);var d=+new Date,y=!1,D=!1;for(var F in this._tiles){var Q=this._tiles[F];if(!(!Q.current||!Q.loaded)){var ce=Math.min(1,(d-Q.loaded)/200);ea(Q.el,ce),ce<1?y=!0:(Q.active?D=!0:this._onOpaqueTile(Q),Q.active=!0)}}D&&!this._noPrune&&this._pruneTiles(),y&&(ee(this._fadeFrame),this._fadeFrame=J(this._updateOpacity,this))}},_onOpaqueTile:_,_initContainer:function(){this._container||(this._container=nr("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var d=this._tileZoom,y=this.options.maxZoom;if(d!==void 0){for(var D in this._levels)D=Number(D),this._levels[D].el.children.length||D===d?(this._levels[D].el.style.zIndex=y-Math.abs(d-D),this._onUpdateLevel(D)):(Wt(this._levels[D].el),this._removeTilesAtZoom(D),this._onRemoveLevel(D),delete this._levels[D]);var F=this._levels[d],Q=this._map;return F||(F=this._levels[d]={},F.el=nr("div","leaflet-tile-container leaflet-zoom-animated",this._container),F.el.style.zIndex=y,F.origin=Q.project(Q.unproject(Q.getPixelOrigin()),d).round(),F.zoom=d,this._setZoomTransform(F,Q.getCenter(),Q.getZoom()),_(F.el.offsetWidth),this._onCreateLevel(F)),this._level=F,F}},_onUpdateLevel:_,_onRemoveLevel:_,_onCreateLevel:_,_pruneTiles:function(){if(this._map){var d,y,D=this._map.getZoom();if(D>this.options.maxZoom||D<this.options.minZoom){this._removeAllTiles();return}for(d in this._tiles)y=this._tiles[d],y.retain=y.current;for(d in this._tiles)if(y=this._tiles[d],y.current&&!y.active){var F=y.coords;this._retainParent(F.x,F.y,F.z,F.z-5)||this._retainChildren(F.x,F.y,F.z,F.z+2)}for(d in this._tiles)this._tiles[d].retain||this._removeTile(d)}},_removeTilesAtZoom:function(d){for(var y in this._tiles)this._tiles[y].coords.z===d&&this._removeTile(y)},_removeAllTiles:function(){for(var d in this._tiles)this._removeTile(d)},_invalidateAll:function(){for(var d in this._levels)Wt(this._levels[d].el),this._onRemoveLevel(Number(d)),delete this._levels[d];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(d,y,D,F){var Q=Math.floor(d/2),ce=Math.floor(y/2),Ae=D-1,Qe=new ne(+Q,+ce);Qe.z=+Ae;var dt=this._tileCoordsToKey(Qe),Ht=this._tiles[dt];return Ht&&Ht.active?(Ht.retain=!0,!0):(Ht&&Ht.loaded&&(Ht.retain=!0),Ae>F?this._retainParent(Q,ce,Ae,F):!1)},_retainChildren:function(d,y,D,F){for(var Q=2*d;Q<2*d+2;Q++)for(var ce=2*y;ce<2*y+2;ce++){var Ae=new ne(Q,ce);Ae.z=D+1;var Qe=this._tileCoordsToKey(Ae),dt=this._tiles[Qe];if(dt&&dt.active){dt.retain=!0;continue}else dt&&dt.loaded&&(dt.retain=!0);D+1<F&&this._retainChildren(Q,ce,D+1,F)}},_resetView:function(d){var y=d&&(d.pinch||d.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),y,y)},_animateZoom:function(d){this._setView(d.center,d.zoom,!0,d.noUpdate)},_clampZoom:function(d){var y=this.options;return y.minNativeZoom!==void 0&&d<y.minNativeZoom?y.minNativeZoom:y.maxNativeZoom!==void 0&&y.maxNativeZoom<d?y.maxNativeZoom:d},_setView:function(d,y,D,F){var Q=Math.round(y);this.options.maxZoom!==void 0&&Q>this.options.maxZoom||this.options.minZoom!==void 0&&Q<this.options.minZoom?Q=void 0:Q=this._clampZoom(Q);var ce=this.options.updateWhenZooming&&Q!==this._tileZoom;(!F||ce)&&(this._tileZoom=Q,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),Q!==void 0&&this._update(d),D||this._pruneTiles(),this._noPrune=!!D),this._setZoomTransforms(d,y)},_setZoomTransforms:function(d,y){for(var D in this._levels)this._setZoomTransform(this._levels[D],d,y)},_setZoomTransform:function(d,y,D){var F=this._map.getZoomScale(D,d.zoom),Q=d.origin.multiplyBy(F).subtract(this._map._getNewPixelOrigin(y,D)).round();rr.any3d?$a(d.el,Q,F):xa(d.el,Q)},_resetGrid:function(){var d=this._map,y=d.options.crs,D=this._tileSize=this.getTileSize(),F=this._tileZoom,Q=this._map.getPixelWorldBounds(this._tileZoom);Q&&(this._globalTileRange=this._pxBoundsToTileRange(Q)),this._wrapX=y.wrapLng&&!this.options.noWrap&&[Math.floor(d.project([0,y.wrapLng[0]],F).x/D.x),Math.ceil(d.project([0,y.wrapLng[1]],F).x/D.y)],this._wrapY=y.wrapLat&&!this.options.noWrap&&[Math.floor(d.project([y.wrapLat[0],0],F).y/D.x),Math.ceil(d.project([y.wrapLat[1],0],F).y/D.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(d){var y=this._map,D=y._animatingZoom?Math.max(y._animateToZoom,y.getZoom()):y.getZoom(),F=y.getZoomScale(D,this._tileZoom),Q=y.project(d,this._tileZoom).floor(),ce=y.getSize().divideBy(F*2);return new Le(Q.subtract(ce),Q.add(ce))},_update:function(d){var y=this._map;if(y){var D=this._clampZoom(y.getZoom());if(d===void 0&&(d=y.getCenter()),this._tileZoom!==void 0){var F=this._getTiledPixelBounds(d),Q=this._pxBoundsToTileRange(F),ce=Q.getCenter(),Ae=[],Qe=this.options.keepBuffer,dt=new Le(Q.getBottomLeft().subtract([Qe,-Qe]),Q.getTopRight().add([Qe,-Qe]));if(!(isFinite(Q.min.x)&&isFinite(Q.min.y)&&isFinite(Q.max.x)&&isFinite(Q.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var Ht in this._tiles){var vr=this._tiles[Ht].coords;(vr.z!==this._tileZoom||!dt.contains(new ne(vr.x,vr.y)))&&(this._tiles[Ht].current=!1)}if(Math.abs(D-this._tileZoom)>1){this._setView(d,D);return}for(var na=Q.min.y;na<=Q.max.y;na++)for(var an=Q.min.x;an<=Q.max.x;an++){var qs=new ne(an,na);if(qs.z=this._tileZoom,!!this._isValidTile(qs)){var zs=this._tiles[this._tileCoordsToKey(qs)];zs?zs.current=!0:Ae.push(qs)}}if(Ae.sort(function(Hn,Vn){return Hn.distanceTo(ce)-Vn.distanceTo(ce)}),Ae.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var _i=document.createDocumentFragment();for(an=0;an<Ae.length;an++)this._addTile(Ae[an],_i);this._level.el.appendChild(_i)}}}},_isValidTile:function(d){var y=this._map.options.crs;if(!y.infinite){var D=this._globalTileRange;if(!y.wrapLng&&(d.x<D.min.x||d.x>D.max.x)||!y.wrapLat&&(d.y<D.min.y||d.y>D.max.y))return!1}if(!this.options.bounds)return!0;var F=this._tileCoordsToBounds(d);return ie(this.options.bounds).overlaps(F)},_keyToBounds:function(d){return this._tileCoordsToBounds(this._keyToTileCoords(d))},_tileCoordsToNwSe:function(d){var y=this._map,D=this.getTileSize(),F=d.scaleBy(D),Q=F.add(D),ce=y.unproject(F,d.z),Ae=y.unproject(Q,d.z);return[ce,Ae]},_tileCoordsToBounds:function(d){var y=this._tileCoordsToNwSe(d),D=new pe(y[0],y[1]);return this.options.noWrap||(D=this._map.wrapLatLngBounds(D)),D},_tileCoordsToKey:function(d){return d.x+":"+d.y+":"+d.z},_keyToTileCoords:function(d){var y=d.split(":"),D=new ne(+y[0],+y[1]);return D.z=+y[2],D},_removeTile:function(d){var y=this._tiles[d];y&&(Wt(y.el),delete this._tiles[d],this.fire("tileunload",{tile:y.el,coords:this._keyToTileCoords(d)}))},_initTile:function(d){Rt(d,"leaflet-tile");var y=this.getTileSize();d.style.width=y.x+"px",d.style.height=y.y+"px",d.onselectstart=_,d.onmousemove=_,rr.ielt9&&this.options.opacity<1&&ea(d,this.options.opacity)},_addTile:function(d,y){var D=this._getTilePos(d),F=this._tileCoordsToKey(d),Q=this.createTile(this._wrapCoords(d),h(this._tileReady,this,d));this._initTile(Q),this.createTile.length<2&&J(h(this._tileReady,this,d,null,Q)),xa(Q,D),this._tiles[F]={el:Q,coords:d,current:!0},y.appendChild(Q),this.fire("tileloadstart",{tile:Q,coords:d})},_tileReady:function(d,y,D){y&&this.fire("tileerror",{error:y,tile:D,coords:d});var F=this._tileCoordsToKey(d);D=this._tiles[F],D&&(D.loaded=+new Date,this._map._fadeAnimated?(ea(D.el,0),ee(this._fadeFrame),this._fadeFrame=J(this._updateOpacity,this)):(D.active=!0,this._pruneTiles()),y||(Rt(D.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:D.el,coords:d})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),rr.ielt9||!this._map._fadeAnimated?J(this._pruneTiles,this):setTimeout(h(this._pruneTiles,this),250)))},_getTilePos:function(d){return d.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(d){var y=new ne(this._wrapX?x(d.x,this._wrapX):d.x,this._wrapY?x(d.y,this._wrapY):d.y);return y.z=d.z,y},_pxBoundsToTileRange:function(d){var y=this.getTileSize();return new Le(d.min.unscaleBy(y).floor(),d.max.unscaleBy(y).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var d in this._tiles)if(!this._tiles[d].loaded)return!1;return!0}});function hn(d){return new Do(d)}var Is=Do.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(d,y){this._url=d,y=R(this,y),y.detectRetina&&rr.retina&&y.maxZoom>0?(y.tileSize=Math.floor(y.tileSize/2),y.zoomReverse?(y.zoomOffset--,y.minZoom=Math.min(y.maxZoom,y.minZoom+1)):(y.zoomOffset++,y.maxZoom=Math.max(y.minZoom,y.maxZoom-1)),y.minZoom=Math.max(0,y.minZoom)):y.zoomReverse?y.minZoom=Math.min(y.maxZoom,y.minZoom):y.maxZoom=Math.max(y.minZoom,y.maxZoom),typeof y.subdomains=="string"&&(y.subdomains=y.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(d,y){return this._url===d&&y===void 0&&(y=!0),this._url=d,y||this.redraw(),this},createTile:function(d,y){var D=document.createElement("img");return nt(D,"load",h(this._tileOnLoad,this,y,D)),nt(D,"error",h(this._tileOnError,this,y,D)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(D.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(D.referrerPolicy=this.options.referrerPolicy),D.alt="",D.src=this.getTileUrl(d),D},getTileUrl:function(d){var y={r:rr.retina?"@2x":"",s:this._getSubdomain(d),x:d.x,y:d.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var D=this._globalTileRange.max.y-d.y;this.options.tms&&(y.y=D),y["-y"]=D}return $(this._url,c(y,this.options))},_tileOnLoad:function(d,y){rr.ielt9?setTimeout(h(d,this,null,y),0):d(null,y)},_tileOnError:function(d,y,D){var F=this.options.errorTileUrl;F&&y.getAttribute("src")!==F&&(y.src=F),d(D,y)},_onTileRemove:function(d){d.tile.onload=null},_getZoomForUrl:function(){var d=this._tileZoom,y=this.options.maxZoom,D=this.options.zoomReverse,F=this.options.zoomOffset;return D&&(d=y-d),d+F},_getSubdomain:function(d){var y=Math.abs(d.x+d.y)%this.options.subdomains.length;return this.options.subdomains[y]},_abortLoading:function(){var d,y;for(d in this._tiles)if(this._tiles[d].coords.z!==this._tileZoom&&(y=this._tiles[d].el,y.onload=_,y.onerror=_,!y.complete)){y.src=z;var D=this._tiles[d].coords;Wt(y),delete this._tiles[d],this.fire("tileabort",{tile:y,coords:D})}},_removeTile:function(d){var y=this._tiles[d];if(y)return y.el.setAttribute("src",z),Do.prototype._removeTile.call(this,d)},_tileReady:function(d,y,D){if(!(!this._map||D&&D.getAttribute("src")===z))return Do.prototype._tileReady.call(this,d,y,D)}});function os(d,y){return new Is(d,y)}var Ws=Is.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(d,y){this._url=d;var D=c({},this.defaultWmsParams);for(var F in y)F in this.options||(D[F]=y[F]);y=R(this,y);var Q=y.detectRetina&&rr.retina?2:1,ce=this.getTileSize();D.width=ce.x*Q,D.height=ce.y*Q,this.wmsParams=D},onAdd:function(d){this._crs=this.options.crs||d.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var y=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[y]=this._crs.code,Is.prototype.onAdd.call(this,d)},getTileUrl:function(d){var y=this._tileCoordsToNwSe(d),D=this._crs,F=Ce(D.project(y[0]),D.project(y[1])),Q=F.min,ce=F.max,Ae=(this._wmsVersion>=1.3&&this._crs===ql?[Q.y,Q.x,ce.y,ce.x]:[Q.x,Q.y,ce.x,ce.y]).join(","),Qe=Is.prototype.getTileUrl.call(this,d);return Qe+O(this.wmsParams,Qe,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+Ae},setParams:function(d,y){return c(this.wmsParams,d),y||this.redraw(),this}});function $n(d,y){return new Ws(d,y)}Is.WMS=Ws,os.wms=$n;var mn=bi.extend({options:{padding:.1},initialize:function(d){R(this,d),b(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Rt(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var d={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(d.zoomanim=this._onAnimZoom),d},_onAnimZoom:function(d){this._updateTransform(d.center,d.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(d,y){var D=this._map.getZoomScale(y,this._zoom),F=this._map.getSize().multiplyBy(.5+this.options.padding),Q=this._map.project(this._center,y),ce=F.multiplyBy(-D).add(Q).subtract(this._map._getNewPixelOrigin(d,y));rr.any3d?$a(this._container,ce,D):xa(this._container,ce)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var d in this._layers)this._layers[d]._reset()},_onZoomEnd:function(){for(var d in this._layers)this._layers[d]._project()},_updatePaths:function(){for(var d in this._layers)this._layers[d]._update()},_update:function(){var d=this.options.padding,y=this._map.getSize(),D=this._map.containerPointToLayerPoint(y.multiplyBy(-d)).round();this._bounds=new Le(D,D.add(y.multiplyBy(1+d*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),ui=mn.extend({options:{tolerance:0},getEvents:function(){var d=mn.prototype.getEvents.call(this);return d.viewprereset=this._onViewPreReset,d},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){mn.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var d=this._container=document.createElement("canvas");nt(d,"mousemove",this._onMouseMove,this),nt(d,"click dblclick mousedown mouseup contextmenu",this._onClick,this),nt(d,"mouseout",this._handleMouseOut,this),d._leaflet_disable_events=!0,this._ctx=d.getContext("2d")},_destroyContainer:function(){ee(this._redrawRequest),delete this._ctx,Wt(this._container),at(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var d;this._redrawBounds=null;for(var y in this._layers)d=this._layers[y],d._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){mn.prototype._update.call(this);var d=this._bounds,y=this._container,D=d.getSize(),F=rr.retina?2:1;xa(y,d.min),y.width=F*D.x,y.height=F*D.y,y.style.width=D.x+"px",y.style.height=D.y+"px",rr.retina&&this._ctx.scale(2,2),this._ctx.translate(-d.min.x,-d.min.y),this.fire("update")}},_reset:function(){mn.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(d){this._updateDashArray(d),this._layers[b(d)]=d;var y=d._order={layer:d,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=y),this._drawLast=y,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(d){this._requestRedraw(d)},_removePath:function(d){var y=d._order,D=y.next,F=y.prev;D?D.prev=F:this._drawLast=F,F?F.next=D:this._drawFirst=D,delete d._order,delete this._layers[b(d)],this._requestRedraw(d)},_updatePath:function(d){this._extendRedrawBounds(d),d._project(),d._update(),this._requestRedraw(d)},_updateStyle:function(d){this._updateDashArray(d),this._requestRedraw(d)},_updateDashArray:function(d){if(typeof d.options.dashArray=="string"){var y=d.options.dashArray.split(/[, ]+/),D=[],F,Q;for(Q=0;Q<y.length;Q++){if(F=Number(y[Q]),isNaN(F))return;D.push(F)}d.options._dashArray=D}else d.options._dashArray=d.options.dashArray},_requestRedraw:function(d){this._map&&(this._extendRedrawBounds(d),this._redrawRequest=this._redrawRequest||J(this._redraw,this))},_extendRedrawBounds:function(d){if(d._pxBounds){var y=(d.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new Le,this._redrawBounds.extend(d._pxBounds.min.subtract([y,y])),this._redrawBounds.extend(d._pxBounds.max.add([y,y]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var d=this._redrawBounds;if(d){var y=d.getSize();this._ctx.clearRect(d.min.x,d.min.y,y.x,y.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var d,y=this._redrawBounds;if(this._ctx.save(),y){var D=y.getSize();this._ctx.beginPath(),this._ctx.rect(y.min.x,y.min.y,D.x,D.y),this._ctx.clip()}this._drawing=!0;for(var F=this._drawFirst;F;F=F.next)d=F.layer,(!y||d._pxBounds&&d._pxBounds.intersects(y))&&d._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(d,y){if(this._drawing){var D,F,Q,ce,Ae=d._parts,Qe=Ae.length,dt=this._ctx;if(Qe){for(dt.beginPath(),D=0;D<Qe;D++){for(F=0,Q=Ae[D].length;F<Q;F++)ce=Ae[D][F],dt[F?"lineTo":"moveTo"](ce.x,ce.y);y&&dt.closePath()}this._fillStroke(dt,d)}}},_updateCircle:function(d){if(!(!this._drawing||d._empty())){var y=d._point,D=this._ctx,F=Math.max(Math.round(d._radius),1),Q=(Math.max(Math.round(d._radiusY),1)||F)/F;Q!==1&&(D.save(),D.scale(1,Q)),D.beginPath(),D.arc(y.x,y.y/Q,F,0,Math.PI*2,!1),Q!==1&&D.restore(),this._fillStroke(D,d)}},_fillStroke:function(d,y){var D=y.options;D.fill&&(d.globalAlpha=D.fillOpacity,d.fillStyle=D.fillColor||D.color,d.fill(D.fillRule||"evenodd")),D.stroke&&D.weight!==0&&(d.setLineDash&&d.setLineDash(y.options&&y.options._dashArray||[]),d.globalAlpha=D.opacity,d.lineWidth=D.weight,d.strokeStyle=D.color,d.lineCap=D.lineCap,d.lineJoin=D.lineJoin,d.stroke())},_onClick:function(d){for(var y=this._map.mouseEventToLayerPoint(d),D,F,Q=this._drawFirst;Q;Q=Q.next)D=Q.layer,D.options.interactive&&D._containsPoint(y)&&(!(d.type==="click"||d.type==="preclick")||!this._map._draggableMoved(D))&&(F=D);this._fireEvent(F?[F]:!1,d)},_onMouseMove:function(d){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var y=this._map.mouseEventToLayerPoint(d);this._handleMouseHover(d,y)}},_handleMouseOut:function(d){var y=this._hoveredLayer;y&&(Yr(this._container,"leaflet-interactive"),this._fireEvent([y],d,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(d,y){if(!this._mouseHoverThrottled){for(var D,F,Q=this._drawFirst;Q;Q=Q.next)D=Q.layer,D.options.interactive&&D._containsPoint(y)&&(F=D);F!==this._hoveredLayer&&(this._handleMouseOut(d),F&&(Rt(this._container,"leaflet-interactive"),this._fireEvent([F],d,"mouseover"),this._hoveredLayer=F)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,d),this._mouseHoverThrottled=!0,setTimeout(h(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(d,y,D){this._map._fireDOMEvent(y,D||y.type,d)},_bringToFront:function(d){var y=d._order;if(y){var D=y.next,F=y.prev;if(D)D.prev=F;else return;F?F.next=D:D&&(this._drawFirst=D),y.prev=this._drawLast,this._drawLast.next=y,y.next=null,this._drawLast=y,this._requestRedraw(d)}},_bringToBack:function(d){var y=d._order;if(y){var D=y.next,F=y.prev;if(F)F.next=D;else return;D?D.prev=F:F&&(this._drawLast=F),y.prev=null,y.next=this._drawFirst,this._drawFirst.prev=y,this._drawFirst=y,this._requestRedraw(d)}}});function ci(d){return rr.canvas?new ui(d):null}var di=(function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(d){return document.createElement("<lvml:"+d+' class="lvml">')}}catch{}return function(d){return document.createElement("<"+d+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),bo={_initContainer:function(){this._container=nr("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(mn.prototype._update.call(this),this.fire("update"))},_initPath:function(d){var y=d._container=di("shape");Rt(y,"leaflet-vml-shape "+(this.options.className||"")),y.coordsize="1 1",d._path=di("path"),y.appendChild(d._path),this._updateStyle(d),this._layers[b(d)]=d},_addPath:function(d){var y=d._container;this._container.appendChild(y),d.options.interactive&&d.addInteractiveTarget(y)},_removePath:function(d){var y=d._container;Wt(y),d.removeInteractiveTarget(y),delete this._layers[b(d)]},_updateStyle:function(d){var y=d._stroke,D=d._fill,F=d.options,Q=d._container;Q.stroked=!!F.stroke,Q.filled=!!F.fill,F.stroke?(y||(y=d._stroke=di("stroke")),Q.appendChild(y),y.weight=F.weight+"px",y.color=F.color,y.opacity=F.opacity,F.dashArray?y.dashStyle=V(F.dashArray)?F.dashArray.join(" "):F.dashArray.replace(/( *, *)/g," "):y.dashStyle="",y.endcap=F.lineCap.replace("butt","flat"),y.joinstyle=F.lineJoin):y&&(Q.removeChild(y),d._stroke=null),F.fill?(D||(D=d._fill=di("fill")),Q.appendChild(D),D.color=F.fillColor||F.color,D.opacity=F.fillOpacity):D&&(Q.removeChild(D),d._fill=null)},_updateCircle:function(d){var y=d._point.round(),D=Math.round(d._radius),F=Math.round(d._radiusY||D);this._setPath(d,d._empty()?"M0 0":"AL "+y.x+","+y.y+" "+D+","+F+" 0,"+65535*360)},_setPath:function(d,y){d._path.v=y},_bringToFront:function(d){hr(d._container)},_bringToBack:function(d){Rr(d._container)}},vo=rr.vml?di:qe,Xl=mn.extend({_initContainer:function(){this._container=vo("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=vo("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Wt(this._container),at(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){mn.prototype._update.call(this);var d=this._bounds,y=d.getSize(),D=this._container;(!this._svgSize||!this._svgSize.equals(y))&&(this._svgSize=y,D.setAttribute("width",y.x),D.setAttribute("height",y.y)),xa(D,d.min),D.setAttribute("viewBox",[d.min.x,d.min.y,y.x,y.y].join(" ")),this.fire("update")}},_initPath:function(d){var y=d._path=vo("path");d.options.className&&Rt(y,d.options.className),d.options.interactive&&Rt(y,"leaflet-interactive"),this._updateStyle(d),this._layers[b(d)]=d},_addPath:function(d){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(d._path),d.addInteractiveTarget(d._path)},_removePath:function(d){Wt(d._path),d.removeInteractiveTarget(d._path),delete this._layers[b(d)]},_updatePath:function(d){d._project(),d._update()},_updateStyle:function(d){var y=d._path,D=d.options;y&&(D.stroke?(y.setAttribute("stroke",D.color),y.setAttribute("stroke-opacity",D.opacity),y.setAttribute("stroke-width",D.weight),y.setAttribute("stroke-linecap",D.lineCap),y.setAttribute("stroke-linejoin",D.lineJoin),D.dashArray?y.setAttribute("stroke-dasharray",D.dashArray):y.removeAttribute("stroke-dasharray"),D.dashOffset?y.setAttribute("stroke-dashoffset",D.dashOffset):y.removeAttribute("stroke-dashoffset")):y.setAttribute("stroke","none"),D.fill?(y.setAttribute("fill",D.fillColor||D.color),y.setAttribute("fill-opacity",D.fillOpacity),y.setAttribute("fill-rule",D.fillRule||"evenodd")):y.setAttribute("fill","none"))},_updatePoly:function(d,y){this._setPath(d,Xe(d._parts,y))},_updateCircle:function(d){var y=d._point,D=Math.max(Math.round(d._radius),1),F=Math.max(Math.round(d._radiusY),1)||D,Q="a"+D+","+F+" 0 1,0 ",ce=d._empty()?"M0 0":"M"+(y.x-D)+","+y.y+Q+D*2+",0 "+Q+-D*2+",0 ";this._setPath(d,ce)},_setPath:function(d,y){d._path.setAttribute("d",y)},_bringToFront:function(d){hr(d._path)},_bringToBack:function(d){Rr(d._path)}});rr.vml&&Xl.include(bo);function lc(d){return rr.svg||rr.vml?new Xl(d):null}kr.include({getRenderer:function(d){var y=d.options.renderer||this._getPaneRenderer(d.options.pane)||this.options.renderer||this._renderer;return y||(y=this._renderer=this._createRenderer()),this.hasLayer(y)||this.addLayer(y),y},_getPaneRenderer:function(d){if(d==="overlayPane"||d===void 0)return!1;var y=this._paneRenderers[d];return y===void 0&&(y=this._createRenderer({pane:d}),this._paneRenderers[d]=y),y},_createRenderer:function(d){return this.options.preferCanvas&&ci(d)||lc(d)}});var wi=Pi.extend({initialize:function(d,y){Pi.prototype.initialize.call(this,this._boundsToLatLngs(d),y)},setBounds:function(d){return this.setLatLngs(this._boundsToLatLngs(d))},_boundsToLatLngs:function(d){return d=ie(d),[d.getSouthWest(),d.getNorthWest(),d.getNorthEast(),d.getSouthEast()]}});function Ap(d,y){return new wi(d,y)}Xl.create=vo,Xl.pointsToPath=Xe,li.geometryToLayer=Ls,li.coordsToLatLng=Zl,li.coordsToLatLngs=Yl,li.latLngToCoords=Zi,li.latLngsToCoords=re,li.getFeature=Fe,li.asFeature=ft,kr.mergeOptions({boxZoom:!0});var ws=Wa.extend({initialize:function(d){this._map=d,this._container=d._container,this._pane=d._panes.overlayPane,this._resetStateTimeout=0,d.on("unload",this._destroy,this)},addHooks:function(){nt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){at(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Wt(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(d){if(!d.shiftKey||d.which!==1&&d.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),oa(),ua(),this._startPoint=this._map.mouseEventToContainerPoint(d),nt(document,{contextmenu:Pa,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(d){this._moved||(this._moved=!0,this._box=nr("div","leaflet-zoom-box",this._container),Rt(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(d);var y=new Le(this._point,this._startPoint),D=y.getSize();xa(this._box,y.min),this._box.style.width=D.x+"px",this._box.style.height=D.y+"px"},_finish:function(){this._moved&&(Wt(this._box),Yr(this._container,"leaflet-crosshair")),Qa(),Xa(),at(document,{contextmenu:Pa,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(d){if(!(d.which!==1&&d.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(h(this._resetState,this),0);var y=new pe(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(y).fire("boxzoomend",{boxZoomBounds:y})}},_onKeyDown:function(d){d.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});kr.addInitHook("addHandler","boxZoom",ws),kr.mergeOptions({doubleClickZoom:!0});var Wl=Wa.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(d){var y=this._map,D=y.getZoom(),F=y.options.zoomDelta,Q=d.originalEvent.shiftKey?D-F:D+F;y.options.doubleClickZoom==="center"?y.setZoom(Q):y.setZoomAround(d.containerPoint,Q)}});kr.addInitHook("addHandler","doubleClickZoom",Wl),kr.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var rl=Wa.extend({addHooks:function(){if(!this._draggable){var d=this._map;this._draggable=new ps(d._mapPane,d._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),d.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),d.on("zoomend",this._onZoomEnd,this),d.whenReady(this._onZoomEnd,this))}Rt(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Yr(this._map._container,"leaflet-grab"),Yr(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var d=this._map;if(d._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var y=ie(this._map.options.maxBounds);this._offsetLimit=Ce(this._map.latLngToContainerPoint(y.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(y.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;d.fire("movestart").fire("dragstart"),d.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(d){if(this._map.options.inertia){var y=this._lastTime=+new Date,D=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(D),this._times.push(y),this._prunePositions(y)}this._map.fire("move",d).fire("drag",d)},_prunePositions:function(d){for(;this._positions.length>1&&d-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var d=this._map.getSize().divideBy(2),y=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=y.subtract(d).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(d,y){return d-(d-y)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var d=this._draggable._newPos.subtract(this._draggable._startPos),y=this._offsetLimit;d.x<y.min.x&&(d.x=this._viscousLimit(d.x,y.min.x)),d.y<y.min.y&&(d.y=this._viscousLimit(d.y,y.min.y)),d.x>y.max.x&&(d.x=this._viscousLimit(d.x,y.max.x)),d.y>y.max.y&&(d.y=this._viscousLimit(d.y,y.max.y)),this._draggable._newPos=this._draggable._startPos.add(d)}},_onPreDragWrap:function(){var d=this._worldWidth,y=Math.round(d/2),D=this._initialWorldOffset,F=this._draggable._newPos.x,Q=(F-y+D)%d+y-D,ce=(F+y+D)%d-y-D,Ae=Math.abs(Q+D)<Math.abs(ce+D)?Q:ce;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=Ae},_onDragEnd:function(d){var y=this._map,D=y.options,F=!D.inertia||d.noInertia||this._times.length<2;if(y.fire("dragend",d),F)y.fire("moveend");else{this._prunePositions(+new Date);var Q=this._lastPos.subtract(this._positions[0]),ce=(this._lastTime-this._times[0])/1e3,Ae=D.easeLinearity,Qe=Q.multiplyBy(Ae/ce),dt=Qe.distanceTo([0,0]),Ht=Math.min(D.inertiaMaxSpeed,dt),vr=Qe.multiplyBy(Ht/dt),na=Ht/(D.inertiaDeceleration*Ae),an=vr.multiplyBy(-na/2).round();!an.x&&!an.y?y.fire("moveend"):(an=y._limitOffset(an,y.options.maxBounds),J(function(){y.panBy(an,{duration:na,easeLinearity:Ae,noMoveStart:!0,animate:!0})}))}}});kr.addInitHook("addHandler","dragging",rl),kr.mergeOptions({keyboard:!0,keyboardPanDelta:80});var rf=Wa.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(d){this._map=d,this._setPanDelta(d.options.keyboardPanDelta),this._setZoomDelta(d.options.zoomDelta)},addHooks:function(){var d=this._map._container;d.tabIndex<=0&&(d.tabIndex="0"),nt(d,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),at(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var d=document.body,y=document.documentElement,D=d.scrollTop||y.scrollTop,F=d.scrollLeft||y.scrollLeft;this._map._container.focus(),window.scrollTo(F,D)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(d){var y=this._panKeys={},D=this.keyCodes,F,Q;for(F=0,Q=D.left.length;F<Q;F++)y[D.left[F]]=[-1*d,0];for(F=0,Q=D.right.length;F<Q;F++)y[D.right[F]]=[d,0];for(F=0,Q=D.down.length;F<Q;F++)y[D.down[F]]=[0,d];for(F=0,Q=D.up.length;F<Q;F++)y[D.up[F]]=[0,-1*d]},_setZoomDelta:function(d){var y=this._zoomKeys={},D=this.keyCodes,F,Q;for(F=0,Q=D.zoomIn.length;F<Q;F++)y[D.zoomIn[F]]=d;for(F=0,Q=D.zoomOut.length;F<Q;F++)y[D.zoomOut[F]]=-d},_addHooks:function(){nt(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){at(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(d){if(!(d.altKey||d.ctrlKey||d.metaKey)){var y=d.keyCode,D=this._map,F;if(y in this._panKeys){if(!D._panAnim||!D._panAnim._inProgress)if(F=this._panKeys[y],d.shiftKey&&(F=ve(F).multiplyBy(3)),D.options.maxBounds&&(F=D._limitOffset(ve(F),D.options.maxBounds)),D.options.worldCopyJump){var Q=D.wrapLatLng(D.unproject(D.project(D.getCenter()).add(F)));D.panTo(Q)}else D.panBy(F)}else if(y in this._zoomKeys)D.setZoom(D.getZoom()+(d.shiftKey?3:1)*this._zoomKeys[y]);else if(y===27&&D._popup&&D._popup.options.closeOnEscapeKey)D.closePopup();else return;Pa(d)}}});kr.addInitHook("addHandler","keyboard",rf),kr.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var Yc=Wa.extend({addHooks:function(){nt(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){at(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(d){var y=Tt(d),D=this._map.options.wheelDebounceTime;this._delta+=y,this._lastMousePos=this._map.mouseEventToContainerPoint(d),this._startTime||(this._startTime=+new Date);var F=Math.max(D-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(h(this._performZoom,this),F),Pa(d)},_performZoom:function(){var d=this._map,y=d.getZoom(),D=this._map.options.zoomSnap||0;d._stop();var F=this._delta/(this._map.options.wheelPxPerZoomLevel*4),Q=4*Math.log(2/(1+Math.exp(-Math.abs(F))))/Math.LN2,ce=D?Math.ceil(Q/D)*D:Q,Ae=d._limitZoom(y+(this._delta>0?ce:-ce))-y;this._delta=0,this._startTime=null,Ae&&(d.options.scrollWheelZoom==="center"?d.setZoom(y+Ae):d.setZoomAround(this._lastMousePos,y+Ae))}});kr.addInitHook("addHandler","scrollWheelZoom",Yc);var bl=600;kr.mergeOptions({tapHold:rr.touchNative&&rr.safari&&rr.mobile,tapTolerance:15});var Lu=Wa.extend({addHooks:function(){nt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){at(this._map._container,"touchstart",this._onDown,this)},_onDown:function(d){if(clearTimeout(this._holdTimeout),d.touches.length===1){var y=d.touches[0];this._startPos=this._newPos=new ne(y.clientX,y.clientY),this._holdTimeout=setTimeout(h(function(){this._cancel(),this._isTapValid()&&(nt(document,"touchend",va),nt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",y))},this),bl),nt(document,"touchend touchcancel contextmenu",this._cancel,this),nt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function d(){at(document,"touchend",va),at(document,"touchend touchcancel",d)},_cancel:function(){clearTimeout(this._holdTimeout),at(document,"touchend touchcancel contextmenu",this._cancel,this),at(document,"touchmove",this._onMove,this)},_onMove:function(d){var y=d.touches[0];this._newPos=new ne(y.clientX,y.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(d,y){var D=new MouseEvent(d,{bubbles:!0,cancelable:!0,view:window,screenX:y.screenX,screenY:y.screenY,clientX:y.clientX,clientY:y.clientY});D._simulated=!0,y.target.dispatchEvent(D)}});kr.addInitHook("addHandler","tapHold",Lu),kr.mergeOptions({touchZoom:rr.touch,bounceAtZoomLimits:!0});var af=Wa.extend({addHooks:function(){Rt(this._map._container,"leaflet-touch-zoom"),nt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Yr(this._map._container,"leaflet-touch-zoom"),at(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(d){var y=this._map;if(!(!d.touches||d.touches.length!==2||y._animatingZoom||this._zooming)){var D=y.mouseEventToContainerPoint(d.touches[0]),F=y.mouseEventToContainerPoint(d.touches[1]);this._centerPoint=y.getSize()._divideBy(2),this._startLatLng=y.containerPointToLatLng(this._centerPoint),y.options.touchZoom!=="center"&&(this._pinchStartLatLng=y.containerPointToLatLng(D.add(F)._divideBy(2))),this._startDist=D.distanceTo(F),this._startZoom=y.getZoom(),this._moved=!1,this._zooming=!0,y._stop(),nt(document,"touchmove",this._onTouchMove,this),nt(document,"touchend touchcancel",this._onTouchEnd,this),va(d)}},_onTouchMove:function(d){if(!(!d.touches||d.touches.length!==2||!this._zooming)){var y=this._map,D=y.mouseEventToContainerPoint(d.touches[0]),F=y.mouseEventToContainerPoint(d.touches[1]),Q=D.distanceTo(F)/this._startDist;if(this._zoom=y.getScaleZoom(Q,this._startZoom),!y.options.bounceAtZoomLimits&&(this._zoom<y.getMinZoom()&&Q<1||this._zoom>y.getMaxZoom()&&Q>1)&&(this._zoom=y._limitZoom(this._zoom)),y.options.touchZoom==="center"){if(this._center=this._startLatLng,Q===1)return}else{var ce=D._add(F)._divideBy(2)._subtract(this._centerPoint);if(Q===1&&ce.x===0&&ce.y===0)return;this._center=y.unproject(y.project(this._pinchStartLatLng,this._zoom).subtract(ce),this._zoom)}this._moved||(y._moveStart(!0,!1),this._moved=!0),ee(this._animRequest);var Ae=h(y._move,y,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=J(Ae,this,!0),va(d)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,ee(this._animRequest),at(document,"touchmove",this._onTouchMove,this),at(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});kr.addInitHook("addHandler","touchZoom",af),kr.BoxZoom=ws,kr.DoubleClickZoom=Wl,kr.Drag=rl,kr.Keyboard=rf,kr.ScrollWheelZoom=Yc,kr.TapHold=Lu,kr.TouchZoom=af,l.Bounds=Le,l.Browser=rr,l.CRS=Ge,l.Canvas=ui,l.Circle=Nn,l.CircleMarker=Xr,l.Class=fe,l.Control=Na,l.DivIcon=tl,l.DivOverlay=ca,l.DomEvent=qr,l.DomUtil=Et,l.Draggable=ps,l.Evented=W,l.FeatureGroup=Ss,l.GeoJSON=li,l.GridLayer=Do,l.Handler=Wa,l.Icon=Un,l.ImageOverlay=ha,l.LatLng=ye,l.LatLngBounds=pe,l.Layer=bi,l.LayerGroup=el,l.LineUtil=Xn,l.Map=kr,l.Marker=br,l.Mixin=ln,l.Path=Sr,l.Point=ne,l.PolyUtil=js,l.Polygon=Pi,l.Polyline=$i,l.Popup=On,l.PosAnimation=Ra,l.Projection=ro,l.Rectangle=wi,l.Renderer=mn,l.SVG=Xl,l.SVGOverlay=Ya,l.TileLayer=Is,l.Tooltip=Es,l.Transformation=ue,l.Util=se,l.VideoOverlay=Fa,l.bind=h,l.bounds=Ce,l.canvas=ci,l.circle=Dn,l.circleMarker=Cn,l.control=on,l.divIcon=yi,l.extend=c,l.featureGroup=Ru,l.geoJSON=_t,l.geoJson=jr,l.gridLayer=hn,l.icon=we,l.imageOverlay=ns,l.latLng=Ne,l.latLngBounds=ie,l.layerGroup=Ou,l.map=ja,l.marker=Er,l.point=ve,l.polygon=Rs,l.polyline=Gl,l.popup=hs,l.rectangle=Ap,l.setOptions=R,l.stamp=b,l.svg=lc,l.svgOverlay=Wn,l.tileLayer=os,l.tooltip=is,l.transformation=Pe,l.version=u,l.videoOverlay=Mn;var nf=window.L;l.noConflict=function(){return window.L=nf,this},window.L=l}))})(Uv,Uv.exports)),Uv.exports}var Rg=xz();const bz=nT(Rg);function zC(a,o){const l=T.useRef(o);T.useEffect(function(){o!==l.current&&a.attributionControl!=null&&(l.current!=null&&a.attributionControl.removeAttribution(l.current),o!=null&&a.attributionControl.addAttribution(o)),l.current=o},[a,o])}const vz=1;function yz(a){return Object.freeze({__version:vz,map:a})}function wz(a,o){return Object.freeze({...a,...o})}const AN=T.createContext(null);function TN(){const a=T.use(AN);if(a==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return a}function _z(a){function o(l,u){const{instance:c,context:f}=a(l).current;T.useImperativeHandle(u,()=>c);const{children:h}=l;return h==null?null:T.createElement(AN,{value:f},h)}return T.forwardRef(o)}function kz(a){function o(l,u){const[c,f]=T.useState(!1),{instance:h}=a(l,f).current;T.useImperativeHandle(u,()=>h),T.useEffect(function(){c&&h.update()},[h,c,l.children]);const g=h._contentNode;return g?Mu.createPortal(l.children,g):null}return T.forwardRef(o)}function $C(a){function o(l,u){const{instance:c}=a(l).current;return T.useImperativeHandle(u,()=>c),null}return T.forwardRef(o)}function jz(a){return function(l){const u=TN(),c=a(l,u),{instance:f}=c.current,h=T.useRef(l.position),{position:g}=l;return T.useEffect(function(){return f.addTo(u.map),function(){f.remove()}},[u.map,f]),T.useEffect(function(){g!=null&&g!==h.current&&(f.setPosition(g),h.current=g)},[f,g]),c}}function PC(a,o){const l=T.useRef(void 0);T.useEffect(function(){return o!=null&&a.instance.on(o),l.current=o,function(){l.current!=null&&a.instance.off(l.current),l.current=null}},[a,o])}function CN(a,o){const l=a.pane??o.pane;return l?{...a,pane:l}:a}function Nz(a,o){return function(u,c){const f=TN(),h=a(CN(u,f),f);return zC(f.map,u.attribution),PC(h.current,u.eventHandlers),o(h.current,f,u,c),h}}function i_(a,o,l){return Object.freeze({instance:a,context:o,container:l})}function o_(a,o){return o==null?function(u,c){const f=T.useRef(void 0);return f.current||(f.current=a(u,c)),f}:function(u,c){const f=T.useRef(void 0);f.current||(f.current=a(u,c));const h=T.useRef(u),{instance:g}=f.current;return T.useEffect(function(){h.current!==u&&(o(g,u,h.current),h.current=u)},[g,u,o]),f}}function Sz(a,o){T.useEffect(function(){return(o.layerContainer??o.map).addLayer(a.instance),function(){o.layerContainer?.removeLayer(a.instance),o.map.removeLayer(a.instance)}},[o,a])}function BC(a){return function(l){const u=TN(),c=a(CN(l,u),u);return zC(u.map,l.attribution),PC(c.current,l.eventHandlers),Sz(c.current,u),c}}function Ez(a){function o(c,f){return i_(a(c),f)}const l=o_(o),u=jz(l);return $C(u)}function Az(a,o){const l=o_(a,o),u=BC(l);return _z(u)}function Tz(a,o){const l=o_(a),u=Nz(l,o);return kz(u)}function Cz(a,o){const l=o_(a,o),u=BC(l);return $C(u)}function Dz(a,o,l){const{opacity:u,zIndex:c}=o;u!=null&&u!==l.opacity&&a.setOpacity(u),c!=null&&c!==l.zIndex&&a.setZIndex(c)}function Mz({bounds:a,boundsOptions:o,center:l,children:u,className:c,id:f,placeholder:h,style:g,whenReady:b,zoom:w,...x},_){const[v]=T.useState({className:c,id:f,style:g}),[N,C]=T.useState(null),R=T.useRef(void 0);T.useImperativeHandle(_,()=>N?.map??null,[N]);const O=T.useCallback($=>{if($!==null&&!R.current){const V=new Rg.Map($,x);R.current=V,l!=null&&w!=null?V.setView(l,w):a!=null&&V.fitBounds(a,o),b!=null&&V.whenReady(b),C(yz(V))}},[]);T.useEffect(()=>()=>{N?.map.remove()},[N]);const E=N?T.createElement(AN,{value:N},u):h??null;return T.createElement("div",{...v,ref:O},E)}const Oz=T.forwardRef(Mz),Rz=Az(function({position:o,...l},u){const c=new Rg.Marker(o,l);return i_(c,wz(u,{overlayContainer:c}))},function(o,l,u){l.position!==u.position&&o.setLatLng(l.position),l.icon!=null&&l.icon!==u.icon&&o.setIcon(l.icon),l.zIndexOffset!=null&&l.zIndexOffset!==u.zIndexOffset&&o.setZIndexOffset(l.zIndexOffset),l.opacity!=null&&l.opacity!==u.opacity&&o.setOpacity(l.opacity),o.dragging!=null&&l.draggable!==u.draggable&&(l.draggable===!0?o.dragging.enable():o.dragging.disable())}),Lz=Tz(function(o,l){const u=new Rg.Popup(o,l.overlayContainer);return i_(u,l)},function(o,l,{position:u},c){T.useEffect(function(){const{instance:h}=o;function g(w){w.popup===h&&(h.update(),c(!0))}function b(w){w.popup===h&&c(!1)}return l.map.on({popupopen:g,popupclose:b}),l.overlayContainer==null?(u!=null&&h.setLatLng(u),h.openOn(l.map)):l.overlayContainer.bindPopup(h),function(){l.map.off({popupopen:g,popupclose:b}),l.overlayContainer?.unbindPopup(),l.map.removeLayer(h)}},[o,l,c,u])}),zz=Cz(function({url:o,...l},u){const c=new Rg.TileLayer(o,CN(l,u));return i_(c,u)},function(o,l,u){Dz(o,l,u);const{url:c}=l;c!=null&&c!==u.url&&o.setUrl(c)}),$z=Ez(function(o){return new Rg.Control.Zoom(o)}),N6="hive-worldmappin-styles",Pz=`
|
|
1127
1127
|
.hive-worldmappin .leaflet-container {
|
|
1128
1128
|
background: #0d1118;
|
|
1129
1129
|
/* Trap Leaflet's z-indexes (panes 200–700, controls 800) inside the
|