PageSourceSearch

https://3dtrees.earth/assets/index-DOIL8smB.js

js 3dtrees.earth collected 2026-10-07 15:46:13 UTC 1,831,180 bytes, 537 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a11585-69a9-7a63-9dc3-77fb47ab3044")}catch(e){}}();const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/point-cloud-hero-BY2N3t9G.js","assets/potree-coloring-DaCRoadU.js","assets/index-LpbdmFwp.js","assets/Collection-B7VkSdS8.js","assets/Object-CcUaLeJe.js","assets/Feature-DeEn3Pe0.js","assets/asserts-C9w6segB.js","assets/Polygon-CHtJYYgp.js","assets/extent-I-eR3KPh.js","assets/proj-DaVmBXpc.js","assets/math-DAon4ME5.js","assets/Point-CvQYgt85.js","assets/transform-B0e-Mfcz.js","assets/transform-6cd064rB.js","assets/intersectsextent-DQlLBZUj.js","assets/contains-D_Sagh8f.js","assets/orient-DMNlmKLR.js","assets/Image-D4TYaeJd.js","assets/ImageState-Dq1ua1T8.js","assets/has-BV0ZlFtg.js","assets/VectorTile-7GZhLqM-.js","assets/TileRange-CywcVdFD.js","assets/TileState-DlVDDZLF.js","assets/easing-C5VOLnNh.js","assets/dom-B9bkas2o.js","assets/defaults-CDzPOQhp.js","assets/rotationconstraint-Biv7cidI.js","assets/LineString-Cy6AcPih.js","assets/Feature-D8SjFDBC.js","assets/length-CRAVcLNl.js","assets/Vector-Vfi6tvCu.js","assets/View-BUGfi4XF.js","assets/common-DLKHJPh3.js","assets/Layer-DMntg2or.js","assets/Base-DaFtvbZ8.js","assets/Circle-CvYakwZ-.js","assets/color-ByGhwCwI.js","assets/css-Vk3IQMjY.js","assets/size-6nEQ_z0h.js","assets/Layer-ByGHSrxI.js","assets/style-qTuj3e24.js","assets/BaseVector-Cqsq5FX1.js","assets/index-6e4P-Gjj.js","assets/Vector-CPi4KwxY.js","assets/Source-D3q4RtYd.js","assets/Map-maJLLJ-h.js","assets/MapEventType-B53hzry2.js","assets/defaults-BvZKCorW.js","assets/Control-BCoEr6rB.js","assets/Group-B8W4HhL1.js","assets/Overlay-DTuoCdVv.js","assets/ol-BjIYm04z.css","assets/Tile-DodoNKp-.js","assets/tilecoord-D5Xw5o05.js","assets/common-CJB6XPcF.js","assets/OSM-DPw64vuj.js","assets/XYZ-D6qr6B_D.js","assets/TileImage-CATT0ZxA.js","assets/uri-klGph0F1.js","assets/openlayers-CQpjlEde.js","assets/GeometryCollection-BdW_8vST.js","assets/audit-detail-5abq-xv3.js","assets/potree-viewer-DICPD9hJ.js","assets/map-CcGVcOuC.js","assets/locate-fixed-CsPFveOM.js","assets/queue-state-DTIN4ska.js","assets/map-page-BGd2B_tl.js","assets/circle-off-B_1aVjDi.js","assets/dataset-details-pAu9I6ev.js","assets/dataset-visualization-h7GcoBA8.js","assets/dataset-embed-CKVj-IPe.js","assets/audit-queue-DC1VCKxA.js"])))=>i.map(i=>d[i]);
2var pV=Object.defineProperty;var JR=t=>{throw TypeError(t)};var mV=(t,e,r)=>e in t?pV(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var En=(t,e,r)=>mV(t,typeof e!="symbol"?e+"":e,r),_x=(t,e,r)=>e.has(t)||JR("Cannot "+r);var X=(t,e,r)=>(_x(t,e,"read from private field"),r?r.call(t):e.get(t)),bt=(t,e,r)=>e.has(t)?JR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Je=(t,e,r,n)=>(_x(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),Qt=(t,e,r)=>(_x(t,e,"access private method"),r);var sy=(t,e,r,n)=>({set _(s){Je(t,e,s,r)},get _(){return X(t,e,n)}});window.CESIUM_BASE_URL="/cesium/";function gV(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();var Zxe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dM(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Jxe(t){if(Object.prototype.hasOwnProperty.call(t,"__esMo
vendor: 4,603 bytes, lines 2-10
2dule"))return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,s.get?s:{enumerable:!0,get:function(){return t[n]}})}),r}var bx={exports:{}},Up={},wx={exports:{}},ir={};/**
3 * @license React
4 * react.production.min.js
5 *
6 * Copyright (c) Facebook, Inc. and its affiliates.
7 *
8 * This source code is licensed under the MIT license found in the
9 * LICENSE file in the root directory of this source tree.
10 */var QR;function vV(){if(QR)return ir;QR=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.iterator;function g($){return $===null||typeof $!="object"?null:($=f&&$[f]||$["@@iterator"],typeof $=="function"?$:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,x={};function w($,F,te){this.props=$,this.context=F,this.refs=x,this.updater=te||v}w.prototype.isReactComponent={},w.prototype.setState=function($,F){if(typeof $!="object"&&typeof $!="function"&&$!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,$,F,"setState")},w.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function S(){}S.prototype=w.prototype;function k($,F,te){this.props=$,this.context=F,this.refs=x,this.updater=te||v}var j=k.prototype=new S;j.constructor=k,_(j,w.prototype),j.isPureReactComponent=!0;var C=Array.isArray,R=Object.prototype.hasOwnProperty,A={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function P($,F,te){var ue,re={},se=null,ye=null;if(F!=null)for(ue in F.ref!==void 0&&(ye=F.ref),F.key!==void 0&&(se=""+F.key),F)R.call(F,ue)&&!I.hasOwnProperty(ue)&&(re[ue]=F[ue]);var de=arguments.length-2;if(de===1)re.children=te;else if(1<de){for(var pe=Array(de),Ie=0;Ie<de;Ie++)pe[Ie]=arguments[Ie+2];re.children=pe}if($&&$.defaultProps)for(ue in de=$.defaultProps,de)re[ue]===void 0&&(re[ue]=de[ue]);return{$$typeof:t,type:$,key:se,ref:ye,props:re,_owner:A.current}}function T($,F){return{$$typeof:t,type:$.type,key:F,ref:$.ref,props:$.props,_owner:$._owner}}function O($){return typeof $=="object"&&$!==null&&$.$$typeof===t}function G($){var F={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(te){return F[te]})}var M=/\/+/g;function U($,F){return typeof $=="object"&&$!==null&&$.key!=null?G(""+$.key):F.toString(36)}function V($,F,te,ue,re){var se=typeof $;(se==="undefined"||se==="boolean")&&($=null);var ye=!1;if($===null)ye=!0;else switch(se){case"string":case"number":ye=!0;break;case"object":switch($.$$typeof){case t:case e:ye=!0}}if(ye)return ye=$,re=re(ye),$=ue===""?"."+U(ye,0):ue,C(re)?(te="",$!=null&&(te=$.replace(M,"$&/")+"/"),V(re,F,te,"",function(Ie){return Ie})):re!=null&&(O(re)&&(re=T(re,te+(!re.key||ye&&ye.key===re.key?"":(""+re.key).replace(M,"$&/")+"/")+$)),F.push(re)),1;if(ye=0,ue=ue===""?".":ue+":",C($))for(var de=0;de<$.length;de++){se=$[de];var pe=ue+U(se,de);ye+=V(se,F,te,pe,re)}else if(pe=g($),typeof pe=="function")for($=pe.call($),de=0;!(se=$.next()).done;)se=se.value,pe=ue+U(se,de++),ye+=V(se,F,te,pe,re);else if(se==="object")throw F=String($),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.");return ye}function H($,F,te){if($==null)return $;var ue=[],re=0;return V($,ue,"","",function(se){return F.call(te,se,re++)}),ue}function Y($){if($._status===-1){var F=$._result;F=F(),F.then(function(te){($._status===0||$._status===-1)&&($._status=1,$._result=te)},function(te){($._status===0||$._status===-1)&&($._status=2,$._result=te)}),$._status===-1&&($._status=0,$._result=F)}if($._status===1)return $._result.default;throw $._result}var B={current:null},z={transition:null},ee={ReactCurrentDispatcher:B,ReactCurrentBatchConfig:z,ReactCurrentOwner:A};function L(){throw Error("act(...) is not supported in production builds of React.")}
vendor: 5,462 bytes, lines 10-26
10return ir.Children={map:H,forEach:function($,F,te){H($,function(){F.apply(this,arguments)},te)},count:function($){var F=0;return H($,function(){F++}),F},toArray:function($){return H($,function(F){return F})||[]},only:function($){if(!O($))throw Error("React.Children.only expected to receive a single React element child.");return $}},ir.Component=w,ir.Fragment=r,ir.Profiler=s,ir.PureComponent=k,ir.StrictMode=n,ir.Suspense=u,ir.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ee,ir.act=L,ir.cloneElement=function($,F,te){if($==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+$+".");var ue=_({},$.props),re=$.key,se=$.ref,ye=$._owner;if(F!=null){if(F.ref!==void 0&&(se=F.ref,ye=A.current),F.key!==void 0&&(re=""+F.key),$.type&&$.type.defaultProps)var de=$.type.defaultProps;for(pe in F)R.call(F,pe)&&!I.hasOwnProperty(pe)&&(ue[pe]=F[pe]===void 0&&de!==void 0?de[pe]:F[pe])}var pe=arguments.length-2;if(pe===1)ue.children=te;else if(1<pe){de=Array(pe);for(var Ie=0;Ie<pe;Ie++)de[Ie]=arguments[Ie+2];ue.children=de}return{$$typeof:t,type:$.type,key:re,ref:se,props:ue,_owner:ye}},ir.createContext=function($){return $={$$typeof:a,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},$.Provider={$$typeof:i,_context:$},$.Consumer=$},ir.createElement=P,ir.createFactory=function($){var F=P.bind(null,$);return F.type=$,F},ir.createRef=function(){return{current:null}},ir.forwardRef=function($){return{$$typeof:l,render:$}},ir.isValidElement=O,ir.lazy=function($){return{$$typeof:p,_payload:{_status:-1,_result:$},_init:Y}},ir.memo=function($,F){return{$$typeof:h,type:$,compare:F===void 0?null:F}},ir.startTransition=function($){var F=z.transition;z.transition={};try{$()}finally{z.transition=F}},ir.unstable_act=L,ir.useCallback=function($,F){return B.current.useCallback($,F)},ir.useContext=function($){return B.current.useContext($)},ir.useDebugValue=function(){},ir.useDeferredValue=function($){return B.current.useDeferredValue($)},ir.useEffect=function($,F){return B.current.useEffect($,F)},ir.useId=function(){return B.current.useId()},ir.useImperativeHandle=function($,F,te){return B.current.useImperativeHandle($,F,te)},ir.useInsertionEffect=function($,F){return B.current.useInsertionEffect($,F)},ir.useLayoutEffect=function($,F){return B.current.useLayoutEffect($,F)},ir.useMemo=function($,F){return B.current.useMemo($,F)},ir.useReducer=function($,F,te){return B.current.useReducer($,F,te)},ir.useRef=function($){return B.current.useRef($)},ir.useState=function($){return B.current.useState($)},ir.useSyncExternalStore=function($,F,te){return B.current.useSyncExternalStore($,F,te)},ir.useTransition=function(){return B.current.useTransition()},ir.version="18.3.1",ir}var XR;function Vj(){return XR||(XR=1,wx.exports=vV()),wx.exports}/**
11 * @license React
12 * react-jsx-runtime.production.min.js
13 *
14 * Copyright (c) Facebook, Inc. and its affiliates.
15 *
16 * This source code is licensed under the MIT license found in the
17 * LICENSE file in the root directory of this source tree.
18 */var eA;function yV(){if(eA)return Up;eA=1;var t=Vj(),e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function a(l,u,h){var p,f={},g=null,v=null;h!==void 0&&(g=""+h),u.key!==void 0&&(g=""+u.key),u.ref!==void 0&&(v=u.ref);for(p in u)n.call(u,p)&&!i.hasOwnProperty(p)&&(f[p]=u[p]);if(l&&l.defaultProps)for(p in u=l.defaultProps,u)f[p]===void 0&&(f[p]=u[p]);return{$$typeof:e,type:l,key:g,ref:v,props:f,_owner:s.current}}return Up.Fragment=r,Up.jsx=a,Up.jsxs=a,Up}var tA;function _V(){return tA||(tA=1,bx.exports=yV()),bx.exports}var o=_V(),y=Vj();const K=dM(y),Id=gV({__proto__:null,default:K},[y]);var iy={},xx={exports:{}},Js={},Sx={exports:{}},kx={};/**
19 * @license React
20 * scheduler.production.min.js
21 *
22 * Copyright (c) Facebook, Inc. and its affiliates.
23 *
24 * This source code is licensed under the MIT license found in the
25 * LICENSE file in the root directory of this source tree.
26 */var rA;function bV(){return rA||(rA=1,(function(t){function e(z,ee){var L=z.length;z.push(ee);e:for(;0<L;){var $=L-1>>>1,F=z[$];if(0<s(F,ee))z[$]=ee,z[L]=F,L=$;else break e}}function r(z){return z.length===0?null:z[0]}function n(z){if(z.length===0)return null;var ee=z[0],L=z.pop();if(L!==ee){z[0]=L;e:for(var $=0,F=z.length,te=F>>>1;$<te;){var ue=2*($+1)-1,re=z[ue],se=ue+1,ye=z[se];if(0>s(re,L))se<F&&0>s(ye,re)?(z[$]=ye,z[se]=L,$=se):(z[$]=re,z[ue]=L,$=ue);else if(se<F&&0>s(ye,L))z[$]=ye,z[se]=L,$=se;else break e}}return ee}function s(z,ee){var L=z.sortIndex-ee.sortIndex;return L!==0?L:z.id-ee.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}var u=[],h=[],p=1,f=null,g=3,v=!1,_=!1,x=!1,w=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function j(z){for(var ee=r(h);ee!==null;){if(ee.callback===null)n(h);else if(ee.startTime<=z)n(h),ee.sortIndex=ee.expirationTime,e(u,ee);else break;ee=r(h)}}
vendor: 40,274 bytes, lines 26-38
26function C(z){if(x=!1,j(z),!_)if(r(u)!==null)_=!0,Y(R);else{var ee=r(h);ee!==null&&B(C,ee.startTime-z)}}function R(z,ee){_=!1,x&&(x=!1,S(P),P=-1),v=!0;var L=g;try{for(j(ee),f=r(u);f!==null&&(!(f.expirationTime>ee)||z&&!G());){var $=f.callback;if(typeof $=="function"){f.callback=null,g=f.priorityLevel;var F=$(f.expirationTime<=ee);ee=t.unstable_now(),typeof F=="function"?f.callback=F:f===r(u)&&n(u),j(ee)}else n(u);f=r(u)}if(f!==null)var te=!0;else{var ue=r(h);ue!==null&&B(C,ue.startTime-ee),te=!1}return te}finally{f=null,g=L,v=!1}}var A=!1,I=null,P=-1,T=5,O=-1;function G(){return!(t.unstable_now()-O<T)}function M(){if(I!==null){var z=t.unstable_now();O=z;var ee=!0;try{ee=I(!0,z)}finally{ee?U():(A=!1,I=null)}}else A=!1}var U;if(typeof k=="function")U=function(){k(M)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,H=V.port2;V.port1.onmessage=M,U=function(){H.postMessage(null)}}else U=function(){w(M,0)};function Y(z){I=z,A||(A=!0,U())}function B(z,ee){P=w(function(){z(t.unstable_now())},ee)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(z){z.callback=null},t.unstable_continueExecution=function(){_||v||(_=!0,Y(R))},t.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<z?Math.floor(1e3/z):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_getFirstCallbackNode=function(){return r(u)},t.unstable_next=function(z){switch(g){case 1:case 2:case 3:var ee=3;break;default:ee=g}var L=g;g=ee;try{return z()}finally{g=L}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(z,ee){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var L=g;g=z;try{return ee()}finally{g=L}},t.unstable_scheduleCallback=function(z,ee,L){var $=t.unstable_now();switch(typeof L=="object"&&L!==null?(L=L.delay,L=typeof L=="number"&&0<L?$+L:$):L=$,z){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=L+F,z={id:p++,callback:ee,priorityLevel:z,startTime:L,expirationTime:F,sortIndex:-1},L>$?(z.sortIndex=L,e(h,z),r(u)===null&&z===r(h)&&(x?(S(P),P=-1):x=!0,B(C,L-$))):(z.sortIndex=F,e(u,z),_||v||(_=!0,Y(R))),z},t.unstable_shouldYield=G,t.unstable_wrapCallback=function(z){var ee=g;return function(){var L=g;g=ee;try{return z.apply(this,arguments)}finally{g=L}}}})(kx)),kx}var nA;function wV(){return nA||(nA=1,Sx.exports=bV()),Sx.exports}/**
27 * @license React
28 * react-dom.production.min.js
29 *
30 * Copyright (c) Facebook, Inc. and its affiliates.
31 *
32 * This source code is licensed under the MIT license found in the
33 * LICENSE file in the root directory of this source tree.
34 */var sA;function xV(){if(sA)return Js;sA=1;var t=Vj(),e=wV();function r(c){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+c,m=1;m<arguments.length;m++)d+="&args[]="+encodeURIComponent(arguments[m]);return"Minified React error #"+c+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var n=new Set,s={};function i(c,d){a(c,d),a(c+"Capture",d)}function a(c,d){for(s[c]=d,c=0;c<d.length;c++)n.add(d[c])}var l=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},f={};function g(c){return u.call(f,c)?!0:u.call(p,c)?!1:h.test(c)?f[c]=!0:(p[c]=!0,!1)}function v(c,d,m,b){if(m!==null&&m.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return b?!1:m!==null?!m.acceptsBooleans:(c=c.toLowerCase().slice(0,5),c!=="data-"&&c!=="aria-");default:return!1}}function _(c,d,m,b){if(d===null||typeof d>"u"||v(c,d,m,b))return!0;if(b)return!1;if(m!==null)switch(m.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function x(c,d,m,b,E,N,D){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=b,this.attributeNamespace=E,this.mustUseProperty=m,this.propertyName=c,this.type=d,this.sanitizeURL=N,this.removeEmptyString=D}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(c){w[c]=new x(c,0,!1,c,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(c){var d=c[0];w[d]=new x(d,1,!1,c[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(c){w[c]=new x(c,2,!1,c.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(c){w[c]=new x(c,2,!1,c,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(c){w[c]=new x(c,3,!1,c.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(c){w[c]=new x(c,3,!0,c,null,!1,!1)}),["capture","download"].forEach(function(c){w[c]=new x(c,4,!1,c,null,!1,!1)}),["cols","rows","size","span"].forEach(function(c){w[c]=new x(c,6,!1,c,null,!1,!1)}),["rowSpan","start"].forEach(function(c){w[c]=new x(c,5,!1,c.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function k(c){return c[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(c){var d=c.replace(S,k);w[d]=new x(d,1,!1,c,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(c){var d=c.replace(S,k);w[d]=new x(d,1,!1,c,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(c){var d=c.replace(S,k);w[d]=new x(d,1,!1,c,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(c){w[c]=new x(c,1,!1,c.toLowerCase(),null,!1,!1)}),w.xlinkHref=new x("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(c){w[c]=new x(c,1,!1,c.toLowerCase(),null,!0,!0)});function j(c,d,m,b){var E=w.hasOwnProperty(d)?w[d]:null;(E!==null?E.type!==0:b||!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(_(d,m,E,b)&&(m=null),b||E===null?g(d)&&(m===null?c.removeAttribute(d):c.setAttribute(d,""+m)):E.mustUseProperty?c[E.propertyName]=m===null?E.type===3?!1:"":m:(d=E.attributeName,b=E.attributeNamespace,m===null?c.removeAttribute(d):(E=E.type,m=E===3||E===4&&m===!0?"":""+m,b?c.setAttributeNS(b,d,m):c.setAttribute(d,m))))}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,R=Symbol.for("react.element"),A=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),O=Symbol.for("react.provider"),G=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),B=Symbol.for("react.offscreen"),z=Symbol.iterator;function ee(c){return c===null||typeof c!="object"?null:(c=z&&c[z]||c["@@iterator"],typeof c=="function"?c:null)}var L=Object.assign,$;function F(c){if($===void 0)try{throw Error()}catch(m){var d=m.stack.trim().match(/\n( *(at )?)/);$=d&&d[1]||""}return`
35`+$+c}var te=!1;function ue(c,d){if(!c||te)return"";te=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(d)if(d=function(){throw Error()},Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(ge){var b=ge}Reflect.construct(c,[],d)}else{try{d.call()}catch(ge){b=ge}c.call(d.prototype)}else{try{throw Error()}catch(ge){b=ge}c()}}catch(ge){if(ge&&b&&typeof ge.stack=="string"){for(var E=ge.stack.split(`
36`),N=b.stack.split(`
37`),D=E.length-1,Q=N.length-1;1<=D&&0<=Q&&E[D]!==N[Q];)Q--;for(;1<=D&&0<=Q;D--,Q--)if(E[D]!==N[Q]){if(D!==1||Q!==1)do if(D--,Q--,0>Q||E[D]!==N[Q]){var ne=`
38`+E[D].replace(" at new "," at ");return c.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",c.displayName)),ne}while(1<=D&&0<=Q);break}}}finally{te=!1,Error.prepareStackTrace=m}return(c=c?c.displayName||c.name:"")?F(c):""}function re(c){switch(c.tag){case 5:return F(c.type);case 16:return F("Lazy");case 13:return F("Suspense");case 19:return F("SuspenseList");case 0:case 2:case 15:return c=ue(c.type,!1),c;case 11:return c=ue(c.type.render,!1),c;case 1:return c=ue(c.type,!0),c;default:return""}}function se(c){if(c==null)return null;if(typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case I:return"Fragment";case A:return"Portal";case T:return"Profiler";case P:return"StrictMode";case U:return"Suspense";case V:return"SuspenseList"}if(typeof c=="object")switch(c.$$typeof){case G:return(c.displayName||"Context")+".Consumer";case O:return(c._context.displayName||"Context")+".Provider";case M:var d=c.render;return c=c.displayName,c||(c=d.displayName||d.name||"",c=c!==""?"ForwardRef("+c+")":"ForwardRef"),c;case H:return d=c.displayName||null,d!==null?d:se(c.type)||"Memo";case Y:d=c._payload,c=c._init;try{return se(c(d))}catch{}}return null}function ye(c){var d=c.type;switch(c.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return c=d.render,c=c.displayName||c.name||"",d.displayName||(c!==""?"ForwardRef("+c+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return se(d);case 8:return d===P?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function de(c){switch(typeof c){case"boolean":case"number":case"string":case"undefined":return c;case"object":return c;default:return""}}function pe(c){var d=c.type;return(c=c.nodeName)&&c.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function Ie(c){var d=pe(c)?"checked":"value",m=Object.getOwnPropertyDescriptor(c.constructor.prototype,d),b=""+c[d];if(!c.hasOwnProperty(d)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var E=m.get,N=m.set;return Object.defineProperty(c,d,{configurable:!0,get:function(){return E.call(this)},set:function(D){b=""+D,N.call(this,D)}}),Object.defineProperty(c,d,{enumerable:m.enumerable}),{getValue:function(){return b},setValue:function(D){b=""+D},stopTracking:function(){c._valueTracker=null,delete c[d]}}}}function Ne(c){c._valueTracker||(c._valueTracker=Ie(c))}function He(c){if(!c)return!1;var d=c._valueTracker;if(!d)return!0;var m=d.getValue(),b="";return c&&(b=pe(c)?c.checked?"true":"false":c.value),c=b,c!==m?(d.setValue(c),!0):!1}function We(c){if(c=c||(typeof document<"u"?document:void 0),typeof c>"u")return null;try{return c.activeElement||c.body}catch{return c.body}}function at(c,d){var m=d.checked;return L({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:m??c._wrapperState.initialChecked})}function Xt(c,d){var m=d.defaultValue==null?"":d.defaultValue,b=d.checked!=null?d.checked:d.defaultChecked;m=de(d.value!=null?d.value:m),c._wrapperState={initialChecked:b,initialValue:m,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function Rt(c,d){d=d.checked,d!=null&&j(c,"checked",d,!1)}function Ee(c,d){Rt(c,d);var m=de(d.value),b=d.type;if(m!=null)b==="number"?(m===0&&c.value===""||c.value!=m)&&(c.value=""+m):c.value!==""+m&&(c.value=""+m);else if(b==="submit"||b==="reset"){c.removeAttribute("value");return}d.hasOwnProperty("value")?Mt(c,d.type,m):d.hasOwnProperty("defaultValue")&&Mt(c,d.type,de(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(c.defaultChecked=!!d.defaultChecked)}function Et(c,d,m){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var b=d.type;if(!(b!=="submit"&&b!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+c._wrapperState.initialValue,m||d===c.value||(c.value=d),c.defaultValue=d}m=c.name,m!==""&&(c.name=""),c.defaultChecked=!!c._wrapperState.initialChecked,m!==""&&(c.name=m)}function Mt(c,d,m){(d!=="number"||We(c.ownerDocument)!==c)&&(m==null?c.defaultValue=""+c._wrapperState.initialValue:c.defaultValue!==""+m&&(c.defaultValue=""+m))}var ot=Array.isArray;function De(c,d,m,b){if(c=c.options,d){d={};for(var E=0;E<m.length;E++)d["$"+m[E]]=!0;for(m=0;m<c.length;m++)E=d.hasOwnProperty("$"+c[m].value),c[m].selected!==E&&(c[m].selected=E),E&&b&&(c[m].defaultSelected=!0)}else{for(m=""+de(m),d=null,E=0;E<c.length;E++){if(c[E].value===m){c[E].selected=!0,b&&(c[E].defaultSelected=!0);return}d!==null||c[E].disabled||(d=c[E])}d!==null&&(d.selected=!0)}}function St(c,d){if(d.dangerouslySetInnerHTML!=null)throw Error(r(91));return L({},d,{value:void 0,defaultValue:void 0,children:""+c._wrapperState.initialValue})}function jt(c,d){var m=d.value;if(m==null){if(m=d.children,d=d.defaultValue,m!=null){if(d!=null)throw Error(r(92));if(ot(m)){if(1<m.length)throw Error(r(93));m=m[0]}d=m}d==null&&(d=""),m=d}c._wrapperState={initialValue:de(m)}}function Cr(c,d){var m=de(d.value),b=de(d.defaultValue);m!=null&&(m=""+m,m!==c.value&&(c.value=m),d.defaultValue==null&&c.defaultValue!==m&&(c.defaultValue=m)),b!=null&&(c.defaultValue=""+b)}function Or(c){var d=c.textContent;d===c._wrapperState.initialValue&&d!==""&&d!==null&&(c.value=d)}function Nr(c){switch(c){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function rr(c,d){return c==null||c==="http://www.w3.org/1999/xhtml"?Nr(d):c==="http://www.w3.org/2000/svg"&&d==="foreignObject"?"http://www.w3.org/1999/xhtml":c}var Pr,At=(function(c){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(d,m,b,E){MSApp.execUnsafeLocalFunction(function(){return c(d,m,b,E)})}:c})(function(c,d){if(c.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in c)c.innerHTML=d;else{for(Pr=Pr||document.createElement("div"),Pr.innerHTML="<svg>"+d.valueOf().toString()+"</svg>",d=Pr.firstChild;c.firstChild;)c.removeChild(c.firstChild);for(;d.firstChild;)c.appendChild(d.firstChild)}});function ar(c,d){if(d){var m=c.firstChild;if(m&&m===c.lastChild&&m.nodeType===3){m.nodeValue=d;return}}c.textContent=d}var wn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},W=["Webkit","ms","Moz","O"];Object.keys(wn).forEach(function(c){W.forEach(function(d){d=d+c.charAt(0).toUpperCase()+c.substring(1),wn[d]=wn[c]})});function ie(c,d,m){return d==null||typeof d=="boolean"||d===""?"":m||typeof d!="number"||d===0||wn.hasOwnProperty(c)&&wn[c]?(""+d).trim():d+"px"}function le(c,d){c=c.style;for(var m in d)if(d.hasOwnProperty(m)){var b=m.indexOf("--")===0,E=ie(m,d[m],b);m==="float"&&(m="cssFloat"),b?c.setProperty(m,E):c[m]=E}}var be=L({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function je(c,d){if(d){if(be[c]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(r(137,c));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(r(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(r(61))}if(d.style!=null&&typeof d.style!="object")throw Error(r(62))}}function Be(c,d){if(c.indexOf("-")===-1)return typeof d.is=="string";switch(c){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Te=null;function Oe(c){return c=c.target||c.srcElement||window,c.correspondingUseElement&&(c=c.correspondingUseElement),c.nodeType===3?c.parentNode:c}var ae=null,Ge=null,Ft=null;function or(c){if(c=jp(c)){if(typeof ae!="function")throw Error(r(280));var d=c.stateNode;d&&(d=_v(d),ae(c.stateNode,c.type,d))}}function Ze(c){Ge?Ft?Ft.push(c):Ft=[c]:Ge=c}function Gt(){if(Ge){var c=Ge,d=Ft;if(Ft=Ge=null,or(c),d)for(c=0;c<d.length;c++)or(d[c])}}function _t(c,d){return c(d)}function Kt(){}var zr=!1;function ur(c,d,m){if(zr)return c(d,m);zr=!0;try{return _t(c,d,m)}finally{zr=!1,(Ge!==null||Ft!==null)&&(Kt(),Gt())}}function Tt(c,d){var m=c.stateNode;if(m===null)return null;var b=_v(m);if(b===null)return null;m=b[d];e:switch(d){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(b=!b.disabled)||(c=c.type,b=!(c==="button"||c==="input"||c==="select"||c==="textarea")),c=!b;break e;default:c=!1}if(c)return null;if(m&&typeof m!="function")throw Error(r(231,d,typeof m));return m}var xn=!1;if(l)try{var Ur={};Object.defineProperty(Ur,"passive",{get:function(){xn=!0}}),window.addEventListener("test",Ur,Ur),window.removeEventListener("test",Ur,Ur)}catch{xn=!1}function Z(c,d,m,b,E,N,D,Q,ne){var ge=Array.prototype.slice.call(arguments,3);try{d.apply(m,ge)}catch(Ae){this.onError(Ae)}}var J=!1,ce=null,Se=!1,_e=null,Re={onError:function(c){J=!0,ce=c}};function Ke(c,d,m,b,E,N,D,Q,ne){J=!1,ce=null,Z.apply(Re,arguments)}function Ct(c,d,m,b,E,N,D,Q,ne){if(Ke.apply(this,arguments),J){if(J){var ge=ce;J=!1,ce=null}else throw Error(r(198));Se||(Se=!0,_e=ge)}}function qe(c){var d=c,m=c;if(c.alternate)for(;d.return;)d=d.return;else{c=d;do d=c,(d.flags&4098)!==0&&(m=d.return),c=d.return;while(c)}return d.tag===3?m:null}function pt(c){if(c.tag===13){var d=c.memoizedState;if(d===null&&(c=c.alternate,c!==null&&(d=c.memoizedState)),d!==null)return d.dehydrated}return null}function et(c){if(qe(c)!==c)throw Error(r(188))}function kt(c){var d=c.alternate;if(!d){if(d=qe(c),d===null)throw Error(r(188));return d!==c?null:c}for(var m=c,b=d;;){var E=m.return;if(E===null)break;var N=E.alternate;if(N===null){if(b=E.return,b!==null){m=b;continue}break}if(E.child===N.child){for(N=E.child;N;){if(N===m)return et(E),c;if(N===b)return et(E),d;N=N.sibling}throw Error(r(188))}if(m.return!==b.return)m=E,b=N;else{for(var D=!1,Q=E.child;Q;){if(Q===m){D=!0,m=E,b=N;break}if(Q===b){D=!0,b=E,m=N;break}Q=Q.sibling}if(!D){for(Q=N.child;Q;){if(Q===m){D=!0,m=N,b=E;break}if(Q===b){D=!0,b=N,m=E;break}Q=Q.sibling}if(!D)throw Error(r(189))}}if(m.alternate!==b)throw Error(r(190))}if(m.tag!==3)throw Error(r(188));return m.stateNode.current===m?c:d}function mt(c){return c=kt(c),c!==null?er(c):null}function er(c){if(c.tag===5||c.tag===6)return c;for(c=c.child;c!==null;){var d=er(c);if(d!==null)return d;c=c.sibling}return null}var vr=e.unstable_scheduleCallback,Wr=e.unstable_cancelCallback,Bt=e.unstable_shouldYield,lr=e.unstable_requestPaint,Jt=e.unstable_now,Hn=e.unstable_getCurrentPriorityLevel,qs=e.unstable_ImmediatePriority,cs=e.unstable_UserBlockingPriority,vi=e.unstable_NormalPriority,Vi=e.unstable_LowPriority,us=e.unstable_IdlePriority,Hi=null,ln=null;function Sa(c){if(ln&&typeof ln.onCommitFiberRoot=="function")try{ln.onCommitFiberRoot(Hi,c,void 0,(c.current.flags&128)===128)}catch{}}var tn=Math.clz32?Math.clz32:Sn,Ko=Math.log,Yt=Math.LN2;function Sn(c){return c>>>=0,c===0?32:31-(Ko(c)/Yt|0)|0}var ts=64,pn=4194304;function yi(c){switch(c&-c){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return c&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return c&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return c}}function xs(c,d){var m=c.pendingLanes;if(m===0)return 0;var b=0,E=c.suspendedLanes,N=c.pingedLanes,D=m&268435455;if(D!==0){var Q=D&~E;Q!==0?b=yi(Q):(N&=D,N!==0&&(b=yi(N)))}else D=m&~E,D!==0?b=yi(D):N!==0&&(b=yi(N));if(b===0)return 0;if(d!==0&&d!==b&&(d&E)===0&&(E=b&-b,N=d&-d,E>=N||E===16&&(N&4194240)!==0))return d;if((b&4)!==0&&(b|=m&16),d=c.entangledLanes,d!==0)for(c=c.entanglements,d&=b;0<d;)m=31-tn(d),E=1<<m,b|=c[m],d&=~E;return b}function Rr(c,d){switch(c){case 1:case 2:case 4:return d+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ka(c,d){for(var m=c.suspendedLanes,b=c.pingedLanes,E=c.expirationTimes,N=c.pendingLanes;0<N;){var D=31-tn(N),Q=1<<D,ne=E[D];ne===-1?((Q&m)===0||(Q&b)!==0)&&(E[D]=Rr(Q,d)):ne<=d&&(c.expiredLanes|=Q),N&=~Q}}function rc(c){return c=c.pendingLanes&-1073741825,c!==0?c:c&1073741824?1073741824:0}function Bd(){var c=ts;return ts<<=1,(ts&4194240)===0&&(ts=64),c}function qi(c){for(var d=[],m=0;31>m;m++)d.push(c);return d}function nc(c,d,m){c.pendingLanes|=d,d!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,d=31-tn(d),c[d]=m}function cp(c,d){var m=c.pendingLanes&~d;c.pendingLanes=d,c.suspendedLanes=0,c.pingedLanes=0,c.expiredLanes&=d,c.mutableReadLanes&=d,c.entangledLanes&=d,d=c.entanglements;var b=c.eventTimes;for(c=c.expirationTimes;0<m;){var E=31-tn(m),N=1<<E;d[E]=0,b[E]=-1,c[E]=-1,m&=~N}}function sc(c,d){var m=c.entangledLanes|=d;for(c=c.entanglements;m;){var b=31-tn(m),E=1<<b;E&d|c[b]&d&&(c[b]|=d),m&=~E}}var nr=0;function Vd(c){return c&=-c,1<c?4<c?(c&268435455)!==0?16:536870912:4:1}var gu,up,vu,dp,_i,Yo=!1,Hd=[],so=null,Wi=null,Ea=null,ja=new Map,yu=new Map,io=[],ao="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function oo(c,d){switch(c){case"focusin":case"focusout":so=null;break;case"dragenter":case"dragleave":Wi=null;break;case"mouseover":case"mouseout":Ea=null;break;case"pointerover":case"pointerout":ja.delete(d.pointerId);break;case"gotpointercapture":case"lostpointercapture":yu.delete(d.pointerId)}}function _u(c,d,m,b,E,N){return c===null||c.nativeEvent!==N?(c={blockedOn:d,domEventName:m,eventSystemFlags:b,nativeEvent:N,targetContainers:[E]},d!==null&&(d=jp(d),d!==null&&up(d)),c):(c.eventSystemFlags|=b,d=c.targetContainers,E!==null&&d.indexOf(E)===-1&&d.push(E),c)}function ov(c,d,m,b,E){switch(d){case"focusin":return so=_u(so,c,d,m,b,E),!0;case"dragenter":return Wi=_u(Wi,c,d,m,b,E),!0;case"mouseover":return Ea=_u(Ea,c,d,m,b,E),!0;case"pointerover":var N=E.pointerId;return ja.set(N,_u(ja.get(N)||null,c,d,m,b,E)),!0;case"gotpointercapture":return N=E.pointerId,yu.set(N,_u(yu.get(N)||null,c,d,m,b,E)),!0}return!1}function hp(c){var d=xu(c.target);if(d!==null){var m=qe(d);if(m!==null){if(d=m.tag,d===13){if(d=pt(m),d!==null){c.blockedOn=d,_i(c.priority,function(){vu(m)});return}}else if(d===3&&m.stateNode.current.memoizedState.isDehydrated){c.blockedOn=m.tag===3?m.stateNode.containerInfo:null;return}}}c.blockedOn=null}function qd(c){if(c.blockedOn!==null)return!1;for(var d=c.targetContainers;0<d.length;){var m=pp(c.domEventName,c.eventSystemFlags,d[0],c.nativeEvent);if(m===null){m=c.nativeEvent;var b=new m.constructor(m.type,m);Te=b,m.target.dispatchEvent(b),Te=null}else return d=jp(m),d!==null&&up(d),c.blockedOn=m,!1;d.shift()}return!0}function lv(c,d,m){qd(c)&&m.delete(d)}function Gw(){Yo=!1,so!==null&&qd(so)&&(so=null),Wi!==null&&qd(Wi)&&(Wi=null),Ea!==null&&qd(Ea)&&(Ea=null),ja.forEach(lv),yu.forEach(lv)}function bu(c,d){c.blockedOn===d&&(c.blockedOn=null,Yo||(Yo=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Gw)))}function wu(c){function d(E){return bu(E,c)}if(0<Hd.length){bu(Hd[0],c);for(var m=1;m<Hd.length;m++){var b=Hd[m];b.blockedOn===c&&(b.blockedOn=null)}}for(so!==null&&bu(so,c),Wi!==null&&bu(Wi,c),Ea!==null&&bu(Ea,c),ja.forEach(d),yu.forEach(d),m=0;m<io.length;m++)b=io[m],b.blockedOn===c&&(b.blockedOn=null);for(;0<io.length&&(m=io[0],m.blockedOn===null);)hp(m),m.blockedOn===null&&io.shift()}var ic=C.ReactCurrentBatchConfig,Wd=!0;function Kw(c,d,m,b){var E=nr,N=ic.transition;ic.transition=null;try{nr=1,fp(c,d,m,b)}finally{nr=E,ic.transition=N}}function Yw(c,d,m,b){var E=nr,N=ic.transition;ic.transition=null;try{nr=4,fp(c,d,m,b)}finally{nr=E,ic.transition=N}}function fp(c,d,m,b){if(Wd){var E=pp(c,d,m,b);if(E===null)c0(c,d,b,Gd,m),oo(c,b);else if(ov(E,c,d,m,b))b.stopPropagation();else if(oo(c,b),d&4&&-1<ao.indexOf(c)){for(;E!==null;){var N=jp(E);if(N!==null&&gu(N),N=pp(c,d,m,b),N===null&&c0(c,d,b,Gd,m),N===E)break;E=N}E!==null&&b.stopPropagation()}else c0(c,d,b,null,m)}}var Gd=null;function pp(c,d,m,b){if(Gd=null,c=Oe(b),c=xu(c),c!==null)if(d=qe(c),d===null)c=null;else if(m=d.tag,m===13){if(c=pt(d),c!==null)return c;c=null}else if(m===3){if(d.stateNode.current.memoizedState.isDehydrated)return d.tag===3?d.stateNode.containerInfo:null;c=null}else d!==c&&(c=null);return Gd=c,null}function cv(c){switch(c){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Hn()){case qs:return 1;case cs:return 4;case vi:case Vi:return 16;case us:return 536870912;default:return 16}default:return 16}}var lo=null,mp=null,Zo=null;function uv(){if(Zo)return Zo;var c,d=mp,m=d.length,b,E="value"in lo?lo.value:lo.textContent,N=E.length;for(c=0;c<m&&d[c]===E[c];c++);var D=m-c;for(b=1;b<=D&&d[m-b]===E[N-b];b++);return Zo=E.slice(c,1<b?1-b:void 0)}function Kd(c){var d=c.keyCode;return"charCode"in c?(c=c.charCode,c===0&&d===13&&(c=13)):c=d,c===10&&(c=13),32<=c||c===13?c:0}function Yd(){return!0}function gp(){return!1}function Ss(c){function d(m,b,E,N,D){this._reactName=m,this._targetInst=E,this.type=b,this.nativeEvent=N,this.target=D,this.currentTarget=null;for(var Q in c)c.hasOwnProperty(Q)&&(m=c[Q],this[Q]=m?m(N):N[Q]);return this.isDefaultPrevented=(N.defaultPrevented!=null?N.defaultPrevented:N.returnValue===!1)?Yd:gp,this.isPropagationStopped=gp,this}return L(d.prototype,{preventDefault:function(){this.defaultPrevented=!0;var m=this.nativeEvent;m&&(m.preventDefault?m.preventDefault():typeof m.returnValue!="unknown"&&(m.returnValue=!1),this.isDefaultPrevented=Yd)},stopPropagation:function(){var m=this.nativeEvent;m&&(m.stopPropagation?m.stopPropagation():typeof m.cancelBubble!="unknown"&&(m.cancelBubble=!0),this.isPropagationStopped=Yd)},persist:function(){},isPersistent:Yd}),d}var Jo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(c){return c.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zd=Ss(Jo),ac=L({},Jo,{view:0,detail:0}),dv=Ss(ac),Jd,Qd,q,ve=L({},ac,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qw,button:0,buttons:0,relatedTarget:function(c){return c.relatedTarget===void 0?c.fromElement===c.srcElement?c.toElement:c.fromElement:c.relatedTarget},movementX:function(c){return"movementX"in c?c.movementX:(c!==q&&(q&&c.type==="mousemove"?(Jd=c.screenX-q.screenX,Qd=c.screenY-q.screenY):Qd=Jd=0,q=c),Jd)},movementY:function(c){return"movementY"in c?c.movementY:Qd}}),ut=Ss(ve),sr=L({},ve,{dataTransfer:0}),Ot=Ss(sr),Gr=L({},ac,{relatedTarget:0}),yr=Ss(Gr),Ln=L({},Jo,{animationName:0,elapsedTime:0,pseudoElement:0}),bi=Ss(Ln),oc=L({},Jo,{clipboardData:function(c){return"clipboardData"in c?c.clipboardData:window.clipboardData}}),Zw=Ss(oc),Jw=L({},Jo,{data:0}),UN=Ss(Jw),ZB={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},JB={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},QB={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function XB(c){var d=this.nativeEvent;return d.getModifierState?d.getModifierState(c):(c=QB[c])?!!d[c]:!1}function Qw(){return XB}var e6=L({},ac,{key:function(c){if(c.key){var d=ZB[c.key]||c.key;if(d!=="Unidentified")return d}return c.type==="keypress"?(c=Kd(c),c===13?"Enter":String.fromCharCode(c)):c.type==="keydown"||c.type==="keyup"?JB[c.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qw,charCode:function(c){return c.type==="keypress"?Kd(c):0},keyCode:function(c){return c.type==="keydown"||c.type==="keyup"?c.keyCode:0},which:function(c){return c.type==="keypress"?Kd(c):c.type==="keydown"||c.type==="keyup"?c.keyCode:0}}),t6=Ss(e6),r6=L({},ve,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),BN=Ss(r6),n6=L({},ac,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qw}),s6=Ss(n6),i6=L({},Jo,{propertyName:0,elapsedTime:0,pseudoElement:0}),a6=Ss(i6),o6=L({},ve,{deltaX:function(c){return"deltaX"in c?c.deltaX:"wheelDeltaX"in c?-c.wheelDeltaX:0},deltaY:function(c){return"deltaY"in c?c.deltaY:"wheelDeltaY"in c?-c.wheelDeltaY:"wheelDelta"in c?-c.wheelDelta:0},deltaZ:0,deltaMode:0}),l6=Ss(o6),c6=[9,13,27,32],Xw=l&&"CompositionEvent"in window,vp=null;l&&"documentMode"in document&&(vp=document.documentMode);var u6=l&&"TextEvent"in window&&!vp,VN=l&&(!Xw||vp&&8<vp&&11>=vp),HN=" ",qN=!1;function WN(c,d){switch(c){case"keyup":return c6.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function GN(c){return c=c.detail,typeof c=="object"&&"data"in c?c.data:null}var Xd=!1;function d6(c,d){switch(c){case"compositionend":return GN(d);case"keypress":return d.which!==32?null:(qN=!0,HN);case"textInput":return c=d.data,c===HN&&qN?null:c;default:return null}}function h6(c,d){if(Xd)return c==="compositionend"||!Xw&&WN(c,d)?(c=uv(),Zo=mp=lo=null,Xd=!1,c):null;switch(c){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1<d.char.length)return d.char;if(d.which)return String.fromCharCode(d.which)}return null;case"compositionend":return VN&&d.locale!=="ko"?null:d.data;default:return null}}var f6={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function KN(c){var d=c&&c.nodeName&&c.nodeName.toLowerCase();return d==="input"?!!f6[c.type]:d==="textarea"}function YN(c,d,m,b){Ze(b),d=gv(d,"onChange"),0<d.length&&(m=new Zd("onChange","change",null,m,b),c.push({event:m,listeners:d}))}var yp=null,_p=null;function p6(c){fP(c,0)}function hv(c){var d=sh(c);if(He(d))return c}function m6(c,d){if(c==="change")return d}var ZN=!1;if(l){var e0;if(l){var t0="oninput"in document;if(!t0){var JN=document.createElement("div");JN.setAttribute("oninput","return;"),t0=typeof JN.oninput=="function"}e0=t0}else e0=!1;ZN=e0&&(!document.documentMode||9<document.documentMode)}function QN(){yp&&(yp.detachEvent("onpropertychange",XN),_p=yp=null)}function XN(c){if(c.propertyName==="value"&&hv(_p)){var d=[];YN(d,_p,c,Oe(c)),ur(p6,d)}}function g6(c,d,m){c==="focusin"?(QN(),yp=d,_p=m,yp.attachEvent("onpropertychange",XN)):c==="focusout"&&QN()}function v6(c){if(c==="selectionchange"||c==="keyup"||c==="keydown")return hv(_p)}function y6(c,d){if(c==="click")return hv(d)}function _6(c,d){if(c==="input"||c==="change")return hv(d)}function b6(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var Ca=typeof Object.is=="function"?Object.is:b6;function bp(c,d){if(Ca(c,d))return!0;if(typeof c!="object"||c===null||typeof d!="object"||d===null)return!1;var m=Object.keys(c),b=Object.keys(d);if(m.length!==b.length)return!1;for(b=0;b<m.length;b++){var E=m[b];if(!u.call(d,E)||!Ca(c[E],d[E]))return!1}return!0}function eP(c){for(;c&&c.firstChild;)c=c.firstChild;return c}function tP(c,d){var m=eP(c);c=0;for(var b;m;){if(m.nodeType===3){if(b=c+m.textContent.length,c<=d&&b>=d)return{node:m,offset:d-c};c=b}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=eP(m)}}function rP(c,d){return c&&d?c===d?!0:c&&c.nodeType===3?!1:d&&d.nodeType===3?rP(c,d.parentNode):"contains"in c?c.contains(d):c.compareDocumentPosition?!!(c.compareDocumentPosition(d)&16):!1:!1}function nP(){for(var c=window,d=We();d instanceof c.HTMLIFrameElement;){try{var m=typeof d.contentWindow.location.href=="string"}catch{m=!1}if(m)c=d.contentWindow;else break;d=We(c.document)}return d}function r0(c){var d=c&&c.nodeName&&c.nodeName.toLowerCase();return d&&(d==="input"&&(c.type==="text"||c.type==="search"||c.type==="tel"||c.type==="url"||c.type==="password")||d==="textarea"||c.contentEditable==="true")}function w6(c){var d=nP(),m=c.focusedElem,b=c.selectionRange;if(d!==m&&m&&m.ownerDocument&&rP(m.ownerDocument.documentElement,m)){if(b!==null&&r0(m)){if(d=b.start,c=b.end,c===void 0&&(c=d),"selectionStart"in m)m.selectionStart=d,m.selectionEnd=Math.min(c,m.value.length);else if(c=(d=m.ownerDocument||document)&&d.defaultView||window,c.getSelection){c=c.getSelection();var E=m.textContent.length,N=Math.min(b.start,E);b=b.end===void 0?N:Math.min(b.end,E),!c.extend&&N>b&&(E=b,b=N,N=E),E=tP(m,N);var D=tP(m,b);E&&D&&(c.rangeCount!==1||c.anchorNode!==E.node||c.anchorOffset!==E.offset||c.focusNode!==D.node||c.focusOffset!==D.offset)&&(d=d.createRange(),d.setStart(E.node,E.offset),c.removeAllRanges(),N>b?(c.addRange(d),c.extend(D.node,D.offset)):(d.setEnd(D.node,D.offset),c.addRange(d)))}}for(d=[],c=m;c=c.parentNode;)c.nodeType===1&&d.push({element:c,left:c.scrollLeft,top:c.scrollTop});for(typeof m.focus=="function"&&m.focus(),m=0;m<d.length;m++)c=d[m],c.element.scrollLeft=c.left,c.element.scrollTop=c.top}}var x6=l&&"documentMode"in document&&11>=document.documentMode,eh=null,n0=null,wp=null,s0=!1;function sP(c,d,m){var b=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;s0||eh==null||eh!==We(b)||(b=eh,"selectionStart"in b&&r0(b)?b={start:b.selectionStart,end:b.selectionEnd}:(b=(b.ownerDocument&&b.ownerDocument.defaultView||window).getSelection(),b={anchorNode:b.anchorNode,anchorOffset:b.anchorOffset,focusNode:b.focusNode,focusOffset:b.focusOffset}),wp&&bp(wp,b)||(wp=b,b=gv(n0,"onSelect"),0<b.length&&(d=new Zd("onSelect","select",null,d,m),c.push({event:d,listeners:b}),d.target=eh)))}function fv(c,d){var m={};return m[c.toLowerCase()]=d.toLowerCase(),m["Webkit"+c]="webkit"+d,m["Moz"+c]="moz"+d,m}var th={animationend:fv("Animation","AnimationEnd"),animationiteration:fv("Animation","AnimationIteration"),animationstart:fv("Animation","AnimationStart"),transitionend:fv("Transition","TransitionEnd")},i0={},iP={};l&&(iP=document.createElement("div").style,"AnimationEvent"in window||(delete th.animationend.animation,delete th.animationiteration.animation,delete th.animationstart.animation),"TransitionEvent"in window||delete th.transitionend.transition);function pv(c){if(i0[c])return i0[c];if(!th[c])return c;var d=th[c],m;for(m in d)if(d.hasOwnProperty(m)&&m in iP)return i0[c]=d[m];return c}var aP=pv("animationend"),oP=pv("animationiteration"),lP=pv("animationstart"),cP=pv("transitionend"),uP=new Map,dP="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function lc(c,d){uP.set(c,d),i(d,[c])}for(var a0=0;a0<dP.length;a0++){var o0=dP[a0],S6=o0.toLowerCase(),k6=o0[0].toUpperCase()+o0.slice(1);lc(S6,"on"+k6)}lc(aP,"onAnimationEnd"),lc(oP,"onAnimationIteration"),lc(lP,"onAnimationStart"),lc("dblclick","onDoubleClick"),lc("focusin","onFocus"),lc("focusout","onBlur"),lc(cP,"onTransitionEnd"),a("onMouseEnter",["mouseout","mouseover"]),a("onMouseLeave",["mouseout","mouseover"]),a("onPointerEnter",["pointerout","pointerover"]),a("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focu
38sin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xp="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),E6=new Set("cancel close invalid load scroll toggle".split(" ").concat(xp));function hP(c,d,m){var b=c.type||"unknown-event";c.currentTarget=m,Ct(b,d,void 0,c),c.currentTarget=null}function fP(c,d){d=(d&4)!==0;for(var m=0;m<c.length;m++){var b=c[m],E=b.event;b=b.listeners;e:{var N=void 0;if(d)for(var D=b.length-1;0<=D;D--){var Q=b[D],ne=Q.instance,ge=Q.currentTarget;if(Q=Q.listener,ne!==N&&E.isPropagationStopped())break e;hP(E,Q,ge),N=ne}else for(D=0;D<b.length;D++){if(Q=b[D],ne=Q.instance,ge=Q.currentTarget,Q=Q.listener,ne!==N&&E.isPropagationStopped())break e;hP(E,Q,ge),N=ne}}}if(Se)throw c=_e,Se=!1,_e=null,c}function Kr(c,d){var m=d[m0];m===void 0&&(m=d[m0]=new Set);var b=c+"__bubble";m.has(b)||(pP(d,c,2,!1),m.add(b))}function l0(c,d,m){var b=0;d&&(b|=4),pP(m,c,b,d)}var mv="_reactListening"+Math.random().toString(36).slice(2);function Sp(c){if(!c[mv]){c[mv]=!0,n.forEach(function(m){m!=="selectionchange"&&(E6.has(m)||l0(m,!1,c),l0(m,!0,c))});var d=c.nodeType===9?c:c.ownerDocument;d===null||d[mv]||(d[mv]=!0,l0("selectionchange",!1,d))}}function pP(c,d,m,b){switch(cv(d)){case 1:var E=Kw;break;case 4:E=Yw;break;default:E=fp}m=E.bind(null,d,m,c),E=void 0,!xn||d!=="touchstart"&&d!=="touchmove"&&d!=="wheel"||(E=!0),b?E!==void 0?c.addEventListener(d,m,{capture:!0,passive:E}):c.addEventListener(d,m,!0):E!==void 0?c.addEventListener(d,m,{passive:E}):c.addEventListener(d,m,!1)}function c0(c,d,m,b,E){var N=b;if((d&1)===0&&(d&2)===0&&b!==null)e:for(;;){if(b===null)return;var D=b.tag;if(D===3||D===4){var Q=b.stateNode.containerInfo;if(Q===E||Q.nodeType===8&&Q.parentNode===E)break;if(D===4)for(D=b.return;D!==null;){var ne=D.tag;if((ne===3||ne===4)&&(ne=D.stateNode.containerInfo,ne===E||ne.nodeType===8&&ne.parentNode===E))return;D=D.return}for(;Q!==null;){if(D=xu(Q),D===null)return;if(ne=D.tag,ne===5||ne===6){b=N=D;continue e}Q=Q.parentNode}}b=b.return}ur(function(){var ge=N,Ae=Oe(m),Me=[];e:{var Pe=uP.get(c);if(Pe!==void 0){var tt=Zd,lt=c;switch(c){case"keypress":if(Kd(m)===0)break e;case"keydown":case"keyup":tt=t6;break;case"focusin":lt="focus",tt=yr;break;case"focusout":lt="blur",tt=yr;break;case"beforeblur":case"afterblur":tt=yr;break;case"click":if(m.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":tt=ut;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":tt=Ot;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":tt=s6;break;case aP:case oP:case lP:tt=bi;break;case cP:tt=a6;break;case"scroll":tt=dv;break;case"wheel":tt=l6;break;case"copy":case"cut":case"paste":tt=Zw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":tt=BN}var dt=(d&4)!==0,kn=!dt&&c==="scroll",he=dt?Pe!==null?Pe+"Capture":null:Pe;dt=[];for(var oe=ge,fe;oe!==null;){fe=oe;var Ve=fe.stateNode;if(fe.tag===5&&Ve!==null&&(fe=Ve,he!==null&&(Ve=Tt(oe,he),Ve!=null&&dt.push(kp(oe,Ve,fe)))),kn)break;oe=oe.return}0<dt.length&&(Pe=new tt(Pe,lt,null,m,Ae),Me.push({event:Pe,listeners:dt}))}}if((d&7)===0){e:{if(Pe=c==="mouseover"||c==="pointerover",tt=c==="mouseout"||c==="pointerout",Pe&&m!==Te&&(lt=m.relatedTarget||m.fromElement)&&(xu(lt)||lt[Qo]))break e;if((tt||Pe)&&(Pe=Ae.window===Ae?Ae:(Pe=Ae.ownerDocument)?Pe.defaultView||Pe.parentWindow:window,tt?(lt=m.relatedTarget||m.toElement,tt=ge,lt=lt?xu(lt):null,lt!==null&&(kn=qe(lt),lt!==kn||lt.tag!==5&&lt.tag!==6)&&(lt=null)):(tt=null,lt=ge),tt!==lt)){
vendor: 5,559 bytes, lines 38-39
38if(dt=ut,Ve="onMouseLeave",he="onMouseEnter",oe="mouse",(c==="pointerout"||c==="pointerover")&&(dt=BN,Ve="onPointerLeave",he="onPointerEnter",oe="pointer"),kn=tt==null?Pe:sh(tt),fe=lt==null?Pe:sh(lt),Pe=new dt(Ve,oe+"leave",tt,m,Ae),Pe.target=kn,Pe.relatedTarget=fe,Ve=null,xu(Ae)===ge&&(dt=new dt(he,oe+"enter",lt,m,Ae),dt.target=fe,dt.relatedTarget=kn,Ve=dt),kn=Ve,tt&&lt)t:{for(dt=tt,he=lt,oe=0,fe=dt;fe;fe=rh(fe))oe++;for(fe=0,Ve=he;Ve;Ve=rh(Ve))fe++;for(;0<oe-fe;)dt=rh(dt),oe--;for(;0<fe-oe;)he=rh(he),fe--;for(;oe--;){if(dt===he||he!==null&&dt===he.alternate)break t;dt=rh(dt),he=rh(he)}dt=null}else dt=null;tt!==null&&mP(Me,Pe,tt,dt,!1),lt!==null&&kn!==null&&mP(Me,kn,lt,dt,!0)}}e:{if(Pe=ge?sh(ge):window,tt=Pe.nodeName&&Pe.nodeName.toLowerCase(),tt==="select"||tt==="input"&&Pe.type==="file")var gt=m6;else if(KN(Pe))if(ZN)gt=_6;else{gt=v6;var It=g6}else(tt=Pe.nodeName)&&tt.toLowerCase()==="input"&&(Pe.type==="checkbox"||Pe.type==="radio")&&(gt=y6);if(gt&&(gt=gt(c,ge))){YN(Me,gt,m,Ae);break e}It&&It(c,Pe,ge),c==="focusout"&&(It=Pe._wrapperState)&&It.controlled&&Pe.type==="number"&&Mt(Pe,"number",Pe.value)}switch(It=ge?sh(ge):window,c){case"focusin":(KN(It)||It.contentEditable==="true")&&(eh=It,n0=ge,wp=null);break;case"focusout":wp=n0=eh=null;break;case"mousedown":s0=!0;break;case"contextmenu":case"mouseup":case"dragend":s0=!1,sP(Me,m,Ae);break;case"selectionchange":if(x6)break;case"keydown":case"keyup":sP(Me,m,Ae)}var Dt;if(Xw)e:{switch(c){case"compositionstart":var Ut="onCompositionStart";break e;case"compositionend":Ut="onCompositionEnd";break e;case"compositionupdate":Ut="onCompositionUpdate";break e}Ut=void 0}else Xd?WN(c,m)&&(Ut="onCompositionEnd"):c==="keydown"&&m.keyCode===229&&(Ut="onCompositionStart");Ut&&(VN&&m.locale!=="ko"&&(Xd||Ut!=="onCompositionStart"?Ut==="onCompositionEnd"&&Xd&&(Dt=uv()):(lo=Ae,mp="value"in lo?lo.value:lo.textContent,Xd=!0)),It=gv(ge,Ut),0<It.length&&(Ut=new UN(Ut,c,null,m,Ae),Me.push({event:Ut,listeners:It}),Dt?Ut.data=Dt:(Dt=GN(m),Dt!==null&&(Ut.data=Dt)))),(Dt=u6?d6(c,m):h6(c,m))&&(ge=gv(ge,"onBeforeInput"),0<ge.length&&(Ae=new UN("onBeforeInput","beforeinput",null,m,Ae),Me.push({event:Ae,listeners:ge}),Ae.data=Dt))}fP(Me,d)})}function kp(c,d,m){return{instance:c,listener:d,currentTarget:m}}function gv(c,d){for(var m=d+"Capture",b=[];c!==null;){var E=c,N=E.stateNode;E.tag===5&&N!==null&&(E=N,N=Tt(c,m),N!=null&&b.unshift(kp(c,N,E)),N=Tt(c,d),N!=null&&b.push(kp(c,N,E))),c=c.return}return b}function rh(c){if(c===null)return null;do c=c.return;while(c&&c.tag!==5);return c||null}function mP(c,d,m,b,E){for(var N=d._reactName,D=[];m!==null&&m!==b;){var Q=m,ne=Q.alternate,ge=Q.stateNode;if(ne!==null&&ne===b)break;Q.tag===5&&ge!==null&&(Q=ge,E?(ne=Tt(m,N),ne!=null&&D.unshift(kp(m,ne,Q))):E||(ne=Tt(m,N),ne!=null&&D.push(kp(m,ne,Q)))),m=m.return}D.length!==0&&c.push({event:d,listeners:D})}var j6=/\r\n?/g,C6=/\u0000|\uFFFD/g;function gP(c){return(typeof c=="string"?c:""+c).replace(j6,`
39`).replace(C6,"")}function vv(c,d,m){if(d=gP(d),gP(c)!==d&&m)throw Error(r(425))}function yv(){}var u0=null,d0=null;function h0(c,d){return c==="textarea"||c==="noscript"||typeof d.children=="string"||typeof d.children=="number"||typeof d.dangerouslySetInnerHTML=="object"&&d.dangerouslySetInnerHTML!==null&&d.dangerouslySetInnerHTML.__html!=null}var f0=typeof setTimeout=="function"?setTimeout:void 0,N6=typeof clearTimeout=="function"?clearTimeout:void 0,vP=typeof Promise=="function"?Promise:void 0,P6=typeof queueMicrotask=="function"?queueMicrotask:typeof vP<"u"?function(c){return vP.resolve(null).then(c).catch(R6)}:f0;function R6(c){setTimeout(function(){throw c})}function p0(c,d){var m=d,b=0;do{var E=m.nextSibling;if(c.removeChild(m),E&&E.nodeType===8)if(m=E.data,m==="/$"){if(b===0){c.removeChild(E),wu(d);return}b--}else m!=="$"&&m!=="$?"&&m!=="$!"||b++;m=E}while(m);wu(d)}function cc(c){for(;c!=null;c=c.nextSibling){var d=c.nodeType;if(d===1||d===3)break;if(d===8){if(d=c.data,d==="$"||d==="$!"||d==="$?")break;if(d==="/$")return null}}return c}function yP(c){c=c.previousSibling;for(var d=0;c;){if(c.nodeType===8){var m=c.data;if(m==="$"||m==="$!"||m==="$?"){if(d===0)return c;d--}else m==="/$"&&d++}c=c.previousSibling}return null}var nh=Math.random().toString(36).slice(2),co="__reactFiber$"+nh,Ep="__reactProps$"+nh,Qo="__reactContainer$"+nh,m0="__reactEvents$"+nh,A6="__reactListeners$"+nh,T6="__reactHandles$"+nh;function xu(c){var d=c[co];if(d)return d;for(var m=c.parentNode;m;){if(d=m[Qo]||m[co]){if(m=d.alternate,d.child!==null||m!==null&&m.child!==null)for(c=yP(c);c!==null;){if(m=c[co])return m;c=yP(c)}return d}c=m,m=c.parentNode}return null}function jp(c){return c=c[co]||c[Qo],!c||c.tag!==5&&c.tag!==6&&c.tag!==13&&c.tag!==3?null:c}function sh(c){if(c.tag===5||c.tag===6)return c.stateNode;throw Error(r(33))}function _v(c){return c[Ep]||null}var g0=[],ih=-1;function uc(c){return{current:c}}function Yr(c){0>ih||(c.current=g0[ih],g0[ih]=null,ih--)}function Br(c,d){ih++,g0[ih]=c.current,c.current=d}var dc={},ds=uc(dc),Ws=uc(!1),Su=dc;function ah(c,d){var m=c.type.contextTypes;if(!m)return dc;var b=c.stateNode;if(b&&b.__reactInternalMemoizedUnmaskedChildContext===d)return b.__reactInternalMemoizedMaskedChildContext;var E={},N;for(N in m)E[N]=d[N];return b&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=d,c.__reactInternalMemoizedMaskedChildContext=E),E}function Gs(c){return c=c.childContextTypes,c!=null}function bv(){Yr(Ws),Yr(ds)}function _P(c,d,m){if(ds.current!==dc)throw Error(r(168));Br(ds,d),Br(Ws,m)}function bP(c,d,m){var b=c.stateNode;
vendor: 6,820 bytes, line 39
39if(d=d.childContextTypes,typeof b.getChildContext!="function")return m;b=b.getChildContext();for(var E in b)if(!(E in d))throw Error(r(108,ye(c)||"Unknown",E));return L({},m,b)}function wv(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||dc,Su=ds.current,Br(ds,c),Br(Ws,Ws.current),!0}function wP(c,d,m){var b=c.stateNode;if(!b)throw Error(r(169));m?(c=bP(c,d,Su),b.__reactInternalMemoizedMergedChildContext=c,Yr(Ws),Yr(ds),Br(ds,c)):Yr(Ws),Br(Ws,m)}var Xo=null,xv=!1,v0=!1;function xP(c){Xo===null?Xo=[c]:Xo.push(c)}function I6(c){xv=!0,xP(c)}function hc(){if(!v0&&Xo!==null){v0=!0;var c=0,d=nr;try{var m=Xo;for(nr=1;c<m.length;c++){var b=m[c];do b=b(!0);while(b!==null)}Xo=null,xv=!1}catch(E){throw Xo!==null&&(Xo=Xo.slice(c+1)),vr(qs,hc),E}finally{nr=d,v0=!1}}return null}var oh=[],lh=0,Sv=null,kv=0,Gi=[],Ki=0,ku=null,el=1,tl="";function Eu(c,d){oh[lh++]=kv,oh[lh++]=Sv,Sv=c,kv=d}function SP(c,d,m){Gi[Ki++]=el,Gi[Ki++]=tl,Gi[Ki++]=ku,ku=c;var b=el;c=tl;var E=32-tn(b)-1;b&=~(1<<E),m+=1;var N=32-tn(d)+E;if(30<N){var D=E-E%5;N=(b&(1<<D)-1).toString(32),b>>=D,E-=D,el=1<<32-tn(d)+E|m<<E|b,tl=N+c}else el=1<<N|m<<E|b,tl=c}function y0(c){c.return!==null&&(Eu(c,1),SP(c,1,0))}function _0(c){for(;c===Sv;)Sv=oh[--lh],oh[lh]=null,kv=oh[--lh],oh[lh]=null;for(;c===ku;)ku=Gi[--Ki],Gi[Ki]=null,tl=Gi[--Ki],Gi[Ki]=null,el=Gi[--Ki],Gi[Ki]=null}var wi=null,xi=null,rn=!1,Na=null;function kP(c,d){var m=Qi(5,null,null,0);m.elementType="DELETED",m.stateNode=d,m.return=c,d=c.deletions,d===null?(c.deletions=[m],c.flags|=16):d.push(m)}function EP(c,d){switch(c.tag){case 5:var m=c.type;return d=d.nodeType!==1||m.toLowerCase()!==d.nodeName.toLowerCase()?null:d,d!==null?(c.stateNode=d,wi=c,xi=cc(d.firstChild),!0):!1;case 6:return d=c.pendingProps===""||d.nodeType!==3?null:d,d!==null?(c.stateNode=d,wi=c,xi=null,!0):!1;case 13:return d=d.nodeType!==8?null:d,d!==null?(m=ku!==null?{id:el,overflow:tl}:null,c.memoizedState={dehydrated:d,treeContext:m,retryLane:1073741824},m=Qi(18,null,null,0),m.stateNode=d,m.return=c,c.child=m,wi=c,xi=null,!0):!1;default:return!1}}function b0(c){return(c.mode&1)!==0&&(c.flags&128)===0}function w0(c){if(rn){var d=xi;if(d){var m=d;if(!EP(c,d)){if(b0(c))throw Error(r(418));d=cc(m.nextSibling);var b=wi;d&&EP(c,d)?kP(b,m):(c.flags=c.flags&-4097|2,rn=!1,wi=c)}}else{if(b0(c))throw Error(r(418));c.flags=c.flags&-4097|2,rn=!1,wi=c}}}function jP(c){for(c=c.return;c!==null&&c.tag!==5&&c.tag!==3&&c.tag!==13;)c=c.return;wi=c}function Ev(c){if(c!==wi)return!1;if(!rn)return jP(c),rn=!0,!1;var d;if((d=c.tag!==3)&&!(d=c.tag!==5)&&(d=c.type,d=d!=="head"&&d!=="body"&&!h0(c.type,c.memoizedProps)),d&&(d=xi)){if(b0(c))throw CP(),Error(r(418));for(;d;)kP(c,d),d=cc(d.nextSibling)}if(jP(c),c.tag===13){if(c=c.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(r(317));e:{for(c=c.nextSibling,d=0;c;){if(c.nodeType===8){var m=c.data;if(m==="/$"){if(d===0){xi=cc(c.nextSibling);break e}d--}else m!=="$"&&m!=="$!"&&m!=="$?"||d++}c=c.nextSibling}xi=null}}else xi=wi?cc(c.stateNode.nextSibling):null;return!0}function CP(){for(var c=xi;c;)c=cc(c.nextSibling)}function ch(){xi=wi=null,rn=!1}function x0(c){Na===null?Na=[c]:Na.push(c)}var D6=C.ReactCurrentBatchConfig;function Cp(c,d,m){if(c=m.ref,c!==null&&typeof c!="function"&&typeof c!="object"){if(m._owner){if(m=m._owner,m){if(m.tag!==1)throw Error(r(309));var b=m.stateNode}if(!b)throw Error(r(147,c));var E=b,N=""+c;return d!==null&&d.ref!==null&&typeof d.ref=="function"&&d.ref._stringRef===N?d.ref:(d=function(D){var Q=E.refs;D===null?delete Q[N]:Q[N]=D},d._stringRef=N,d)}if(typeof c!="string")throw Error(r(284));if(!m._owner)throw Error(r(290,c))}return c}function jv(c,d){throw c=Object.prototype.toString.call(d),Error(r(31,c==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":c))}function NP(c){var d=c._init;return d(c._payload)}function PP(c){function d(he,oe){if(c){var fe=he.deletions;fe===null?(he.deletions=[oe],he.flags|=16):fe.push(oe)}}function m(he,oe){if(!c)return null;for(;oe!==null;)d(he,oe),oe=oe.sibling;return null}function b(he,oe){for(he=new Map;oe!==null;)oe.key!==null?he.set(oe.key,oe):he.set(oe.index,oe),oe=oe.sibling;return he}function E(he,oe){return he=bc(he,oe),he.index=0,he.sibling=null,he}function N(he,oe,fe){return he.index=fe,c?(fe=he.alternate,fe!==null?(fe=fe.index,fe<oe?(he.flags|=2,oe):fe):(he.flags|=2,oe)):(he.flags|=1048576,oe)}function D(he){return c&&he.alternate===null&&(he.flags|=2),he}function Q(he,oe,fe,Ve){return oe===null||oe.tag!==6?(oe=fx(fe,he.mode,Ve),oe.return=he,oe):(oe=E(oe,fe),oe.return=he,oe)}function ne(he,oe,fe,Ve){var gt=fe.type;return gt===I?Ae(he,oe,fe.props.children,Ve,fe.key):oe!==null&&(oe.elementType===gt||typeof gt=="object"&&gt!==null&&gt.$$typeof===Y&&NP(gt)===oe.type)?(Ve=E(oe,fe.props),Ve.ref=Cp(he,oe,fe),Ve.return=he,Ve):(Ve=Zv(fe.type,fe.key,fe.props,null,he.mode,Ve),Ve.ref=Cp(he,oe,fe),Ve.return=he,Ve)}function ge(he,oe,fe,Ve){return oe===null||oe.tag!==4||oe.stateNode.containerInfo!==fe.containerInfo||oe.stateNode.implementation!==fe.implementation?(oe=px(fe,he.mode,Ve),oe.return=he,oe):(oe=E(oe,fe.children||[]),oe.return=he,oe)}function Ae(he,oe,fe,Ve,gt){return oe===null||oe.tag!==7?(oe=Iu(fe,he.mode,Ve,gt),oe.return=he,oe):(oe=E(oe,fe),oe.return=he,oe)}function Me(he,oe,fe){if(typeof oe=="string"&&oe!==""||typeof oe=="number")return oe=fx(""+oe,he.mode,fe),oe.return=he,oe;if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case R:return fe=Zv(oe.type,oe.key,oe.props,null,he.mode,fe),fe.ref=Cp(he,null,oe),fe.return=he,fe;case A:return oe=px(oe,he.mode,fe),oe.return=he,oe;case Y:var Ve=oe._init;return Me(he,Ve(oe._payload),fe)}if(ot(oe)||ee(oe))return oe=Iu(oe,he.mode,fe,null),oe.return=he,oe;jv(he,oe)}return null}function Pe(he,oe,fe,Ve){var gt=oe!==null?oe.key:null;if(typeof fe=="string"&&fe!==""||typeof fe=="number")return gt!==null?null:Q(he,oe,""+fe,Ve);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case R:return fe.key===gt?ne(he,oe,fe,Ve):null;case A:return fe.key===gt?ge(he,oe,fe,Ve):null;case Y:return gt=fe._init,Pe(he,oe,gt(fe._payload),Ve)}if(ot(fe)||ee(fe))return gt!==null?null:Ae(he,oe,fe,Ve,null);jv(he,fe)}return null}function tt(he,oe,fe,Ve,gt){if(typeof Ve=="string"&&Ve!==""||typeof Ve=="number")return he=he.get(fe)||null,Q(oe,he,""+Ve,gt);if(typeof Ve=="object"&&Ve!==null){switch(Ve.$$typeof){case R:return he=he.get(Ve.key===null?fe:Ve.key)||null,ne(oe,he,Ve,gt);case A:return he=he.get(Ve.key===null?fe:Ve.key)||null,ge(oe,he,Ve,gt);case Y:var It=Ve._init;return tt(he,oe,fe,It(Ve._payload),gt)}if(ot(Ve)||ee(Ve))return he=he.get(fe)||null,Ae(oe,he,Ve,gt,null);jv(oe,Ve)}return null}function lt(he,oe,fe,Ve){for(var gt=null,It=null,Dt=oe,Ut=oe=0,Gn=null;Dt!==null&&Ut<fe.length;Ut++){Dt.index>Ut?(Gn=Dt,Dt=null):Gn=Dt.sibling;var _r=Pe(he,Dt,fe[Ut],Ve);
vendor: 6,995 bytes, line 39
39if(_r===null){Dt===null&&(Dt=Gn);break}c&&Dt&&_r.alternate===null&&d(he,Dt),oe=N(_r,oe,Ut),It===null?gt=_r:It.sibling=_r,It=_r,Dt=Gn}if(Ut===fe.length)return m(he,Dt),rn&&Eu(he,Ut),gt;if(Dt===null){for(;Ut<fe.length;Ut++)Dt=Me(he,fe[Ut],Ve),Dt!==null&&(oe=N(Dt,oe,Ut),It===null?gt=Dt:It.sibling=Dt,It=Dt);return rn&&Eu(he,Ut),gt}for(Dt=b(he,Dt);Ut<fe.length;Ut++)Gn=tt(Dt,he,Ut,fe[Ut],Ve),Gn!==null&&(c&&Gn.alternate!==null&&Dt.delete(Gn.key===null?Ut:Gn.key),oe=N(Gn,oe,Ut),It===null?gt=Gn:It.sibling=Gn,It=Gn);return c&&Dt.forEach(function(wc){return d(he,wc)}),rn&&Eu(he,Ut),gt}function dt(he,oe,fe,Ve){var gt=ee(fe);if(typeof gt!="function")throw Error(r(150));if(fe=gt.call(fe),fe==null)throw Error(r(151));for(var It=gt=null,Dt=oe,Ut=oe=0,Gn=null,_r=fe.next();Dt!==null&&!_r.done;Ut++,_r=fe.next()){Dt.index>Ut?(Gn=Dt,Dt=null):Gn=Dt.sibling;var wc=Pe(he,Dt,_r.value,Ve);if(wc===null){Dt===null&&(Dt=Gn);break}c&&Dt&&wc.alternate===null&&d(he,Dt),oe=N(wc,oe,Ut),It===null?gt=wc:It.sibling=wc,It=wc,Dt=Gn}if(_r.done)return m(he,Dt),rn&&Eu(he,Ut),gt;if(Dt===null){for(;!_r.done;Ut++,_r=fe.next())_r=Me(he,_r.value,Ve),_r!==null&&(oe=N(_r,oe,Ut),It===null?gt=_r:It.sibling=_r,It=_r);return rn&&Eu(he,Ut),gt}for(Dt=b(he,Dt);!_r.done;Ut++,_r=fe.next())_r=tt(Dt,he,Ut,_r.value,Ve),_r!==null&&(c&&_r.alternate!==null&&Dt.delete(_r.key===null?Ut:_r.key),oe=N(_r,oe,Ut),It===null?gt=_r:It.sibling=_r,It=_r);return c&&Dt.forEach(function(fV){return d(he,fV)}),rn&&Eu(he,Ut),gt}function kn(he,oe,fe,Ve){if(typeof fe=="object"&&fe!==null&&fe.type===I&&fe.key===null&&(fe=fe.props.children),typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case R:e:{for(var gt=fe.key,It=oe;It!==null;){if(It.key===gt){if(gt=fe.type,gt===I){if(It.tag===7){m(he,It.sibling),oe=E(It,fe.props.children),oe.return=he,he=oe;break e}}else if(It.elementType===gt||typeof gt=="object"&&gt!==null&&gt.$$typeof===Y&&NP(gt)===It.type){m(he,It.sibling),oe=E(It,fe.props),oe.ref=Cp(he,It,fe),oe.return=he,he=oe;break e}m(he,It);break}else d(he,It);It=It.sibling}fe.type===I?(oe=Iu(fe.props.children,he.mode,Ve,fe.key),oe.return=he,he=oe):(Ve=Zv(fe.type,fe.key,fe.props,null,he.mode,Ve),Ve.ref=Cp(he,oe,fe),Ve.return=he,he=Ve)}return D(he);case A:e:{for(It=fe.key;oe!==null;){if(oe.key===It)if(oe.tag===4&&oe.stateNode.containerInfo===fe.containerInfo&&oe.stateNode.implementation===fe.implementation){m(he,oe.sibling),oe=E(oe,fe.children||[]),oe.return=he,he=oe;break e}else{m(he,oe);break}else d(he,oe);oe=oe.sibling}oe=px(fe,he.mode,Ve),oe.return=he,he=oe}return D(he);case Y:return It=fe._init,kn(he,oe,It(fe._payload),Ve)}if(ot(fe))return lt(he,oe,fe,Ve);if(ee(fe))return dt(he,oe,fe,Ve);jv(he,fe)}return typeof fe=="string"&&fe!==""||typeof fe=="number"?(fe=""+fe,oe!==null&&oe.tag===6?(m(he,oe.sibling),oe=E(oe,fe),oe.return=he,he=oe):(m(he,oe),oe=fx(fe,he.mode,Ve),oe.return=he,he=oe),D(he)):m(he,oe)}return kn}var uh=PP(!0),RP=PP(!1),Cv=uc(null),Nv=null,dh=null,S0=null;function k0(){S0=dh=Nv=null}function E0(c){var d=Cv.current;Yr(Cv),c._currentValue=d}function j0(c,d,m){for(;c!==null;){var b=c.alternate;if((c.childLanes&d)!==d?(c.childLanes|=d,b!==null&&(b.childLanes|=d)):b!==null&&(b.childLanes&d)!==d&&(b.childLanes|=d),c===m)break;c=c.return}}function hh(c,d){Nv=c,S0=dh=null,c=c.dependencies,c!==null&&c.firstContext!==null&&((c.lanes&d)!==0&&(Ks=!0),c.firstContext=null)}function Yi(c){var d=c._currentValue;if(S0!==c)if(c={context:c,memoizedValue:d,next:null},dh===null){if(Nv===null)throw Error(r(308));dh=c,Nv.dependencies={lanes:0,firstContext:c}}else dh=dh.next=c;return d}var ju=null;function C0(c){ju===null?ju=[c]:ju.push(c)}function AP(c,d,m,b){var E=d.interleaved;return E===null?(m.next=m,C0(d)):(m.next=E.next,E.next=m),d.interleaved=m,rl(c,b)}function rl(c,d){c.lanes|=d;var m=c.alternate;for(m!==null&&(m.lanes|=d),m=c,c=c.return;c!==null;)c.childLanes|=d,m=c.alternate,m!==null&&(m.childLanes|=d),m=c,c=c.return;return m.tag===3?m.stateNode:null}var fc=!1;function N0(c){c.updateQueue={baseState:c.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function TP(c,d){c=c.updateQueue,d.updateQueue===c&&(d.updateQueue={baseState:c.baseState,firstBaseUpdate:c.firstBaseUpdate,lastBaseUpdate:c.lastBaseUpdate,shared:c.shared,effects:c.effects})}function nl(c,d){return{eventTime:c,lane:d,tag:0,payload:null,callback:null,next:null}}function pc(c,d,m){var b=c.updateQueue;if(b===null)return null;if(b=b.shared,(hr&2)!==0){var E=b.pending;return E===null?d.next=d:(d.next=E.next,E.next=d),b.pending=d,rl(c,m)}return E=b.interleaved,E===null?(d.next=d,C0(b)):(d.next=E.next,E.next=d),b.interleaved=d,rl(c,m)}function Pv(c,d,m){if(d=d.updateQueue,d!==null&&(d=d.shared,(m&4194240)!==0)){var b=d.lanes;b&=c.pendingLanes,m|=b,d.lanes=m,sc(c,m)}}function IP(c,d){var m=c.updateQueue,b=c.alternate;if(b!==null&&(b=b.updateQueue,m===b)){var E=null,N=null;if(m=m.firstBaseUpdate,m!==null){do{var D={eventTime:m.eventTime,lane:m.lane,tag:m.tag,payload:m.payload,callback:m.callback,next:null};N===null?E=N=D:N=N.next=D,m=m.next}while(m!==null);N===null?E=N=d:N=N.next=d}else E=N=d;m={baseState:b.baseState,firstBaseUpdate:E,lastBaseUpdate:N,shared:b.shared,effects:b.effects},c.updateQueue=m;return}c=m.lastBaseUpdate,c===null?m.firstBaseUpdate=d:c.next=d,m.lastBaseUpdate=d}function Rv(c,d,m,b){var E=c.updateQueue;fc=!1;var N=E.firstBaseUpdate,D=E.lastBaseUpdate,Q=E.shared.pending;if(Q!==null){E.shared.pending=null;var ne=Q,ge=ne.next;ne.next=null,D===null?N=ge:D.next=ge,D=ne;var Ae=c.alternate;Ae!==null&&(Ae=Ae.updateQueue,Q=Ae.lastBaseUpdate,Q!==D&&(Q===null?Ae.firstBaseUpdate=ge:Q.next=ge,Ae.lastBaseUpdate=ne))}if(N!==null){var Me=E.baseState;D=0,Ae=ge=ne=null,Q=N;do{var Pe=Q.lane,tt=Q.eventTime;if((b&Pe)===Pe){Ae!==null&&(Ae=Ae.next={eventTime:tt,lane:0,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null});e:{var lt=c,dt=Q;switch(Pe=d,tt=m,dt.tag){case 1:if(lt=dt.payload,typeof lt=="function"){Me=lt.call(tt,Me,Pe);break e}Me=lt;break e;case 3:lt.flags=lt.flags&-65537|128;case 0:if(lt=dt.payload,Pe=typeof lt=="function"?lt.call(tt,Me,Pe):lt,Pe==null)break e;Me=L({},Me,Pe);break e;case 2:fc=!0}}Q.callback!==null&&Q.lane!==0&&(c.flags|=64,Pe=E.effects,Pe===null?E.effects=[Q]:Pe.push(Q))}else tt={eventTime:tt,lane:Pe,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null},Ae===null?(ge=Ae=tt,ne=Me):Ae=Ae.next=tt,D|=Pe;if(Q=Q.next,Q===null){if(Q=E.shared.pending,Q===null)break;Pe=Q,Q=Pe.next,Pe.next=null,E.lastBaseUpdate=Pe,E.shared.pending=null}}while(!0);if(Ae===null&&(ne=Me),E.baseState=ne,E.firstBaseUpdate=ge,E.lastBaseUpdate=Ae,d=E.shared.interleaved,d!==null){E=d;do D|=E.lane,E=E.next;while(E!==d)}else N===null&&(E.shared.lanes=0);Pu|=D,c.lanes=D,c.memoizedState=Me}}function DP(c,d,m){if(c=d.effects,d.effects=null,c!==null)for(d=0;d<c.length;d++){var b=c[d],E=b.callback;if(E!==null){if(b.callback=null,b=m,typeof E!="function")throw Error(r(191,E));E.call(b)}}}var Np={},uo=uc(Np),Pp=uc(Np),Rp=uc(Np);
vendor: 8,157 bytes, line 39
39function Cu(c){if(c===Np)throw Error(r(174));return c}function P0(c,d){switch(Br(Rp,d),Br(Pp,c),Br(uo,Np),c=d.nodeType,c){case 9:case 11:d=(d=d.documentElement)?d.namespaceURI:rr(null,"");break;default:c=c===8?d.parentNode:d,d=c.namespaceURI||null,c=c.tagName,d=rr(d,c)}Yr(uo),Br(uo,d)}function fh(){Yr(uo),Yr(Pp),Yr(Rp)}function OP(c){Cu(Rp.current);var d=Cu(uo.current),m=rr(d,c.type);d!==m&&(Br(Pp,c),Br(uo,m))}function R0(c){Pp.current===c&&(Yr(uo),Yr(Pp))}var cn=uc(0);function Av(c){for(var d=c;d!==null;){if(d.tag===13){var m=d.memoizedState;if(m!==null&&(m=m.dehydrated,m===null||m.data==="$?"||m.data==="$!"))return d}else if(d.tag===19&&d.memoizedProps.revealOrder!==void 0){if((d.flags&128)!==0)return d}else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===c)break;for(;d.sibling===null;){if(d.return===null||d.return===c)return null;d=d.return}d.sibling.return=d.return,d=d.sibling}return null}var A0=[];function T0(){for(var c=0;c<A0.length;c++)A0[c]._workInProgressVersionPrimary=null;A0.length=0}var Tv=C.ReactCurrentDispatcher,I0=C.ReactCurrentBatchConfig,Nu=0,un=null,Fn=null,qn=null,Iv=!1,Ap=!1,Tp=0,O6=0;function hs(){throw Error(r(321))}function D0(c,d){if(d===null)return!1;for(var m=0;m<d.length&&m<c.length;m++)if(!Ca(c[m],d[m]))return!1;return!0}function O0(c,d,m,b,E,N){if(Nu=N,un=d,d.memoizedState=null,d.updateQueue=null,d.lanes=0,Tv.current=c===null||c.memoizedState===null?$6:z6,c=m(b,E),Ap){N=0;do{if(Ap=!1,Tp=0,25<=N)throw Error(r(301));N+=1,qn=Fn=null,d.updateQueue=null,Tv.current=U6,c=m(b,E)}while(Ap)}if(Tv.current=Mv,d=Fn!==null&&Fn.next!==null,Nu=0,qn=Fn=un=null,Iv=!1,d)throw Error(r(300));return c}function M0(){var c=Tp!==0;return Tp=0,c}function ho(){var c={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qn===null?un.memoizedState=qn=c:qn=qn.next=c,qn}function Zi(){if(Fn===null){var c=un.alternate;c=c!==null?c.memoizedState:null}else c=Fn.next;var d=qn===null?un.memoizedState:qn.next;if(d!==null)qn=d,Fn=c;else{if(c===null)throw Error(r(310));Fn=c,c={memoizedState:Fn.memoizedState,baseState:Fn.baseState,baseQueue:Fn.baseQueue,queue:Fn.queue,next:null},qn===null?un.memoizedState=qn=c:qn=qn.next=c}return qn}function Ip(c,d){return typeof d=="function"?d(c):d}function L0(c){var d=Zi(),m=d.queue;if(m===null)throw Error(r(311));m.lastRenderedReducer=c;var b=Fn,E=b.baseQueue,N=m.pending;if(N!==null){if(E!==null){var D=E.next;E.next=N.next,N.next=D}b.baseQueue=E=N,m.pending=null}if(E!==null){N=E.next,b=b.baseState;var Q=D=null,ne=null,ge=N;do{var Ae=ge.lane;if((Nu&Ae)===Ae)ne!==null&&(ne=ne.next={lane:0,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null}),b=ge.hasEagerState?ge.eagerState:c(b,ge.action);else{var Me={lane:Ae,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null};ne===null?(Q=ne=Me,D=b):ne=ne.next=Me,un.lanes|=Ae,Pu|=Ae}ge=ge.next}while(ge!==null&&ge!==N);ne===null?D=b:ne.next=Q,Ca(b,d.memoizedState)||(Ks=!0),d.memoizedState=b,d.baseState=D,d.baseQueue=ne,m.lastRenderedState=b}if(c=m.interleaved,c!==null){E=c;do N=E.lane,un.lanes|=N,Pu|=N,E=E.next;while(E!==c)}else E===null&&(m.lanes=0);return[d.memoizedState,m.dispatch]}function F0(c){var d=Zi(),m=d.queue;if(m===null)throw Error(r(311));m.lastRenderedReducer=c;var b=m.dispatch,E=m.pending,N=d.memoizedState;if(E!==null){m.pending=null;var D=E=E.next;do N=c(N,D.action),D=D.next;while(D!==E);Ca(N,d.memoizedState)||(Ks=!0),d.memoizedState=N,d.baseQueue===null&&(d.baseState=N),m.lastRenderedState=N}return[N,b]}function MP(){}function LP(c,d){var m=un,b=Zi(),E=d(),N=!Ca(b.memoizedState,E);if(N&&(b.memoizedState=E,Ks=!0),b=b.queue,$0(zP.bind(null,m,b,c),[c]),b.getSnapshot!==d||N||qn!==null&&qn.memoizedState.tag&1){if(m.flags|=2048,Dp(9,$P.bind(null,m,b,E,d),void 0,null),Wn===null)throw Error(r(349));(Nu&30)!==0||FP(m,d,E)}return E}function FP(c,d,m){c.flags|=16384,c={getSnapshot:d,value:m},d=un.updateQueue,d===null?(d={lastEffect:null,stores:null},un.updateQueue=d,d.stores=[c]):(m=d.stores,m===null?d.stores=[c]:m.push(c))}function $P(c,d,m,b){d.value=m,d.getSnapshot=b,UP(d)&&BP(c)}function zP(c,d,m){return m(function(){UP(d)&&BP(c)})}function UP(c){var d=c.getSnapshot;c=c.value;try{var m=d();return!Ca(c,m)}catch{return!0}}function BP(c){var d=rl(c,1);d!==null&&Ta(d,c,1,-1)}function VP(c){var d=ho();return typeof c=="function"&&(c=c()),d.memoizedState=d.baseState=c,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ip,lastRenderedState:c},d.queue=c,c=c.dispatch=F6.bind(null,un,c),[d.memoizedState,c]}function Dp(c,d,m,b){return c={tag:c,create:d,destroy:m,deps:b,next:null},d=un.updateQueue,d===null?(d={lastEffect:null,stores:null},un.updateQueue=d,d.lastEffect=c.next=c):(m=d.lastEffect,m===null?d.lastEffect=c.next=c:(b=m.next,m.next=c,c.next=b,d.lastEffect=c)),c}function HP(){return Zi().memoizedState}function Dv(c,d,m,b){var E=ho();un.flags|=c,E.memoizedState=Dp(1|d,m,void 0,b===void 0?null:b)}function Ov(c,d,m,b){var E=Zi();b=b===void 0?null:b;var N=void 0;if(Fn!==null){var D=Fn.memoizedState;if(N=D.destroy,b!==null&&D0(b,D.deps)){E.memoizedState=Dp(d,m,N,b);return}}un.flags|=c,E.memoizedState=Dp(1|d,m,N,b)}function qP(c,d){return Dv(8390656,8,c,d)}function $0(c,d){return Ov(2048,8,c,d)}function WP(c,d){return Ov(4,2,c,d)}function GP(c,d){return Ov(4,4,c,d)}function KP(c,d){if(typeof d=="function")return c=c(),d(c),function(){d(null)};if(d!=null)return c=c(),d.current=c,function(){d.current=null}}function YP(c,d,m){return m=m!=null?m.concat([c]):null,Ov(4,4,KP.bind(null,d,c),m)}function z0(){}function ZP(c,d){var m=Zi();d=d===void 0?null:d;var b=m.memoizedState;return b!==null&&d!==null&&D0(d,b[1])?b[0]:(m.memoizedState=[c,d],c)}function JP(c,d){var m=Zi();d=d===void 0?null:d;var b=m.memoizedState;return b!==null&&d!==null&&D0(d,b[1])?b[0]:(c=c(),m.memoizedState=[c,d],c)}function QP(c,d,m){return(Nu&21)===0?(c.baseState&&(c.baseState=!1,Ks=!0),c.memoizedState=m):(Ca(m,d)||(m=Bd(),un.lanes|=m,Pu|=m,c.baseState=!0),d)}function M6(c,d){var m=nr;nr=m!==0&&4>m?m:4,c(!0);var b=I0.transition;I0.transition={};try{c(!1),d()}finally{nr=m,I0.transition=b}}function XP(){return Zi().memoizedState}function L6(c,d,m){var b=yc(c);if(m={lane:b,action:m,hasEagerState:!1,eagerState:null,next:null},eR(c))tR(d,m);else if(m=AP(c,d,m,b),m!==null){var E=Es();Ta(m,c,b,E),rR(m,d,b)}}function F6(c,d,m){var b=yc(c),E={lane:b,action:m,hasEagerState:!1,eagerState:null,next:null};if(eR(c))tR(d,E);else{var N=c.alternate;if(c.lanes===0&&(N===null||N.lanes===0)&&(N=d.lastRenderedReducer,N!==null))try{var D=d.lastRenderedState,Q=N(D,m);if(E.hasEagerState=!0,E.eagerState=Q,Ca(Q,D)){var ne=d.interleaved;ne===null?(E.next=E,C0(d)):(E.next=ne.next,ne.next=E),d.interleaved=E;return}}catch{}finally{}m=AP(c,d,E,b),m!==null&&(E=Es(),Ta(m,c,b,E),rR(m,d,b))}}function eR(c){var d=c.alternate;return c===un||d!==null&&d===un}function tR(c,d){Ap=Iv=!0;var m=c.pending;m===null?d.next=d:(d.next=m.next,m.next=d),c.pending=d}function rR(c,d,m){if((m&4194240)!==0){var b=d.lanes;b&=c.pendingLanes,m|=b,d.lanes=m,sc(c,m)}}var Mv={readContext:Yi,useCallback:hs,useContext:hs,useEffect:hs,useImperativeHandle:hs,useInsertionEffect:hs,useLayoutEffect:hs,useMemo:hs,useReducer:hs,useRef:hs,useState:hs,useDebugValue:hs,useDeferredValue:hs,useTransition:hs,useMutableSource:hs,useSyncExternalStore:hs,useId:hs,unstable_isNewReconciler:!1},$6={readContext:Yi,useCallback:function(c,d){return ho().memoizedState=[c,d===void 0?null:d],c},useContext:Yi,useEffect:qP,useImperativeHandle:function(c,d,m){return m=m!=null?m.concat([c]):null,Dv(4194308,4,KP.bind(null,d,c),m)},useLayoutEffect:function(c,d){return Dv(4194308,4,c,d)},useInsertionEffect:function(c,d){return Dv(4,2,c,d)},useMemo:function(c,d){var m=ho();return d=d===void 0?null:d,c=c(),m.memoizedState=[c,d],c},useReducer:function(c,d,m){var b=ho();return d=m!==void 0?m(d):d,b.memoizedState=b.baseState=d,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:d},b.queue=c,c=c.dispatch=L6.bind(null,un,c),[b.memoizedState,c]},useRef:function(c){var d=ho();return c={current:c},d.memoizedState=c}
vendor: 4,898 bytes, lines 39-41
39,useState:VP,useDebugValue:z0,useDeferredValue:function(c){return ho().memoizedState=c},useTransition:function(){var c=VP(!1),d=c[0];return c=M6.bind(null,c[1]),ho().memoizedState=c,[d,c]},useMutableSource:function(){},useSyncExternalStore:function(c,d,m){var b=un,E=ho();if(rn){if(m===void 0)throw Error(r(407));m=m()}else{if(m=d(),Wn===null)throw Error(r(349));(Nu&30)!==0||FP(b,d,m)}E.memoizedState=m;var N={value:m,getSnapshot:d};return E.queue=N,qP(zP.bind(null,b,N,c),[c]),b.flags|=2048,Dp(9,$P.bind(null,b,N,m,d),void 0,null),m},useId:function(){var c=ho(),d=Wn.identifierPrefix;if(rn){var m=tl,b=el;m=(b&~(1<<32-tn(b)-1)).toString(32)+m,d=":"+d+"R"+m,m=Tp++,0<m&&(d+="H"+m.toString(32)),d+=":"}else m=O6++,d=":"+d+"r"+m.toString(32)+":";return c.memoizedState=d},unstable_isNewReconciler:!1},z6={readContext:Yi,useCallback:ZP,useContext:Yi,useEffect:$0,useImperativeHandle:YP,useInsertionEffect:WP,useLayoutEffect:GP,useMemo:JP,useReducer:L0,useRef:HP,useState:function(){return L0(Ip)},useDebugValue:z0,useDeferredValue:function(c){var d=Zi();return QP(d,Fn.memoizedState,c)},useTransition:function(){var c=L0(Ip)[0],d=Zi().memoizedState;return[c,d]},useMutableSource:MP,useSyncExternalStore:LP,useId:XP,unstable_isNewReconciler:!1},U6={readContext:Yi,useCallback:ZP,useContext:Yi,useEffect:$0,useImperativeHandle:YP,useInsertionEffect:WP,useLayoutEffect:GP,useMemo:JP,useReducer:F0,useRef:HP,useState:function(){return F0(Ip)},useDebugValue:z0,useDeferredValue:function(c){var d=Zi();return Fn===null?d.memoizedState=c:QP(d,Fn.memoizedState,c)},useTransition:function(){var c=F0(Ip)[0],d=Zi().memoizedState;return[c,d]},useMutableSource:MP,useSyncExternalStore:LP,useId:XP,unstable_isNewReconciler:!1};function Pa(c,d){if(c&&c.defaultProps){d=L({},d),c=c.defaultProps;for(var m in c)d[m]===void 0&&(d[m]=c[m]);return d}return d}function U0(c,d,m,b){d=c.memoizedState,m=m(b,d),m=m==null?d:L({},d,m),c.memoizedState=m,c.lanes===0&&(c.updateQueue.baseState=m)}var Lv={isMounted:function(c){return(c=c._reactInternals)?qe(c)===c:!1},enqueueSetState:function(c,d,m){c=c._reactInternals;var b=Es(),E=yc(c),N=nl(b,E);N.payload=d,m!=null&&(N.callback=m),d=pc(c,N,E),d!==null&&(Ta(d,c,E,b),Pv(d,c,E))},enqueueReplaceState:function(c,d,m){c=c._reactInternals;var b=Es(),E=yc(c),N=nl(b,E);N.tag=1,N.payload=d,m!=null&&(N.callback=m),d=pc(c,N,E),d!==null&&(Ta(d,c,E,b),Pv(d,c,E))},enqueueForceUpdate:function(c,d){c=c._reactInternals;var m=Es(),b=yc(c),E=nl(m,b);E.tag=2,d!=null&&(E.callback=d),d=pc(c,E,b),d!==null&&(Ta(d,c,b,m),Pv(d,c,b))}};function nR(c,d,m,b,E,N,D){return c=c.stateNode,typeof c.shouldComponentUpdate=="function"?c.shouldComponentUpdate(b,N,D):d.prototype&&d.prototype.isPureReactComponent?!bp(m,b)||!bp(E,N):!0}function sR(c,d,m){var b=!1,E=dc,N=d.contextType;return typeof N=="object"&&N!==null?N=Yi(N):(E=Gs(d)?Su:ds.current,b=d.contextTypes,N=(b=b!=null)?ah(c,E):dc),d=new d(m,N),c.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Lv,c.stateNode=d,d._reactInternals=c,b&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=E,c.__reactInternalMemoizedMaskedChildContext=N),d}function iR(c,d,m,b){c=d.state,typeof d.componentWillReceiveProps=="function"&&d.componentWillReceiveProps(m,b),typeof d.UNSAFE_componentWillReceiveProps=="function"&&d.UNSAFE_componentWillReceiveProps(m,b),d.state!==c&&Lv.enqueueReplaceState(d,d.state,null)}function B0(c,d,m,b){var E=c.stateNode;E.props=m,E.state=c.memoizedState,E.refs={},N0(c);var N=d.contextType;typeof N=="object"&&N!==null?E.context=Yi(N):(N=Gs(d)?Su:ds.current,E.context=ah(c,N)),E.state=c.memoizedState,N=d.getDerivedStateFromProps,typeof N=="function"&&(U0(c,d,N,m),E.state=c.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(d=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),d!==E.state&&Lv.enqueueReplaceState(E,E.state,null),Rv(c,m,E,b),E.state=c.memoizedState),typeof E.componentDidMount=="function"&&(c.flags|=4194308)}function ph(c,d){try{var m="",b=d;do m+=re(b),b=b.return;while(b);var E=m}catch(N){E=`
40Error generating stack: `+N.message+`
41`+N.stack}return{value:c,source:d,stack:E,digest:null}}function V0(c,d,m){return{value:c,source:null,stack:m??null,digest:d??null}}function H0(c,d){try{console.error(d.value)}catch(m){setTimeout(function(){throw m})}}var B6=typeof WeakMap=="function"?WeakMap:Map;function aR(c,d,m){m=nl(-1,m),m.tag=3,m.payload={element:null};var b=d.value;return m.callback=function(){Hv||(Hv=!0,ix=b),H0(c,d)},m}function oR(c,d,m){m=nl(-1,m),m.tag=3;var b=c.type.getDerivedStateFromError;if(typeof b=="function"){var E=d.value;m.payload=function(){return b(E)},m.callback=function(){H0(c,d)}}var N=c.stateNode;
vendor: 40,118 bytes, line 41
41return N!==null&&typeof N.componentDidCatch=="function"&&(m.callback=function(){H0(c,d),typeof b!="function"&&(gc===null?gc=new Set([this]):gc.add(this));var D=d.stack;this.componentDidCatch(d.value,{componentStack:D!==null?D:""})}),m}function lR(c,d,m){var b=c.pingCache;if(b===null){b=c.pingCache=new B6;var E=new Set;b.set(d,E)}else E=b.get(d),E===void 0&&(E=new Set,b.set(d,E));E.has(m)||(E.add(m),c=rV.bind(null,c,d,m),d.then(c,c))}function cR(c){do{var d;if((d=c.tag===13)&&(d=c.memoizedState,d=d!==null?d.dehydrated!==null:!0),d)return c;c=c.return}while(c!==null);return null}function uR(c,d,m,b,E){return(c.mode&1)===0?(c===d?c.flags|=65536:(c.flags|=128,m.flags|=131072,m.flags&=-52805,m.tag===1&&(m.alternate===null?m.tag=17:(d=nl(-1,1),d.tag=2,pc(m,d,1))),m.lanes|=1),c):(c.flags|=65536,c.lanes=E,c)}var V6=C.ReactCurrentOwner,Ks=!1;function ks(c,d,m,b){d.child=c===null?RP(d,null,m,b):uh(d,c.child,m,b)}function dR(c,d,m,b,E){m=m.render;var N=d.ref;return hh(d,E),b=O0(c,d,m,b,N,E),m=M0(),c!==null&&!Ks?(d.updateQueue=c.updateQueue,d.flags&=-2053,c.lanes&=~E,sl(c,d,E)):(rn&&m&&y0(d),d.flags|=1,ks(c,d,b,E),d.child)}function hR(c,d,m,b,E){if(c===null){var N=m.type;return typeof N=="function"&&!hx(N)&&N.defaultProps===void 0&&m.compare===null&&m.defaultProps===void 0?(d.tag=15,d.type=N,fR(c,d,N,b,E)):(c=Zv(m.type,null,b,d,d.mode,E),c.ref=d.ref,c.return=d,d.child=c)}if(N=c.child,(c.lanes&E)===0){var D=N.memoizedProps;if(m=m.compare,m=m!==null?m:bp,m(D,b)&&c.ref===d.ref)return sl(c,d,E)}return d.flags|=1,c=bc(N,b),c.ref=d.ref,c.return=d,d.child=c}function fR(c,d,m,b,E){if(c!==null){var N=c.memoizedProps;if(bp(N,b)&&c.ref===d.ref)if(Ks=!1,d.pendingProps=b=N,(c.lanes&E)!==0)(c.flags&131072)!==0&&(Ks=!0);else return d.lanes=c.lanes,sl(c,d,E)}return q0(c,d,m,b,E)}function pR(c,d,m){var b=d.pendingProps,E=b.children,N=c!==null?c.memoizedState:null;if(b.mode==="hidden")if((d.mode&1)===0)d.memoizedState={baseLanes:0,cachePool:null,transitions:null},Br(gh,Si),Si|=m;else{if((m&1073741824)===0)return c=N!==null?N.baseLanes|m:m,d.lanes=d.childLanes=1073741824,d.memoizedState={baseLanes:c,cachePool:null,transitions:null},d.updateQueue=null,Br(gh,Si),Si|=c,null;d.memoizedState={baseLanes:0,cachePool:null,transitions:null},b=N!==null?N.baseLanes:m,Br(gh,Si),Si|=b}else N!==null?(b=N.baseLanes|m,d.memoizedState=null):b=m,Br(gh,Si),Si|=b;return ks(c,d,E,m),d.child}function mR(c,d){var m=d.ref;(c===null&&m!==null||c!==null&&c.ref!==m)&&(d.flags|=512,d.flags|=2097152)}function q0(c,d,m,b,E){var N=Gs(m)?Su:ds.current;return N=ah(d,N),hh(d,E),m=O0(c,d,m,b,N,E),b=M0(),c!==null&&!Ks?(d.updateQueue=c.updateQueue,d.flags&=-2053,c.lanes&=~E,sl(c,d,E)):(rn&&b&&y0(d),d.flags|=1,ks(c,d,m,E),d.child)}function gR(c,d,m,b,E){if(Gs(m)){var N=!0;wv(d)}else N=!1;if(hh(d,E),d.stateNode===null)$v(c,d),sR(d,m,b),B0(d,m,b,E),b=!0;else if(c===null){var D=d.stateNode,Q=d.memoizedProps;D.props=Q;var ne=D.context,ge=m.contextType;typeof ge=="object"&&ge!==null?ge=Yi(ge):(ge=Gs(m)?Su:ds.current,ge=ah(d,ge));var Ae=m.getDerivedStateFromProps,Me=typeof Ae=="function"||typeof D.getSnapshotBeforeUpdate=="function";Me||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(Q!==b||ne!==ge)&&iR(d,D,b,ge),fc=!1;var Pe=d.memoizedState;D.state=Pe,Rv(d,b,D,E),ne=d.memoizedState,Q!==b||Pe!==ne||Ws.current||fc?(typeof Ae=="function"&&(U0(d,m,Ae,b),ne=d.memoizedState),(Q=fc||nR(d,m,Q,b,Pe,ne,ge))?(Me||typeof D.UNSAFE_componentWillMount!="function"&&typeof D.componentWillMount!="function"||(typeof D.componentWillMount=="function"&&D.componentWillMount(),typeof D.UNSAFE_componentWillMount=="function"&&D.UNSAFE_componentWillMount()),typeof D.componentDidMount=="function"&&(d.flags|=4194308)):(typeof D.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=b,d.memoizedState=ne),D.props=b,D.state=ne,D.context=ge,b=Q):(typeof D.componentDidMount=="function"&&(d.flags|=4194308),b=!1)}else{D=d.stateNode,TP(c,d),Q=d.memoizedProps,ge=d.type===d.elementType?Q:Pa(d.type,Q),D.props=ge,Me=d.pendingProps,Pe=D.context,ne=m.contextType,typeof ne=="object"&&ne!==null?ne=Yi(ne):(ne=Gs(m)?Su:ds.current,ne=ah(d,ne));var tt=m.getDerivedStateFromProps;(Ae=typeof tt=="function"||typeof D.getSnapshotBeforeUpdate=="function")||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(Q!==Me||Pe!==ne)&&iR(d,D,b,ne),fc=!1,Pe=d.memoizedState,D.state=Pe,Rv(d,b,D,E);var lt=d.memoizedState;Q!==Me||Pe!==lt||Ws.current||fc?(typeof tt=="function"&&(U0(d,m,tt,b),lt=d.memoizedState),(ge=fc||nR(d,m,ge,b,Pe,lt,ne)||!1)?(Ae||typeof D.UNSAFE_componentWillUpdate!="function"&&typeof D.componentWillUpdate!="function"||(typeof D.componentWillUpdate=="function"&&D.componentWillUpdate(b,lt,ne),typeof D.UNSAFE_componentWillUpdate=="function"&&D.UNSAFE_componentWillUpdate(b,lt,ne)),typeof D.componentDidUpdate=="function"&&(d.flags|=4),typeof D.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof D.componentDidUpdate!="function"||Q===c.memoizedProps&&Pe===c.memoizedState||(d.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||Q===c.memoizedProps&&Pe===c.memoizedState||(d.flags|=1024),d.memoizedProps=b,d.memoizedState=lt),D.props=b,D.state=lt,D.context=ne,b=ge):(typeof D.componentDidUpdate!="function"||Q===c.memoizedProps&&Pe===c.memoizedState||(d.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||Q===c.memoizedProps&&Pe===c.memoizedState||(d.flags|=1024),b=!1)}return W0(c,d,m,b,N,E)}function W0(c,d,m,b,E,N){mR(c,d);var D=(d.flags&128)!==0;if(!b&&!D)return E&&wP(d,m,!1),sl(c,d,N);b=d.stateNode,V6.current=d;var Q=D&&typeof m.getDerivedStateFromError!="function"?null:b.render();return d.flags|=1,c!==null&&D?(d.child=uh(d,c.child,null,N),d.child=uh(d,null,Q,N)):ks(c,d,Q,N),d.memoizedState=b.state,E&&wP(d,m,!0),d.child}function vR(c){var d=c.stateNode;d.pendingContext?_P(c,d.pendingContext,d.pendingContext!==d.context):d.context&&_P(c,d.context,!1),P0(c,d.containerInfo)}function yR(c,d,m,b,E){return ch(),x0(E),d.flags|=256,ks(c,d,m,b),d.child}var G0={dehydrated:null,treeContext:null,retryLane:0};function K0(c){return{baseLanes:c,cachePool:null,transitions:null}}function _R(c,d,m){var b=d.pendingProps,E=cn.current,N=!1,D=(d.flags&128)!==0,Q;if((Q=D)||(Q=c!==null&&c.memoizedState===null?!1:(E&2)!==0),Q?(N=!0,d.flags&=-129):(c===null||c.memoizedState!==null)&&(E|=1),Br(cn,E&1),c===null)return w0(d),c=d.memoizedState,c!==null&&(c=c.dehydrated,c!==null)?((d.mode&1)===0?d.lanes=1:c.data==="$!"?d.lanes=8:d.lanes=1073741824,null):(D=b.children,c=b.fallback,N?(b=d.mode,N=d.child,D={mode:"hidden",children:D},(b&1)===0&&N!==null?(N.childLanes=0,N.pendingProps=D):N=Jv(D,b,0,null),c=Iu(c,b,m,null),N.return=d,c.return=d,N.sibling=c,d.child=N,d.child.memoizedState=K0(m),d.memoizedState=G0,c):Y0(d,D));if(E=c.memoizedState,E!==null&&(Q=E.dehydrated,Q!==null))return H6(c,d,D,b,Q,E,m);if(N){N=b.fallback,D=d.mode,E=c.child,Q=E.sibling;var ne={mode:"hidden",children:b.children};return(D&1)===0&&d.child!==E?(b=d.child,b.childLanes=0,b.pendingProps=ne,d.deletions=null):(b=bc(E,ne),b.subtreeFlags=E.subtreeFlags&14680064),Q!==null?N=bc(Q,N):(N=Iu(N,D,m,null),N.flags|=2),N.return=d,b.return=d,b.sibling=N,d.child=b,b=N,N=d.child,D=c.child.memoizedState,D=D===null?K0(m):{baseLanes:D.baseLanes|m,cachePool:null,transitions:D.transitions},N.memoizedState=D,N.childLanes=c.childLanes&~m,d.memoizedState=G0,b}return N=c.child,c=N.sibling,b=bc(N,{mode:"visible",children:b.children}),(d.mode&1)===0&&(b.lanes=m),b.return=d,b.sibling=null,c!==null&&(m=d.deletions,m===null?(d.deletions=[c],d.flags|=16):m.push(c)),d.child=b,d.memoizedState=null,b}function Y0(c,d){return d=Jv({mode:"visible",children:d},c.mode,0,null),d.return=c,c.child=d}function Fv(c,d,m,b){return b!==null&&x0(b),uh(d,c.child,null,m),c=Y0(d,d.pendingProps.children),c.flags|=2,d.memoizedState=null,c}function H6(c,d,m,b,E,N,D){if(m)return d.flags&256?(d.flags&=-257,b=V0(Error(r(422))),Fv(c,d,D,b)):d.memoizedState!==null?(d.child=c.child,d.flags|=128,null):(N=b.fallback,E=d.mode,b=Jv({mode:"visible",children:b.children},E,0,null),N=Iu(N,E,D,null),N.flags|=2,b.return=d,N.return=d,b.sibling=N,d.child=b,(d.mode&1)!==0&&uh(d,c.child,null,D),d.child.memoizedState=K0(D),d.memoizedState=G0,N);if((d.mode&1)===0)return Fv(c,d,D,null);if(E.data==="$!"){if(b=E.nextSibling&&E.nextSibling.dataset,b)var Q=b.dgst;return b=Q,N=Error(r(419)),b=V0(N,b,void 0),Fv(c,d,D,b)}if(Q=(D&c.childLanes)!==0,Ks||Q){if(b=Wn,b!==null){switch(D&-D){case 4:E=2;break;case 16:E=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:E=32;break;case 536870912:E=268435456;break;default:E=0}E=(E&(b.suspendedLanes|D))!==0?0:E,E!==0&&E!==N.retryLane&&(N.retryLane=E,rl(c,E),Ta(b,c,E,-1))}return dx(),b=V0(Error(r(421))),Fv(c,d,D,b)}return E.data==="$?"?(d.flags|=128,d.child=c.child,d=nV.bind(null,c),E._reactRetry=d,null):(c=N.treeContext,xi=cc(E.nextSibling),wi=d,rn=!0,Na=null,c!==null&&(Gi[Ki++]=el,Gi[Ki++]=tl,Gi[Ki++]=ku,el=c.id,tl=c.overflow,ku=d),d=Y0(d,b.children),d.flags|=4096,d)}function bR(c,d,m){c.lanes|=d;var b=c.alternate;b!==null&&(b.lanes|=d),j0(c.return,d,m)}function Z0(c,d,m,b,E){var N=c.memoizedState;N===null?c.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:b,tail:m,tailMode:E}:(N.isBackwards=d,N.rendering=null,N.renderingStartTime=0,N.last=b,N.tail=m,N.tailMode=E)}function wR(c,d,m){var b=d.pendingProps,E=b.revealOrder,N=b.tail;if(ks(c,d,b.children,m),b=cn.current,(b&2)!==0)b=b&1|2,d.flags|=128;else{if(c!==null&&(c.flags&128)!==0)e:for(c=d.child;c!==null;){if(c.tag===13)c.memoizedState!==null&&bR(c,m,d);else if(c.tag===19)bR(c,m,d);else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===d)break e;for(;c.sibling===null;){if(c.return===null||c.return===d)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}b&=1}if(Br(cn,b),(d.mode&1)===0)d.memoizedState=null;else switch(E){case"forwards":for(m=d.child,E=null;m!==null;)c=m.alternate,c!==null&&Av(c)===null&&(E=m),m=m.sibling;m=E,m===null?(E=d.child,d.child=null):(E=m.sibling,m.sibling=null),Z0(d,!1,E,m,N);break;case"backwards":for(m=null,E=d.child,d.child=null;E!==null;){if(c=E.alternate,c!==null&&Av(c)===null){d.child=E;break}c=E.sibling,E.sibling=m,m=E,E=c}Z0(d,!0,m,null,N);break;case"together":Z0(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function $v(c,d){(d.mode&1)===0&&c!==null&&(c.alternate=null,d.alternate=null,d.flags|=2)}function sl(c,d,m){if(c!==null&&(d.dependencies=c.dependencies),Pu|=d.lanes,(m&d.childLanes)===0)return null;if(c!==null&&d.child!==c.child)throw Error(r(153));if(d.child!==null){for(c=d.child,m=bc(c,c.pendingProps),d.child=m,m.return=d;c.sibling!==null;)c=c.sibling,m=m.sibling=bc(c,c.pendingProps),m.return=d;m.sibling=null}return d.child}function q6(c,d,m){switch(d.tag){case 3:vR(d),ch();break;case 5:OP(d);break;case 1:Gs(d.type)&&wv(d);break;case 4:P0(d,d.stateNode.containerInfo);break;case 10:var b=d.type._context,E=d.memoizedProps.value;Br(Cv,b._currentValue),b._currentValue=E;break;case 13:if(b=d.memoizedState,b!==null)return b.dehydrated!==null?(Br(cn,cn.current&1),d.flags|=128,null):(m&d.child.childLanes)!==0?_R(c,d,m):(Br(cn,cn.current&1),c=sl(c,d,m),c!==null?c.sibling:null);Br(cn,cn.current&1);break;case 19:if(b=(m&d.childLanes)!==0,(c.flags&128)!==0){if(b)return wR(c,d,m);d.flags|=128}if(E=d.memoizedState,E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),Br(cn,cn.current),b)break;return null;case 22:case 23:return d.lanes=0,pR(c,d,m)}return sl(c,d,m)}var xR,J0,SR,kR;xR=function(c,d){for(var m=d.child;m!==null;){if(m.tag===5||m.tag===6)c.appendChild(m.stateNode);else if(m.tag!==4&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===d)break;for(;m.sibling===null;){if(m.return===null||m.return===d)return;m=m.return}m.sibling.return=m.return,m=m.sibling}},J0=function(){},SR=function(c,d,m,b){var E=c.memoizedProps;if(E!==b){c=d.stateNode,Cu(uo.current);var N=null;switch(m){case"input":E=at(c,E),b=at(c,b),N=[];break;case"select":E=L({},E,{value:void 0}),b=L({},b,{value:void 0}),N=[];break;case"textarea":E=St(c,E),b=St(c,b),N=[];break;default:typeof E.onClick!="function"&&typeof b.onClick=="function"&&(c.onclick=yv)}je(m,b);var D;m=null;for(ge in E)if(!b.hasOwnProperty(ge)&&E.hasOwnProperty(ge)&&E[ge]!=null)if(ge==="style"){var Q=E[ge];for(D in Q)Q.hasOwnProperty(D)&&(m||(m={}),m[D]="")}else ge!=="dangerouslySetInnerHTML"&&ge!=="children"&&ge!=="suppressContentEditableWarning"&&ge!=="suppressHydrationWarning"&&ge!=="autoFocus"&&(s.hasOwnProperty(ge)?N||(N=[]):(N=N||[]).push(ge,null));for(ge in b){var ne=b[ge];if(Q=E!=null?E[ge]:void 0,b.hasOwnProperty(ge)&&ne!==Q&&(ne!=null||Q!=null))if(ge==="style")if(Q){for(D in Q)!Q.hasOwnProperty(D)||ne&&ne.hasOwnProperty(D)||(m||(m={}),m[D]="");for(D in ne)ne.hasOwnProperty(D)&&Q[D]!==ne[D]&&(m||(m={}),m[D]=ne[D])}else m||(N||(N=[]),N.push(ge,m)),m=ne;else ge==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,Q=Q?Q.__html:void 0,ne!=null&&Q!==ne&&(N=N||[]).push(ge,ne)):ge==="children"?typeof ne!="string"&&typeof ne!="number"||(N=N||[]).push(ge,""+ne):ge!=="suppressContentEditableWarning"&&ge!=="suppressHydrationWarning"&&(s.hasOwnProperty(ge)?(ne!=null&&ge==="onScroll"&&Kr("scroll",c),N||Q===ne||(N=[])):(N=N||[]).push(ge,ne))}m&&(N=N||[]).push("style",m);var ge=N;(d.updateQueue=ge)&&(d.flags|=4)}},kR=function(c,d,m,b){m!==b&&(d.flags|=4)};function Op(c,d){if(!rn)switch(c.tailMode){case"hidden":d=c.tail;for(var m=null;d!==null;)d.alternate!==null&&(m=d),d=d.sibling;m===null?c.tail=null:m.sibling=null;break;case"collapsed":m=c.tail;for(var b=null;m!==null;)m.alternate!==null&&(b=m),m=m.sibling;b===null?d||c.tail===null?c.tail=null:c.tail.sibling=null:b.sibling=null}}function fs(c){var d=c.alternate!==null&&c.alternate.child===c.child,m=0,b=0;if(d)for(var E=c.child;E!==null;)m|=E.lanes|E.childLanes,b|=E.subtreeFlags&14680064,b|=E.flags&14680064,E.return=c,E=E.sibling;else for(E=c.child;E!==null;)m|=E.lanes|E.childLanes,b|=E.subtreeFlags,b|=E.flags,E.return=c,E=E.sibling;return c.subtreeFlags|=b,c.childLanes=m,d}function W6(c,d,m){var b=d.pendingProps;switch(_0(d),d.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return fs(d),null;case 1:return Gs(d.type)&&bv(),fs(d),null;case 3:return b=d.stateNode,fh(),Yr(Ws),Yr(ds),T0(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(c===null||c.child===null)&&(Ev(d)?d.flags|=4:c===null||c.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,Na!==null&&(lx(Na),Na=null))),J0(c,d),fs(d),null;case 5:R0(d);var E=Cu(Rp.current);if(m=d.type,c!==null&&d.stateNode!=null)SR(c,d,m,b,E),c.ref!==d.ref&&(d.flags|=512,d.flags|=2097152);else{if(!b){if(d.stateNode===null)throw Error(r(166));return fs(d),null}if(c=Cu(uo.current),Ev(d)){b=d.stateNode,m=d.type;var N=d.memoizedProps;switch(b[co]=d,b[Ep]=N,c=(d.mode&1)!==0,m){case"dialog":Kr("cancel",b),Kr("close",b);break;case"iframe":case"object":case"embed":Kr("load",b);break;case"video":case"audio":for(E=0;E<xp.length;E++)Kr(xp[E],b);break;case"source":Kr("error",b);break;case"img":case"image":case"link":Kr("error",b),Kr("load",b);break;case"details":Kr("toggle",b);break;case"input":Xt(b,N),Kr("invalid",b);break;case"select":b._wrapperState={wasMultiple:!!N.multiple},Kr("invalid",b);break;case"textarea":jt(b,N),Kr("invalid",b)}je(m,N),E=null;for(var D in N)if(N.hasOwnProperty(D)){var Q=N[D];D==="children"?typeof Q=="string"?b.textContent!==Q&&(N.suppressHydrationWarning!==!0&&vv(b.textContent,Q,c),E=["children",Q]):typeof Q=="number"&&b.textContent!==""+Q&&(N.suppressHydrationWarning!==!0&&vv(b.textContent,Q,c),E=["children",""+Q]):s.hasOwnProperty(D)&&Q!=null&&D==="onScroll"&&Kr("scroll",b)}switch(m){case"input":Ne(b),Et(b,N,!0);break;case"textarea":Ne(b),Or(b);break;case"select":case"option":break;default:typeof N.onClick=="function"&&(b.onclick=yv)}b=E,d.updateQueue=b,b!==null&&(d.flags|=4)}else{D=E.nodeType===9?E:E.ownerDocument,c==="http://www.w3.org/1999/xhtml"&&(c=Nr(m)),c==="http://www.w3.org/1999/xhtml"?m==="script"?(c=D.createElement("div"),c.innerHTML="<script><\/script>",c=c.removeChild(c.firstChild)):typeof b.is=="string"?c=D.createElement(m,{is:b.is}):(c=D.createElement(m),m==="select"&&(D=c,b.multiple?D.multiple=!0:b.size&&(D.size=b.size))):c=D.createElementNS(c,m),c[co]=d,c[Ep]=b,xR(c,d,!1,!1),d.stateNode=c;e:{switch(D=Be(m,b),m){case"dialog":Kr("cancel",c),Kr("close",c),E=b;break;case"iframe":case"object":case"embed":Kr("load",c),E=b;break;case"video":case"audio":for(E=0;E<xp.length;E++)Kr(xp[E],c);E=b;break;case"source":Kr("error",c),E=b;break;case"img":case"image":case"link":Kr("error",c),Kr("load",c),E=b;break;case"details":Kr("toggle",c),E=b;break;case"input":Xt(c,b),E=at(c,b),Kr("invalid",c);break;case"option":E=b;break;case"select":c._wrapperState={wasMultiple:!!b.multiple},E=L({},b,{value:void 0}),Kr("invalid",c);break;case"textarea":jt(c,b),E=St(c,b),Kr("invalid",c);break;default:E=b}je(m,E),Q=E;for(N in Q)if(Q.hasOwnProperty(N)){var ne=Q[N];N==="style"?le(c,ne):N==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,ne!=null&&At(c,ne)):N==="children"?typeof ne=="string"?(m!=="textarea"||ne!=="")&&ar(c,ne):typeof ne=="number"&&ar(c,""+ne):N!=="suppressContentEditableWarning"&&N!=="suppressHydrationWarning"&&N!=="autoFocus"&&(s.hasOwnProperty(N)?ne!=null&&N==="onScroll"&&Kr("scroll",c):ne!=null&&j(c,N,ne,D))}switch(m){case"input":Ne(c),Et(c,b,!1);break;case"textarea":Ne(c),Or(c);break;case"option":b.value!=null&&c.setAttribute("value",""+de(b.value));break;case"select":c.multiple=!!b.multiple,N=b.value,N!=null?De(c,!!b.multiple,N,!1):b.defaultValue!=null&&De(c,!!b.multiple,b.defaultValue,!0);break;default:typeof E.onClick=="function"&&(c.onclick=yv)}switch(m){case"button":case"input":case"select":case"textarea":b=!!b.autoFocus;break e;case"img":b=!0;break e;default:b=!1}}b&&(d.flags|=4)}d.ref!==null&&(d.flags|=512,d.flags|=2097152)}return fs(d),null;case 6:if(c&&d.stateNode!=null)kR(c,d,c.memoizedProps,b);else{if(typeof b!="string"&&d.stateNode===null)throw Error(r(166));if(m=Cu(Rp.current),Cu(uo.current),Ev(d)){if(b=d.stateNode,m=d.memoizedProps,b[co]=d,(N=b.nodeValue!==m)&&(c=wi,c!==null))switch(c.tag){case 3:vv(b.nodeValue,m,(c.mode&1)!==0);break;case 5:c.memoizedProps.suppressHydrationWarning!==!0&&vv(b.nodeValue,m,(c.mode&1)!==0)}N&&(d.flags|=4)}else b=(m.nodeType===9?m:m.ownerDocument).createTextNode(b),b[co]=d,d.stateNode=b}return fs(d),null;case 13:if(Yr(cn),b=d.memoizedState,c===null||c.memoizedState!==null&&c.memoizedState.dehydrated!==null){if(rn&&xi!==null&&(d.mode&1)!==0&&(d.flags&128)===0)CP(),ch(),d.flags|=98560,N=!1;else if(N=Ev(d),b!==null&&b.dehydrated!==null){if(c===null){if(!N)throw Error(r(318));if(N=d.memoizedState,N=N!==null?N.dehydrated:null,!N)throw Error(r(317));N[co]=d}else ch(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;fs(d),N=!1}else Na!==null&&(lx(Na),Na=null),N=!0;if(!N)return d.flags&65536?d:null}return(d.flags&128)!==0?(d.lanes=m,d):(b=b!==null,b!==(c!==null&&c.memoizedState!==null)&&b&&(d.child.flags|=8192,(d.mode&1)!==0&&(c===null||(cn.current&1)!==0?$n===0&&($n=3):dx())),d.updateQueue!==null&&(d.flags|=4),fs(d),null);case 4:return fh(),J0(c,d),c===null&&Sp(d.stateNode.containerInfo),fs(d),null;case 10:return E0(d.type._context),fs(d),null;case 17:return Gs(d.type)&&bv(),fs(d),null;case 19:if(Yr(cn),N=d.memoizedState,N===null)return fs(d),null;if(b=(d.flags&128)!==0,D=N.rendering,D===null)if(b)Op(N,!1);else{if($n!==0||c!==null&&(c.flags&128)!==0)for(c=d.child;c!==null;){if(D=Av(c),D!==null){for(d.flags|=128,Op(N,!1),b=D.updateQueue,b!==null&&(d.updateQueue=b,d.flags|=4),d.subtreeFlags=0,b=m,m=d.child;m!==null;)N=m,c=b,N.flags&=14680066,D=N.alternate,D===null?(N.childLanes=0,N.lanes=c,N.child=null,N.subtreeFlags=0,N.memoizedProps=null,N.memoizedState=null,N.updateQueue=null,N.dependencies=null,N.stateNode=null):(N.childLanes=D.childLanes,N.lanes=D.lanes,N.child=D.child,N.subtreeFlags=0,N.deletions=null,N.memoizedProps=D.memoizedProps,N.memoizedState=D.memoizedState,N.updateQueue=D.updateQueue,N.type=D.type,c=D.dependencies,N.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),m=m.sibling;return Br(cn,cn.current&1|2),d.child}c=c.sibling}N.tail!==null&&Jt()>vh&&(d.flags|=128,b=!0,Op(N,!1),d.lanes=4194304)}else{if(!b)if(c=Av(D),c!==null){if(d.flags|=128,b=!0,m=c.updateQueue,m!==null&&(d.updateQueue=m,d.flags|=4),Op(N,!0),N.tail===null&&N.tailMode==="hidden"&&!D.alternate&&!rn)return fs(d),null}else 2*Jt()-N.renderingStartTime>vh&&m!==1073741824&&(d.flags|=128,b=!0,Op(N,!1),d.lanes=4194304);N.isBackwards?(D.sibling=d.child,d.child=D):(m=N.last,m!==null?m.sibling=D:d.child=D,N.last=D)}return N.tail!==null?(d=N.tail,N.rendering=d,N.tail=d.sibling,N.renderingStartTime=Jt(),d.sibling=null,m=cn.current,Br(cn,b?m&1|2:m&1),d):(fs(d),null);case 22:case 23:return ux(),b=d.memoizedState!==null,c!==null&&c.memoizedState!==null!==b&&(d.flags|=8192),b&&(d.mode&1)!==0?(Si&1073741824)!==0&&(fs(d),d.subtreeFlags&6&&(d.flags|=8192)):fs(d),null;case 24:return null;case 25:return null}throw Error(r(156,d.tag))}function G6(c,d){switch(_0(d),d.tag){case 1:return Gs(d.type)&&bv(),c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 3:return fh(),Yr(Ws),Yr(ds),T0(),c=d.flags,(c&65536)!==0&&(c&128)===0?(d.flags=c&-65537|128,d):null;case 5:return R0(d),null;case 13:if(Yr(cn),c=d.memoizedState,c!==null&&c.dehydrated!==null){if(d.alternate===null)throw Error(r(340));ch()}return c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 19:return Yr(cn),null;case 4:return fh(),null;case 10:return E0(d.type._context),null;case 22:case 23:return ux(),null;case 24:return null;default:return null}}var zv=!1,ps=!1,K6=typeof WeakSet=="function"?WeakSet:Set,nt=null;function mh(c,d){var m=c.ref;if(m!==null)if(typeof m=="function")try{m(null)}catch(b){mn(c,d,b)}else m.current=null}function Q0(c,d,m){try{m()}catch(b){mn(c,d,b)}}var ER=!1;function Y6(c,d){if(u0=Wd,c=nP(),r0(c)){if("selectionStart"in c)var m={start:c.selectionStart,end:c.selectionEnd};else e:{m=(m=c.ownerDocument)&&m.defaultView||window;var b=m.getSelection&&m.getSelection();if(b&&b.rangeCount!==0){m=b.anchorNode;var E=b.anchorOffset,N=b.focusNode;b=b.focusOffset;try{m.nodeType,N.nodeType}catch{m=null;break e}var D=0,Q=-1,ne=-1,ge=0,Ae=0,Me=c,Pe=null;t:for(;;){for(var tt;Me!==m||E!==0&&Me.nodeType!==3||(Q=D+E),Me!==N||b!==0&&Me.nodeType!==3||(ne=D+b),Me.nodeType===3&&(D+=Me.nodeValue.length),(tt=Me.firstChild)!==null;)Pe=Me,Me=tt;for(;;){if(Me===c)break t;if(Pe===m&&++ge===E&&(Q=D),Pe===N&&++Ae===b&&(ne=D),(tt=Me.nextSibling)!==null)break;Me=Pe,Pe=Me.parentNode}Me=tt}m=Q===-1||ne===-1?null:{start:Q,end:ne}}else m=null}m=m||{start:0,end:0}}else m=null;for(d0={focusedElem:c,selectionRange:m},Wd=!1,nt=d;nt!==null;)if(d=nt,c=d.child,(d.subtreeFlags&1028)!==0&&c!==null)c.return=d,nt=c;else for(;nt!==null;){d=nt;try{var lt=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(lt!==null){var dt=lt.memoizedProps,kn=lt.memoizedState,he=d.stateNode,oe=he.getSnapshotBeforeUpdate(d.elementType===d.type?dt:Pa(d.type,dt),kn);he.__reactInternalSnapshotBeforeUpdate=oe}break;case 3:var fe=d.stateNode.containerInfo;fe.nodeType===1?fe.textContent="":fe.nodeType===9&&fe.documentElement&&fe.removeChild(fe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(Ve){mn(d,d.return,Ve)}if(c=d.sibling,c!==null){c.return=d.return,nt=c;break}nt=d.return}return lt=ER,ER=!1,lt}function Mp(c,d,m){var b=d.updateQueue;if(b=b!==null?b.lastEffect:null,b!==null){var E=b=b.next;do{if((E.tag&c)===c){var N=E.destroy;E.destroy=void 0,N!==void 0&&Q0(d,m,N)}E=E.next}while(E!==b)}}function Uv(c,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var m=d=d.next;do{if((m.tag&c)===c){var b=m.create;m.destroy=b()}m=m.next}while(m!==d)}}function X0(c){var d=c.ref;if(d!==null){var m=c.stateNode;switch(c.tag){case 5:c=m;break;default:c=m}typeof d=="function"?d(c):d.current=c}}function jR(c){var d=c.alternate;d!==null&&(c.alternate=null,jR(d)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(d=c.stateNode,d!==null&&(delete d[co],delete d[Ep],delete d[m0],delete d[A6],delete d[T6])),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}function CR(c){return c.tag===5||c.tag===3||c.tag===4}function NR(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||CR(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function ex(c,d,m){var b=c.tag;if(b===5||b===6)c=c.stateNode,d?m.nodeType===8?m.parentNode.insertBefore(c,d):m.insertBefore(c,d):(m.nodeType===8?(d=m.parentNode,d.insertBefore(c,m)):(d=m,d.appendChild(c)),m=m._reactRootContainer,m!=null||d.onclick!==null||(d.onclick=yv));else if(b!==4&&(c=c.child,c!==null))for(ex(c,d,m),c=c.sibling;c!==null;)ex(c,d,m),c=c.sibling}function tx(c,d,m){var b=c.tag;if(b===5||b===6)c=c.stateNode,d?m.insertBefore(c,d):m.appendChild(c);else if(b!==4&&(c=c.child,c!==null))for(tx(c,d,m),c=c.sibling;c!==null;)tx(c,d,m),c=c.sibling}var rs=null,Ra=!1;function mc(c,d,m){for(m=m.child;m!==null;)PR(c,d,m),m=m.sibling}function PR(c,d,m){if(ln&&typeof ln.onCommitFiberUnmount=="function")try{ln.onCommitFiberUnmount(Hi,m)}catch{}switch(m.tag){case 5:ps||mh(m,d);case 6:var b=rs,E=Ra;rs=null,mc(c,d,m),rs=b,Ra=E,rs!==null&&(Ra?(c=rs,m=m.stateNode,c.nodeType===8?c.parentNode.removeChild(m):c.removeChild(m)):rs.removeChild(m.stateNode));break;case 18:rs!==null&&(Ra?(c=rs,m=m.stateNode,c.nodeType===8?p0(c.parentNode,m):c.nodeType===1&&p0(c,m),wu(c)):p0(rs,m.stateNode));break;case 4:b=rs,E=Ra,rs=m.stateNode.containerInfo,Ra=!0,mc(c,d,m),rs=b,Ra=E;break;case 0:case 11:case 14:case 15:if(!ps&&(b=m.updateQueue,b!==null&&(b=b.lastEffect,b!==null))){E=b=b.next;do{var N=E,D=N.destroy;N=N.tag,D!==void 0&&((N&2)!==0||(N&4)!==0)&&Q0(m,d,D),E=E.next}while(E!==b)}mc(c,d,m);break;case 1:if(!ps&&(mh(m,d),b=m.stateNode,typeof b.componentWillUnmount=="function"))try{b.props=m.memoizedProps,b.state=m.memoizedState,b.componentWillUnmount()}catch(Q){mn(m,d,Q)}mc(c,d,m);break;case 21:mc(c,d,m);break;case 22:m.mode&1?(ps=(b=ps)||m.memoizedState!==null,mc(c,d,m),ps=b):mc(c,d,m);break;default:mc(c,d,m)}}function RR(c){var d=c.updateQueue;if(d!==null){c.updateQueue=null;var m=c.stateNode;m===null&&(m=c.stateNode=new K6),d.forEach(function(b){var E=sV.bind(null,c,b);m.has(b)||(m.add(b),b.then(E,E))})}}function Aa(c,d){var m=d.deletions;if(m!==null)for(var b=0;b<m.length;b++){var E=m[b];try{var N=c,D=d,Q=D;e:for(;Q!==null;){switch(Q.tag){case 5:rs=Q.stateNode,Ra=!1;break e;case 3:rs=Q.stateNode.containerInfo,Ra=!0;break e;case 4:rs=Q.stateNode.containerInfo,Ra=!0;break e}Q=Q.return}if(rs===null)throw Error(r(160));PR(N,D,E),rs=null,Ra=!1;var ne=E.alternate;ne!==null&&(ne.return=null),E.return=null}catch(ge){mn(E,d,ge)}}if(d.subtreeFlags&12854)for(d=d.child;d!==null;)AR(d,c),d=d.sibling}function AR(c,d){var m=c.alternate,b=c.flags;switch(c.tag){case 0:case 11:case 14:case 15:if(Aa(d,c),fo(c),b&4){try{Mp(3,c,c.return),Uv(3,c)}catch(dt){mn(c,c.return,dt)}try{Mp(5,c,c.return)}catch(dt){mn(c,c.return,dt)}}break;case 1:Aa(d,c),fo(c),b&512&&m!==null&&mh(m,m.return);break;case 5:if(Aa(d,c),fo(c),b&512&&m!==null&&mh(m,m.return),c.flags&32){var E=c.stateNode;try{ar(E,"")}catch(dt){mn(c,c.return,dt)}}if(b&4&&(E=c.stateNode,E!=null)){var N=c.memoizedProps,D=m!==null?m.memoizedProps:N,Q=c.type,ne=c.updateQueue;if(c.updateQueue=null,ne!==null)try{Q==="input"&&N.type==="radio"&&N.name!=null&&Rt(E,N),Be(Q,D);var ge=Be(Q,N);for(D=0;D<ne.length;D+=2){var Ae=ne[D],Me=ne[D+1];Ae==="style"?le(E,Me):Ae==="dangerouslySetInnerHTML"?At(E,Me):Ae==="children"?ar(E,Me):j(E,Ae,Me,ge)}switch(Q){case"input":Ee(E,N);break;case"textarea":Cr(E,N);break;case"select":var Pe=E._wrapperState.wasMultiple;E._wrapperState.wasMultiple=!!N.multiple;var tt=N.value;tt!=null?De(E,!!N.multiple,tt,!1):Pe!==!!N.multiple&&(N.defaultValue!=null?De(E,!!N.multiple,N.defaultValue,!0):De(E,!!N.multiple,N.multiple?[]:"",!1))}E[Ep]=N}catch(dt){mn(c,c.return,dt)}}break;case 6:if(Aa(d,c),fo(c),b&4){if(c.stateNode===null)throw Error(r(162));E=c.stateNode,N=c.memoizedProps;try{E.nodeValue=N}catch(dt){mn(c,c.return,dt)}}break;case 3:if(Aa(d,c),fo(c),b&4&&m!==null&&m.memoizedState.isDehydrated)try{wu(d.containerInfo)}catch(dt){mn(c,c.return,dt)}break;case 4:Aa(d,c),fo(c);break;case 13:Aa(d,c),fo(c),E=c.child,E.flags&8192&&(N=E.memoizedState!==null,E.stateNode.isHidden=N,!N||E.alternate!==null&&E.alternate.memoizedState!==null||(sx=Jt())),b&4&&RR(c);break;case 22:if(Ae=m!==null&&m.memoizedState!==null,c.mode&1?(ps=(ge=ps)||Ae,Aa(d,c),ps=ge):Aa(d,c),fo(c),b&8192){if(ge=c.memoizedState!==null,(c.stateNode.isHidden=ge)&&!Ae&&(c.mode&1)!==0)for(nt=c,Ae=c.child;Ae!==null;){for(Me=nt=Ae;nt!==null;){switch(Pe=nt,tt=Pe.child,Pe.tag){case 0:case 11:case 14:case 15:Mp(4,Pe,Pe.return);break;case 1:mh(Pe,Pe.return);var lt=Pe.stateNode;if(typeof lt.componentWillUnmount=="function"){b=Pe,m=Pe.return;try{d=b,lt.props=d.memoizedProps,lt.state=d.memoizedState,lt.componentWillUnmount()}catch(dt){mn(b,m,dt)}}break;case 5:mh(Pe,Pe.return);break;case 22:if(Pe.memoizedState!==null){DR(Me);continue}}tt!==null?(tt.return=Pe,nt=tt):DR(Me)}Ae=Ae.sibling}e:for(Ae=null,Me=c;;){if(Me.tag===5){if(Ae===null){Ae=Me;try{E=Me.stateNode,ge?(N=E.style,typeof N.setProperty=="function"?N.setProperty("display","none","important"):N.display="none"):(Q=Me.stateNode,ne=Me.memoizedProps.style,D=ne!=null&&ne.hasOwnProperty("display")?ne.display:null,Q.style.display=ie("display",D))}catch(dt){mn(c,c.return,dt)}}}else if(Me.tag===6){if(Ae===null)try{Me.stateNode.nodeValue=ge?"":Me.memoizedProps}catch(dt){mn(c,c.return,dt)}}else if((Me.tag!==22&&Me.tag!==23||Me.memoizedState===null||Me===c)&&Me.child!==null){Me.child.return=Me,Me=Me.child;continue}if(Me===c)break e;for(;Me.sibling===null;){if(Me.return===null||Me.return===c)break e;Ae===Me&&(Ae=null),Me=Me.return}Ae===Me&&(Ae=null),Me.sibling.return=Me.return,Me=Me.sibling}}break;case 19:Aa(d,c),fo(c),b&4&&RR(c);break;case 21:break;default:Aa(d,c),fo(c)}}function fo(c){var d=c.flags;if(d&2){try{e:{for(var m=c.return;m!==null;){if(CR(m)){var b=m;break e}m=m.return}throw Error(r(160))}switch(b.tag){case 5:var E=b.stateNode;b.flags&32&&(ar(E,""),b.flags&=-33);var N=NR(c);tx(c,N,E);break;case 3:case 4:var D=b.stateNode.containerInfo,Q=NR(c);ex(c,Q,D);break;default:throw Error(r(161))}}catch(ne){mn(c,c.return,ne)}c.flags&=-3}d&4096&&(c.flags&=-4097)}function Z6(c,d,m){nt=c,TR(c)}function TR(c,d,m){for(var b=(c.mode&1)!==0;nt!==null;){var E=nt,N=E.child;if(E.tag===22&&b){var D=E.memoizedState!==null||zv;if(!D){var Q=E.alternate,ne=Q!==null&&Q.memoizedState!==null||ps;Q=zv;var ge=ps;if(zv=D,(ps=ne)&&!ge)for(nt=E;nt!==null;)D=nt,ne=D.child,D.tag===22&&D.memoizedState!==null?OR(E):ne!==null?(ne.return=D,nt=ne):OR(E);for(;N!==null;)nt=N,TR(N),N=N.sibling;nt=E,zv=Q,ps=ge}IR(c)}else(E.subtreeFlags&8772)!==0&&N!==null?(N.return=E,nt=N):IR(c)}}function IR(c){for(;nt!==null;){var d=nt;if((d.flags&8772)!==0){var m=d.alternate;try{if((d.flags&8772)!==0)switch(d.tag){case 0:case 11:case 15:ps||Uv(5,d);break;case 1:var b=d.stateNode;if(d.flags&4&&!ps)if(m===null)b.componentDidMount();else{var E=d.elementType===d.type?m.memoizedProps:Pa(d.type,m.memoizedProps);b.componentDidUpdate(E,m.memoizedState,b.__reactInternalSnapshotBeforeUpdate)}var N=d.updateQueue;N!==null&&DP(d,N,b);break;case 3:var D=d.updateQueue;if(D!==null){if(m=null,d.child!==null)switch(d.child.tag){case 5:m=d.child.stateNode;break;case 1:m=d.child.stateNode}DP(d,D,m)}break;case 5:var Q=d.stateNode;if(m===null&&d.flags&4){m=Q;var ne=d.memoizedProps;switch(d.type){case"button":case"input":case"select":case"textarea":ne.autoFocus&&m.focus();break;case"img":ne.src&&(m.src=ne.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(d.memoizedState===null){var ge=d.alternate;if(ge!==null){var Ae=ge.memoizedState;if(Ae!==null){var Me=Ae.dehydrated;Me!==null&&wu(Me)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}ps||d.flags&512&&X0(d)}catch(Pe){mn(d,d.return,Pe)}}if(d===c){nt=null;break}if(m=d.sibling,m!==null){m.return=d.return,nt=m;break}nt=d.return}}function DR(c){for(;nt!==null;){var d=nt;if(d===c){nt=null;break}var m=d.sibling;if(m!==null){m.return=d.return,nt=m;break}nt=d.return}}function OR(c){for(;nt!==null;){var d=nt;try{switch(d.tag){case 0:case 11:case 15:var m=d.return;try{Uv(4,d)}catch(ne){mn(d,m,ne)}break;case 1:var b=d.stateNode;if(typeof b.componentDidMount=="function"){var E=d.return;try{b.componentDidMount()}catch(ne){mn(d,E,ne)}}var N=d.return;try{X0(d)}catch(ne){mn(d,N,ne)}break;case 5:var D=d.return;try{X0(d)}catch(ne){mn(d,D,ne)}}}catch(ne){mn(d,d.return,ne)}if(d===c){nt=null;break}var Q=d.sibling;if(Q!==null){Q.return=d.return,nt=Q;break}nt=d.return}}var J6=Math.ceil,Bv=C.ReactCurrentDispatcher,rx=C.ReactCurrentOwner,Ji=C.ReactCurrentBatchConfig,hr=0,Wn=null,Tn=null,ns=0,Si=0,gh=uc(0),$n=0,Lp=null,Pu=0,Vv=0,nx=0,Fp=null,Ys=null,sx=0,vh=1/0,il=null,Hv=!1,ix=null,gc=null,qv=!1,vc=null,Wv=0,$p=0,ax=null,Gv=-1,Kv=0;function Es(){return(hr&6)!==0?Jt():Gv!==-1?Gv:Gv=Jt()}function yc(c){return(c.mode&1)===0?1:(hr&2)!==0&&ns!==0?ns&-ns:D6.transition!==null?(Kv===0&&(Kv=Bd()),Kv):(c=nr,c!==0||(c=window.event,c=c===void 0?16:cv(c.type)),c)}function Ta(c,d,m,b){if(50<$p)throw $p=0,ax=null,Error(r(185));nc(c,m,b),((hr&2)===0||c!==Wn)&&(c===Wn&&((hr&2)===0&&(Vv|=m),$n===4&&_c(c,ns)),Zs(c,b),m===1&&hr===0&&(d.mode&1)===0&&(vh=Jt()+500,xv&&hc()))}function Zs(c,d){var m=c.callbackNode;ka(c,d);var b=xs(c,c===Wn?ns:0);if(b===0)m!==null&&Wr(m),c.callbackNode=null,c.callbackPriority=0;else if(d=b&-b,c.callbackPriority!==d){if(m!=null&&Wr(m),d===1)c.tag===0?I6(LR.bind(null,c)):xP(LR.bind(null,c)),P6(function(){(hr&6)===0&&hc()}),m=null;else{switch(Vd(b)){case 1:m=qs;break;case 4:m=cs;break;case 16:m=vi;break;case 536870912:m=us;break;default:m=vi}m=qR(m,MR.bind(null,c))}c.callbackPriority=d,c.callbackNode=m}}function MR(c,d){if(Gv=-1,Kv=0,(hr&6)!==0)throw Error(r(327));var m=c.callbackNode;if(yh()&&c.callbackNode!==m)return null;var b=xs(c,c===Wn?ns:0);if(b===0)return null;if((b&30)!==0||(b&c.expiredLanes)!==0||d)d=Yv(c,b);else{d=b;var E=hr;hr|=2;var N=$R();(Wn!==c||ns!==d)&&(il=null,vh=Jt()+500,Au(c,d));do try{eV();break}catch(Q){FR(c,Q)}while(!0);k0(),Bv.current=N,hr=E,Tn!==null?d=0:(Wn=null,ns=0,d=$n)}if(d!==0){if(d===2&&(E=rc(c),E!==0&&(b=E,d=ox(c,E))),d===1)throw m=Lp,Au(c,0),_c(c,b),Zs(c,Jt()),m;if(d===6)_c(c,b);else{if(E=c.current.alternate,(b&30)===0&&!Q6(E)&&(d=Yv(c,b),d===2&&(N=rc(c),N!==0&&(b=N,d=ox(c,N))),d===1))throw m=Lp,Au(c,0),_c(c,b),Zs(c,Jt()),m;switch(c.finishedWork=E,c.finishedLanes=b,d){case 0:case 1:throw Error(r(345));case 2:Tu(c,Ys,il);break;case 3:if(_c(c,b),(b&130023424)===b&&(d=sx+500-Jt(),10<d)){if(xs(c,0)!==0)break;if(E=c.suspendedLanes,(E&b)!==b){Es(),c.pingedLanes|=c.suspendedLanes&E;break}c.timeoutHandle=f0(Tu.bind(null,c,Ys,il),d);break}Tu(c,Ys,il);break;case 4:if(_c(c,b),(b&4194240)===b)break;for(d=c.eventTimes,E=-1;0<b;){var D=31-tn(b);N=1<<D,D=d[D],D>E&&(E=D),b&=~N}if(b=E,b=Jt()-b,b=(120>b?120:480>b?480:1080>b?1080:1920>b?1920:3e3>b?3e3:4320>b?4320:1960*J6(b/1960))-b,10<b){c.timeoutHandle=f0(Tu.bind(null,c,Ys,il),b);break}Tu(c,Ys,il);break;case 5:Tu(c,Ys,il);break;default:throw Error(r(329))}}}return Zs(c,Jt()),c.callbackNode===m?MR.bind(null,c):null}function ox(c,d){var m=Fp;return c.current.memoizedState.isDehydrated&&(Au(c,d).flags|=256),c=Yv(c,d),c!==2&&(d=Ys,Ys=m,d!==null&&lx(d)),c}function lx(c){Ys===null?Ys=c:Ys.push.apply(Ys,c)}function Q6(c){for(var d=c;;){if(d.flags&16384){var m=d.updateQueue;if(m!==null&&(m=m.stores,m!==null))for(var b=0;b<m.length;b++){var E=m[b],N=E.getSnapshot;E=E.value;try{if(!Ca(N(),E))return!1}catch{return!1}}}if(m=d.child,d.subtreeFlags&16384&&m!==null)m.return=d,d=m;else{if(d===c)break;for(;d.sibling===null;){if(d.return===null||d.return===c)return!0;d=d.return}d.sibling.return=d.return,d=d.sibling}}return!0}function _c(c,d){for(d&=~nx,d&=~Vv,c.suspendedLanes|=d,c.pingedLanes&=~d,c=c.expirationTimes;0<d;){var m=31-tn(d),b=1<<m;c[m]=-1,d&=~b}}function LR(c){if((hr&6)!==0)throw Error(r(327));yh();var d=xs(c,0);if((d&1)===0)return Zs(c,Jt()),null;var m=Yv(c,d);if(c.tag!==0&&m===2){var b=rc(c);b!==0&&(d=b,m=ox(c,b))}if(m===1)throw m=Lp,Au(c,0),_c(c,d),Zs(c,Jt()),m;if(m===6)throw Error(r(345));return c.finishedWork=c.current.alternate,c.finishedLanes=d,Tu(c,Ys,il),Zs(c,Jt()),null}function cx(c,d){var m=hr;hr|=1;try{return c(d)}finally{hr=m,hr===0&&(vh=Jt()+500,xv&&hc())}}function Ru(c){vc!==null&&vc.tag===0&&(hr&6)===0&&yh();var d=hr;hr|=1;var m=Ji.transition,b=nr;try{if(Ji.transition=null,nr=1,c)return c()}finally{nr=b,Ji.transition=m,hr=d,(hr&6)===0&&hc()}}function ux(){Si=gh.current,Yr(gh)}function Au(c,d){c.finishedWork=null,c.finishedLanes=0;var m=c.timeoutHandle;if(m!==-1&&(c.timeoutHandle=-1,N6(m)),Tn!==null)for(m=Tn.return;m!==null;){var b=m;switch(_0(b),b.tag){case 1:b=b.type.childContextTypes,b!=null&&bv();break;case 3:fh(),Yr(Ws),Yr(ds),T0();break;case 5:R0(b);break;case 4:fh();break;case 13:Yr(cn);break;case 19:Yr(cn);break;case 10:E0(b.type._context);break;case 22:case 23:ux()}m=m.return}if(Wn=c,Tn=c=bc(c.current,null),ns=Si=d,$n=0,Lp=null,nx=Vv=Pu=0,Ys=Fp=null,ju!==null){for(d=0;d<ju.length;d++)if(m=ju[d],b=m.interleaved,b!==null){m.interleaved=null;var E=b.next,N=m.pending;if(N!==null){var D=N.next;N.next=E,b.next=D}m.pending=b}ju=null}return c}function FR(c,d){do{var m=Tn;try{if(k0(),Tv.current=Mv,Iv){for(var b=un.memoizedState;b!==null;){var E=b.queue;E!==null&&(E.pending=null),b=b.next}Iv=!1}if(Nu=0,qn=Fn=un=null,Ap=!1,Tp=0,rx.current=null,m===null||m.return===null){$n=1,Lp=d,Tn=null;break}e:{var N=c,D=m.return,Q=m,ne=d;if(d=ns,Q.flags|=32768,ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var ge=ne,Ae=Q,Me=Ae.tag;if((Ae.mode&1)===0&&(Me===0||Me===11||Me===15)){var Pe=Ae.alternate;Pe?(Ae.updateQueue=Pe.updateQueue,Ae.memoizedState=Pe.memoizedState,Ae.lanes=Pe.lanes):(Ae.updateQueue=null,Ae.memoizedState=null)}var tt=cR(D);if(tt!==null){tt.flags&=-257,uR(tt,D,Q,N,d),tt.mode&1&&lR(N,ge,d),d=tt,ne=ge;var lt=d.updateQueue;if(lt===null){var dt=new Set;dt.add(ne),d.updateQueue=dt}else lt.add(ne);break e}else{if((d&1)===0){lR(N,ge,d),dx();break e}ne=Error(r(426))}}else if(rn&&Q.mode&1){var kn=cR(D);if(kn!==null){(kn.flags&65536)===0&&(kn.flags|=256),uR(kn,D,Q,N,d),x0(ph(ne,Q));break e}}N=ne=ph(ne,Q),$n!==4&&($n=2),Fp===null?Fp=[N]:Fp.push(N),N=D;do{switch(N.tag){case 3:N.flags|=65536,d&=-d,N.lanes|=d;var he=aR(N,ne,d);IP(N,he);break e;case 1:Q=ne;var oe=N.type,fe=N.stateNode;if((N.flags&128)===0&&(typeof oe.getDerivedStateFromError=="function"||fe!==null&&typeof fe.componentDidCatch=="function"&&(gc===null||!gc.has(fe)))){N.flags|=65536,d&=-d,N.lanes|=d;var Ve=oR(N,Q,d);IP(N,Ve);break e}}N=N.return}while(N!==null)}UR(m)}catch(gt){d=gt,Tn===m&&m!==null&&(Tn=m=m.return);continue}break}while(!0)}function $R(){var c=Bv.current;return Bv.current=Mv,c===null?Mv:c}function dx(){($n===0||$n===3||$n===2)&&($n=4),Wn===null||(Pu&268435455)===0&&(Vv&268435455)===0||_c(Wn,ns)}function Yv(c,d){var m=hr;hr|=2;var b=$R();(Wn!==c||ns!==d)&&(il=null,Au(c,d));do try{X6();break}catch(E){FR(c,E)}while(!0);if(k0(),hr=m,Bv.current=b,Tn!==null)throw Error(r(261));return Wn=null,ns=0,$n}function X6(){for(;Tn!==null;)zR(Tn)}function eV(){for(;Tn!==null&&!Bt();)zR(Tn)}function zR(c){var d=HR(c.alternate,c,Si);c.memoizedProps=c.pendingProps,d===null?UR(c):Tn=d,rx.current=null}function UR(c){var d=c;do{var m=d.alternate;if(c=d.return,(d.flags&32768)===0){if(m=W6(m,d,Si),m!==null){Tn=m;return}}else{if(m=G6(m,d),m!==null){m.flags&=32767,Tn=m;return}
vendor: 4,145 bytes, line 41
41if(c!==null)c.flags|=32768,c.subtreeFlags=0,c.deletions=null;else{$n=6,Tn=null;return}}if(d=d.sibling,d!==null){Tn=d;return}Tn=d=c}while(d!==null);$n===0&&($n=5)}function Tu(c,d,m){var b=nr,E=Ji.transition;try{Ji.transition=null,nr=1,tV(c,d,m,b)}finally{Ji.transition=E,nr=b}return null}function tV(c,d,m,b){do yh();while(vc!==null);if((hr&6)!==0)throw Error(r(327));m=c.finishedWork;var E=c.finishedLanes;if(m===null)return null;if(c.finishedWork=null,c.finishedLanes=0,m===c.current)throw Error(r(177));c.callbackNode=null,c.callbackPriority=0;var N=m.lanes|m.childLanes;if(cp(c,N),c===Wn&&(Tn=Wn=null,ns=0),(m.subtreeFlags&2064)===0&&(m.flags&2064)===0||qv||(qv=!0,qR(vi,function(){return yh(),null})),N=(m.flags&15990)!==0,(m.subtreeFlags&15990)!==0||N){N=Ji.transition,Ji.transition=null;var D=nr;nr=1;var Q=hr;hr|=4,rx.current=null,Y6(c,m),AR(m,c),w6(d0),Wd=!!u0,d0=u0=null,c.current=m,Z6(m),lr(),hr=Q,nr=D,Ji.transition=N}else c.current=m;if(qv&&(qv=!1,vc=c,Wv=E),N=c.pendingLanes,N===0&&(gc=null),Sa(m.stateNode),Zs(c,Jt()),d!==null)for(b=c.onRecoverableError,m=0;m<d.length;m++)E=d[m],b(E.value,{componentStack:E.stack,digest:E.digest});if(Hv)throw Hv=!1,c=ix,ix=null,c;return(Wv&1)!==0&&c.tag!==0&&yh(),N=c.pendingLanes,(N&1)!==0?c===ax?$p++:($p=0,ax=c):$p=0,hc(),null}function yh(){if(vc!==null){var c=Vd(Wv),d=Ji.transition,m=nr;try{if(Ji.transition=null,nr=16>c?16:c,vc===null)var b=!1;else{if(c=vc,vc=null,Wv=0,(hr&6)!==0)throw Error(r(331));var E=hr;for(hr|=4,nt=c.current;nt!==null;){var N=nt,D=N.child;if((nt.flags&16)!==0){var Q=N.deletions;if(Q!==null){for(var ne=0;ne<Q.length;ne++){var ge=Q[ne];for(nt=ge;nt!==null;){var Ae=nt;switch(Ae.tag){case 0:case 11:case 15:Mp(8,Ae,N)}var Me=Ae.child;if(Me!==null)Me.return=Ae,nt=Me;else for(;nt!==null;){Ae=nt;var Pe=Ae.sibling,tt=Ae.return;if(jR(Ae),Ae===ge){nt=null;break}if(Pe!==null){Pe.return=tt,nt=Pe;break}nt=tt}}}var lt=N.alternate;if(lt!==null){var dt=lt.child;if(dt!==null){lt.child=null;do{var kn=dt.sibling;dt.sibling=null,dt=kn}while(dt!==null)}}nt=N}}if((N.subtreeFlags&2064)!==0&&D!==null)D.return=N,nt=D;else e:for(;nt!==null;){if(N=nt,(N.flags&2048)!==0)switch(N.tag){case 0:case 11:case 15:Mp(9,N,N.return)}var he=N.sibling;if(he!==null){he.return=N.return,nt=he;break e}nt=N.return}}var oe=c.current;for(nt=oe;nt!==null;){D=nt;var fe=D.child;if((D.subtreeFlags&2064)!==0&&fe!==null)fe.return=D,nt=fe;else e:for(D=oe;nt!==null;){if(Q=nt,(Q.flags&2048)!==0)try{switch(Q.tag){case 0:case 11:case 15:Uv(9,Q)}}catch(gt){mn(Q,Q.return,gt)}if(Q===D){nt=null;break e}var Ve=Q.sibling;if(Ve!==null){Ve.return=Q.return,nt=Ve;break e}nt=Q.return}}if(hr=E,hc(),ln&&typeof ln.onPostCommitFiberRoot=="function")try{ln.onPostCommitFiberRoot(Hi,c)}catch{}b=!0}return b}finally{nr=m,Ji.transition=d}}return!1}function BR(c,d,m){d=ph(m,d),d=aR(c,d,1),c=pc(c,d,1),d=Es(),c!==null&&(nc(c,1,d),Zs(c,d))}function mn(c,d,m){if(c.tag===3)BR(c,c,m);else for(;d!==null;){if(d.tag===3){BR(d,c,m);break}else if(d.tag===1){var b=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(gc===null||!gc.has(b))){c=ph(m,c),c=oR(d,c,1),d=pc(d,c,1),c=Es(),d!==null&&(nc(d,1,c),Zs(d,c));break}}d=d.return}}function rV(c,d,m){var b=c.pingCache;b!==null&&b.delete(d),d=Es(),c.pingedLanes|=c.suspendedLanes&m,Wn===c&&(ns&m)===m&&($n===4||$n===3&&(ns&130023424)===ns&&500>Jt()-sx?Au(c,0):nx|=m),Zs(c,d)}function VR(c,d){d===0&&((c.mode&1)===0?d=1:(d=pn,pn<<=1,(pn&130023424)===0&&(pn=4194304)));var m=Es();c=rl(c,d),c!==null&&(nc(c,d,m),Zs(c,m))}function nV(c){var d=c.memoizedState,m=0;d!==null&&(m=d.retryLane),VR(c,m)}function sV(c,d){var m=0;switch(c.tag){case 13:var b=c.stateNode,E=c.memoizedState;E!==null&&(m=E.retryLane);break;case 19:b=c.stateNode;break;default:throw Error(r(314))}b!==null&&b.delete(d),VR(c,m)}var HR;HR=function(c,d,m){if(c!==null)if(c.memoizedProps!==d.pendingProps||Ws.current)Ks=!0;else{if((c.lanes&m)===0&&(d.flags&128)===0)return Ks=!1,q6(c,d,m);Ks=(c.flags&131072)!==0}else Ks=!1,rn&&(d.flags&1048576)!==0&&SP(d,kv,d.index);switch(d.lanes=0,d.tag){case 2:var b=d.type;$v(c,d),c=d.pendingProps;var E=ah(d,ds.current);
vendor: 14,163 bytes, lines 41-50
41hh(d,m),E=O0(null,d,b,c,E,m);var N=M0();return d.flags|=1,typeof E=="object"&&E!==null&&typeof E.render=="function"&&E.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,Gs(b)?(N=!0,wv(d)):N=!1,d.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,N0(d),E.updater=Lv,d.stateNode=E,E._reactInternals=d,B0(d,b,c,m),d=W0(null,d,b,!0,N,m)):(d.tag=0,rn&&N&&y0(d),ks(null,d,E,m),d=d.child),d;case 16:b=d.elementType;e:{switch($v(c,d),c=d.pendingProps,E=b._init,b=E(b._payload),d.type=b,E=d.tag=aV(b),c=Pa(b,c),E){case 0:d=q0(null,d,b,c,m);break e;case 1:d=gR(null,d,b,c,m);break e;case 11:d=dR(null,d,b,c,m);break e;case 14:d=hR(null,d,b,Pa(b.type,c),m);break e}throw Error(r(306,b,""))}return d;case 0:return b=d.type,E=d.pendingProps,E=d.elementType===b?E:Pa(b,E),q0(c,d,b,E,m);case 1:return b=d.type,E=d.pendingProps,E=d.elementType===b?E:Pa(b,E),gR(c,d,b,E,m);case 3:e:{if(vR(d),c===null)throw Error(r(387));b=d.pendingProps,N=d.memoizedState,E=N.element,TP(c,d),Rv(d,b,null,m);var D=d.memoizedState;if(b=D.element,N.isDehydrated)if(N={element:b,isDehydrated:!1,cache:D.cache,pendingSuspenseBoundaries:D.pendingSuspenseBoundaries,transitions:D.transitions},d.updateQueue.baseState=N,d.memoizedState=N,d.flags&256){E=ph(Error(r(423)),d),d=yR(c,d,b,m,E);break e}else if(b!==E){E=ph(Error(r(424)),d),d=yR(c,d,b,m,E);break e}else for(xi=cc(d.stateNode.containerInfo.firstChild),wi=d,rn=!0,Na=null,m=RP(d,null,b,m),d.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling;else{if(ch(),b===E){d=sl(c,d,m);break e}ks(c,d,b,m)}d=d.child}return d;case 5:return OP(d),c===null&&w0(d),b=d.type,E=d.pendingProps,N=c!==null?c.memoizedProps:null,D=E.children,h0(b,E)?D=null:N!==null&&h0(b,N)&&(d.flags|=32),mR(c,d),ks(c,d,D,m),d.child;case 6:return c===null&&w0(d),null;case 13:return _R(c,d,m);case 4:return P0(d,d.stateNode.containerInfo),b=d.pendingProps,c===null?d.child=uh(d,null,b,m):ks(c,d,b,m),d.child;case 11:return b=d.type,E=d.pendingProps,E=d.elementType===b?E:Pa(b,E),dR(c,d,b,E,m);case 7:return ks(c,d,d.pendingProps,m),d.child;case 8:return ks(c,d,d.pendingProps.children,m),d.child;case 12:return ks(c,d,d.pendingProps.children,m),d.child;case 10:e:{if(b=d.type._context,E=d.pendingProps,N=d.memoizedProps,D=E.value,Br(Cv,b._currentValue),b._currentValue=D,N!==null)if(Ca(N.value,D)){if(N.children===E.children&&!Ws.current){d=sl(c,d,m);break e}}else for(N=d.child,N!==null&&(N.return=d);N!==null;){var Q=N.dependencies;if(Q!==null){D=N.child;for(var ne=Q.firstContext;ne!==null;){if(ne.context===b){if(N.tag===1){ne=nl(-1,m&-m),ne.tag=2;var ge=N.updateQueue;if(ge!==null){ge=ge.shared;var Ae=ge.pending;Ae===null?ne.next=ne:(ne.next=Ae.next,Ae.next=ne),ge.pending=ne}}N.lanes|=m,ne=N.alternate,ne!==null&&(ne.lanes|=m),j0(N.return,m,d),Q.lanes|=m;break}ne=ne.next}}else if(N.tag===10)D=N.type===d.type?null:N.child;else if(N.tag===18){if(D=N.return,D===null)throw Error(r(341));D.lanes|=m,Q=D.alternate,Q!==null&&(Q.lanes|=m),j0(D,m,d),D=N.sibling}else D=N.child;if(D!==null)D.return=N;else for(D=N;D!==null;){if(D===d){D=null;break}if(N=D.sibling,N!==null){N.return=D.return,D=N;break}D=D.return}N=D}ks(c,d,E.children,m),d=d.child}return d;case 9:return E=d.type,b=d.pendingProps.children,hh(d,m),E=Yi(E),b=b(E),d.flags|=1,ks(c,d,b,m),d.child;case 14:return b=d.type,E=Pa(b,d.pendingProps),E=Pa(b.type,E),hR(c,d,b,E,m);case 15:return fR(c,d,d.type,d.pendingProps,m);case 17:return b=d.type,E=d.pendingProps,E=d.elementType===b?E:Pa(b,E),$v(c,d),d.tag=1,Gs(b)?(c=!0,wv(d)):c=!1,hh(d,m),sR(d,b,E),B0(d,b,E,m),W0(null,d,b,!0,c,m);case 19:return wR(c,d,m);case 22:return pR(c,d,m)}throw Error(r(156,d.tag))};function qR(c,d){return vr(c,d)}function iV(c,d,m,b){this.tag=c,this.key=m,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qi(c,d,m,b){return new iV(c,d,m,b)}function hx(c){return c=c.prototype,!(!c||!c.isReactComponent)}function aV(c){if(typeof c=="function")return hx(c)?1:0;if(c!=null){if(c=c.$$typeof,c===M)return 11;if(c===H)return 14}return 2}function bc(c,d){var m=c.alternate;return m===null?(m=Qi(c.tag,d,c.key,c.mode),m.elementType=c.elementType,m.type=c.type,m.stateNode=c.stateNode,m.alternate=c,c.alternate=m):(m.pendingProps=d,m.type=c.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=c.flags&14680064,m.childLanes=c.childLanes,m.lanes=c.lanes,m.child=c.child,m.memoizedProps=c.memoizedProps,m.memoizedState=c.memoizedState,m.updateQueue=c.updateQueue,d=c.dependencies,m.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},m.sibling=c.sibling,m.index=c.index,m.ref=c.ref,m}function Zv(c,d,m,b,E,N){var D=2;if(b=c,typeof c=="function")hx(c)&&(D=1);else if(typeof c=="string")D=5;else e:switch(c){case I:return Iu(m.children,E,N,d);case P:D=8,E|=8;break;case T:return c=Qi(12,m,d,E|2),c.elementType=T,c.lanes=N,c;case U:return c=Qi(13,m,d,E),c.elementType=U,c.lanes=N,c;case V:return c=Qi(19,m,d,E),c.elementType=V,c.lanes=N,c;case B:return Jv(m,E,N,d);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case O:D=10;break e;case G:D=9;break e;case M:D=11;break e;case H:D=14;break e;case Y:D=16,b=null;break e}throw Error(r(130,c==null?c:typeof c,""))}return d=Qi(D,m,d,E),d.elementType=c,d.type=b,d.lanes=N,d}function Iu(c,d,m,b){return c=Qi(7,c,b,d),c.lanes=m,c}function Jv(c,d,m,b){return c=Qi(22,c,b,d),c.elementType=B,c.lanes=m,c.stateNode={isHidden:!1},c}function fx(c,d,m){return c=Qi(6,c,null,d),c.lanes=m,c}function px(c,d,m){return d=Qi(4,c.children!==null?c.children:[],c.key,d),d.lanes=m,d.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},d}function oV(c,d,m,b,E){this.tag=d,this.containerInfo=c,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=qi(0),this.expirationTimes=qi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qi(0),this.identifierPrefix=b,this.onRecoverableError=E,this.mutableSourceEagerHydrationData=null}function mx(c,d,m,b,E,N,D,Q,ne){return c=new oV(c,d,m,Q,ne),d===1?(d=1,N===!0&&(d|=8)):d=0,N=Qi(3,null,null,d),c.current=N,N.stateNode=c,N.memoizedState={element:b,isDehydrated:m,cache:null,transitions:null,pendingSuspenseBoundaries:null},N0(N),c}function lV(c,d,m){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:A,key:b==null?null:""+b,children:c,containerInfo:d,implementation:m}}function WR(c){if(!c)return dc;c=c._reactInternals;e:{if(qe(c)!==c||c.tag!==1)throw Error(r(170));var d=c;do{switch(d.tag){case 3:d=d.stateNode.context;break e;case 1:if(Gs(d.type)){d=d.stateNode.__reactInternalMemoizedMergedChildContext;break e}}d=d.return}while(d!==null);throw Error(r(171))}if(c.tag===1){var m=c.type;if(Gs(m))return bP(c,m,d)}return d}function GR(c,d,m,b,E,N,D,Q,ne){return c=mx(m,b,!0,c,E,N,D,Q,ne),c.context=WR(null),m=c.current,b=Es(),E=yc(m),N=nl(b,E),N.callback=d??null,pc(m,N,E),c.current.lanes=E,nc(c,E,b),Zs(c,b),c}function Qv(c,d,m,b){var E=d.current,N=Es(),D=yc(E);return m=WR(m),d.context===null?d.context=m:d.pendingContext=m,d=nl(N,D),d.payload={element:c},b=b===void 0?null:b,b!==null&&(d.callback=b),c=pc(E,d,D),c!==null&&(Ta(c,E,D,N),Pv(c,E,D)),D}function Xv(c){if(c=c.current,!c.child)return null;switch(c.child.tag){case 5:return c.child.stateNode;default:return c.child.stateNode}}function KR(c,d){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var m=c.retryLane;c.retryLane=m!==0&&m<d?m:d}}function gx(c,d){KR(c,d),(c=c.alternate)&&KR(c,d)}function cV(){return null}var YR=typeof reportError=="function"?reportError:function(c){console.error(c)};function vx(c){this._internalRoot=c}ey.prototype.render=vx.prototype.render=function(c){var d=this._internalRoot;if(d===null)throw Error(r(409));Qv(c,d,null,null)},ey.prototype.unmount=vx.prototype.unmount=function(){var c=this._internalRoot;if(c!==null){this._internalRoot=null;var d=c.containerInfo;Ru(function(){Qv(null,c,null,null)}),d[Qo]=null}};function ey(c){this._internalRoot=c}ey.prototype.unstable_scheduleHydration=function(c){if(c){var d=dp();c={blockedOn:null,target:c,priority:d};for(var m=0;m<io.length&&d!==0&&d<io[m].priority;m++);io.splice(m,0,c),m===0&&hp(c)}};function yx(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)}function ty(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11&&(c.nodeType!==8||c.nodeValue!==" react-mount-point-unstable "))}function ZR(){}function uV(c,d,m,b,E){if(E){if(typeof b=="function"){var N=b;b=function(){var ge=Xv(D);N.call(ge)}}var D=GR(d,b,c,0,null,!1,!1,"",ZR);return c._reactRootContainer=D,c[Qo]=D.current,Sp(c.nodeType===8?c.parentNode:c),Ru(),D}for(;E=c.lastChild;)c.removeChild(E);if(typeof b=="function"){var Q=b;b=function(){var ge=Xv(ne);Q.call(ge)}}var ne=mx(c,0,!1,null,null,!1,!1,"",ZR);return c._reactRootContainer=ne,c[Qo]=ne.current,Sp(c.nodeType===8?c.parentNode:c),Ru(function(){Qv(d,ne,m,b)}),ne}function ry(c,d,m,b,E){var N=m._reactRootContainer;if(N){var D=N;if(typeof E=="function"){var Q=E;E=function(){var ne=Xv(D);Q.call(ne)}}Qv(d,D,c,E)}else D=uV(m,d,c,E,b);return Xv(D)}gu=function(c){switch(c.tag){case 3:var d=c.stateNode;if(d.current.memoizedState.isDehydrated){var m=yi(d.pendingLanes);m!==0&&(sc(d,m|1),Zs(d,Jt()),(hr&6)===0&&(vh=Jt()+500,hc()))}break;case 13:Ru(function(){var b=rl(c,1);if(b!==null){var E=Es();Ta(b,c,1,E)}}),gx(c,1)}},up=function(c){if(c.tag===13){var d=rl(c,134217728);if(d!==null){var m=Es();Ta(d,c,134217728,m)}gx(c,134217728)}},vu=function(c){if(c.tag===13){var d=yc(c),m=rl(c,d);if(m!==null){var b=Es();Ta(m,c,d,b)}gx(c,d)}},dp=function(){return nr},_i=function(c,d){var m=nr;try{return nr=c,d()}finally{nr=m}},ae=function(c,d,m){switch(d){case"input":if(Ee(c,m),d=m.name,m.type==="radio"&&d!=null){for(m=c;m.parentNode;)m=m.parentNode;for(m=m.querySelectorAll("input[name="+JSON.stringify(""+d)+'][type="radio"]'),d=0;d<m.length;d++){var b=m[d];if(b!==c&&b.form===c.form){var E=_v(b);if(!E)throw Error(r(90));He(b),Ee(b,E)}}}break;case"textarea":Cr(c,m);break;case"select":d=m.value,d!=null&&De(c,!!m.multiple,d,!1)}},_t=cx,Kt=Ru;var dV={usingClientEntryPoint:!1,Events:[jp,sh,_v,Ze,Gt,cx]},zp={findFiberByHostInstance:xu,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},hV={bundleType:zp.bundleType,version:zp.version,rendererPackageName:zp.rendererPackageName,rendererConfig:zp.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(c){return c=mt(c),c===null?null:c.stateNode},findFiberByHostInstance:zp.findFiberByHostInstance||cV,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ny=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ny.isDisabled&&ny.supportsFiber)try{Hi=ny.inject(hV),ln=ny}catch{}}return Js.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=dV,Js.createPortal=function(c,d){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!yx(d))throw Error(r(200));return lV(c,d,null,m)},Js.createRoot=function(c,d){if(!yx(c))throw Error(r(299));var m=!1,b="",E=YR;return d!=null&&(d.unstable_strictMode===!0&&(m=!0),d.identifierPrefix!==void 0&&(b=d.identifierPrefix),d.onRecoverableError!==void 0&&(E=d.onRecoverableError)),d=mx(c,1,!1,null,null,m,!1,b,E),c[Qo]=d.current,Sp(c.nodeType===8?c.parentNode:c),new vx(d)},Js.findDOMNode=function(c){if(c==null)return null;if(c.nodeType===1)return c;var d=c._reactInternals;if(d===void 0)throw typeof c.render=="function"?Error(r(188)):(c=Object.keys(c).join(","),Error(r(268,c)));return c=mt(d),c=c===null?null:c.stateNode,c},Js.flushSync=function(c){return Ru(c)},Js.hydrate=function(c,d,m){if(!ty(d))throw Error(r(200));return ry(null,c,d,!0,m)},Js.hydrateRoot=function(c,d,m){if(!yx(c))throw Error(r(405));var b=m!=null&&m.hydratedSources||null,E=!1,N="",D=YR;if(m!=null&&(m.unstable_strictMode===!0&&(E=!0),m.identifierPrefix!==void 0&&(N=m.identifierPrefix),m.onRecoverableError!==void 0&&(D=m.onRecoverableError)),d=GR(d,null,c,1,m??null,E,!1,N,D),c[Qo]=d.current,Sp(c),b)for(c=0;c<b.length;c++)m=b[c],E=m._getVersion,E=E(m._source),d.mutableSourceEagerHydrationData==null?d.mutableSourceEagerHydrationData=[m,E]:d.mutableSourceEagerHydrationData.push(m,E);return new ey(d)},Js.render=function(c,d,m){if(!ty(d))throw Error(r(200));return ry(null,c,d,!1,m)},Js.unmountComponentAtNode=function(c){if(!ty(c))throw Error(r(40));return c._reactRootContainer?(Ru(function(){ry(null,null,c,!1,function(){c._reactRootContainer=null,c[Qo]=null})}),!0):!1},Js.unstable_batchedUpdates=cx,Js.unstable_renderSubtreeIntoContainer=function(c,d,m,b){if(!ty(m))throw Error(r(200));if(c==null||c._reactInternals===void 0)throw Error(r(38));return ry(c,d,m,!1,b)},Js.version="18.3.1-next-f1338f8080-20240426",Js}var iA;function hM(){if(iA)return xx.exports;iA=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),xx.exports=xV(),xx.exports}var aA;function SV(){if(aA)return iy;aA=1;var t=hM();return iy.createRoot=t.createRoot,iy.hydrateRoot=t.hydrateRoot,iy}var kV=SV();/**
42 * react-router v7.18.2
43 *
44 * Copyright (c) Remix Software Inc.
45 *
46 * This source code is licensed under the MIT license found in the
47 * LICENSE.md file in the root directory of this source tree.
48 *
49 * @license MIT
50 */var fM=t=>{throw TypeError(t)},pM=(t,e,r)=>e.has(t)||fM("Cannot "+r),sa=(t,e,r)=>
50(pM(t,e,"read from private field"),r?r.call(t):e.get(t)),fm=(t,e,r)=>e.has(t)?fM("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),po=(t,e,r,n)=>(pM(t,e,"write to private field"),e.set(t,r),r),Vb=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Hj=/^[\\/]{2}/;function mM(t,e){return e+t.replace(/\\/g,"/")}var oA="popstate";function lA(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function EV(t={}){function e(n,s){var h;let i=(h=s.state)==null?void 0:h.masked,{pathname:a,search:l,hash:u}=i||n.location;return $m("",{pathname:a,search:l,hash:u},s.state&&s.state.usr||null,s.state&&s.state.key||"default",i?{pathname:n.location.pathname,search:n.location.search,hash:n.location.hash}:void 0)}function r(n,s){return typeof s=="string"?s:$o(s)}return CV(e,r,null,t)}function Zt(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function An(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function jV(){return Math.random().toString(36).substring(2,10)}function cA(t,e){return{usr:t.state,key:t.key,idx:e,masked:t.mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function $m(t,e,r=null,n,s){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?Bo(e):e,state:r,key:e&&e.key||n||jV(),mask:s}}function $o({pathname:t="/",search:e="",hash:r=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Bo(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substring(r),t=t.substring(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substring(n),t=t.substring(0,n)),t&&(e.pathname=t)}return e}function CV(t,e,r,n={}){let{window:s=document.defaultView,v5Compat:i=!1}=n,a=s.history,l="POP",u=null,h=p();h==null&&(h=0,a.replaceState({...a.state,idx:h},""));function p(){return(a.state||{idx:null}).idx}function f(){l="POP";let w=p(),S=w==null?null:w-h;h=w,u&&u({action:l,location:x.location,delta:S})}function g(w,S){l="PUSH";let k=lA(w)?w:$m(x.location,w,S);h=p()+1;let j=cA(k,h),C=x.createHref(k.mask||k);try{a.pushState(j,"",C)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;s.location.assign(C)}i&&u&&u({action:l,location:x.location,delta:1})}function v(w,S){l="REPLACE";let k=lA(w)?w:$m(x.location,w,S);h=p();let j=cA(k,h),C=x.createHref(k.mask||k);a.replaceState(j,"",C),i&&u&&u({action:l,location:x.location,delta:0})}function _(w){return gM(s,w)}let x={get action(){return l},get location(){return t(s,a)},listen(w){if(u)throw new Error("A history only accepts one active listener");return s.addEventListener(oA,f),u=w,()=>{s.removeEventListener(oA,f),u=null}},createHref(w){return e(s,w)},createURL:_,encodeLocation(w){let S=_(w);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:g,replace:v,go(w){return a.go(w)}};return x}function gM(t,e,r=!1){let n="http://localhost";t&&(n=t.location.origin!=="null"?t.location.origin:t.location.href),Zt(n,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:$o(e);return s=s.replace(/ $/,"%20"),!r&&Hj.test(s)&&(s=n+s),new URL(s,n)}var pm,uA=class{constructor(t){if(fm(this,pm,new Map),t)for(let[e,r]of t)this.set(e,r)}get(t){if(sa(this,pm).has(t))return sa(this,pm).get(t);if(t.defaultValue!==void 0)return t.defaultValue;throw new Error("No value found for context")}set(t,e){sa(this,pm).set(t,e)}};pm=new WeakMap;var NV=new Set(["lazy","caseSensitive","path","id","index","children"]);function PV(t){return NV.has(t)}var RV=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function AV(t){return RV.has(t)}function TV(t){return t.index===!0}function zm(t,e,r=[],n={},s=!1){return t.map((i,a)=>{let l=[...r,String(a)],u=typeof i.id=="string"?i.id:l.join("-");if(Zt(i.index!==!0||!i.children,"Cannot specify children on an index route"),Zt(s||!n[u],`Found a route id collision on i
50d "${u}".  Route id's must be globally unique within Data Router usages`),TV(i)){let h={...i,id:u};return n[u]=dA(h,e(h)),h}else{let h={...i,id:u,children:void 0};return n[u]=dA(h,e(h)),i.children&&(h.children=zm(i.children,e,l,n,s)),h}})}function dA(t,e){return Object.assign(t,{...e,...typeof e.lazy=="object"&&e.lazy!=null?{lazy:{...t.lazy,...e.lazy}}:{}})}function vM(t,e,r="/"){return Ma(t,e,r,!1)}function Ma(t,e,r,n,s){let i=typeof e=="string"?Bo(e):e,a=ma(i.pathname||"/",r);if(a==null)return null;let l=s??Qy(t),u=null,h=HV(a);for(let p=0;u==null&&p<l.length;++p)u=VV(l[p],h,n);return u}function IV(t,e){let{route:r,pathname:n,params:s}=t;return{id:r.id,pathname:n,params:s,data:e[r.id],loaderData:e[r.id],handle:r.handle}}function Qy(t){let e=yM(t);return DV(e),e}function yM(t,e=[],r=[],n="",s=!1){let i=(a,l,u=s,h)=>{let p={relativePath:h===void 0?a.path||"":h,caseSensitive:a.caseSensitive===!0,childrenIndex:l,route:a};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(n)&&u)return;Zt(p.relativePath.startsWith(n),`Absolute route path "${p.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(n.length)}let f=ua([n,p.relativePath]),g=r.concat(p);a.children&&a.children.length>0&&(Zt(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),yM(a.children,e,g,f,u)),!(a.path==null&&!a.index)&&e.push({path:f,score:UV(f,a.index),routesMeta:g.map((v,_)=>{let[x,w]=wM(v.relativePath,v.caseSensitive,_===g.length-1);return{...v,matcher:x,compiledParams:w}})})};return t.forEach((a,l)=>{var u;if(a.path===""||!((u=a.path)!=null&&u.includes("?")))i(a,l);else for(let h of _M(a.path))i(a,l,!0,h)}),e}function _M(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,s=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return s?[i,""]:[i];let a=_M(n.join("/")),l=[];return l.push(...a.map(u=>u===""?i:[i,u].join("/"))),s&&l.push(...a),l.map(u=>t.startsWith("/")&&u===""?"/":u)}function DV(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:BV(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var OV=/^:[\w-]+$/,MV=3,LV=2,FV=1,$V=10,zV=-2,hA=t=>t==="*";function UV(t,e){let r=t.split("/"),n=r.length;return r.some(hA)&&(n+=zV),e&&(n+=LV),r.filter(s=>!hA(s)).reduce((s,i)=>s+(OV.test(i)?MV:i===""?FV:$V),n)}function BV(t,e){return t.length===e.length&&t.slice(0,-1).every((n,s)=>n===e[s])?t[t.length-1]-e[e.length-1]:0}function VV(t,e,r=!1){let{routesMeta:n}=t,s={},i="/",a=[];for(let l=0;l<n.length;++l){let u=n[l],h=l===n.length-1,p=i==="/"?e:e.slice(i.length)||"/",f={path:u.relativePath,caseSensitive:u.caseSensitive,end:h},g=u.matcher&&u.compiledParams?bM(f,p,u.matcher,u.compiledParams):Um(f,p),v=u.route;if(!g&&h&&r&&!n[n.length-1].route.index&&(g=Um({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},p)),!g)return null;
50Object.assign(s,g.params),a.push({params:s,pathname:ua([i,g.pathname]),pathnameBase:GV(ua([i,g.pathnameBase])),route:v}),g.pathnameBase!=="/"&&(i=ua([i,g.pathnameBase]))}return a}function Um(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,n]=wM(t.path,t.caseSensitive,t.end);return bM(t,e,r,n)}function bM(t,e,r,n){let s=e.match(r);if(!s)return null;let i=s[0],a=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:n.reduce((h,{paramName:p,isOptional:f},g)=>{if(p==="*"){let _=l[g]||"";a=i.slice(0,i.length-_.length).replace(/(.)\/+$/,"$1")}const v=l[g];return f&&!v?h[p]=void 0:h[p]=(v||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:a,pattern:t}}function wM(t,e=!1,r=!0){An(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let n=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,l,u,h,p)=>{if(n.push({paramName:l,isOptional:u!=null}),u){let f=p.charAt(h+a.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(n.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),n]}function HV(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return An(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function ma(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function qV({basename:t,pathname:e}){return e==="/"?t:ua([t,e])}var qj=t=>Vb.test(t);function WV(t,e="/"){let{pathname:r,search:n="",hash:s=""}=typeof t=="string"?Bo(t):t,i;return r?(r=Gj(r),r.startsWith("/")?i=fA(r.substring(1),"/"):i=fA(r,e)):i=e,{pathname:i,search:KV(n),hash:YV(s)}}function fA(t,e){let r=P_(e).split("/");return t.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function Ex(t,e,r,n){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(n)}].  Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function xM(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function Wj(t){let e=xM(t);return e.map((r,n)=>n===e.length-1?r.pathname:r.pathnameBase)}function Hb(t,e,r,n=!1){let s;typeof t=="string"?s=Bo(t):(s={...t},Zt(!s.pathname||!s.pathname.includes("?"),Ex("?","pathname","search",s)),Zt(!s.pathname||!s.pathname.includes("#"),Ex("#","pathname","hash",s)),Zt(!s.search||!s.search.includes("#"),Ex("#","search","hash",s)));let i=t===""||s.pathname==="",a=i?"/":s.pathname,l;if(a==null)l=r;else{let f=e.length-1;if(!n&&a.startsWith("..")){let g=a.split("/");for(;g[0]==="..";)g.shift(),f-=1;s.pathname=g.join("/")}l=f>=0?e[f]:"/"}let u=WV(s,l),h=a&&a!=="/"&&a.endsWith("/"),p=(i||a===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(h||p)&&(u.pathname+="/"),u}var Gj=t=>t.replace(/[\\/]{2,}/g,"/"),ua=t=>Gj(t.join("/")),P_=t=>t.replace(/\/+$/,""),GV=t=>P_(t).replace(/^\/*/,"/"),KV=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,YV=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,ga=(t,e=302)=>{let r=e;typeof r=="number"?r={status:r}:typeof r.status>"u"&&(r.status=302);let n=new Headers(r.headers);return n.set("Location",t),new Response(null,{...r,headers:n})},ZV=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],jg=class{constructor(t,e,r,n=!1){this.status=t,this.statusText=e||"",this.internal=n,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Sd(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Cg(t){let e=t.map(r=>
50r.route.path).filter(Boolean);return ua(e)||"/"}var SM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function kM(t,e){let r=t;if(typeof r!="string"||!Vb.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let n=r,s=!1;if(SM)try{let i=new URL(window.location.href),a=Hj.test(r)?new URL(mM(r,i.protocol)):new URL(r),l=ma(a.pathname,e);a.origin===i.origin&&l!=null?r=l+a.search+a.hash:s=!0}catch{An(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:s,to:r}}var Wc=Symbol("Uninstrumented");function JV(t,e){let r={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};t.forEach(s=>s({id:e.id,index:e.index,path:e.path,instrument(i){let a=Object.keys(r);for(let l of a)i[l]&&r[l].push(i[l])}}));let n={};if(typeof e.lazy=="function"&&r.lazy.length>0){let s=Zh(r.lazy,e.lazy,()=>{});s&&(n.lazy=s)}if(typeof e.lazy=="object"){let s=e.lazy;["middleware","loader","action"].forEach(i=>{let a=s[i],l=r[`lazy.${i}`];if(typeof a=="function"&&l.length>0){let u=Zh(l,a,()=>{});u&&(n.lazy=Object.assign(n.lazy||{},{[i]:u}))}})}return["loader","action"].forEach(s=>{let i=e[s];if(typeof i=="function"&&r[s].length>0){let a=i[Wc]??i,l=Zh(r[s],a,(...u)=>pA(u[0]));l&&(s==="loader"&&a.hydrate===!0&&(l.hydrate=!0),l[Wc]=a,n[s]=l)}}),e.middleware&&e.middleware.length>0&&r.middleware.length>0&&(n.middleware=e.middleware.map(s=>{let i=s[Wc]??s,a=Zh(r.middleware,i,(...l)=>pA(l[0]));return a?(a[Wc]=i,a):s})),n}function QV(t,e){let r={navigate:[],fetch:[]};if(e.forEach(n=>n({instrument(s){let i=Object.keys(s);for(let a of i)s[a]&&r[a].push(s[a])}})),r.navigate.length>0){let n=t.navigate[Wc]??t.navigate,s=Zh(r.navigate,n,(...i)=>{let[a,l]=i;return{to:typeof a=="number"||typeof a=="string"?a:a?$o(a):".",...mA(t,l??{})}});s&&(s[Wc]=n,t.navigate=s)}if(r.fetch.length>0){let n=t.fetch[Wc]??t.fetch,s=Zh(r.fetch,n,(...i)=>{let[a,,l,u]=i;return{href:l??".",fetcherKey:a,...mA(t,u??{})}});s&&(s[Wc]=n,t.fetch=s)}return t}function Zh(t,e,r){return t.length===0?null:async(...n)=>{let s=await EM(t,r(...n),()=>e(...n),t.length-1);if(s.type==="error")throw s.value;return s.value}}async function EM(t,e,r,n){let s=t[n],i;if(s){let a,l=async()=>(a?console.error("You cannot call instrumented handlers more than once"):a=EM(t,e,r,n-1),i=await a,Zt(i,"Expected a result"),i.type==="error"&&i.value instanceof Error?{status:"error",error:i.value}:{status:"success",error:void 0});try{await s(l,e)}catch(u){console.error("An instrumentation function threw an error:",u)}a||await l(),await a}else try{i={type:"success",value:await r()}}catch(a){i={type:"error",value:a}}return i||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function pA(t){let{request:e,context:r,params:n,pattern:s}=t;return{request:XV(e),params:{...n},pattern:s,context:e8(r)}}function mA(t,e){return{currentUrl:$o(t.state.location),..."formMethod"in e?{formMethod:e.formMethod}:{},..."formEncType"in e?{formEncType:e.formEncType}:{},..."formData"in e?{formData:e.formData}:{},..."body"in e?{body:e.body}:{}}}function XV(t){return{method:t.method,url:t.url,headers:{get:(...e)=>t.headers.get(...e)}}}function e8(t){if(r8(t)){let e={...t};return Object.freeze(e),e}else return{get:e=>t.get(e)}}var t8=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function r8(t){if(t===null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null||Object.getOwnPropertyNames(e).sort().join("\0")===t8}var jM=["POST","PUT","PATCH","DELETE"],n8=new Set(jM),s8=["GET",...jM],i8=new Set(s8),CM=new Set([301,302,303,307,308]),a8=new Set([307,308]),jx={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},NM={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Bp={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},o8=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),PM="remix-router-transitions",RM=Symbol("ResetLoaderData"),Ku,Lh,Pc,Fh,l8=class{constructor(t){fm(this,Ku),fm(this,Lh),fm(this,Pc),fm(this,Fh),po(this,Ku,t),po(this,Lh,Qy(t))}get stableRoutes(){return sa(this,Ku)}get activeRoutes(){return sa(this,Pc)??sa(this,Ku)}get branches(){return sa(this,Fh)??sa(this,Lh)}get hasHMRRoutes(){return sa(this,Pc)!=null}setRoutes(t){po(this,Ku,t),po(this,Lh,Qy(t))}setHmrRoutes(t){po(this,Pc,t),po(this,Fh,Qy(t))}commitHmrRoutes(){sa(this,Pc)&&(po(this,Ku,sa(this,Pc)),po(this,Lh,sa(this,Fh)),po(this,Pc,void 0),po(this,Fh,void 0))}};Ku=new WeakMap;Lh=new WeakMap;Pc=new WeakMap;Fh=new WeakMap;function c8(t){const e=t.window?t.window:typeof window<"u"?window:void 0,r=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u";Zt(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let n=t.hydrationRouteProperties||[],s=t.mapRouteProperties||o8,i=s;if(t.instrumentations){let Z=t.instrumentations;i=J=>({...s(J),...JV(Z.map(ce=>
50ce.route).filter(Boolean),J)})}let a={},l=new l8(zm(t.routes,i,void 0,a)),u=t.basename||"/";u.startsWith("/")||(u=`/${u}`);let h=t.dataStrategy||p8,p={...t.future},f=null,g=new Set,v=null,_=null,x=null,w=null,S=t.hydrationData!=null,k=Ma(l.activeRoutes,t.history.location,u,!1,l.branches),j=!1,C=null,R,A;if(k==null&&!t.patchRoutesOnNavigation){let Z=aa(404,{pathname:t.history.location.pathname}),{matches:J,route:ce}=ay(l.activeRoutes);R=!0,A=!R,k=J,C={[ce.id]:Z}}else if(k&&!t.hydrationData&&zr(k,l.activeRoutes,t.history.location.pathname).active&&(k=null),k)if(k.some(Z=>Z.route.lazy))R=!1,A=!R;else if(!k.some(Z=>Kj(Z.route)))R=!0,A=!R;else{let Z=t.hydrationData?t.hydrationData.loaderData:null,J=t.hydrationData?t.hydrationData.errors:null,ce=k;if(J){let Se=k.findIndex(_e=>J[_e.route.id]!==void 0);ce=ce.slice(0,Se+1)}A=!1,R=!0,ce.forEach(Se=>{let _e=AM(Se.route,Z,J);A=A||_e.renderFallback,R=R&&!_e.shouldLoad})}else{R=!1,A=!R,k=[];let Z=zr(null,l.activeRoutes,t.history.location.pathname);Z.active&&Z.matches&&(j=!0,k=Z.matches)}let I,P={historyAction:t.history.action,location:t.history.location,matches:k,initialized:R,renderFallback:A,navigation:jx,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||C,fetchers:new Map,blockers:new Map},T="POP",O=null,G=!1,M,U=!1,V=new Map,H=null,Y=!1,B=!1,z=new Set,ee=new Map,L=0,$=-1,F=new Map,te=new Set,ue=new Map,re=new Map,se=new Set,ye=new Map,de,pe=null;function Ie(){if(f=t.history.listen(({action:Z,location:J,delta:ce})=>{if(de){de(),de=void 0;return}An(ye.size===0||ce!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs.  This can also happen if you are using createHashRouter and the user manually changes the URL.");let Se=Ft({currentLocation:P.location,nextLocation:J,historyAction:Z});if(Se&&ce!=null){let _e=new Promise(Re=>{de=Re});t.history.go(ce*-1),Ge(Se,{state:"blocked",location:J,proceed(){Ge(Se,{state:"proceeding",proceed:void 0,reset:void 0,location:J}),_e.then(()=>t.history.go(ce))},reset(){let Re=new Map(P.blockers);Re.set(Se,Bp),We({blockers:Re})}}),O==null||O.resolve(),O=null;return}return Ee(Z,J)}),r){I8(e,V);let Z=()=>D8(e,V);e.addEventListener("pagehide",Z),H=()=>e.removeEventListener("pagehide",Z)}return P.initialized||Ee("POP",P.location,{initialHydration:!0}),I}function Ne(){f&&f(),H&&H(),g.clear(),M&&M.abort(),P.fetchers.forEach((Z,J)=>ie(P.fetchers,J)),P.blockers.forEach((Z,J)=>ae(J))}function He(Z){if(g.add(Z),v){let{newErrors:J}=v;v=null,Z(P,{deletedFetchers:[],newErrors:J,viewTransitionOpts:void 0,flushSync:!1})}return()=>g.delete(Z)}function We(Z,J={}){Z.matches&&(Z.matches=Z.matches.map(_e=>{let Re=a[_e.route.id],Ke=_e.route;return Ke.element!==Re.element||Ke.errorElement!==Re.errorElement||Ke.hydrateFallbackElement!==Re.hydrateFallbackElement?{..._e,route:Re}:_e})),P={...P,...Z};let ce=[],Se=[];P.fetchers.forEach((_e,Re)=>{_e.state==="idle"&&(se.has(Re)?ce.push(Re):Se.push(Re))}),se.forEach(_e=>{!P.fetchers.has(_e)&&!ee.has(_e)&&ce.push(_e)}),g.size===0&&(v={newErrors:Z.errors??null}),[...g].forEach(_e=>_e(P,{deletedFetchers:ce,newErrors:Z.errors??null,viewTransitionOpts:J.viewTransitionOpts,flushSync:J.flushSync===!0})),ce.forEach(_e=>ie(P.fetchers,_e)),Se.forEach(_e=>P.fetchers.delete(_e))}function at(Z,J,{flushSync:ce}={}){var et,kt;let Se=P.actionData!=null&&P.navigation.formMethod!=null&&ys(P.navigation.formMethod)&&P.navigation.state==="loading"&&((et=Z.state)==null?void 0:et._isRedirect)!==!0,_e;J.actionData?Object.keys(J.actionData).length>0?_e=J.actionData:_e=null:Se?_e=P.actionData:_e=null;let Re=J.loaderData?EA(P.loaderData,J.loaderData,J.matches||[],J.errors):P.loaderData,Ke=P.blockers;Ke.size>0&&(Ke=new Map(Ke),Ke.forEach((mt,er)=>
50Ke.set(er,Bp)));let Ct=Y?!1:Kt(Z,J.matches||P.matches),qe=G===!0||P.navigation.formMethod!=null&&ys(P.navigation.formMethod)&&((kt=Z.state)==null?void 0:kt._isRedirect)!==!0;l.commitHmrRoutes(),Y||T==="POP"||(T==="PUSH"?t.history.push(Z,Z.state):T==="REPLACE"&&t.history.replace(Z,Z.state));let pt;if(T==="POP"){let mt=V.get(P.location.pathname);mt&&mt.has(Z.pathname)?pt={currentLocation:P.location,nextLocation:Z}:V.has(Z.pathname)&&(pt={currentLocation:Z,nextLocation:P.location})}else if(U){let mt=V.get(P.location.pathname);mt?mt.add(Z.pathname):(mt=new Set([Z.pathname]),V.set(P.location.pathname,mt)),pt={currentLocation:P.location,nextLocation:Z}}We({...J,actionData:_e,loaderData:Re,historyAction:T,location:Z,initialized:!0,renderFallback:!1,navigation:jx,revalidation:"idle",restoreScrollPosition:Ct,preventScrollReset:qe,blockers:Ke},{viewTransitionOpts:pt,flushSync:ce===!0}),T="POP",G=!1,U=!1,Y=!1,B=!1,O==null||O.resolve(),O=null,pe==null||pe.resolve(),pe=null}async function Xt(Z,J){if(O==null||O.resolve(),O=null,typeof Z=="number"){O||(O=PA());let vr=O.promise;return t.history.go(Z),vr}let ce=fk(P.location,P.matches,u,Z,J==null?void 0:J.fromRouteId,J==null?void 0:J.relative),{path:Se,submission:_e,error:Re}=gA(!1,ce,J),Ke;J!=null&&J.mask&&(Ke={pathname:"",search:"",hash:"",...typeof J.mask=="string"?Bo(J.mask):{...P.location.mask,...J.mask}});let Ct=P.location,qe=$m(Ct,Se,J&&J.state,void 0,Ke);qe={...qe,...t.history.encodeLocation(qe)};let pt=J&&J.replace!=null?J.replace:void 0,et="PUSH";pt===!0?et="REPLACE":pt===!1||_e!=null&&ys(_e.formMethod)&&_e.formAction===P.location.pathname+P.location.search&&(et="REPLACE");let kt=J&&"preventScrollReset"in J?J.preventScrollReset===!0:void 0,mt=(J&&J.flushSync)===!0,er=Ft({currentLocation:Ct,nextLocation:qe,historyAction:et});if(er){Ge(er,{state:"blocked",location:qe,proceed(){Ge(er,{state:"proceeding",proceed:void 0,reset:void 0,location:qe}),Xt(Z,J)},reset(){let vr=new Map(P.blockers);vr.set(er,Bp),We({blockers:vr})}});return}await Ee(et,qe,{submission:_e,pendingError:Re,preventScrollReset:kt,replace:J&&J.replace,enableViewTransition:J&&J.viewTransition,flushSync:mt,callSiteDefaultShouldRevalidate:J&&J.defaultShouldRevalidate})}function Rt(){pe||(pe=PA()),Pr(),We({revalidation:"loading"});let Z=pe.promise;return P.navigation.state==="submitting"?Z:P.navigation.state==="idle"?(Ee(P.historyAction,P.location,{startUninterruptedRevalidation:!0}),Z):(Ee(T||P.historyAction,P.navigation.location,{overrideNavigation:P.navigation,enableViewTransition:U===!0}),Z)}async function Ee(Z,J,ce){M&&M.abort(),M=null,T=Z,Y=(ce&&ce.startUninterruptedRevalidation)===!0,_t(P.location,P.matches),G=(ce&&ce.preventScrollReset)===!0,U=(ce&&ce.enableViewTransition)===!0;let Se=l.activeRoutes,_e=ce!=null&&ce.initialHydration&&P.matches&&P.matches.length>0&&!j?P.matches:Ma(Se,J,u,!1,l.branches),Re=(ce&&ce.flushSync)===!0;if(_e&&P.initialized&&!B&&S8(P.location,J)&&!(ce&&ce.submission&&ys(ce.submission.formMethod))){at(J,{matches:_e},{flushSync:Re});return}let Ke=zr(_e,Se,J.pathname);if(Ke.active&&Ke.matches&&(_e=Ke.matches),!_e){let{error:Bt,notFoundMatches:lr,route:Jt}=or(J.pathname);at(J,{matches:lr,loaderData:{},errors:{[Jt.id]:Bt}},{flushSync:Re});return}let Ct=ce&&ce.overrideNavigation?{...ce.overrideNavigation,matches:_e,historyAction:Z}:void 0;M=new AbortController;let qe=$h(t.history,J,M.signal,ce&&ce.submission),pt=t.getContext?await t.getContext():new uA,et;if(ce&&ce.pendingError)et=[Tc(_e).route.id,{type:"error",error:ce.pendingError}];else if(ce&&ce.submission&&ys(ce.submission.formMethod)){let Bt=await Et(qe,J,ce.submission,_e,Z,pt,Ke.active,ce&&ce.initialHydration===!0,{replace:ce.replace,flushSync:Re});if(Bt.shortCircuited)return;if(Bt.pendingActionResult){let[lr,Jt]=Bt.pendingActionResult;if(ji(Jt)&&Sd(Jt.error)&&Jt.error.status===404){M=null,at(J,{matches:Bt.matches,loaderData:{},errors:{[lr]:Jt.error}});return}}
50_e=Bt.matches||_e,et=Bt.pendingActionResult,Ct=Cx(J,_e,Z,ce.submission),Re=!1,Ke.active=!1,qe=$h(t.history,qe.url,qe.signal)}let{shortCircuited:kt,matches:mt,loaderData:er,errors:vr,workingFetchers:Wr}=await Mt(qe,J,_e,Z,pt,Ke.active,Ct,ce&&ce.submission,ce&&ce.fetcherSubmission,ce&&ce.replace,ce&&ce.initialHydration===!0,Re,et,ce&&ce.callSiteDefaultShouldRevalidate);kt||(M=null,at(J,{matches:mt||_e,...jA(et),loaderData:er,errors:vr,...Wr?{fetchers:Wr}:{}}))}async function Et(Z,J,ce,Se,_e,Re,Ke,Ct,qe={}){Pr();let pt=A8(J,Se,_e,ce);if(We({navigation:pt},{flushSync:qe.flushSync===!0}),Ke){let mt=await ur(Se,J.pathname,Z.signal);if(mt.type==="aborted")return{shortCircuited:!0};if(mt.type==="error"){if(mt.partialMatches.length===0){let{matches:vr,route:Wr}=ay(l.activeRoutes);return{matches:vr,pendingActionResult:[Wr.id,{type:"error",error:mt.error}]}}let er=Tc(mt.partialMatches).route.id;return{matches:mt.partialMatches,pendingActionResult:[er,{type:"error",error:mt.error}]}}else if(mt.matches)Se=mt.matches;else{let{notFoundMatches:er,error:vr,route:Wr}=or(J.pathname);return{matches:er,pendingActionResult:[Wr.id,{type:"error",error:vr}]}}}let et,kt=Xy(Se,J);if(!kt.route.action&&!kt.route.lazy)et={type:"error",error:aa(405,{method:Z.method,pathname:J.pathname,routeId:kt.route.id})};else{let mt=sf(i,a,Z,J,Se,kt,Ct?[]:n,Re),er=await Nr(Z,J,mt,Re,null);if(et=er[kt.route.id],!et){for(let vr of Se)if(er[vr.route.id]){et=er[vr.route.id];break}}if(Z.signal.aborted)return{shortCircuited:!0}}if(id(et)){let mt;return qe&&qe.replace!=null?mt=qe.replace:mt=xA(et.response.headers.get("Location"),new URL(Z.url),u,t.history)===P.location.pathname+P.location.search,await Or(Z,et,!0,{submission:ce,replace:mt}),{shortCircuited:!0}}if(ji(et)){let mt=Tc(Se,kt.route.id);return(qe&&qe.replace)!==!0&&(T="PUSH"),{matches:Se,pendingActionResult:[mt.route.id,et,kt.route.id]}}return{matches:Se,pendingActionResult:[kt.route.id,et]}}async function Mt(Z,J,ce,Se,_e,Re,Ke,Ct,qe,pt,et,kt,mt,er){let vr=Ke||Cx(J,ce,Se,Ct),Wr=Ct||qe||NA(vr),Bt=!Y&&!et;if(Re){if(Bt){let Sn=ot(mt);We({navigation:vr,...Sn!==void 0?{actionData:Sn}:{}},{flushSync:kt})}let Yt=await ur(ce,J.pathname,Z.signal);if(Yt.type==="aborted")return{shortCircuited:!0};if(Yt.type==="error"){if(Yt.partialMatches.length===0){let{matches:ts,route:pn}=ay(l.activeRoutes);return{matches:ts,loaderData:{},errors:{[pn.id]:Yt.error}}}let Sn=Tc(Yt.partialMatches).route.id;return{matches:Yt.partialMatches,loaderData:{},errors:{[Sn]:Yt.error}}}else if(Yt.matches)ce=Yt.matches;else{let{error:Sn,notFoundMatches:ts,route:pn}=or(J.pathname);return{matches:ts,loaderData:{},errors:{[pn.id]:Sn}}}}let lr=l.activeRoutes,{dsMatches:Jt,revalidatingFetchers:Hn}=vA(Z,_e,i,a,t.history,P,ce,Wr,J,et?[]:n,et===!0,B,z,se,ue,te,lr,u,t.patchRoutesOnNavigation!=null,l.branches,mt,er);if($=++L,!t.dataStrategy&&!Jt.some(Yt=>Yt.shouldLoad)&&!Jt.some(Yt=>Yt.route.middleware&&Yt.route.middleware.length>0)&&Hn.length===0){let Yt=new Map(P.fetchers),Sn=Be(Yt);return at(J,{matches:ce,loaderData:{},errors:mt&&ji(mt[1])?{[mt[0]]:mt[1].error}:null,...jA(mt),...Sn?{fetchers:Yt}:{}},{flushSync:kt}),{shortCircuited:!0}}if(Bt){let Yt={};if(!Re){Yt.navigation=vr;let Sn=ot(mt);Sn!==void 0&&(Yt.actionData=Sn)}Hn.length>0&&(Yt.fetchers=De(Hn)),We(Yt,{flushSync:kt})}Hn.forEach(Yt=>{be(Yt.key),Yt.controller&&ee.set(Yt.key,Yt.controller)});let qs=()=>Hn.forEach(Yt=>be(Yt.key));M&&M.signal.addEventListener("abort",qs);let{loaderResults:cs,fetcherResults:vi}=await rr(Jt,Hn,Z,J,_e);if(Z.signal.aborted)return{shortCircuited:!0};M&&M.signal.removeEventListener("abort",qs),Hn.forEach(Yt=>ee.delete(Yt.key));let Vi=oy(cs);if(Vi)return await Or(Z,Vi.result,!0,{replace:pt}),{shortCircuited:!0};if(Vi=oy(vi),Vi)return te.add(Vi.key),await Or(Z,Vi.result,!0,{replace:pt}),{shortCircuited:!0};let us=new Map(P.fetchers),{loaderData:Hi,errors:ln}=kA(P,ce,cs,mt,Hn,vi,us);et&&P.errors&&(ln={...P.errors,...ln});let Sa=Be(us),tn=Te($,us),Ko=Sa||tn||Hn.length>0;return{matches:ce,loaderData:Hi,errors:ln,...Ko?{workingFetchers:us}:{}}}function ot(Z){if(Z&&!ji(Z[1]))return{[Z[0]]:Z[1].data};if(P.actionData)return Object.keys(P.actionData).length===0?null:P.actionData}function De(Z){let J=new Map(P.fetchers);return Z.forEach(ce=>{let Se=J.get(ce.key),_e=Vp(void 0,Se?Se.data:void 0);J.set(ce.key,_e)}),J}async function St(Z,J,ce,Se){be(Z);let _e=(Se&&Se.flushSync)===!0,Re=l.activeRoutes,Ke=fk(P.location,P.matches,u,ce,J,Se==null?void 0:Se.relative),Ct=Ma(Re,Ke,u,!1,l.branches),qe=zr(Ct,Re,Ke);
50if(qe.active&&qe.matches&&(Ct=qe.matches),!Ct){ar(Z,J,aa(404,{pathname:Ke}),{flushSync:_e});return}let{path:pt,submission:et,error:kt}=gA(!0,Ke,Se);if(kt){ar(Z,J,kt,{flushSync:_e});return}let mt=t.getContext?await t.getContext():new uA,er=(Se&&Se.preventScrollReset)===!0;if(et&&ys(et.formMethod)){await jt(Z,J,pt,Ct,mt,qe.active,_e,er,et,Se&&Se.defaultShouldRevalidate);return}ue.set(Z,{routeId:J,path:pt}),await Cr(Z,J,pt,Ct,mt,qe.active,_e,er,et)}async function jt(Z,J,ce,Se,_e,Re,Ke,Ct,qe,pt){Pr(),ue.delete(Z);let et=P.fetchers.get(Z);At(Z,T8(qe,et),{flushSync:Ke});let kt=new AbortController,mt=$h(t.history,ce,kt.signal,qe);if(Re){let Rr=await ur(Se,new URL(mt.url).pathname,mt.signal,Z);if(Rr.type==="aborted")return;if(Rr.type==="error"){ar(Z,J,Rr.error,{flushSync:Ke});return}else if(Rr.matches)Se=Rr.matches;else{ar(Z,J,aa(404,{pathname:ce}),{flushSync:Ke});return}}let er=Xy(Se,ce);if(!er.route.action&&!er.route.lazy){let Rr=aa(405,{method:qe.formMethod,pathname:ce,routeId:J});ar(Z,J,Rr,{flushSync:Ke});return}ee.set(Z,kt);let vr=L,Wr=sf(i,a,mt,ce,Se,er,n,_e),Bt=await Nr(mt,ce,Wr,_e,Z),lr=Bt[er.route.id];if(!lr){for(let Rr of Wr)if(Bt[Rr.route.id]){lr=Bt[Rr.route.id];break}}if(mt.signal.aborted){ee.get(Z)===kt&&ee.delete(Z);return}if(se.has(Z)){if(id(lr)||ji(lr)){At(Z,wo(void 0));return}}else{if(id(lr))if(ee.delete(Z),$>vr){At(Z,wo(void 0));return}else return te.add(Z),At(Z,Vp(qe)),Or(mt,lr,!1,{fetcherSubmission:qe,preventScrollReset:Ct});if(ji(lr)){ar(Z,J,lr.error);return}}let Jt=P.navigation.location||P.location,Hn=$h(t.history,Jt,kt.signal),qs=l.activeRoutes,cs=P.navigation.state!=="idle"?Ma(qs,P.navigation.location,u,!1,l.branches):P.matches;Zt(cs,"Didn't find any matches after fetcher action");let vi=++L;F.set(Z,vi);let{dsMatches:Vi,revalidatingFetchers:us}=vA(Hn,_e,i,a,t.history,P,cs,qe,Jt,n,!1,B,z,se,ue,te,qs,u,t.patchRoutesOnNavigation!=null,l.branches,[er.route.id,lr],pt),Hi=Vp(qe,lr.data),ln=new Map(P.fetchers);ln.set(Z,Hi),us.filter(Rr=>Rr.key!==Z).forEach(Rr=>{let ka=Rr.key,rc=ln.get(ka),Bd=Vp(void 0,rc?rc.data:void 0);ln.set(ka,Bd),be(ka),Rr.controller&&ee.set(ka,Rr.controller)}),We({fetchers:ln});let Sa=()=>us.forEach(Rr=>be(Rr.key));kt.signal.addEventListener("abort",Sa);let{loaderResults:tn,fetcherResults:Ko}=await rr(Vi,us,Hn,Jt,_e);if(kt.signal.aborted)return;kt.signal.removeEventListener("abort",Sa),F.delete(Z),ee.delete(Z),us.forEach(Rr=>ee.delete(Rr.key));let Yt=P.fetchers.has(Z),Sn=Rr=>{if(!Yt)return Rr;let ka=new Map(Rr.fetchers);return ka.set(Z,wo(lr.data)),{...Rr,fetchers:ka}},ts=oy(tn);if(ts)return P=Sn(P),Or(Hn,ts.result,!1,{preventScrollReset:Ct});if(ts=oy(Ko),ts)return te.add(ts.key),P=Sn(P),Or(Hn,ts.result,!1,{preventScrollReset:Ct});let pn=new Map(P.fetchers);Yt&&pn.set(Z,wo(lr.data));let{loaderData:yi,errors:xs}=kA(P,cs,tn,void 0,us,Ko,pn);Te(vi,pn),P.navigation.state==="loading"&&vi>$?(Zt(T,"Expected pending action"),M&&M.abort(),at(P.navigation.location,{matches:cs,loaderData:yi,errors:xs,fetchers:pn})):(We({errors:xs,loaderData:EA(P.loaderData,yi,cs,xs),fetchers:pn}),B=!1)}async function Cr(Z,J,ce,Se,_e,Re,Ke,Ct,qe){let pt=P.fetchers.get(Z);At(Z,Vp(qe,pt?pt.data:void 0),{flushSync:Ke});let et=new AbortController,kt=$h(t.history,ce,et.signal);if(Re){let lr=await ur(Se,new URL(kt.url).pathname,kt.signal,Z);if(lr.type==="aborted")return;if(lr.type==="error"){ar(Z,J,lr.error,{flushSync:Ke});return}else if(lr.matches)Se=lr.matches;else{ar(Z,J,aa(404,{pathname:ce}),{flushSync:Ke});return}}let mt=Xy(Se,ce);ee.set(Z,et);let er=L,vr=sf(i,a,kt,ce,Se,mt,n,_e),Wr=await Nr(kt,ce,vr,_e,Z),Bt=Wr[mt.route.id];if(!Bt){for(let lr of Se)if(Wr[lr.route.id]){Bt=Wr[lr.route.id];break}}if(ee.get(Z)===et&&ee.delete(Z),!kt.signal.aborted){if(se.has(Z)){At(Z,wo(void 0));return}if(id(Bt))if($>er){At(Z,wo(void 0));return}else{te.add(Z),await Or(kt,Bt,!1,{preventScrollReset:Ct});return}if(ji(Bt)){ar(Z,J,Bt.error);return}At(Z,wo(Bt.data))}}async function Or(Z,J,ce,{submission:Se,fetcherSubmission:_e,preventScrollReset:Re,replace:Ke}={}){ce||(O==null||O.resolve(),O=null),J.response.headers.has("X-Remix-Revalidate")&&(B=!0);let Ct=J.response.headers.get("Location");Zt(Ct,"Expected a Location header on the redirect Response"),Ct=xA(Ct,new URL(Z.url),u,t.history);let qe=$m(P.location,Ct,{_isRedirect:!0});if(r){let vr=!1;if(J.response.headers.has("X-Remix-Reload-Document"))vr=!0;else if(qj(Ct)){const Wr=gM(e,Ct,!0);vr=Wr.origin!==e.location.origin||ma(Wr.pathname,u)==null}if(vr){Ke?e.location.replace(Ct):e.location.assign(Ct);return}}M=null;let pt=Ke===!0||J.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:et,formAction:kt,formEncType:mt}=P.navigation;!Se&&!_e&&et&&kt&&mt&&(Se=NA(P.navigation));let er=Se||_e;if(a8.has(J.response.status)&&er&&ys(er.formMethod))await Ee(pt,qe,{submission:{...er,formAction:Ct},preventScrollReset:Re||G,enableViewTransition:ce?U:void 0});else{let vr=Cx(qe,[],pt,Se);await Ee(pt,qe,{overrideNavigation:vr,fetcherSubmission:_e,preventScrollReset:Re||G,enableViewTransition:ce?U:void 0})}}async function Nr(Z,J,ce,Se,_e){var Ct;let Re,Ke={};try{Re=await g8(h,Z,J,ce,_e,Se,!1)}catch(qe){return ce.filter(pt=>
50pt.shouldLoad).forEach(pt=>{Ke[pt.route.id]={type:"error",error:qe}}),Ke}if(Z.signal.aborted)return Ke;if(!ys(Z.method))for(let qe of ce){if(((Ct=Re[qe.route.id])==null?void 0:Ct.type)==="error")break;!Re.hasOwnProperty(qe.route.id)&&!P.loaderData.hasOwnProperty(qe.route.id)&&(!P.errors||!P.errors.hasOwnProperty(qe.route.id))&&qe.shouldCallHandler()&&(Re[qe.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${qe.route.id}`)})}for(let[qe,pt]of Object.entries(Re))if(C8(pt)){let et=pt.result;Ke[qe]={type:"redirect",response:b8(et,Z,qe,ce,u)}}else Ke[qe]=await _8(pt);return Ke}async function rr(Z,J,ce,Se,_e){let Re=Nr(ce,Se,Z,_e,null),Ke=Promise.all(J.map(async pt=>{if(pt.matches&&pt.match&&pt.request&&pt.controller){let kt=(await Nr(pt.request,pt.path,pt.matches,_e,pt.key))[pt.match.route.id];return{[pt.key]:kt}}else return Promise.resolve({[pt.key]:{type:"error",error:aa(404,{pathname:pt.path})}})})),Ct=await Re,qe=(await Ke).reduce((pt,et)=>Object.assign(pt,et),{});return{loaderResults:Ct,fetcherResults:qe}}function Pr(){B=!0,ue.forEach((Z,J)=>{ee.has(J)&&z.add(J),be(J)})}function At(Z,J,ce={}){let Se=new Map(P.fetchers);Se.set(Z,J),We({fetchers:Se},{flushSync:(ce&&ce.flushSync)===!0})}function ar(Z,J,ce,Se={}){let _e=Tc(P.matches,J),Re=new Map(P.fetchers);ie(Re,Z),We({errors:{[_e.route.id]:ce},fetchers:Re},{flushSync:(Se&&Se.flushSync)===!0})}function wn(Z){return re.set(Z,(re.get(Z)||0)+1),se.has(Z)&&se.delete(Z),P.fetchers.get(Z)||NM}function W(Z,J){be(Z,J==null?void 0:J.reason),At(Z,wo(null))}function ie(Z,J){let ce=P.fetchers.get(J);ee.has(J)&&!(ce&&ce.state==="loading"&&F.has(J))&&be(J),ue.delete(J),F.delete(J),te.delete(J),se.delete(J),z.delete(J),Z.delete(J)}function le(Z){let J=(re.get(Z)||0)-1;J<=0?(re.delete(Z),se.add(Z)):re.set(Z,J),We({fetchers:new Map(P.fetchers)})}function be(Z,J){let ce=ee.get(Z);ce&&(ce.abort(J),ee.delete(Z))}function je(Z,J){for(let ce of Z){let Se=J.get(ce);Zt(Se,`Expected fetcher: ${ce}`);let _e=wo(Se.data);
50J.set(ce,_e)}}function Be(Z){let J=[],ce=!1;for(let Se of te){let _e=Z.get(Se);Zt(_e,`Expected fetcher: ${Se}`),_e.state==="loading"&&(te.delete(Se),J.push(Se),ce=!0)}return je(J,Z),ce}function Te(Z,J){let ce=[];for(let[Se,_e]of F)if(_e<Z){let Re=J.get(Se);Zt(Re,`Expected fetcher: ${Se}`),Re.state==="loading"&&(be(Se),F.delete(Se),ce.push(Se))}return je(ce,J),ce.length>0}function Oe(Z,J){let ce=P.blockers.get(Z)||Bp;return ye.get(Z)!==J&&ye.set(Z,J),ce}function ae(Z){P.blockers.delete(Z),ye.delete(Z)}function Ge(Z,J){let ce=P.blockers.get(Z)||Bp;Zt(ce.state==="unblocked"&&J.state==="blocked"||ce.state==="blocked"&&J.state==="blocked"||ce.state==="blocked"&&J.state==="proceeding"||ce.state==="blocked"&&J.state==="unblocked"||ce.state==="proceeding"&&J.state==="unblocked",`Invalid blocker state transition: ${ce.state} -> ${J.state}`);let Se=new Map(P.blockers);Se.set(Z,J),We({blockers:Se})}function Ft({currentLocation:Z,nextLocation:J,historyAction:ce}){if(ye.size===0)return;ye.size>1&&An(!1,"A router only supports one blocker at a time");let Se=Array.from(ye.entries()),[_e,Re]=Se[Se.length-1],Ke=P.blockers.get(_e);if(!(Ke&&Ke.state==="proceeding")&&Re({currentLocation:Z,nextLocation:J,historyAction:ce}))return _e}function or(Z){let J=aa(404,{pathname:Z}),ce=l.activeRoutes,{matches:Se,route:_e}=ay(ce);return{notFoundMatches:Se,route:_e,error:J}}function Ze(Z,J,ce){if(_=Z,w=J,x=ce||null,!S&&P.navigation===jx){S=!0;let Se=Kt(P.location,P.matches);Se!=null&&We({restoreScrollPosition:Se})}return()=>{_=null,w=null,x=null}}function Gt(Z,J){return x&&x(Z,J.map(Se=>IV(Se,P.loaderData)))||Z.key}function _t(Z,J){if(_&&w){let ce=Gt(Z,J);_[ce]=w()}}function Kt(Z,J){if(_){let ce=Gt(Z,J),Se=_[ce];if(typeof Se=="number")return Se}return null}function zr(Z,J,ce){if(t.patchRoutesOnNavigation){let Se=l.branches;if(Z){if(Object.keys(Z[0].params).length>0)return{active:!0,matches:Ma(J,ce,u,!0,Se)}}else return{active:!0,matches:Ma(J,ce,u,!0,Se)||[]}}return{active:!1,matches:null}}async function ur(Z,J,ce,Se){if(!t.patchRoutesOnNavigation)return{type:"success",matches:Z};let _e=Z;for(;;){let Re=a;try{await t.patchRoutesOnNavigation({signal:ce,path:J,matches:_e,fetcherKey:Se,patch:(pt,et)=>{ce.aborted||yA(pt,et,l,Re,i,!1)}})}catch(pt){return{type:"error",error:pt,partialMatches:_e}}if(ce.aborted)return{type:"aborted"};let Ke=l.branches,Ct=Ma(l.activeRoutes,J,u,!1,Ke),qe=null;if(Ct){if(Object.keys(Ct[0].params).length===0)return{type:"success",matches:Ct};if(qe=Ma(l.activeRoutes,J,u,!0,Ke),!(qe&&_e.length<qe.length&&Tt(_e,qe.slice(0,_e.length))))return{type:"success",matches:Ct}}if(qe||(qe=Ma(l.activeRoutes,J,u,!0,Ke)),!qe||Tt(_e,qe))return{type:"success",matches:null};_e=qe}}function Tt(Z,J){return Z.length===J.length&&Z.every((ce,Se)=>ce.route.id===J[Se].route.id)}function xn(Z){a={},l.setHmrRoutes(zm(Z,i,void 0,a))}function Ur(Z,J,ce=!1){yA(Z,J,l,a,i,ce),l.hasHMRRoutes||We({})}return I={get basename(){return u},get future(){return p},get state(){return P},get routes(){return l.stableRoutes},get branches(){return l.branches},get manifest(){return a},get window(){return e},initialize:Ie,subscribe:He,enableScrollRestoration:Ze,navigate:Xt,fetch:St,revalidate:Rt,createHref:Z=>t.history.createHref(Z),encodeLocation:Z=>t.history.encodeLocation(Z),getFetcher:wn,resetFetcher:W,deleteFetcher:le,dispose:Ne,getBlocker:Oe,deleteBlocker:ae,patchRoutes:Ur,_internalFetchControllers:ee,_internalSetRoutes:xn,_internalSetStateDoNotUseOrYouWillBreakYourApp(Z){We(Z)}},t.instrumentations&&(I=QV(I,t.instrumentations.map(Z=>Z.router).filter(Boolean))),I}function u8(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function fk(t,e,r,n,s,i){let a,l;if(s){a=[];for(let h of e)if(a.push(h),h.route.id===s){l=h;break}}else a=e,l=e[e.length-1];let u=Hb(n||".",Wj(a),ma(t.pathname,r)||t.pathname,i==="path");if(n==null&&(u.search=t.search,u.hash=t.hash),(n==null||n===""||n===".")&&l){let h=Zj(u.search);if(l.route.index&&!h)u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index";else if(!l.route.index&&h){let p=new URLSearchParams(u.search),f=p.getAll("index");p.delete("index"),f.filter(v=>v).forEach(v=>p.append("index",v));let g=p.toString();u.search=g?`?${g}`:""}}return r!=="/"&&(u.pathname=qV({basename:r,pathname:u.pathname})),$o(u)}function gA(t,e,r){if(!r||!u8(r))return{path:e};if(r.formMethod&&!R8(r.formMethod))return{path:e,error:aa(405,{method:r.formMethod})};let n=()=>({path:e,error:aa(400,{type:"invalid-body"})}),i=(r.formMethod||"get").toUpperCase(),a=FM(e);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!ys(i))return n();
50let f=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((g,[v,_])=>`${g}${v}=${_}
51`,""):String(r.body);return{path:e,submission:{formMethod:i,formAction:a,formEncType:r.formEncType,formData:void 0,json:void 0,text:f}}}else if(r.formEncType==="application/json"){if(!ys(i))return n();try{let f=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:e,submission:{formMethod:i,formAction:a,formEncType:r.formEncType,formData:void 0,json:f,text:void 0}}}catch{return n()}}}Zt(typeof FormData=="function","FormData is not available in this environment");let l,u;if(r.formData)l=gk(r.formData),u=r.formData;else if(r.body instanceof FormData)l=gk(r.body),u=r.body;else if(r.body instanceof URLSearchParams)l=r.body,u=SA(l);else if(r.body==null)l=new URLSearchParams,u=new FormData;else try{l=new URLSearchParams(r.body),u=SA(l)}catch{return n()}let h={formMethod:i,formAction:a,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(ys(h.formMethod))return{path:e,submission:h};let p=Bo(e);return t&&p.search&&Zj(p.search)&&l.append("index",""),p.search=`?${l}`,{path:$o(p),submission:h}}function vA(t,e,r,n,s,i,a,l,u,h,p,f,g,v,_,x,w,S,k,j,C,R){var Y;let A=C?ji(C[1])?C[1].error:C[1].data:void 0,I=s.createURL(i.location),P=s.createURL(u),T;if(p&&i.errors){let B=Object.keys(i.errors)[0];T=a.findIndex(z=>z.route.id===B)}else if(C&&ji(C[1])){let B=C[0];T=a.findIndex(z=>z.route.id===B)-1}let O=C?C[1].statusCode:void 0,G=O&&O>=400,M={currentUrl:I,currentParams:((Y=i.matches[0])==null?void 0:Y.params)||{},nextUrl:P,nextParams:a[0].params,...l,actionResult:A,actionStatus:O},U=Cg(a),V=a.map((B,z)=>{let{route:ee}=B,L=null;if(T!=null&&z>T)L=!1;else if(ee.lazy)L=!0;else if(!Kj(ee))L=!1;else if(p){let{shouldLoad:ue}=AM(ee,i.loaderData,i.errors);L=ue}else d8(i.loaderData,i.matches[z],B)&&(L=!0);if(L!==null)return pk(r,n,t,u,U,B,h,e,L);let $=!1;typeof R=="boolean"?$=R:G?$=!1:(f||I.pathname+I.search===P.pathname+P.search||I.search!==P.search||h8(i.matches[z],B))&&($=!0);let F={...M,defaultShouldRevalidate:$},te=Nm(B,F);return pk(r,n,t,u,U,B,h,e,te,F,R)}),H=[];return _.forEach((B,z)=>{if(p||!a.some(se=>se.route.id===B.routeId)||v.has(z))return;let ee=i.fetchers.get(z),L=ee&&ee.state!=="idle"&&ee.data===void 0,$=Ma(w,B.path,S??"/",!1,j);if(!$){if(k&&L)return;H.push({key:z,routeId:B.routeId,path:B.path,matches:null,match:null,request:null,controller:null});return}if(x.has(z))return;let F=Xy($,B.path),te=new AbortController,ue=$h(s,B.path,te.signal),re=null;if(g.has(z))g.delete(z),re=sf(r,n,ue,B.path,$,F,h,e);else if(L)f&&(re=sf(r,n,ue,B.path,$,F,h,e));else{let se;typeof R=="boolean"?se=R:G?se=!1:se=f;let ye={...M,defaultShouldRevalidate:se};Nm(F,ye)&&(re=sf(r,n,ue,B.path,$,F,h,e,ye))}re&&H.push({key:z,routeId:B.routeId,path:B.path,matches:re,match:F,request:ue,controller:te})}),{dsMatches:V,revalidatingFetchers:H}}function Kj(t){return t.loader!=null||t.middleware!=null&&t.middleware.length>0}function AM(t,e,r){if(t.lazy)return{shouldLoad:!0,renderFallback:!0};if(!Kj(t))return{shouldLoad:!1,renderFallback:!1};let n=e!=null&&t.id in e,s=r!=null&&r[t.id]!==void 0;if(!n&&s)return{shouldLoad:!1,renderFallback:!1};if(typeof t.loader=="function"&&t.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!n};let i=!n&&!s;return{shouldLoad:i,renderFallback:i}}function d8(t,e,r){let n=!e||r.route.id!==e.route.id,s=!t.hasOwnProperty(r.route.id);return n||s}function h8(t,e){let r=t.route.path;return t.pathname!==e.pathname||r!=null&&r.endsWith("*")&&t.params["*"]!==e.params["*"]}function Nm(t,e){if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate(e);if(typeof r=="boolean")return r}return e.defaultShouldRevalidate}function yA(t,e,r,n,s,i){let a;if(t){let h=n[t];Zt(h,`No route found to patch children into: routeId = ${t}`),h.children||(h.children=[]),a=h.children}else a=r.activeRoutes;let l=[],u=[];if(e.forEach(h=>{let p=a.find(f=>TM(h,f));p?u.push({existingRoute:p,newRoute:h}):l.push(h)}),l.length>0){let h=zm(l,s,[t||"_","patch",String((a==null?void 0:a.length)||"0")],n);a.push(...h)}if(i&&u.length>0)for(let h=0;h<u.length;h++){let{existingRoute:p,newRoute:f}=u[h],g=p,[v]=zm([f],s,[],{},!0);Object.assign(g,{element:v.element?v.element:g.element,errorElement:v.errorElement?v.errorElement:g.errorElement,hydrateFallbackElement:v.hydrateFallbackElement?v.hydrateFallbackElement:g.hydrateFallbackElement})}r.hasHMRRoutes||r.setRoutes([...r.activeRoutes])}function TM(t,e){var r;return"id"in t&&"id"in e&&t.id===e.id?!0:t.index===e.index&&t.path===e.path&&t.caseSensitive===e.caseSensitive?(!t.children||t.children.length===0)&&(!e.children||e.children.length===0)?!0:((r=t.children)==null?void 0:r.every((n,s)=>{var i;return(i=e.children)==null?void 0:i.some(a=>TM(n,a))}))??!1:!1}var _A=new WeakMap,IM=({key:t,route:e,manifest:r,mapRouteProperties:n})=>{let s=r[e.id];if(Zt(s,"No route found in manifest"),!s.lazy||typeof s.lazy!="object")return;let i=s.lazy[t];if(!i)return;let a=_A.get(s);a||(a={},_A.set(s,a));let l=a[t];
51if(l)return l;let u=(async()=>{let h=PV(t),f=s[t]!==void 0&&t!=="hasErrorBoundary";if(h)An(!h,"Route property "+t+" is not a supported lazy route property. This property will be ignored."),a[t]=Promise.resolve();else if(f)An(!1,`Route "${s.id}" has a static property "${t}" defined. The lazy property will be ignored.`);else{let g=await i();g!=null&&(Object.assign(s,{[t]:g}),Object.assign(s,n(s)))}typeof s.lazy=="object"&&(s.lazy[t]=void 0,Object.values(s.lazy).every(g=>g===void 0)&&(s.lazy=void 0))})();return a[t]=u,u},bA=new WeakMap;function f8(t,e,r,n,s){let i=r[t.id];if(Zt(i,"No route found in manifest"),!t.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof t.lazy=="function"){let p=bA.get(i);if(p)return{lazyRoutePromise:p,lazyHandlerPromise:p};let f=(async()=>{Zt(typeof t.lazy=="function","No lazy route function found");let g=await t.lazy(),v={};for(let _ in g){let x=g[_];if(x===void 0)continue;let w=AV(_),k=i[_]!==void 0&&_!=="hasErrorBoundary";w?An(!w,"Route property "+_+" is not a supported property to be returned from a lazy route function. This property will be ignored."):k?An(!k,`Route "${i.id}" has a static property "${_}" defined but its lazy function is also returning a value for this property. The lazy route property "${_}" will be ignored.`):v[_]=x}Object.assign(i,v),Object.assign(i,{...n(i),lazy:void 0})})();return bA.set(i,f),f.catch(()=>{}),{lazyRoutePromise:f,lazyHandlerPromise:f}}let a=Object.keys(t.lazy),l=[],u;for(let p of a){if(s&&s.includes(p))continue;let f=IM({key:p,route:t,manifest:r,mapRouteProperties:n});f&&(l.push(f),p===e&&(u=f))}let h=l.length>0?Promise.all(l).then(()=>{}):void 0;return h==null||h.catch(()=>{}),u==null||u.catch(()=>{}),{lazyRoutePromise:h,lazyHandlerPromise:u}}async function wA(t){let e=t.matches.filter(s=>s.shouldLoad),r={};return(await Promise.all(e.map(s=>s.resolve()))).forEach((s,i)=>{r[e[i].route.id]=s}),r}async function p8(t){return t.matches.some(e=>e.route.middleware)?DM(t,()=>wA(t)):wA(t)}function DM(t,e){return m8(t,e,n=>{if(P8(n))throw n;return n},E8,r);function r(n,s,i){if(i)return Promise.resolve(Object.assign(i.value,{[s]:{type:"error",result:n}}));{let{matches:a}=t,l=Math.min(Math.max(a.findIndex(h=>h.route.id===s),0),Math.max(a.findIndex(h=>h.shouldCallHandler()),0)),u=Tc(a,a[l].route.id).route.id;return Promise.resolve({[u]:{type:"error",result:n}})}}}async function m8(t,e,r,n,s){let{matches:i,...a}=t,l=i.flatMap(h=>h.route.middleware?h.route.middleware.map(p=>[h.route.id,p]):[]);return await OM(a,l,e,r,n,s)}async function OM(t,e,r,n,s,i,a=0){let{request:l}=t;if(l.signal.aborted)throw l.signal.reason??new Error(`Request aborted: ${l.method} ${l.url}`);let u=e[a];if(!u)return await r();let[h,p]=u,f,g=async()=>{if(f)throw new Error("You may only call `next()` once per middleware");try{return f={value:await OM(t,e,r,n,s,i,a+1)},f.value}catch(v){return f={value:await i(v,h,f)},f.value}};try{let v=await p(t,g),_=v!=null?n(v):void 0;return s(_)?_:f?_??f.value:(f={value:await g()},f.value)}catch(v){return await i(v,h,f)}}function MM(t,e,r,n,s){let i=IM({key:"middleware",route:n.route,manifest:e,mapRouteProperties:t}),a=f8(n.route,ys(r.method)?"action":"loader",e,t,s);return{middleware:i,route:a.lazyRoutePromise,handler:a.lazyHandlerPromise}}function pk(t,e,r,n,s,i,a,l,u,h=null,p){let f=!1,g=MM(t,e,r,i,a);return{...i,_lazyPromises:g,shouldLoad:u,shouldRevalidateArgs:h,shouldCallHandler(v){return f=!0,h?typeof p=="boolean"?Nm(i,{...h,defaultShouldRevalidate:p}):typeof v=="boolean"?Nm(i,{...h,defaultShouldRevalidate:v}):Nm(i,h):u},resolve(v){let{lazy:_,loader:x,middleware:w}=i.route,S=f||u||v&&!ys(r.method)&&(_||x),k=w&&w.length>0&&!x&&!_;return S&&(ys(r.method)||!k)?v8({request:r,path:n,pattern:s,match:i,lazyHandlerPromise:g==null?void 0:g.handler,lazyRoutePromise:g==null?void 0:g.route,handlerOverride:v,scopedContext:l}):Promise.resolve({type:"data",result:void 0})}}}function sf(t,e,r,n,s,i,a,l,u=null){return s.map(h=>h.route.id!==i.route.id?{...h,shouldLoad:!1,shouldRevalidateArgs:u,shouldCallHandler:()=>!1,_lazyPromises:MM(t,e,r,h,a),resolve:()=>Promise.resolve({type:"data",result:void 0})}:pk(t,e,r,n,Cg(s),h,a,l,!0,u))}async function g8(t,e,r,n,s,i,a){n.some(p=>{var f;return(f=p._lazyPromises)==null?void 0:f.middleware})&&await Promise.all(n.map(p=>{var f;return(f=p._lazyPromises)==null?void 0:f.middleware}));let l={request:e,url:LM(e,r),pattern:Cg(n),params:n[0].params,context:i,matches:n},h=await t({...l,fetcherKey:s,runClientMiddleware:p=>{let f=l;return DM(f,()=>p({...f,fetcherKey:s,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(n.flatMap(p=>{var f,g;return[(f=p._lazyPromises)==null?void 0:f.handler,(g=p._lazyPromises)==null?void 0:g.route]}))}catch{}return h}async function v8({request:t,path:e,pattern:r,match:n,lazyHandlerPromise:s,lazyRoutePromise:i,handlerOverride:a,scopedContext:l}){let u,h,p=ys(t.method),f=p?"action":"loader",g=v=>{let _,x=new Promise((k,j)=>_=j);h=()=>_(),t.signal.addEventListener("abort",h);let w=k=>typeof v!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${f}" [routeId: ${n.route.id}]`)):v({request:t,url:LM(t,e),pattern:r,params:n.params,context:l},...k!==void 0?[k]:[]),S=(async()=>{try{return{type:"data",result:await(a?a(j=>w(j)):w())}}catch(k){return{type:"error",result:k}}})();return Promise.race([S,x])};try{let v=p?n.route.action:n.route.loader;
51if(s||i)if(v){let _,[x]=await Promise.all([g(v).catch(w=>{_=w}),s,i]);if(_!==void 0)throw _;u=x}else{await s;let _=p?n.route.action:n.route.loader;if(_)[u]=await Promise.all([g(_),i]);else if(f==="action"){let x=new URL(t.url),w=x.pathname+x.search;throw aa(405,{method:t.method,pathname:w,routeId:n.route.id})}else return{type:"data",result:void 0}}else if(v)u=await g(v);else{let _=new URL(t.url),x=_.pathname+_.search;throw aa(404,{pathname:x})}}catch(v){return{type:"error",result:v}}finally{h&&t.signal.removeEventListener("abort",h)}return u}async function y8(t){let e=t.headers.get("Content-Type");return e&&/\bapplication\/json\b/.test(e)?t.body==null?null:t.json():t.text()}async function _8(t){var n,s,i,a,l;let{result:e,type:r}=t;if(Yj(e)){let u;try{u=await y8(e)}catch(h){return{type:"error",error:h}}return r==="error"?{type:"error",error:new jg(e.status,e.statusText,u),statusCode:e.status,headers:e.headers}:{type:"data",data:u,statusCode:e.status,headers:e.headers}}return r==="error"?CA(e)?e.data instanceof Error?{type:"error",error:e.data,statusCode:(n=e.init)==null?void 0:n.status,headers:(s=e.init)!=null&&s.headers?new Headers(e.init.headers):void 0}:{type:"error",error:k8(e),statusCode:Sd(e)?e.status:void 0,headers:(i=e.init)!=null&&i.headers?new Headers(e.init.headers):void 0}:{type:"error",error:e,statusCode:Sd(e)?e.status:void 0}:CA(e)?{type:"data",data:e.data,statusCode:(a=e.init)==null?void 0:a.status,headers:(l=e.init)!=null&&l.headers?new Headers(e.init.headers):void 0}:{type:"data",data:e}}function b8(t,e,r,n,s){let i=t.headers.get("Location");if(Zt(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!qj(i)){let a=n.slice(0,n.findIndex(l=>l.route.id===r)+1);i=fk(new URL(e.url),a,s,i),t.headers.set("Location",i)}return t}var w8=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function mk(t){try{return w8.includes(new URL(t).protocol)}catch{return!1}}function xA(t,e,r,n){if(qj(t)){let s=t,i=Hj.test(s)?new URL(mM(s,e.protocol)):new URL(s);if(mk(i.toString()))throw new Error("Invalid redirect location");let a=ma(i.pathname,r)!=null;if(i.origin===e.origin&&a)return Gj(i.pathname)+i.search+i.hash}try{let s=n.createURL(t);if(mk(s.toString()))throw new Error("Invalid redirect location")}catch{}return t}function $h(t,e,r,n){let s=t.createURL(FM(e)).toString(),i={signal:r};if(n&&ys(n.formMethod)){let{formMethod:a,formEncType:l}=n;i.method=a.toUpperCase(),l==="application/json"?(i.headers=new Headers({"Content-Type":l}),i.body=JSON.stringify(n.json)):l==="text/plain"?i.body=n.text:l==="application/x-www-form-urlencoded"&&n.formData?i.body=gk(n.formData):i.body=n.formData}return new Request(s,i)}function LM(t,e){let r=new URL(t.url),n=typeof e=="string"?Bo(e):e;if(r.pathname=n.pathname||"/",n.search){let s=new URLSearchParams(n.search),i=s.getAll("index");s.delete("index");for(let a of i.filter(Boolean))s.append("index",a);r.search=s.size?`?${s.toString()}`:""}else r.search="";return r.hash=n.hash||"",r}function gk(t){let e=new URLSearchParams;for(let[r,n]of t.entries())e.append(r,typeof n=="string"?n:n.name);return e}function SA(t){let e=new FormData;for(let[r,n]of t.entries())e.append(r,n);return e}function x8(t,e,r,n=!1,s=!1){let i={},a=null,l,u=!1,h={},p=r&&ji(r[1])?r[1].error:void 0;return t.forEach(f=>{if(!(f.route.id in e))return;let g=f.route.id,v=e[g];if(Zt(!id(v),"Cannot handle redirect results in processLoaderData"),ji(v)){let _=v.error;if(p!==void 0&&(_=p,p=void 0),a=a||{},s)a[g]=_;else{let x=Tc(t,g);a[x.route.id]==null&&(a[x.route.id]=_)}n||(i[g]=RM),u||(u=!0,l=Sd(v.error)?v.error.status:500),v.headers&&(h[g]=v.headers)}else i[g]=v.data,v.statusCode&&v.statusCode!==200&&!u&&(l=v.statusCode),v.headers&&(h[g]=v.headers)}),p!==void 0&&r&&(a={[r[0]]:p},r[2]&&(i[r[2]]=void 0)),{loaderData:i,errors:a,statusCode:l||200,loaderHeaders:h}}function kA(t,e,r,n,s,i,a){let{loaderData:l,errors:u}=x8(e,r,n);return s.filter(h=>!h.matches||h.matches.some(p=>p.shouldLoad)).forEach(h=>{let{key:p,match:f,controller:g}=h;if(g&&g.signal.aborted)return;let v=i[p];if(Zt(v,"Did not find corresponding fetcher result"),ji(v)){let _=Tc(t.matches,f==null?void 0:f.route.id);u&&u[_.route.id]||(u={...u,[_.route.id]:v.error}),a.delete(p)}else if(id(v))Zt(!1,"Unhandled fetcher revalidation redirect");else{let _=wo(v.data);a.set(p,_)}}),{loaderData:l,errors:u}}function EA(t,e,r,n){let s=Object.entries(e).filter(([,i])=>i!==RM).reduce((i,[a,l])=>(i[a]=l,i),{});for(let i of r){let a=i.route.id;if(!e.hasOwnProperty(a)&&t.hasOwnProperty(a)&&i.route.loader&&(s[a]=t[a]),n&&n.hasOwnProperty(a))break}return s}function jA(t){return t?ji(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function Tc(t,e){return(e?t.slice(0,t.findIndex(n=>n.route.id===e)+1):[...t]).reverse().find(n=>n.route.hasErrorBoundary===!0)||t[0]}function ay(t){let e=t.length===1?t[0]:t.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function aa(t,{pathname:e,routeId:r,method:n,type:s,message:i}={}){let a="Unknown Server Error",l="Unknown @remix-run/router error";return t===400?(a="Bad Request",n&&e&&r?l=`You made a ${n} request to "${e}" but did not provide a \`loader\` for route "${r}", so there is no way to handle the request.`:s==="invalid-body"&&(l="Unable to encode submission body")):t===403?(a="Forbidden",l=`Route "${r}" does not match URL "${e}"`):t===404?(a="Not Found",l=`No route matches URL "${e}"`):t===405&&(a="Method Not Allowed",n&&e&&r?l=`You made a ${n.toUpperCase()} request to "${e}" but did not provide an \`action\` for route "${r}", so there is no way to handle the request.`:n&&(l=`Invalid request method "${n.toUpperCase()}"`)),new jg(t||500,a,new Error(l),!0)}function oy(t){let e=Object.entries(t);for(let r=e.length-1;r>=0;r--){let[n,s]=e[r];if(id(s))return{key:n,result:s}}}function FM(t){let e=typeof t=="string"?Bo(t):t;return $o({...e,hash:""})}function S8(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function k8(t){var e,r;return new jg(((e=t.init)==null?void 0:e.status)??500,((r=t.init)==null?void 0:r.statusText)??"Internal Server Error",t.data)}function E8(t){return t!=null&&typeof t=="object"&&Object.entries(t).every(([e,r])=>typeof e=="string"&&j8(r))}function j8(t){return t!=null&&typeof t=="object"&&"type"in t&&"result"in t&&(t.type==="data"||t.type==="error")}function C8(t){return Yj(t.result)&&CM.has(t.result.status)}function ji(t){return t.type==="error"}function id(t){return(t&&t.type)==="redirect"}function CA(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function Yj(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function N8(t){return CM.has(t)}function P8(t){return Yj(t)&&N8(t.status)&&t.headers.has("Location")}function R8(t){return i8.has(t.toUpperCase())}function ys(t){return n8.has(t.toUpperCase())}function Zj(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function Xy(t,e){let r=typeof e=="string"?Bo(e).search:e.search;if(t[t.length-1].route.index&&Zj(r||""))return t[t.length-1];let n=xM(t);return n[n.length-1]}function NA(t){let{formMethod:e,formAction:r,formEncType:n,text:s,formData:i,json:a}=t;
51if(!(!e||!r||!n)){if(s!=null)return{formMethod:e,formAction:r,formEncType:n,formData:void 0,json:void 0,text:s};if(i!=null)return{formMethod:e,formAction:r,formEncType:n,formData:i,json:void 0,text:void 0};if(a!==void 0)return{formMethod:e,formAction:r,formEncType:n,formData:void 0,json:a,text:void 0}}}function Cx(t,e,r,n){return n?{state:"loading",location:t,matches:e,historyAction:r,formMethod:n.formMethod,formAction:n.formAction,formEncType:n.formEncType,formData:n.formData,json:n.json,text:n.text}:{state:"loading",location:t,matches:e,historyAction:r,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function A8(t,e,r,n){return{state:"submitting",location:t,matches:e,historyAction:r,formMethod:n.formMethod,formAction:n.formAction,formEncType:n.formEncType,formData:n.formData,json:n.json,text:n.text}}function Vp(t,e){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function T8(t,e){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e?e.data:void 0}}function wo(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function I8(t,e){try{let r=t.sessionStorage.getItem(PM);if(r){let n=JSON.parse(r);for(let[s,i]of Object.entries(n||{}))i&&Array.isArray(i)&&e.set(s,new Set(i||[]))}}catch{}}function D8(t,e){if(e.size>0){let r={};for(let[n,s]of e)r[n]=[...s];try{t.sessionStorage.setItem(PM,JSON.stringify(r))}catch(n){An(!1,`Failed to save applied view transitions in sessionStorage (${n}).`)}}}function PA(){let t,e,r=new Promise((n,s)=>{t=async i=>{n(i);try{await r}catch{}},e=async i=>{s(i);try{await r}catch{}}});return{promise:r,resolve:t,reject:e}}var Dd=y.createContext(null);Dd.displayName="DataRouter";var Yf=y.createContext(null);Yf.displayName="DataRouterState";var $M=y.createContext(!1);function zM(){return y.useContext($M)}var Jj=y.createContext({isTransitioning:!1});Jj.displayName="ViewTransition";var Qj=y.createContext(new Map);Qj.displayName="Fetchers";var O8=y.createContext(null);O8.displayName="Await";var _a=y.createContext(null);_a.displayName="Navigation";var qb=y.createContext(null);qb.displayName="Location";var ba=y.createContext({outlet:null,matches:[],isDataRoute:!1});ba.displayName="Route";var Xj=y.createContext(null);Xj.displayName="RouteError";var UM="REACT_ROUTER_ERROR",M8="REDIRECT",L8="ROUTE_ERROR_RESPONSE";function F8(t){if(t.startsWith(`${UM}:${M8}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function $8(t){if(t.startsWith(`${UM}:${L8}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new jg(e.status,e.statusText,e.data)}catch{}}function z8(t,{relative:e}={}){Zt(Ng(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=y.useContext(_a),{hash:s,pathname:i,search:a}=Pg(t,{relative:e}),l=i;return r!=="/"&&(l=i==="/"?r:ua([r,i])),n.createHref({pathname:l,search:a,hash:s})}function Ng(){return y.useContext(qb)!=null}function Hs(){return Zt(Ng(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(qb).location}var BM="You should call navigate() in a React.useEffect(), not when your component is first rendered.";
51function VM(t){y.useContext(_a).static||y.useLayoutEffect(t)}function Vo(){let{isDataRoute:t}=y.useContext(ba);return t?eH():U8()}function U8(){Zt(Ng(),"useNavigate() may be used only in the context of a <Router> component.");let t=y.useContext(Dd),{basename:e,navigator:r}=y.useContext(_a),{matches:n}=y.useContext(ba),{pathname:s}=Hs(),i=JSON.stringify(Wj(n)),a=y.useRef(!1);return VM(()=>{a.current=!0}),y.useCallback((u,h={})=>{if(An(a.current,BM),!a.current)return;if(typeof u=="number"){r.go(u);return}let p=Hb(u,JSON.parse(i),s,h.relative==="path");t==null&&e!=="/"&&(p.pathname=p.pathname==="/"?e:ua([e,p.pathname])),(h.replace?r.replace:r.push)(p,h.state,h)},[e,r,i,s,t])}var B8=y.createContext(null);function V8(t){let e=y.useContext(ba).outlet;return y.useMemo(()=>e&&y.createElement(B8.Provider,{value:t},e),[e,t])}function H8(){let{matches:t}=y.useContext(ba),e=t[t.length-1];return(e==null?void 0:e.params)??{}}function Pg(t,{relative:e}={}){let{matches:r}=y.useContext(ba),{pathname:n}=Hs(),s=JSON.stringify(Wj(r));return y.useMemo(()=>Hb(t,JSON.parse(s),n,e==="path"),[t,s,n,e])}function q8(t,e,r){Zt(Ng(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=y.useContext(_a),{matches:s}=y.useContext(ba),i=s[s.length-1],a=i?i.params:{},l=i?i.pathname:"/",u=i?i.pathnameBase:"/",h=i&&i.route;{let w=h&&h.path||"";WM(l,!h||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${w}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
52
53Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let p=Hs(),f;f=p;let g=f.pathname||"/",v=g;if(u!=="/"){let w=u.replace(/^\//,"").split("/");v="/"+g.replace(/^\//,"").split("/").slice(w.length).join("/")}let _=r&&r.state.matches.length?r.state.matches.map(w=>Object.assign(w,{route:r.manifest[w.route.id]||w.route})):vM(t,{pathname:v});return An(h||_!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),An(_==null||_[_.length-1].route.element!==void 0||_[_.length-1].route.Component!==void 0||_[_.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),Z8(_&&_.map(w=>Object.assign({},w,{params:Object.assign({},a,w.params),pathname:ua([u,n.encodeLocation?n.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?u:ua([u,n.encodeLocation?n.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),s,r)}function W8(){let t=rC(),e=Sd(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,n="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:n},i={padding:"2px 4px",backgroundColor:n},a=null;return console.error("Error handled by React Router default ErrorBoundary:",t),a=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:i},"ErrorBoundary")," or"," ",y.createElement("code",{style:i},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},e),r?y.createElement("pre",{style:s},r):null,a)}var G8=y.createElement(W8,null),HM=class extends y.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const r=$8(t.digest);r&&(t=r)}let e=t!==void 0?y.createElement(ba.Provider,{value:this.props.routeContext},y.createElement(Xj.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?y.createElement(K8,{error:t},e):e}};HM.contextType=$M;var Nx=new WeakMap;function K8({children:t,error:e}){let{basename:r}=y.useContext(_a);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let n=F8(e.digest);if(n){let s=Nx.get(e);if(s)throw s;let i=kM(n.location,r),a=i.absoluteURL||i.to;
53if(mk(a))throw new Error("Invalid redirect location");if(SM&&!Nx.get(e))if(i.isExternal||n.reloadDocument)window.location.href=a;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:n.replace}));throw Nx.set(e,l),l}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a}`})}}return t}function Y8({routeContext:t,match:e,children:r}){let n=y.useContext(Dd);return n&&n.static&&n.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=e.route.id),y.createElement(ba.Provider,{value:t},r)}function Z8(t,e=[],r){let n=r==null?void 0:r.state;if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let s=t,i=n==null?void 0:n.errors;if(i!=null){let p=s.findIndex(f=>f.route.id&&(i==null?void 0:i[f.route.id])!==void 0);Zt(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),s=s.slice(0,Math.min(s.length,p+1))}let a=!1,l=-1;if(r&&n){a=n.renderFallback;for(let p=0;p<s.length;p++){let f=s[p];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(l=p),f.route.id){let{loaderData:g,errors:v}=n,_=f.route.loader&&!g.hasOwnProperty(f.route.id)&&(!v||v[f.route.id]===void 0);if(f.route.lazy||_){r.isStatic&&(a=!0),l>=0?s=s.slice(0,l+1):s=[s[0]];break}}}}let u=r==null?void 0:r.onError,h=n&&u?(p,f)=>{var g,v;u(p,{location:n.location,params:((v=(g=n.matches)==null?void 0:g[0])==null?void 0:v.params)??{},pattern:Cg(n.matches),errorInfo:f})}:void 0;return s.reduceRight((p,f,g)=>{let v,_=!1,x=null,w=null;n&&(v=i&&f.route.id?i[f.route.id]:void 0,x=f.route.errorElement||G8,a&&(l<0&&g===0?(WM("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),_=!0,w=null):l===g&&(_=!0,w=f.route.hydrateFallbackElement||null)));let S=e.concat(s.slice(0,g+1)),k=()=>{let j;return v?j=x:_?j=w:f.route.Component?j=y.createElement(f.route.Component,null):f.route.element?j=f.route.element:j=p,y.createElement(Y8,{match:f,routeContext:{outlet:p,matches:S,isDataRoute:n!=null},children:j})};return n&&(f.route.ErrorBoundary||f.route.errorElement||g===0)?y.createElement(HM,{location:n.location,revalidation:n.revalidation,component:x,error:v,children:k(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:h}):k()},null)}function eC(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function J8(t){let e=y.useContext(Dd);return Zt(e,eC(t)),e}function tC(t){let e=y.useContext(Yf);return Zt(e,eC(t)),e}function Q8(t){let e=y.useContext(ba);return Zt(e,eC(t)),e}function Wb(t){let e=Q8(t),r=e.matches[e.matches.length-1];return Zt(r.route.id,`${t} can only be used on routes that contain a unique "id"`),r.route.id}function X8(){return Wb("useRouteId")}function Qxe(){let t=tC("useNavigation");return y.useMemo(()=>{let{matches:e,historyAction:r,...n}=t.navigation;return n},[t.navigation])}function qM(){let t=tC("useLoaderData"),e=Wb("useLoaderData");return t.loaderData[e]}function rC(){var n;let t=y.useContext(Xj),e=tC("useRouteError"),r=Wb("useRouteError");return t!==void 0?t:(n=e.errors)==null?void 0:n[r]}function eH(){let{router:t}=J8("useNavigate"),e=Wb("useNavigate"),r=y.useRef(!1);return VM(()=>{r.current=!0}),y.useCallback(async(s,i={})=>{An(r.current,BM),r.current&&(typeof s=="number"?await t.navigate(s):await t.navigate(s,{fromRouteId:e,...i}))},[t,e])}var RA={};function WM(t,e,r){!e&&!RA[t]&&(RA[t]=!0,An(!1,r))}var AA={};function TA(t,e){!t&&!AA[e]&&(AA[e]=!0,console.warn(e))}var tH="useOptimistic",IA=Id[tH],rH=()=>{};function nH(t){return IA?IA(t):[t,rH]}function sH(t){let e={hasErrorBoundary:t.hasErrorBoundary||t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&(t.element&&An(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(e,{element:y.createElement(t.Component),Component:void 0})),t.HydrateFallback&&(t.hydrateFallbackElement&&An(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(e,{hydrateFallbackElement:y.createElement(t.HydrateFallback),HydrateFallback:void 0})),t.ErrorBoundary&&(t.errorElement&&An(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(e,{errorElement:y.createElement(t.ErrorBoundary),ErrorBoundary:void 0})),e}var iH=["HydrateFallback","hydrateFallbackElement"],aH=class{constructor(){this.status="pending",this.promise=new Promise((e,r)=>{this.resolve=n=>
53{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}};function oH({router:t,flushSync:e,onError:r,useTransitions:n}){n=zM()||n;let[i,a]=y.useState(t.state),[l,u]=nH(i),[h,p]=y.useState(),[f,g]=y.useState({isTransitioning:!1}),[v,_]=y.useState(),[x,w]=y.useState(),[S,k]=y.useState(),j=y.useRef(new Map),C=y.useCallback((P,{deletedFetchers:T,newErrors:O,flushSync:G,viewTransitionOpts:M})=>{O&&r&&Object.values(O).forEach(V=>{var H;return r(V,{location:P.location,params:((H=P.matches[0])==null?void 0:H.params)??{},pattern:Cg(P.matches)})}),P.fetchers.forEach((V,H)=>{V.data!==void 0&&j.current.set(H,V.data)}),T.forEach(V=>j.current.delete(V)),TA(G===!1||e!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable.  Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let U=t.window!=null&&t.window.document!=null&&typeof t.window.document.startViewTransition=="function";if(TA(M==null||U,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!M||!U){e&&G?e(()=>a(P)):n===!1?a(P):y.startTransition(()=>{n===!0&&u(V=>DA(V,P)),a(P)});return}if(e&&G){e(()=>{x&&(v==null||v.resolve(),x.skipTransition()),g({isTransitioning:!0,flushSync:!0,currentLocation:M.currentLocation,nextLocation:M.nextLocation})});let V=t.window.document.startViewTransition(()=>{e(()=>a(P))});V.finished.finally(()=>{e(()=>{_(void 0),w(void 0),p(void 0),g({isTransitioning:!1})})}),e(()=>w(V));return}x?(v==null||v.resolve(),x.skipTransition(),k({state:P,currentLocation:M.currentLocation,nextLocation:M.nextLocation})):(p(P),g({isTransitioning:!0,flushSync:!1,currentLocation:M.currentLocation,nextLocation:M.nextLocation}))},[t.window,e,x,v,n,u,r]);y.useLayoutEffect(()=>t.subscribe(C),[t,C]),y.useEffect(()=>{f.isTransitioning&&!f.flushSync&&_(new aH)},[f]),y.useEffect(()=>{if(v&&h&&t.window){let P=h,T=v.promise,O=t.window.document.startViewTransition(async()=>{n===!1?a(P):y.startTransition(()=>{n===!0&&u(G=>DA(G,P)),a(P)}),await T});O.finished.finally(()=>{_(void 0),w(void 0),p(void 0),g({isTransitioning:!1})}),w(O)}},[h,v,t.window,n,u]),y.useEffect(()=>{v&&h&&l.location.key===h.location.key&&v.resolve()},[v,x,l.location,h]),y.useEffect(()=>{!f.isTransitioning&&S&&(p(S.state),g({isTransitioning:!0,flushSync:!1,currentLocation:S.currentLocation,nextLocation:S.nextLocation}),k(void 0))},[f.isTransitioning,S]);let R=y.useMemo(()=>({createHref:t.createHref,encodeLocation:t.encodeLocation,go:P=>t.navigate(P),push:(P,T,O)=>t.navigate(P,{state:T,preventScrollReset:O==null?void 0:O.preventScrollReset}),replace:(P,T,O)=>t.navigate(P,{replace:!0,state:T,preventScrollReset:O==null?void 0:O.preventScrollReset})}),[t]),A=t.basename||"/",I=y.useMemo(()=>({router:t,navigator:R,static:!1,basename:A,onError:r}),[t,R,A,r]);return y.createElement(y.Fragment,null,y.createElement(Dd.Provider,{value:I},y.createElement(Yf.Provider,{value:l},y.createElement(Qj.Provider,{value:j.current},y.createElement(Jj.Provider,{value:f},y.createElement(uH,{basename:A,location:l.location,navigationType:l.historyAction,navigator:R,useTransitions:n},y.createElement(lH,{routes:t.routes,manifest:t.manifest,future:t.future,state:l,isStatic:!1,onError:r})))))),null)}function DA(t,e){return{...t,navigation:e.navigation.state!=="idle"?e.navigation:t.navigation,revalidation:e.revalidation!=="idle"?e.revalidation:t.revalidation,actionData:e.navigation.state!=="submitting"?e.actionData:t.actionData,fetchers:e.fetchers}}var lH=y.memo(cH);function cH({routes:t,manifest:e,future:r,state:n,isStatic:s,onError:i}){return q8(t,void 0,{manifest:e,state:n,isStatic:s,onError:i})}function GM(t){return V8(t.context)}function uH({basename:t="/",children:e=null,location:r,navigationType:n="POP",navigator:s,static:i=!1,useTransitions:a}){Zt(!Ng(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=t.replace(/^\/*/,"/"),u=y.useMemo(()=>({basename:l,navigator:s,static:i,useTransitions:a,future:{}}),[l,s,i,a]);typeof r=="string"&&(r=Bo(r));let{pathname:h="/",search:p="",hash:f="",state:g=null,key:v="default",mask:_}=r,x=y.useMemo(()=>{let w=ma(h,l);return w==null?null:{location:{pathname:w,search:p,hash:f,state:g,key:v,mask:_},navigationType:n}},[l,h,p,f,g,v,n,_]);
53return An(x!=null,`<Router basename="${l}"> is not able to match the URL "${h}${p}${f}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:y.createElement(_a.Provider,{value:u},y.createElement(qb.Provider,{children:e,value:x}))}var e_="get",t_="application/x-www-form-urlencoded";function Gb(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function dH(t){return Gb(t)&&t.tagName.toLowerCase()==="button"}function hH(t){return Gb(t)&&t.tagName.toLowerCase()==="form"}function fH(t){return Gb(t)&&t.tagName.toLowerCase()==="input"}function pH(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function mH(t,e){return t.button===0&&(!e||e==="_self")&&!pH(t)}function vk(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,r)=>{let n=t[r];return e.concat(Array.isArray(n)?n.map(s=>[r,s]):[[r,n]])},[]))}function gH(t,e){let r=vk(t);return e&&e.forEach((n,s)=>{r.has(s)||e.getAll(s).forEach(i=>{r.append(s,i)})}),r}var ly=null;function vH(){if(ly===null)try{new FormData(document.createElement("form"),0),ly=!1}catch{ly=!0}return ly}var yH=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Px(t){return t!=null&&!yH.has(t)?(An(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${t_}"`),null):t}function _H(t,e){let r,n,s,i,a;if(hH(t)){let l=t.getAttribute("action");n=l?ma(l,e):null,r=t.getAttribute("method")||e_,s=Px(t.getAttribute("enctype"))||t_,i=new FormData(t)}else if(dH(t)||fH(t)&&(t.type==="submit"||t.type==="image")){let l=t.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=t.getAttribute("formaction")||l.getAttribute("action");if(n=u?ma(u,e):null,r=t.getAttribute("formmethod")||l.getAttribute("method")||e_,s=Px(t.getAttribute("formenctype"))||Px(l.getAttribute("enctype"))||t_,i=new FormData(l,t),!vH()){let{name:h,type:p,value:f}=t;if(p==="image"){let g=h?`${h}.`:"";i.append(`${g}x`,"0"),i.append(`${g}y`,"0")}else h&&i.append(h,f)}}else{if(Gb(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=e_,n=null,s=t_,a=t}return i&&s==="text/plain"&&(a=i,i=void 0),{action:n,method:r.toLowerCase(),encType:s,formData:i,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function nC(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function KM(t,e,r,n){let s=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return r?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${n}`:s.pathname=`${s.pathname}.${n}`:s.pathname==="/"?s.pathname=`_root.${n}`:e&&ma(s.pathname,e)==="/"?s.pathname=`${P_(e)}/_root.${n}`:s.pathname=`${P_(s.pathname)}.${n}`,s}async function bH(t,e){if(t.id in e)return e[t.id];try{let r=await import(t.module);return e[t.id]=r,r}catch(r){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function wH(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function xH(t,e,r){let n=await Promise.all(t.map(async s=>{let i=e.routes[s.route.id];if(i){let a=await bH(i,r);return a.links?a.links():[]}return[]}));return jH(n.flat(1).filter(wH).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function OA(t,e,r,n,s,i){let a=(u,h)=>r[h]?u.route.id!==r[h].route.id:!0,l=(u,h)=>{var p;return r[h].pathname!==u.pathname||((p=r[h].route.path)==null?void 0:p.endsWith("*"))&&r[h].params["*"]!==u.params["*"]};return i==="assets"?e.filter((u,h)=>a(u,h)||l(u,h)):i==="data"?e.filter((u,h)=>{var f;let p=n.routes[u.route.id];if(!p||!p.hasLoader)return!1;if(a(u,h)||l(u,h))return!0;if(u.route.shouldRevalidate){let g=u.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParam
53s:((f=r[0])==null?void 0:f.params)||{},nextUrl:new URL(t,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function SH(t,e,{includeHydrateFallback:r}={}){return kH(t.map(n=>{let s=e.routes[n.route.id];if(!s)return[];let i=[s.module];return s.clientActionModule&&(i=i.concat(s.clientActionModule)),s.clientLoaderModule&&(i=i.concat(s.clientLoaderModule)),r&&s.hydrateFallbackModule&&(i=i.concat(s.hydrateFallbackModule)),s.imports&&(i=i.concat(s.imports)),i}).flat(1))}function kH(t){return[...new Set(t)]}function EH(t){let e={},r=Object.keys(t).sort();for(let n of r)e[n]=t[n];return e}function jH(t,e){let r=new Set;return new Set(e),t.reduce((n,s)=>{let i=JSON.stringify(EH(s));return r.has(i)||(r.add(i),n.push({key:i,link:s})),n},[])}function sC(){let t=y.useContext(Dd);return nC(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function CH(){let t=y.useContext(Yf);return nC(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var iC=y.createContext(void 0);iC.displayName="FrameworkContext";function Kb(){let t=y.useContext(iC);return nC(t,"You must render this element inside a <HydratedRouter> element"),t}function NH(t,e){let r=y.useContext(iC),[n,s]=y.useState(!1),[i,a]=y.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:h,onMouseLeave:p,onTouchStart:f}=e,g=y.useRef(null);y.useEffect(()=>{if(t==="render"&&a(!0),t==="viewport"){let x=S=>{S.forEach(k=>{a(k.isIntersecting)})},w=new IntersectionObserver(x,{threshold:.5});return g.current&&w.observe(g.current),()=>{w.disconnect()}}},[t]),y.useEffect(()=>{if(n){let x=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(x)}}},[n]);let v=()=>{s(!0)},_=()=>{s(!1),a(!1)};return r?t!=="intent"?[i,g,{}]:[i,g,{onFocus:Hp(l,v),onBlur:Hp(u,_),onMouseEnter:Hp(h,v),onMouseLeave:Hp(p,_),onTouchStart:Hp(f,v)}]:[!1,g,{}]}function Hp(t,e){return r=>{t&&t(r),r.defaultPrevented||e(r)}}function PH({page:t,...e}){let r=zM(),{nonce:n}=Kb(),{router:s}=sC(),i=y.useMemo(()=>vM(s.routes,t,s.basename),[s.routes,t,s.basename]);return i?(e.nonce==null&&n&&(e={...e,nonce:n}),r?y.createElement(AH,{page:t,matches:i,...e}):y.createElement(TH,{page:t,matches:i,...e})):null}function RH(t){let{manifest:e,routeModules:r}=Kb(),[n,s]=y.useState([]);return y.useEffect(()=>{let i=!1;return xH(t,e,r).then(a=>{i||s(a)}),()=>{i=!0}},[t,e,r]),n}function AH({page:t,matches:e,...r}){let n=Hs(),{future:s}=Kb(),{basename:i}=sC(),a=y.useMemo(()=>{if(t===n.pathname+n.search+n.hash)return[];let l=KM(t,i,s.v8_trailingSlashAwareDataRequests,"rsc"),u=!1,h=[];for(let p of e)typeof p.route.shouldRevalidate=="function"?u=!0:h.push(p.route.id);return u&&h.length>0&&l.searchParams.set("_routes",h.join(",")),[l.pathname+l.search]},[i,s.v8_trailingSlashAwareDataRequests,t,n,e]);return y.createElement(y.Fragment,null,a.map(l=>y.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...r})))}function TH({page:t,matches:e,...r}){let n=Hs(),{future:s,manifest:i,routeModules:a}=Kb(),{basename:l}=sC(),{loaderData:u,matches:h}=CH(),p=y.useMemo(()=>OA(t,e,h,i,n,"data"),[t,e,h,i,n]),f=y.useMemo(()=>OA(t,e,h,i,n,"assets"),[t,e,h,i,n]),g=y.useMemo(()=>{if(t===n.pathname+n.search+n.hash)return[];let x=new Set,w=!1;if(e.forEach(k=>{var C;let j=i.routes[k.route.id];!j||!j.hasLoader||(!p.some(R=>R.route.id===k.route.id)&&k.route.id in u&&((C=a[k.route.id])!=null&&C.shouldRevalidate)||j.hasClientLoader?w=!0:x.add(k.route.id))}),x.size===0)return[];let S=KM(t,l,s.v8_trailingSlashAwareDataRequests,"data");return w&&x.size>0&&S.searchParams.set("_routes",e.filter(k=>x.has(k.route.id)).map(k=>k.route.id).join(",")),[S.pathname+S.search]},[l,s.v8_trailingSlashAwareDataRequests,u,n,i,p,e,t,a]),v=y.useMemo(()=>SH(f,i),[f,i]),_=RH(f);return y.createElement(y.Fragment,null,g.map(x=>y.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...r})),v.map(x=>y.createElement("link",{key:x,rel:"modulepreload",href:x,...r})),_.map(({key:x,link:w})=>y.createElement("link",{key:x,nonce:r.nonce,...w,crossOrigin:w.crossOrigin??r.crossOrigin})))}function IH(...t){return e=>{t.forEach(r=>
53{typeof r=="function"?r(e):r!=null&&(r.current=e)})}}var DH=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{DH&&(window.__reactRouterVersion="7.18.2")}catch{}function OH(t,e){return c8({basename:e==null?void 0:e.basename,getContext:e==null?void 0:e.getContext,future:e==null?void 0:e.future,history:EV({window:e==null?void 0:e.window}),hydrationData:MH(),routes:t,mapRouteProperties:sH,hydrationRouteProperties:iH,dataStrategy:e==null?void 0:e.dataStrategy,patchRoutesOnNavigation:e==null?void 0:e.patchRoutesOnNavigation,window:e==null?void 0:e.window,instrumentations:e==null?void 0:e.instrumentations}).initialize()}function MH(){let t=window==null?void 0:window.__staticRouterHydrationData;return t&&t.errors&&(t={...t,errors:LH(t.errors)}),t}function LH(t){if(!t)return null;let e=Object.entries(t),r={};for(let[n,s]of e)if(s&&s.__type==="RouteErrorResponse")r[n]=new jg(s.status,s.statusText,s.data,s.internal===!0);else if(s&&s.__type==="Error"){if(typeof s.__subType=="string"&&ZV.includes(s.__subType)){let i=window[s.__subType];if(typeof i=="function")try{let a=new i(s.message);a.stack="",r[n]=a}catch{}}if(r[n]==null){let i=new Error(s.message);i.stack="",r[n]=i}}else r[n]=s;return r}var Sr=y.forwardRef(function({onClick:e,discover:r="render",prefetch:n="none",relative:s,reloadDocument:i,replace:a,mask:l,state:u,target:h,to:p,preventScrollReset:f,viewTransition:g,defaultShouldRevalidate:v,..._},x){let{basename:w,navigator:S,useTransitions:k}=y.useContext(_a),j=typeof p=="string"&&Vb.test(p),C=kM(p,w);p=C.to;let R=z8(p,{relative:s}),A=Hs(),I=null;if(l){let H=Hb(l,[],A.mask?A.mask.pathname:"/",!0);w!=="/"&&(H.pathname=H.pathname==="/"?w:ua([w,H.pathname])),I=S.createHref(H)}let[P,T,O]=NH(n,_),G=zH(p,{replace:a,mask:l,state:u,target:h,preventScrollReset:f,relative:s,viewTransition:g,defaultShouldRevalidate:v,useTransitions:k});function M(H){e&&e(H),H.defaultPrevented||G(H)}let U=!(C.isExternal||i),V=y.createElement("a",{..._,...O,href:(U?I:void 0)||C.absoluteURL||R,onClick:U?M:e,ref:IH(x,T),target:h,"data-discover":!j&&r==="render"?"true":void 0});return P&&!j?y.createElement(y.Fragment,null,V,y.createElement(PH,{page:R})):V});Sr.displayName="Link";var FH=y.forwardRef(function({"aria-current":e="page",caseSensitive:r=!1,className:n="",end:s=!1,style:i,to:a,viewTransition:l,children:u,...h},p){let f=Pg(a,{relative:h.relative}),g=Hs(),v=y.useContext(Yf),{navigator:_,basename:x}=y.useContext(_a),w=v!=null&&HH(f)&&l===!0,S=_.encodeLocation?_.encodeLocation(f).pathname:f.pathname,k=g.pathname,j=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;r||(k=k.toLowerCase(),j=j?j.toLowerCase():null,S=S.toLowerCase()),j&&x&&(j=ma(j,x)||j);const C=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let R=k===S||!s&&k.startsWith(S)&&k.charAt(C)==="/",A=j!=null&&(j===S||!s&&j.startsWith(S)&&j.charAt(S.length)==="/"),I={isActive:R,isPending:A,isTransitioning:w},P=R?e:void 0,T;typeof n=="function"?T=n(I):T=[n,R?"active":null,A?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let O=typeof i=="function"?i(I):i;return y.createElement(Sr,{...h,"aria-current":P,className:T,ref:p,style:O,to:a,viewTransition:l},typeof u=="function"?u(I):u)});FH.displayName="NavLink";var YM=y.forwardRef(({discover:t="render",fetcherKey:e,navigate:r,reloadDocument:n,replace:s,state:i,method:a=e_,action:l,onSubmit:u,relative:h,preventScrollReset:p,viewTransition:f,defaultShouldRevalidate:g,...v},_)=>{let{useTransitions:x}=y.useContext(_a),w=JM(),S=VH(l,{relative:h}),k=a.toLowerCase()==="get"?"get":"post",j=typeof l=="string"&&Vb.test(l),C=R=>{if(u&&u(R),R.defaultPrevented)return;R.preventDefault();let A=R.nativeEvent.submitter,I=(A==null?void 0:A.getAttribute("formmethod"))||a,P=()=>w(A||R.currentTarget,{fetcherKey:e,method:I,navigate:r,replace:s,state:i,relative:h,preventScrollReset:p,viewTransition:f,defaultShouldRevalidate:g});x&&r!==!1?y.startTransition(()=>P()):P()};return y.createElement("form",{ref:_,method:k,action:S,onSubmit:n?u:C,...v,"data-discover":!j&&t==="render"?"true":void 0})});YM.displayName="Form";function ZM(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function aC(t){let e=y.useContext(Dd);return Zt(e,ZM(t)),e}function $H(t){let e=y.useContext(Yf);return Zt(e,ZM(t)),e}function zH(t,{target:e,replace:r,mask:n,state:s,preventScrollReset:i,relative:a,viewTransition:l,defaultShouldRevalidate:u,useTransitions:h}={}){let p=Vo(),f=Hs(),g=Pg(t,{relative:a});return y.useCallback(v=>{if(mH(v,e)){v.preventDefault();let _=r!==void 0?r:$o(f)===$o(g),x=()=>p(t,{replace:_,mask:n,state:s,preventScrollReset:i,relative:a,viewTransition:l,defaultShouldRevalidate:u});h?y.startTransition(()=>x()):x()}},[f,p,g,r,n,s,e,t,i,a,l,u,h])}function Rg(t){An(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let e=y.useRef(vk(t)),r=y.useRef(!1),n=Hs(),s=y.useMemo(()=>gH(n.search,r.current?null:e.current),[n.search]),i=Vo(),a=y.useCallback((l,u)=>{const h=vk(typeof l=="function"?l(new URLSearchParams(s)):l);r.current=!0,i("?"+h,u)},[i,s]);return[s,a]}var UH=0,BH=()=>`__${String(++UH)}__`;function JM(){let{router:t}=aC("useSubmit"),{basename:e}=y.useContext(_a),r=X8(),n=t.fetch,s=t.navigate;return y.useCallback(async(i,a={})=>{let{action:l,method:u,encType:h,formData:p,body:f}=_H(i,e);if(a.navigate===!1){let g=a.fetcherKey||BH();await n(g,r,a.action||l,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:p,body:f,formMethod:a.method||u,formEncType:a.encType||h,flushSync:a.flushSync})}else await s(a.action||l,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:p,body:f,formMethod:a.method||u,formEncType:a.encType||h,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})},[n,s,e,r])}function VH(t,{relative:e}={}){let{basename:r}=y.useContext(_a),n=y.useContext(ba);Zt(n,"useFormAction must be used inside a RouteContext");let[s]=n.matches.slice(-1),i={...Pg(t||".",{relative:e})},a=Hs();if(t==null){i.search=a.search;let l=new URLSearchParams(i.search),u=l.getAll("index");if(u.some(p=>p==="")){l.delete("index"),u.filter(f=>f).forEach(f=>l.append("index",f));let p=l.toString();i.search=p?`?${p}`:""}}return(!t||t===".")&&s.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(i.pathname=i.pathname==="/"?r:ua([r,i.pathname])),$o(i)}function Ag({key:t}={}){var R;let{router:e}=aC("useFetcher"),r=$H("useFetcher"),n=y.useContext(Qj),s=y.useContext(ba),i=(R=s.matches[s.matches.length-1])==null?void 0:R.route.id;Zt(n,"useFetcher must be used inside a FetchersContext"),Zt(s,"useFetcher must be used inside a RouteContext"),Zt(i!=null,'useFetcher can only be used on routes that contain a unique "id"');let a=y.useId(),[l,u]=y.useState(t||a);t&&t!==l&&u(t);let{deleteFetcher:h,getFetcher:p,resetFetcher:f,fetch:g}=e;y.useEffect(()=>(p(l),()=>h(l)),[h,p,l]);let v=y.useCallback(async(A,I)=>{Zt(i,"No routeId available for fetcher.load()"),await g(l,i,A,I)},[l,i,g]),_=JM(),x=y.useCallback(async(A,I)=>{await _(A,{...I,navigate:!1,fetcherKey:l})},[l,_]),w=y.useCallback(A=>f(l,A),[f,l]),S=y.useMemo(()=>{let A=y.forwardRef((I,P)=>y.createElement(YM,{...I,navigate:!1,fetcherKey:l,ref:P}));return A.displayName="fetcher.Form",A},[l]),k=r.fetchers.get(l)||NM,j=n.get(l);return y.useMemo(()=>({Form:S,submit:x,load:v,reset:w,...k,data:j}),[S,x,v,w,k,j])}function HH(t,{relative:e}={}){let r=y.useContext(Jj);Zt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=aC("useViewTransitionState"),s=Pg(t,{relative:e});if(!r.isTransitioning)return!1;let i=ma(r.currentLocation.pathname,n)||r.currentLocation.pathname,a=ma(r.nextLocation.pathname,n)||r.nextLocation.pathname;return Um(s.pathname,a)!=null||Um(s.pathname,i)!=null}var ou=hM();const qH=dM(ou);function WH(t){return y.createElement(oH,{flushSync:ou.flushSync,...t})}const GH="modulepreload",KH=function(t){return"/"+t},MA={},Nn=function(e,r,n){let s=Promise.resolve();if(r&&r.length>0){let a=function(h){return Promise.all(h.map(p=>Promise.resolve(p).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}
53))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));s=a(r.map(h=>{if(h=KH(h),h in MA)return;MA[h]=!0;const p=h.endsWith(".css"),f=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${f}`))return;const g=document.createElement("link");if(g.rel=p?"stylesheet":GH,p||(g.as="script"),g.crossOrigin="",g.href=h,u&&g.setAttribute("nonce",u),document.head.appendChild(g),p)return new Promise((v,_)=>{g.addEventListener("load",v),g.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${h}`)))})}))}function i(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return s.then(a=>{for(const l of a||[])l.status==="rejected"&&i(l.reason);return e().catch(i)})};var Zf=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ud,Lc,mf,eM,YH=(eM=class extends Zf{constructor(){super();bt(this,ud);bt(this,Lc);bt(this,mf);Je(this,mf,e=>{if(typeof window<"u"&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){X(this,Lc)||this.setEventListener(X(this,mf))}onUnsubscribe(){var e;this.hasListeners()||((e=X(this,Lc))==null||e.call(this),Je(this,Lc,void 0))}setEventListener(e){var r;Je(this,mf,e),(r=X(this,Lc))==null||r.call(this),Je(this,Lc,e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(e){X(this,ud)!==e&&(Je(this,ud,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof X(this,ud)=="boolean"?X(this,ud):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},ud=new WeakMap,Lc=new WeakMap,mf=new WeakMap,eM),oC=new YH,ZH={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Fc,Bj,tM,JH=(tM=class{constructor(){bt(this,Fc,ZH);bt(this,Bj,!1)}setTimeoutProvider(t){Je(this,Fc,t)}setTimeout(t,e){return X(this,Fc).setTimeout(t,e)}clearTimeout(t){X(this,Fc).clearTimeout(t)}setInterval(t,e){return X(this,Fc).setInterval(t,e)}clearInterval(t){X(this,Fc).clearInterval(t)}},Fc=new WeakMap,Bj=new WeakMap,tM),ad=new JH;function QH(t){setTimeout(t,0)}var XH=typeof window>"u"||"Deno"in globalThis;function Ps(){}function eq(t,e){return typeof t=="function"?t(e):t}function yk(t){return typeof t=="number"&&t>=0&&t!==1/0}function QM(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Yc(t,e){return typeof t=="function"?t(e):t}function Ci(t,e){return typeof t=="function"?t(e):t}function LA(t,e){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:a,stale:l}=t;if(a){if(n){if(e.queryHash!==lC(a,e.options))return!1}else if(!Nf(e.queryKey,a))return!1}if(r!=="all"){const u=e.isActive();if(r==="active"&&!u||r==="inactive"&&u)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||s&&s!==e.state.fetchStatus||i&&!i(e))}function FA(t,e){const{exact:r,status:n,predicate:s,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(r){if(kd(e.options.mutationKey)!==kd(i))return!1}else if(!Nf(e.options.mutationKey,i))return!1}return!(n&&e.state.status!==n||s&&!s(e))}function lC(t,e){return((e==null?void 0:e.queryKeyHashFn)||kd)(t)}function kd(t){return JSON.stringify(t,(e,r)=>_k(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Nf(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(Array.isArray(t)&&Array.isArray(e)){for(let n=0;n<e.length;n++)if(!Nf(t[n],e[n]))return!1;return!0}const r=Object.keys(e);for(const n of r)if(!Nf(t[n],e[n]))return!1;return!0}return!1}var tq=Object.prototype.hasOwnProperty;function XM(t,e,r=0){if(t===e)return t;if(r>500)return e;const n=$A(t)&&$A(e);
53if(!n&&!(_k(t)&&_k(e)))return e;const i=(n?t:Object.keys(t)).length,a=n?e:Object.keys(e),l=a.length,u=n?new Array(l):{};let h=0;for(let p=0;p<l;p++){const f=n?p:a[p],g=t[f],v=e[f];if(g===v){u[f]=g,(n?p<i:tq.call(t,f))&&h++;continue}if(g===null||v===null||typeof g!="object"||typeof v!="object"){u[f]=v;continue}const _=XM(g,v,r+1);u[f]=_,_===g&&h++}return i===l&&h===i?t:u}function R_(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const r in t)if(t[r]!==e[r])return!1;return!0}function $A(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function _k(t){if(!zA(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!zA(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function zA(t){return Object.prototype.toString.call(t)==="[object Object]"}function rq(t){return new Promise(e=>{ad.setTimeout(e,t)})}function bk(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?XM(t,e):e}function nq(t,e,r=0){const n=[...t,e];return r&&n.length>r?n.slice(1):n}function sq(t,e,r=0){const n=[e,...t];return r&&n.length>r?n.slice(0,-1):n}var cC=Symbol();function eL(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===cC?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function uC(t,e){return typeof t=="function"?t(...e):!!t}function iq(t,e,r){let n=!1,s;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(s??(s=e()),n||(n=!0,s.aborted?r():s.addEventListener("abort",r,{once:!0})),s)}),t}var Bm=(()=>{let t=()=>XH;return{isServer(){return t()},setIsServer(e){t=e}}})();function wk(){let t,e;const r=new Promise((s,i)=>{t=s,e=i});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),t(s)},r.reject=s=>{n({status:"rejected",reason:s}),e(s)},r}var aq=QH;function oq(){let t=[],e=0,r=l=>{l()},n=l=>{l()},s=aq;const i=l=>{e?t.push(l):s(()=>{r(l)})},a=()=>{const l=t;t=[],l.length&&s(()=>{n(()=>{l.forEach(u=>{r(u)})})})};return{batch:l=>{let u;e++;try{u=l()}finally{e--,e||a()}return u},batchCalls:l=>(...u)=>{i(()=>{l(...u)})},schedule:i,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{s=l}}}var Un=oq(),gf,$c,vf,rM,lq=(rM=class extends Zf{constructor(){super();bt(this,gf,!0);bt(this,$c);bt(this,vf);Je(this,vf,e=>{if(typeof window<"u"&&window.addEventListener){const r=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){X(this,$c)||this.setEventListener(X(this,vf))}onUnsubscribe(){var e;this.hasListeners()||((e=X(this,$c))==null||e.call(this),Je(this,$c,void 0))}setEventListener(e){var r;Je(this,vf,e),(r=X(this,$c))==null||r.call(this),Je(this,$c,e(this.setOnline.bind(this)))}setOnline(e){X(this,gf)!==e&&(Je(this,gf,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return X(this,gf)}},gf=new WeakMap,$c=new WeakMap,vf=new WeakMap,rM),A_=new lq;function cq(t){return Math.min(1e3*2**t,3e4)}function tL(t){return(t??"online")==="online"?A_.isOnline():!0}var xk=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function rL(t){let e=!1,r=0,n;const s=wk(),i=()=>s.status!=="pending",a=x=>{var w;if(!i()){const S=new xk(x);g(S),(w=t.onCancel)==null||w.call(t,S)}},l=()=>{e=!0},u=()=>{e=!1},h=()=>oC.isFocused()&&(t.networkMode==="always"||A_.isOnline())&&t.canRun(),p=()=>tL(t.networkMode)&&t.canRun(),f=x=>{i()||(n==null||n(),s.resolve(x))},g=x=>{i()||(n==null||n(),s.reject(x))},v=()=>new Promise(x=>{var w;n=S=>{(i()||h())&&x(S)},(w=t.onPause)==null||w.call(t)}).then(()=>{var x;n=void 0,i()||(x=t.onContinue)==null||x.call(t)}),_=()=>{if(i())return;let x;const w=r===0?t.initialPromise:void 0;try{x=w??t.fn()}catch(S){x=Promise.reject(S)}Promise.resolve(x).then(f).catch(S=>{var A;if(i())return;const k=t.retry??(Bm.isServer()?0:3),j=t.retryDelay??cq,C=typeof j=="function"?j(r,S):j,R=k===!0||typeof k=="number"&&r<k||typeof k=="function"&&k(r,S);if(e||!R){g(S);return}r++,(A=t.onFail)==null||A.call(t,r,S),rq(C).then(()=>h()?void 0:v()).then(()=>{e?g(S):_()})})};return{promise:s,status:()=>s.status,cancel:a,continue:()=>(n==null||n(),s),cancelRetry:l,continueRetry:u,canStart:p,start:()=>(p()?_():v().then(_),s)}}var dd,nM,nL=(nM=class{constructor(){bt(this,dd)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),yk(this.gcTime)&&Je(this,dd,ad.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Bm.isServer()?1/0:300*1e3))}clearGcTimeout(){X(this,dd)!==void 0&&(ad.clearTimeout(X(this,dd)),Je(this,dd,void 0))}},dd=new WeakMap,nM);function uq(t){return{onFetch:(e,r)=>{var p,f,g,v,_;const n=e.options,s=(g=(f=(p=e.fetchOptions)==null?void 0:p.meta)==null?void 0:f.fetchMore)==null?void 0:g.direction,i=((v=e.state.data)==null?void 0:v.pages)||[],a=((_=e.state.data)==null?void 0:_.pageParams)||[];let l={pages:[],pageParams:[]},u=0;const h=async()=>{let x=!1;const w=j=>{iq(j,()=>e.signal,()=>x=!0)},S=eL(e.options,e.fetchOptions),k=async(j,C,R)=>
53{if(x)return Promise.reject(e.signal.reason);if(C==null&&j.pages.length)return Promise.resolve(j);const I=(()=>{const G={client:e.client,queryKey:e.queryKey,pageParam:C,direction:R?"backward":"forward",meta:e.options.meta};return w(G),G})(),P=await S(I),{maxPages:T}=e.options,O=R?sq:nq;return{pages:O(j.pages,P,T),pageParams:O(j.pageParams,C,T)}};if(s&&i.length){const j=s==="backward",C=j?dq:UA,R={pages:i,pageParams:a},A=C(n,R);l=await k(R,A,j)}else{const j=t??i.length;do{const C=u===0?a[0]??n.initialPageParam:UA(n,l);if(u>0&&C==null)break;l=await k(l,C),u++}while(u<j)}return l};e.options.persister?e.fetchFn=()=>{var x,w;return(w=(x=e.options).persister)==null?void 0:w.call(x,h,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=h}}}function UA(t,{pages:e,pageParams:r}){const n=e.length-1;return e.length>0?t.getNextPageParam(e[n],e,r[n],r):void 0}function dq(t,{pages:e,pageParams:r}){var n;return e.length>0?(n=t.getPreviousPageParam)==null?void 0:n.call(t,e[0],e,r[0],r):void 0}var yf,hd,_f,ia,fd,Yn,wg,pd,ki,sL,hl,sM,hq=(sM=class extends nL{constructor(e){super();bt(this,ki);bt(this,yf);bt(this,hd);bt(this,_f);bt(this,ia);bt(this,fd);bt(this,Yn);bt(this,wg);bt(this,pd);Je(this,pd,!1),Je(this,wg,e.defaultOptions),this.setOptions(e.options),this.observers=[],Je(this,fd,e.client),Je(this,ia,X(this,fd).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Je(this,hd,VA(this.options)),this.state=e.state??X(this,hd),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return X(this,yf)}get promise(){var e;return(e=X(this,Yn))==null?void 0:e.promise}setOptions(e){if(this.options={...X(this,wg),...e},e!=null&&e._type&&Je(this,yf,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=VA(this.options);r.data!==void 0&&(this.setState(BA(r.data,r.dataUpdatedAt)),Je(this,hd,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&X(this,ia).remove(this)}setData(e,r){const n=bk(this.state.data,e,this.options);return Qt(this,ki,hl).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(e){Qt(this,ki,hl).call(this,{type:"setState",state:e})}cancel(e){var n,s;const r=(n=X(this,Yn))==null?void 0:n.promise;return(s=X(this,Yn))==null||s.cancel(e),r?r.then(Ps).catch(Ps):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return X(this,hd)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Ci(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===cC||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Yc(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!QM(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(n=>n.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=X(this,Yn))==null||r.continue()}onOnline(){var r;const e=this.observers.find(n=>n.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=X(this,Yn))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),X(this,ia).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(X(this,Yn)&&(X(this,pd)||Qt(this,ki,sL).call(this)?X(this,Yn).cancel({revert:!0}):X(this,Yn).cancelRetry()),this.scheduleGc()),X(this,ia).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Qt(this,ki,hl).call(this,{type:"invalidate"})}async fetch(e,r){var h,p,f,g,v,_,x,w,S,k,j;if(this.state.fetchStatus!=="idle"&&((h=X(this,Yn))==null?void 0:h.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(X(this,Yn))return X(this,Yn).continueRetry(),X(this,Yn).promise}if(e&&this.setOptions(e),!this.options.queryFn){const C=this.observers.find(R=>R.options.queryFn);C&&this.setOptions(C.options)}const n=new AbortController,s=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(Je(this,pd,!0),n.signal)}
53)},i=()=>{const C=eL(this.options,r),A=(()=>{const I={client:X(this,fd),queryKey:this.queryKey,meta:this.meta};return s(I),I})();return Je(this,pd,!1),this.options.persister?this.options.persister(C,A,this):C(A)},l=(()=>{const C={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:X(this,fd),state:this.state,fetchFn:i};return s(C),C})(),u=X(this,yf)==="infinite"?uq(this.options.pages):this.options.behavior;u==null||u.onFetch(l,this),Je(this,_f,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=l.fetchOptions)==null?void 0:p.meta))&&Qt(this,ki,hl).call(this,{type:"fetch",meta:(f=l.fetchOptions)==null?void 0:f.meta}),Je(this,Yn,rL({initialPromise:r==null?void 0:r.initialPromise,fn:l.fetchFn,onCancel:C=>{C instanceof xk&&C.revert&&this.setState({...X(this,_f),fetchStatus:"idle"}),n.abort()},onFail:(C,R)=>{Qt(this,ki,hl).call(this,{type:"failed",failureCount:C,error:R})},onPause:()=>{Qt(this,ki,hl).call(this,{type:"pause"})},onContinue:()=>{Qt(this,ki,hl).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const C=await X(this,Yn).start();if(C===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(C),(v=(g=X(this,ia).config).onSuccess)==null||v.call(g,C,this),(x=(_=X(this,ia).config).onSettled)==null||x.call(_,C,this.state.error,this),C}catch(C){if(C instanceof xk){if(C.silent)return X(this,Yn).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw Qt(this,ki,hl).call(this,{type:"error",error:C}),(S=(w=X(this,ia).config).onError)==null||S.call(w,C,this),(j=(k=X(this,ia).config).onSettled)==null||j.call(k,this.state.data,C,this),C}finally{this.scheduleGc()}}},yf=new WeakMap,hd=new WeakMap,_f=new WeakMap,ia=new WeakMap,fd=new WeakMap,Yn=new WeakMap,wg=new WeakMap,pd=new WeakMap,ki=new WeakSet,sL=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},hl=function(e){const r=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...iL(n.data,this.options),fetchMeta:e.meta??null};case"success":const s={...n,...BA(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Je(this,_f,e.manual?s:void 0),s;case"error":const i=e.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=r(this.state),Un.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),X(this,ia).notify({query:this,type:"updated",action:e})})},sM);function iL(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:tL(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function BA(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function VA(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,n=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var ei,dr,xg,Ns,md,bf,Cl,zc,Sg,wf,xf,gd,vd,Uc,Sf,jr,mm,Sk,kk,Ek,jk,Ck,Nk,Pk,aL,iM,fq=(iM=class extends Zf{constructor(e,r){super();bt(this,jr);bt(this,ei);bt(this,dr);bt(this,xg);bt(this,Ns);bt(this,md);bt(this,bf);bt(this,Cl);bt(this,zc);bt(this,Sg);bt(this,wf);bt(this,xf);bt(this,gd);bt(this,vd);bt(this,Uc);bt(this,Sf,new Set);this.options=r,Je(this,ei,e),Je(this,zc,null),Je(this,Cl,wk()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(X(this,dr).addObserver(this),HA(X(this,dr),this.options)?Qt(this,jr,mm).call(this):this.updateResult(),Qt(this,jr,jk).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Rk(X(this,dr),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Rk(X(this,dr),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Qt(this,jr,Ck).call(this),Qt(this,jr,Nk).call(this),X(this,dr).removeObserver(this)}setOptions(e){const r=this.options,n=X(this,dr);if(this.options=X(this,ei).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ci(this.options.enabled,X(this,dr))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Qt(this,jr,Pk).call(this),X(this,dr).setOptions(this.options),r._defaulted&&!R_(this.options,r)&&X(this,ei).getQueryCache().notify({type:"observerOptionsUpdated",query:X(this,dr),observer:this});const s=this.hasListeners();s&&qA(X(this,dr),n,this.options,r)&&Qt(this,jr,mm).call(this),this.updateResult(),s&&(X(this,dr)!==n||Ci(this.options.enabled,X(this,dr))!==Ci(r.enabled,X(this,dr))||Yc(this.options.staleTime,X(this,dr))!==Yc(r.staleTime,X(this,dr)))&&Qt(this,jr,Sk).call(this);const i=Qt(this,jr,kk).call(this);s&&(X(this,dr)!==n||Ci(this.options.enabled,X(this,dr))!==Ci(r.enabled,X(this,dr))||i!==X(this,Uc))&&Qt(this,jr,Ek).call(this,i)}getOptimisticResult(e){const r=X(this,ei).getQueryCache().build(X(this,ei),e),n=this.createResult(r,e);
vendor: 3,193 bytes, line 53
53return mq(this,n)&&(Je(this,Ns,n),Je(this,bf,this.options),Je(this,md,X(this,dr).state)),n}getCurrentResult(){return X(this,Ns)}trackResult(e,r){return new Proxy(e,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&X(this,Cl).status==="pending"&&X(this,Cl).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(e){X(this,Sf).add(e)}getCurrentQuery(){return X(this,dr)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=X(this,ei).defaultQueryOptions(e),n=X(this,ei).getQueryCache().build(X(this,ei),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(e){return Qt(this,jr,mm).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),X(this,Ns)))}createResult(e,r){var T;const n=X(this,dr),s=this.options,i=X(this,Ns),a=X(this,md),l=X(this,bf),h=e!==n?e.state:X(this,xg),{state:p}=e;let f={...p},g=!1,v;if(r._optimisticResults){const O=this.hasListeners(),G=!O&&HA(e,r),M=O&&qA(e,n,r,s);(G||M)&&(f={...f,...iL(p.data,e.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:_,errorUpdatedAt:x,status:w}=f;v=f.data;let S=!1;if(r.placeholderData!==void 0&&v===void 0&&w==="pending"){let O;i!=null&&i.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData)?(O=i.data,S=!0):O=typeof r.placeholderData=="function"?r.placeholderData((T=X(this,xf))==null?void 0:T.state.data,X(this,xf)):r.placeholderData,O!==void 0&&(w="success",v=bk(i==null?void 0:i.data,O,r),g=!0)}if(r.select&&v!==void 0&&!S)if(i&&v===(a==null?void 0:a.data)&&r.select===X(this,Sg))v=X(this,wf);else try{Je(this,Sg,r.select),v=r.select(v),v=bk(i==null?void 0:i.data,v,r),Je(this,wf,v),Je(this,zc,null)}catch(O){Je(this,zc,O)}X(this,zc)&&(_=X(this,zc),v=X(this,wf),x=Date.now(),w="error");const k=f.fetchStatus==="fetching",j=w==="pending",C=w==="error",R=j&&k,A=v!==void 0,P={status:w,fetchStatus:f.fetchStatus,isPending:j,isSuccess:w==="success",isError:C,isInitialLoading:R,isLoading:R,data:v,dataUpdatedAt:f.dataUpdatedAt,error:_,errorUpdatedAt:x,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>h.dataUpdateCount||f.errorUpdateCount>h.errorUpdateCount,isFetching:k,isRefetching:k&&!j,isLoadingError:C&&!A,isPaused:f.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:C&&A,isStale:dC(e,r),refetch:this.refetch,promise:X(this,Cl),isEnabled:Ci(r.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const O=P.data!==void 0,G=P.status==="error"&&!O,M=H=>{G?H.reject(P.error):O&&H.resolve(P.data)},U=()=>{const H=Je(this,Cl,P.promise=wk());M(H)},V=X(this,Cl);switch(V.status){case"pending":e.queryHash===n.queryHash&&M(V);break;case"fulfilled":(G||P.data!==V.value)&&U();break;case"rejected":(!G||P.error!==V.reason)&&U();break}}return P}updateResult(){const e=X(this,Ns),r=this.createResult(X(this,dr),this.options);if(Je(this,md,X(this,dr).state),Je(this,bf,this.options),X(this,md).data!==void 0&&Je(this,xf,X(this,dr)),R_(r,e))return;Je(this,Ns,r);const n=()=>
vendor: 4,478 bytes, line 53
53{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!X(this,Sf).size)return!0;const a=new Set(i??X(this,Sf));return this.options.throwOnError&&a.add("error"),Object.keys(X(this,Ns)).some(l=>{const u=l;return X(this,Ns)[u]!==e[u]&&a.has(u)})};Qt(this,jr,aL).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Qt(this,jr,jk).call(this)}},ei=new WeakMap,dr=new WeakMap,xg=new WeakMap,Ns=new WeakMap,md=new WeakMap,bf=new WeakMap,Cl=new WeakMap,zc=new WeakMap,Sg=new WeakMap,wf=new WeakMap,xf=new WeakMap,gd=new WeakMap,vd=new WeakMap,Uc=new WeakMap,Sf=new WeakMap,jr=new WeakSet,mm=function(e){Qt(this,jr,Pk).call(this);let r=X(this,dr).fetch(this.options,e);return e!=null&&e.throwOnError||(r=r.catch(Ps)),r},Sk=function(){Qt(this,jr,Ck).call(this);const e=Yc(this.options.staleTime,X(this,dr));if(Bm.isServer()||X(this,Ns).isStale||!yk(e))return;const n=QM(X(this,Ns).dataUpdatedAt,e)+1;Je(this,gd,ad.setTimeout(()=>{X(this,Ns).isStale||this.updateResult()},n))},kk=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(X(this,dr)):this.options.refetchInterval)??!1},Ek=function(e){Qt(this,jr,Nk).call(this),Je(this,Uc,e),!(Bm.isServer()||Ci(this.options.enabled,X(this,dr))===!1||!yk(X(this,Uc))||X(this,Uc)===0)&&Je(this,vd,ad.setInterval(()=>{(this.options.refetchIntervalInBackground||oC.isFocused())&&Qt(this,jr,mm).call(this)},X(this,Uc)))},jk=function(){Qt(this,jr,Sk).call(this),Qt(this,jr,Ek).call(this,Qt(this,jr,kk).call(this))},Ck=function(){X(this,gd)!==void 0&&(ad.clearTimeout(X(this,gd)),Je(this,gd,void 0))},Nk=function(){X(this,vd)!==void 0&&(ad.clearInterval(X(this,vd)),Je(this,vd,void 0))},Pk=function(){const e=X(this,ei).getQueryCache().build(X(this,ei),this.options);if(e===X(this,dr))return;const r=X(this,dr);Je(this,dr,e),Je(this,xg,e.state),this.hasListeners()&&(r==null||r.removeObserver(this),e.addObserver(this))},aL=function(e){Un.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(X(this,Ns))}),X(this,ei).getQueryCache().notify({query:X(this,dr),type:"observerResultsUpdated"})})},iM);function pq(t,e){return Ci(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&Ci(e.retryOnMount,t)===!1)}function HA(t,e){return pq(t,e)||t.state.data!==void 0&&Rk(t,e,e.refetchOnMount)}function Rk(t,e,r){if(Ci(e.enabled,t)!==!1&&Yc(e.staleTime,t)!=="static"){const n=typeof r=="function"?r(t):r;return n==="always"||n!==!1&&dC(t,e)}return!1}function qA(t,e,r,n){return(t!==e||Ci(n.enabled,t)===!1)&&(!r.suspense||t.state.status!=="error")&&dC(t,r)}function dC(t,e){return Ci(e.enabled,t)!==!1&&t.isStaleByTime(Yc(e.staleTime,t))}function mq(t,e){return!R_(t.getCurrentResult(),e)}var kg,Eo,gs,yd,jo,Rc,aM,gq=(aM=class extends nL{constructor(e){super();bt(this,jo);bt(this,kg);bt(this,Eo);bt(this,gs);bt(this,yd);Je(this,kg,e.client),this.mutationId=e.mutationId,Je(this,gs,e.mutationCache),Je(this,Eo,[]),this.state=e.state||oL(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){X(this,Eo).includes(e)||(X(this,Eo).push(e),this.clearGcTimeout(),X(this,gs).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Je(this,Eo,X(this,Eo).filter(r=>r!==e)),this.scheduleGc(),X(this,gs).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){X(this,Eo).length||(this.state.status==="pending"?this.scheduleGc():X(this,gs).remove(this))}continue(){var e;return((e=X(this,yd))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,l,u,h,p,f,g,v,_,x,w,S,k,j,C,R,A,I;const r=()=>{Qt(this,jo,Rc).call(this,{type:"continue"})},n={client:X(this,kg),meta:this.options.meta,mutationKey:this.options.mutationKey};Je(this,yd,rL({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(P,T)=>{Qt(this,jo,Rc).call(this,{type:"failed",failureCount:P,error:T})},onPause:()=>{Qt(this,jo,Rc).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>X(this,gs).canRun(this)}));const s=this.state.status==="pending",i=!X(this,yd).canStart();try{if(s)r();else{Qt(this,jo,Rc).call(this,{type:"pending",variables:e,isPaused:i}),X(this,gs).config.onMutate&&await X(this,gs).config.onMutate(e,this,n);
53const T=await((l=(a=this.options).onMutate)==null?void 0:l.call(a,e,n));T!==this.state.context&&Qt(this,jo,Rc).call(this,{type:"pending",context:T,variables:e,isPaused:i})}const P=await X(this,yd).start();return await((h=(u=X(this,gs).config).onSuccess)==null?void 0:h.call(u,P,e,this.state.context,this,n)),await((f=(p=this.options).onSuccess)==null?void 0:f.call(p,P,e,this.state.context,n)),await((v=(g=X(this,gs).config).onSettled)==null?void 0:v.call(g,P,null,this.state.variables,this.state.context,this,n)),await((x=(_=this.options).onSettled)==null?void 0:x.call(_,P,null,e,this.state.context,n)),Qt(this,jo,Rc).call(this,{type:"success",data:P}),P}catch(P){try{await((S=(w=X(this,gs).config).onError)==null?void 0:S.call(w,P,e,this.state.context,this,n))}catch(T){Promise.reject(T)}try{await((j=(k=this.options).onError)==null?void 0:j.call(k,P,e,this.state.context,n))}catch(T){Promise.reject(T)}try{await((R=(C=X(this,gs).config).onSettled)==null?void 0:R.call(C,void 0,P,this.state.variables,this.state.context,this,n))}catch(T){Promise.reject(T)}try{await((I=(A=this.options).onSettled)==null?void 0:I.call(A,void 0,P,e,this.state.context,n))}catch(T){Promise.reject(T)}throw Qt(this,jo,Rc).call(this,{type:"error",error:P}),P}finally{X(this,gs).runNext(this)}}},kg=new WeakMap,Eo=new WeakMap,gs=new WeakMap,yd=new WeakMap,jo=new WeakSet,Rc=function(e){const r=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),Un.batch(()=>{X(this,Eo).forEach(n=>{n.onMutationUpdate(e)}),X(this,gs).notify({mutation:this,type:"updated",action:e})})},aM);function oL(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Nl,Ua,Eg,oM,lL=(oM=class extends Zf{constructor(e={}){super();bt(this,Nl);bt(this,Ua);bt(this,Eg);this.config=e,Je(this,Nl,new Set),Je(this,Ua,new Map),Je(this,Eg,0)}build(e,r,n){const s=new gq({client:e,mutationCache:this,mutationId:++sy(this,Eg)._,options:e.defaultMutationOptions(r),state:n});return this.add(s),s}add(e){X(this,Nl).add(e);const r=cy(e);if(typeof r=="string"){const n=X(this,Ua).get(r);n?n.push(e):X(this,Ua).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(X(this,Nl).delete(e)){const r=cy(e);if(typeof r=="string"){const n=X(this,Ua).get(r);if(n)if(n.length>1){const s=n.indexOf(e);s!==-1&&n.splice(s,1)}else n[0]===e&&X(this,Ua).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=cy(e);if(typeof r=="string"){const n=X(this,Ua).get(r),s=n==null?void 0:n.find(i=>i.state.status==="pending");return!s||s===e}else return!0}runNext(e){var n;const r=cy(e);if(typeof r=="string"){const s=(n=X(this,Ua).get(r))==null?void 0:n.find(i=>i!==e&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Un.batch(()=>{X(this,Nl).forEach(e=>{this.notify({type:"removed",mutation:e})}),X(this,Nl).clear(),X(this,Ua).clear()})}getAll(){return Array.from(X(this,Nl))}find(e){const r={exact:!0,...e};return this.getAll().find(n=>FA(r,n))}findAll(e={}){return this.getAll().filter(r=>FA(e,r))}notify(e){Un.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>
vendor: 1,824 bytes, line 53
53r.state.isPaused);return Un.batch(()=>Promise.all(e.map(r=>r.continue().catch(Ps))))}},Nl=new WeakMap,Ua=new WeakMap,Eg=new WeakMap,oM);function cy(t){var e;return(e=t.options.scope)==null?void 0:e.id}var Pl,Bc,ti,Rl,Bl,r_,Ak,lM,vq=(lM=class extends Zf{constructor(r,n){super();bt(this,Bl);bt(this,Pl);bt(this,Bc);bt(this,ti);bt(this,Rl);Je(this,Pl,r),this.setOptions(n),this.bindMethods(),Qt(this,Bl,r_).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var s;const n=this.options;this.options=X(this,Pl).defaultMutationOptions(r),R_(this.options,n)||X(this,Pl).getMutationCache().notify({type:"observerOptionsUpdated",mutation:X(this,ti),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&kd(n.mutationKey)!==kd(this.options.mutationKey)?this.reset():((s=X(this,ti))==null?void 0:s.state.status)==="pending"&&X(this,ti).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=X(this,ti))==null||r.removeObserver(this)}onMutationUpdate(r){Qt(this,Bl,r_).call(this),Qt(this,Bl,Ak).call(this,r)}getCurrentResult(){return X(this,Bc)}reset(){var r;(r=X(this,ti))==null||r.removeObserver(this),Je(this,ti,void 0),Qt(this,Bl,r_).call(this),Qt(this,Bl,Ak).call(this)}mutate(r,n){var s;return Je(this,Rl,n),(s=X(this,ti))==null||s.removeObserver(this),Je(this,ti,X(this,Pl).getMutationCache().build(X(this,Pl),this.options)),X(this,ti).addObserver(this),X(this,ti).execute(r)}},Pl=new WeakMap,Bc=new WeakMap,ti=new WeakMap,Rl=new WeakMap,Bl=new WeakSet,r_=function(){var n;const r=((n=X(this,ti))==null?void 0:n.state)??oL();Je(this,Bc,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},Ak=function(r){Un.batch(()=>{var n,s,i,a,l,u,h,p;
53if(X(this,Rl)&&this.hasListeners()){const f=X(this,Bc).variables,g=X(this,Bc).context,v={client:X(this,Pl),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(s=(n=X(this,Rl)).onSuccess)==null||s.call(n,r.data,f,g,v)}catch(_){Promise.reject(_)}try{(a=(i=X(this,Rl)).onSettled)==null||a.call(i,r.data,null,f,g,v)}catch(_){Promise.reject(_)}}else if((r==null?void 0:r.type)==="error"){try{(u=(l=X(this,Rl)).onError)==null||u.call(l,r.error,f,g,v)}catch(_){Promise.reject(_)}try{(p=(h=X(this,Rl)).onSettled)==null||p.call(h,void 0,r.error,f,g,v)}catch(_){Promise.reject(_)}}}this.listeners.forEach(f=>{f(X(this,Bc))})})},lM),Co,cM,cL=(cM=class extends Zf{constructor(e={}){super();bt(this,Co);this.config=e,Je(this,Co,new Map)}build(e,r,n){const s=r.queryKey,i=r.queryHash??lC(s,r);let a=this.get(i);return a||(a=new hq({client:e,queryKey:s,queryHash:i,options:e.defaultQueryOptions(r),state:n,defaultOptions:e.getQueryDefaults(s)}),this.add(a)),a}add(e){X(this,Co).has(e.queryHash)||(X(this,Co).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=X(this,Co).get(e.queryHash);r&&(e.destroy(),r===e&&X(this,Co).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Un.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return X(this,Co).get(e)}getAll(){return[...X(this,Co).values()]}find(e){const r={exact:!0,...e};return this.getAll().find(n=>LA(r,n))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(n=>LA(e,n)):r}notify(e){Un.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){Un.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Un.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Co=new WeakMap,cM),vn,Vc,Hc,kf,Ef,qc,jf,Cf,uM,yq=(uM=class{constructor(t={}){bt(this,vn);bt(this,Vc);bt(this,Hc);bt(this,kf);bt(this,Ef);bt(this,qc);bt(this,jf);bt(this,Cf);Je(this,vn,t.queryCache||new cL),Je(this,Vc,t.mutationCache||new lL),Je(this,Hc,t.defaultOptions||{}),Je(this,kf,new Map),Je(this,Ef,new Map),Je(this,qc,0)}mount(){sy(this,qc)._++,X(this,qc)===1&&(Je(this,jf,oC.subscribe(async t=>{t&&(await this.resumePausedMutations(),X(this,vn).onFocus())})),Je(this,Cf,A_.subscribe(async t=>{t&&(await this.resumePausedMutations(),X(this,vn).onOnline())})))}unmount(){var t,e;sy(this,qc)._--,X(this,qc)===0&&((t=X(this,jf))==null||t.call(this),Je(this,jf,void 0),(e=X(this,Cf))==null||e.call(this),Je(this,Cf,void 0))}isFetching(t){return X(this,vn).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return X(this,Vc).findAll({...t,status:"pending"}).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=X(this,vn).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=X(this,vn).build(this,e),n=r.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(Yc(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(t){return X(this,vn).findAll(t).map(({queryKey:e,state:r})=>{const n=r.data;return[e,n]})}setQueryData(t,e,r){const n=this.defaultQueryOptions({queryKey:t}),s=X(this,vn).get(n.queryHash),i=s==null?void 0:s.state.data,a=eq(e,i);if(a!==void 0)return X(this,vn).build(this,n).setData(a,{...r,manual:!0})}setQueriesData(t,e,r){return Un.batch(()=>X(this,vn).findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=X(this,vn).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=X(this,vn);Un.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=X(this,vn);return Un.batch(()=>(r.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},n=Un.batch(()=>X(this,vn).findAll(t).map(s=>s.cancel(r)));return Promise.all(n).then(Ps).catch(Ps)}invalidateQueries(t,e={}){return Un.batch(()=>(X(this,vn).findAll(t).forEach(r=>{r.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const r={...e,cancelRefetch:e.cancelRefetch??!0},n=Un.batch(()=>X(this,vn).findAll(t).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(Ps)),s.state.fetchStatus==="paused"?Promise.resolve():i}
53));return Promise.all(n).then(Ps)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=X(this,vn).build(this,e);return r.isStaleByTime(Yc(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Ps).catch(Ps)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Ps).catch(Ps)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return A_.isOnline()?X(this,Vc).resumePausedMutations():Promise.resolve()}getQueryCache(){return X(this,vn)}getMutationCache(){return X(this,Vc)}getDefaultOptions(){return X(this,Hc)}setDefaultOptions(t){Je(this,Hc,t)}setQueryDefaults(t,e){X(this,kf).set(kd(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...X(this,kf).values()],r={};return e.forEach(n=>{Nf(t,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(t,e){X(this,Ef).set(kd(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...X(this,Ef).values()],r={};return e.forEach(n=>{Nf(t,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={...X(this,Hc).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=lC(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===cC&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...X(this,Hc).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){X(this,vn).clear(),X(this,Vc).clear()}},vn=new WeakMap,Vc=new WeakMap,Hc=new WeakMap,kf=new WeakMap,Ef=new WeakMap,qc=new WeakMap,jf=new WeakMap,Cf=new WeakMap,uM),uL=y.createContext(void 0),lu=t=>{const e=y.useContext(uL);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},_q=({client:t,children:e})=>(y.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),o.jsx(uL.Provider,{value:t,children:e})),dL=y.createContext(!1),bq=()=>y.useContext(dL);dL.Provider;function wq(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var xq=y.createContext(wq()),Sq=()=>y.useContext(xq),kq=(t,e,r)=>{const n=r!=null&&r.state.error&&typeof t.throwOnError=="function"?uC(t.throwOnError,[r.state.error,r]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||n)&&(e.isReset()||(t.retryOnMount=!1))},Eq=t=>{y.useEffect(()=>{t.clearReset()},[t])},jq=({result:t,errorResetBoundary:e,throwOnError:r,query:n,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&n&&(s&&t.data===void 0||uC(r,[t.error,n])),Cq=t=>{if(t.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=t.staleTime;t.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},Nq=(t,e)=>t.isLoading&&t.isFetching&&!e,Pq=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,WA=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function Rq(t,e,r){var v,_,x,w;const n=bq(),s=Sq(),i=lu(),a=i.defaultQueryOptions(t);(_=(v=i.getDefaultOptions().queries)==null?void 0:v._experimental_beforeQuery)==null||_.call(v,a);const l=i.getQueryCache().get(a.queryHash),u=t.subscribed!==!1;a._optimisticResults=n?"isRestoring":u?"optimistic":void 0,Cq(a),kq(a,s,l),Eq(s);const h=!i.getQueryCache().get(a.queryHash),[p]=y.useState(()=>new e(i,a)),f=p.getOptimisticResult(a),g=!n&&u;if(y.useSyncExternalStore(y.useCallback(S=>{const k=g?p.subscribe(Un.batchCalls(S)):Ps;return p.updateResult(),k},[p,g]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),y.useEffect(()=>{p.setOptions(a)},[a,p]),Pq(a,f))throw WA(a,p,s);if(jq({result:f,errorResetBoundary:s,throwOnError:a.throwOnError,query:l,suspense:a.suspense}))throw f.error;if((w=(x=i.getDefaultOptions().queries)==null?void 0:x._experimental_afterQuery)==null||w.call(x,a,f),a.experimental_prefetchInRender&&!Bm.isServer()&&Nq(f,n)){const S=h?WA(a,p,s):l==null?void 0:l.promise;S==null||S.catch(Ps).finally(()=>{p.updateResult()})}return a.notifyOnChangeProps?f:p.trackResult(f)}function fr(t,e){return Rq(t,fq)}function Aq(t,e){const r=lu(),[n]=y.useState(()=>new vq(r,t));y.useEffect(()=>{n.setOptions(t)},[n,t]);const s=y.useSyncExternalStore(y.useCallback(a=>n.subscribe(Un.batchCalls(a)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),i=y.useCallback((a,l)=>{n.mutate(a,l).catch(Ps)},[n]);if(s.error&&uC(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}/**
54 * @license lucide-react v0.577.0 - ISC
55 *
56 * This source code is licensed under the ISC license.
57 * See the LICENSE file in the root directory of this source tree.
58 */const hL=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/**
59 * @license lucide-react v0.577.0 - ISC
60 *
61 * This source code is licensed under the ISC license.
62 * See the LICENSE file in the root directory of this source tree.
63 */const Tq=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
64 * @license lucide-react v0.577.0 - ISC
65 *
66 * This source code is licensed under the ISC license.
67 * See the LICENSE file in the root directory of this source tree.
68 */const Iq=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,n)=>n?n.toUpperCase():r.toLowerCase());/**
69 * @license lucide-react v0.577.0 - ISC
70 *
71 * This source code is licensed under the ISC license.
72 * See the LICENSE file in the root directory of this source tree.
73 */const GA=t=>{const e=Iq(t);return e.charAt(0).toUpperCase()+e.slice(1)};/**
74 * @license lucide-react v0.577.0 - ISC
75 *
76 * This source code is licensed under the ISC license.
77 * See the LICENSE file in the root directory of this source tree.
78 */var Dq={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
79 * @license lucide-react v0.577.0 - ISC
80 *
81 * This source code is licensed under the ISC license.
82 * See the LICENSE file in the root directory of this source tree.
83 */const Oq=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};/**
84 * @license lucide-react v0.577.0 - ISC
85 *
86 * This source code is licensed under the ISC license.
87 * See the LICENSE file in the root directory of this source tree.
88 */const Mq=y.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:a,...l},u)=>y.createElement("svg",{ref:u,...Dq,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:hL("lucide",s),...!i&&!Oq(l)&&{"aria-hidden":"true"},...l},[...a.map(([h,p])=>y.createElement(h,p)),...Array.isArray(i)?i:[i]]));/**
89 * @license lucide-react v0.577.0 - ISC
90 *
91 * This source code is licensed under the ISC license.
92 * See the LICENSE file in the root directory of this source tree.
93 */const xt=(t,e)=>{const r=y.forwardRef(({className:n,...s},i)=>y.createElement(Mq,{ref:i,iconNode:e,className:hL(`lucide-${Tq(GA(t))}`,`lucide-${t}`,n),...s}));return r.displayName=GA(t),r};
93/**
94 * @license lucide-react v0.577.0 - ISC
95 *
96 * This source code is licensed under the ISC license.
97 * See the LICENSE file in the root directory of this source tree.
98 */const Lq=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],T_=xt("archive",Lq);/**
99 * @license lucide-react v0.577.0 - ISC
100 *
101 * This source code is licensed under the ISC license.
102 * See the LICENSE file in the root directory of this source tree.
103 */const Fq=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],$q=xt("arrow-down",Fq);/**
104 * @license lucide-react v0.577.0 - ISC
105 *
106 * This source code is licensed under the ISC license.
107 * See the LICENSE file in the root directory of this source tree.
108 */const zq=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],fL=xt("arrow-left",zq);/**
109 * @license lucide-react v0.577.0 - ISC
110 *
111 * This source code is licensed under the ISC license.
112 * See the LICENSE file in the root directory of this source tree.
113 */const Uq=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],eu=xt("arrow-right",Uq);/**
114 * @license lucide-react v0.577.0 - ISC
115 *
116 * This source code is licensed under the ISC license.
117 * See the LICENSE file in the root directory of this source tree.
118 */const Bq=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],pL=xt("arrow-up-right",Bq);/**
119 * @license lucide-react v0.577.0 - ISC
120 *
121 * This source code is licensed under the ISC license.
122 * See the LICENSE file in the root directory of this source tree.
123 */const Vq=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Hq=xt("arrow-up",Vq);/**
124 * @license lucide-react v0.577.0 - ISC
125 *
126 * This source code is licensed under the ISC license.
127 * See the LICENSE file in the root directory of this source tree.
128 */const qq=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Wq=xt("calendar",qq);/**
129 * @license lucide-react v0.577.0 - ISC
130 *
131 * This source code is licensed under the ISC license.
132 * See the LICENSE file in the root directory of this source tree.
133 */const Gq=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],mL=xt("camera",Gq);/**
134 * @license lucide-react v0.577.0 - ISC
135 *
136 * This source code is licensed under the ISC license.
137 * See the LICENSE file in the root directory of this source tree.
138 */const Kq=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Vl=xt("check",Kq);/**
139 * @license lucide-react v0.577.0 - ISC
140 *
141 * This source code is licensed under the ISC license.
142 * See the LICENSE file in the root directory of this source tree.
143 */const Yq=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Od=xt("chevron-down",Yq);/**
144 * @license lucide-react v0.577.0 - ISC
145 *
146 * This source code is licensed under the ISC license.
147 * See the LICENSE file in the root directory of this source tree.
148 */const Zq=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],gL=xt("chevron-left",Zq);/**
149 * @license lucide-react v0.577.0 - ISC
150 *
151 * This source code is licensed under the ISC license.
152 * See the LICENSE file in the root directory of this source tree.
153 */const Jq=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],hC=xt("chevron-right",Jq);/**
154 * @license lucide-react v0.577.0 - ISC
155 *
156 * This source code is licensed under the ISC license.
157 * See the LICENSE file in the root directory of this source tree.
158 */const Qq=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],vL=xt("chevron-up",Qq);/**
159 * @license lucide-react v0.577.0 - ISC
160 *
161 * This source code is licensed under the ISC license.
162 * See the LICENSE file in the root directory of this source tree.
163 */const Xq=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],I_=xt("chevrons-up-down",Xq);/**
164 * @license lucide-react v0.577.0 - ISC
165 *
166 * This source code is licensed under the ISC license.
167 * See the LICENSE file in the root directory of this source tree.
168 */const e9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Pf=xt("circle-alert",e9);/**
169 * @license lucide-react v0.577.0 - ISC
170 *
171 * This source code is licensed under the ISC license.
172 * See the LICENSE file in the root directory of this source tree.
173 */const t9=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],r9=xt("circle-check-big",t9);/**
174 * @license lucide-react v0.577.0 - ISC
175 *
176 * This source code is licensed under the ISC license.
177 * See the LICENSE file in the root directory of this source tree.
178 */const n9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],yL=xt("circle-check",n9);/**
179 * @license lucide-react v0.577.0 - ISC
180 *
181 * This source code is licensed under the ISC license.
182 * See the LICENSE file in the root directory of this source tree.
183 */const s9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],_L=xt("circle-x",s9);/**
184 * @license lucide-react v0.577.0 - ISC
185 *
186 * This source code is licensed under the ISC license.
187 * See the LICENSE file in the root directory of this source tree.
188 */const i9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],bL=xt("circle",i9);/**
189 * @license lucide-react v0.577.0 - ISC
190 *
191 * This source code is licensed under the ISC license.
192 * See the LICENSE file in the root directory of this source tree.
193 */const a9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],wL=xt("clock",a9);/**
194 * @license lucide-react v0.577.0 - ISC
195 *
196 * This source code is licensed under the ISC license.
197 * See the LICENSE file in the root directory of this source tree.
198 */const o9=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],l9=xt("cloud-upload",o9);/**
199 * @license lucide-react v0.577.0 - ISC
200 *
201 * This source code is licensed under the ISC license.
202 * See the LICENSE file in the root directory of this source tree.
203 */const c9=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Tk=xt("database",c9);/**
204 * @license lucide-react v0.577.0 - ISC
205 *
206 * This source code is licensed under the ISC license.
207 * See the LICENSE file in the root directory of this source tree.
208 */const u9=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],KA=xt("download",u9);/**
209 * @license lucide-react v0.577.0 - ISC
210 *
211 * This source code is licensed under the ISC license.
212 * See the LICENSE file in the root directory of this source tree.
213 */const d9=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],xL=xt("ellipsis",d9);/**
214 * @license lucide-react v0.577.0 - ISC
215 *
216 * This source code is licensed under the ISC license.
217 * See the LICENSE file in the root directory of this source tree.
218 */const h9=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],n_=xt("external-link",h9);/**
219 * @license lucide-react v0.577.0 - ISC
220 *
221 * This source code is licensed under the ISC license.
222 * See the LICENSE file in the root directory of this source tree.
223 */const f9=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],p9=xt("eye",f9);/**
224 * @license lucide-react v0.577.0 - ISC
225 *
226 * This source code is licensed under the ISC license.
227 * See the LICENSE file in the root directory of this source tree.
228 */const m9=[["path",{d:"M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5",key:"4pqfef"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 12v-1",key:"1ej8lb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M8 7V6",key:"1nbb54"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]],Yb=xt("file-archive",m9);/**
229 * @license lucide-react v0.577.0 - ISC
230 *
231 * This source code is licensed under the ISC license.
232 * See the LICENSE file in the root directory of this source tree.
233 */const g9=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],v9=xt("file-text",g9);/**
234 * @license lucide-react v0.577.0 - ISC
235 *
236 * This source code is licensed under the ISC license.
237 * See the LICENSE file in the root directory of this source tree.
238 */const y9=[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]],SL=xt("files",y9);/**
239 * @license lucide-react v0.577.0 - ISC
240 *
241 * This source code is licensed under the ISC license.
242 * See the LICENSE file in the root directory of this source tree.
243 */const _9=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],b9=xt("file",_9);/**
244 * @license lucide-react v0.577.0 - ISC
245 *
246 * This source code is licensed under the ISC license.
247 * See the LICENSE file in the root directory of this source tree.
248 */const w9=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],x9=xt("folder-open",w9);/**
249 * @license lucide-react v0.577.0 - ISC
250 *
251 * This source code is licensed under the ISC license.
252 * See the LICENSE file in the root directory of this source tree.
253 */const S9=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],fC=xt("folder-tree",S9);/**
254 * @license lucide-react v0.577.0 - ISC
255 *
256 * This source code is licensed under the ISC license.
257 * See the LICENSE file in the root directory of this source tree.
258 */const k9=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],E9=xt("hard-drive",k9);/**
259 * @license lucide-react v0.577.0 - ISC
260 *
261 * This source code is licensed under the ISC license.
262 * See the LICENSE file in the root directory of this source tree.
263 */const j9=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],Ik=xt("house",j9);/**
264 * @license lucide-react v0.577.0 - ISC
265 *
266 * This source code is licensed under the ISC license.
267 * See the LICENSE file in the root directory of this source tree.
268 */const C9=[["path",{d:"m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16",key:"9kzy35"}],["path",{d:"M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2",ke
268y:"1t0f0t"}],["circle",{cx:"13",cy:"7",r:"1",fill:"currentColor",key:"1obus6"}],["rect",{x:"8",y:"2",width:"14",height:"14",rx:"2",key:"1gvhby"}]],N9=xt("images",C9);/**
269 * @license lucide-react v0.577.0 - ISC
270 *
271 * This source code is licensed under the ISC license.
272 * See the LICENSE file in the root directory of this source tree.
273 */const P9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],R9=xt("info",P9);/**
274 * @license lucide-react v0.577.0 - ISC
275 *
276 * This source code is licensed under the ISC license.
277 * See the LICENSE file in the root directory of this source tree.
278 */const A9=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ds=xt("loader-circle",A9);/**
279 * @license lucide-react v0.577.0 - ISC
280 *
281 * This source code is licensed under the ISC license.
282 * See the LICENSE file in the root directory of this source tree.
283 */const T9=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],I9=xt("log-in",T9);/**
284 * @license lucide-react v0.577.0 - ISC
285 *
286 * This source code is licensed under the ISC license.
287 * See the LICENSE file in the root directory of this source tree.
288 */const D9=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],O9=xt("log-out",D9);/**
289 * @license lucide-react v0.577.0 - ISC
290 *
291 * This source code is licensed under the ISC license.
292 * See the LICENSE file in the root directory of this source tree.
293 */const M9=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],L9=xt("mail",M9);/**
294 * @license lucide-react v0.577.0 - ISC
295 *
296 * This source code is licensed under the ISC license.
297 * See the LICENSE file in the root directory of this source tree.
298 */const F9=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],$9=xt("map-pin",F9);/**
299 * @license lucide-react v0.577.0 - ISC
300 *
301 * This source code is licensed under the ISC license.
302 * See the LICENSE file in the root directory of this source tree.
303 */const z9=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],U9=xt("mic",z9);/**
304 * @license lucide-react v0.577.0 - ISC
305 *
306 * This source code is licensed under the ISC license.
307 * See the LICENSE file in the root directory of this source tree.
308 */const B9=[["path",{d:"M5 12h14",key:"1ays0h"}]],V9=xt("minus",B9);/**
309 * @license lucide-react v0.577.0 - ISC
310 *
311 * This source code is licensed under the ISC license.
312 * See the LICENSE file in the root directory of this source tree.
313 */const H9=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Zb=xt("pen-line",H9);/**
314 * @license lucide-react v0.577.0 - ISC
315 *
316 * This source code is licensed under the ISC license.
317 * See the LICENSE file in the root directory of this source tree.
318 */const q9=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Zc=xt("plus",q9);/**
319 * @license lucide-react v0.577.0 - ISC
320 *
321 * This source code is licensed under the ISC license.
322 * See the LICENSE file in the root directory of this source tree.
323 */const W9=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],G9=xt("refresh-ccw",W9);/**
324 * @license lucide-react v0.577.0 - ISC
325 *
326 * This source code is licensed under the ISC license.
327 * See the LICENSE file in the root directory of this source tree.
328 */const K9=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Y9=xt("refresh-cw",K9);/**
329 * @license lucide-react v0.577.0 - ISC
330 *
331 * This source code is licensed under the ISC license.
332 * See the LICENSE file in the root directory of this source tree.
333 */const Z9=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],kL=xt("rotate-ccw",Z9);/**
334 * @license lucide-react v0.577.0 - ISC
335 *
336 * This source code is licensed under the ISC license.
337 * See the LICENSE file in the root directory of this source tree.
338 */const J9=[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Q9=xt("search-x",J9);/**
339 * @license lucide-react v0.577.0 - ISC
340 *
341 * This source code is licensed under the ISC license.
342 * See the LICENSE file in the root directory of this source tree.
343 */const X9=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],EL=xt("search",X9);/**
344 * @license lucide-react v0.577.0 - ISC
345 *
346 * This source code is licensed under the ISC license.
347 * See the LICENSE file in the root directory of this source tree.
348 */const eW=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],pC=xt("trash-2",eW);/**
349 * @license lucide-react v0.577.0 - ISC
350 *
351 * This source code is licensed under the ISC license.
352 * See the LICENSE file in the root directory of this source tree.
353 */const tW=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}
353]],Oo=xt("triangle-alert",tW);/**
354 * @license lucide-react v0.577.0 - ISC
355 *
356 * This source code is licensed under the ISC license.
357 * See the LICENSE file in the root directory of this source tree.
358 */const rW=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],mC=xt("upload",rW);/**
359 * @license lucide-react v0.577.0 - ISC
360 *
361 * This source code is licensed under the ISC license.
362 * See the LICENSE file in the root directory of this source tree.
363 */const nW=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],sW=xt("user-plus",nW);/**
364 * @license lucide-react v0.577.0 - ISC
365 *
366 * This source code is licensed under the ISC license.
367 * See the LICENSE file in the root directory of this source tree.
368 */const iW=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],gC=xt("user",iW);/**
369 * @license lucide-react v0.577.0 - ISC
370 *
371 * This source code is licensed under the ISC license.
372 * See the LICENSE file in the root directory of this source tree.
373 */const aW=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],jL=xt("users",aW);/**
374 * @license lucide-react v0.577.0 - ISC
375 *
376 * This source code is licensed under the ISC license.
377 * See the LICENSE file in the root directory of this source tree.
378 */const oW=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],lW=xt("wrench",oW);/**
379 * @license lucide-react v0.577.0 - ISC
380 *
381 * This source code is licensed under the ISC license.
382 * See the LICENSE file in the root directory of this source tree.
383 */const cW=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],cu=xt("x",cW);var uW=Object.defineProperty,vC=(t,e)=>uW(t,"name",{value:e,configurable:!0});function Dk(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}vC(Dk,"setRef");function Ed(...t){return e=>{let r=!1;const n=t.map(s=>{const i=Dk(s,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let s=0;s<n.length;s++){const i=n[s];typeof i=="function"?i():Dk(t[s],null)}}}}vC(Ed,"composeRefs");function Vt(...t){return y.useCallback(Ed(...t),t)}vC(Vt,"useComposedRefs");var dW=Object.defineProperty,Xa=(t,e)=>dW(t,"name",{value:e,configurable:!0});function Ga(t){const e=y.forwardRef((r,n)=>{let{children:s,...i}=r,a=null,l=!1;const u=[];Ok(s)&&typeof uy=="function"&&(s=uy(s._payload)),y.Children.forEach(s,g=>{var v;if(RL(g)){l=!0;const _=g;let x="child"in _.props?_.props.child:_.props.children;Ok(x)&&typeof uy=="function"&&(x=uy(x._payload)),a=fW(_,x),u.push((v=a==null?void 0:a.props)==null?void 0:v.children)}else u.push(g)}),a?a=y.cloneElement(a,void 0,u):!l&&y.Children.count(s)===1&&y.isValidElement(s)&&(a=s);const h=a?PL(a):void 0,p=Vt(n,h);if(!a){if(s||s===0)throw new Error(l?gW(t):mW(t));return s}const f=NL(i,a.props??{});return a.type!==y.Fragment&&(f.ref=n?p:h),y.cloneElement(a,f)});return e.displayName=`${t}.Slot`,e}Xa(Ga,"createSlot");var yC=Ga("Slot"),CL=Symbol.for("radix.slottable");function hW(t){const e=Xa(r=>"child"in r?r.children(r.child):r.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=CL,e}Xa(hW,"createSlottable");var fW=Xa((t,e)=>{if("child"in t.props){const r=t.props.child;return y.isValidElement(r)?y.cloneElement(r,void 0,t.props.children(r.props.children)):null}return y.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function NL(t,e){const r={...e};for(const n in e){const s=t[n],i=e[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{const u=i(...l);return s(...l),u}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}
vendor: 6,454 bytes, line 383
383:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...t,...r}}Xa(NL,"mergeProps");function PL(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}Xa(PL,"getElementRef");function RL(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===CL}Xa(RL,"isSlottable");var pW=Symbol.for("react.lazy");function Ok(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===pW&&"_payload"in t&&AL(t._payload)}Xa(Ok,"isLazyComponent");function AL(t){return typeof t=="object"&&t!==null&&"then"in t}Xa(AL,"isPromiseLike");var mW=Xa(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),gW=Xa(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),uy=Id[" use ".trim().toString()];function TL(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(r=TL(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function IL(){for(var t,e,r=0,n="",s=arguments.length;r<s;r++)(t=arguments[r])&&(e=TL(t))&&(n&&(n+=" "),n+=e);return n}const YA=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,ZA=IL,Jb=(t,e)=>r=>{var n;if((e==null?void 0:e.variants)==null)return ZA(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:i}=e,a=Object.keys(s).map(h=>{const p=r==null?void 0:r[h],f=i==null?void 0:i[h];if(p===null)return null;const g=YA(p)||YA(f);return s[h][g]}),l=r&&Object.entries(r).reduce((h,p)=>{let[f,g]=p;return g===void 0||(h[f]=g),h},{}),u=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((h,p)=>{let{class:f,className:g,...v}=p;return Object.entries(v).every(_=>{let[x,w]=_;return Array.isArray(w)?w.includes({...i,...l}[x]):{...i,...l}[x]===w})?[...h,f,g]:h},[]);return ZA(t,a,u,r==null?void 0:r.class,r==null?void 0:r.className)},vW=(t,e)=>{const r=new Array(t.length+e.length);for(let n=0;n<t.length;n++)r[n]=t[n];for(let n=0;n<e.length;n++)r[t.length+n]=e[n];return r},yW=(t,e)=>({classGroupId:t,validator:e}),DL=(t=new Map,e=null,r)=>({nextPart:t,validators:e,classGroupId:r}),D_="-",JA=[],_W="arbitrary..",bW=t=>{const e=xW(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return wW(a);const l=a.split(D_),u=l[0]===""&&l.length>1?1:0;return OL(l,u,e)},getConflictingClassGroupIds:(a,l)=>{if(l){const u=n[a],h=r[a];return u?h?vW(h,u):u:h||JA}return r[a]||JA}}},OL=(t,e,r)=>{if(t.length-e===0)return r.classGroupId;const s=t[e],i=r.nextPart.get(s);if(i){const h=OL(t,e+1,i);if(h)return h}const a=r.validators;if(a===null)return;const l=e===0?t.join(D_):t.slice(e).join(D_),u=a.length;for(let h=0;h<u;h++){const p=a[h];if(p.validator(l))return p.classGroupId}},wW=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),r=e.indexOf(":"),n=e.slice(0,r);return n?_W+n:void 0})(),xW=t=>{const{theme:e,classGroups:r}=t;return SW(r,e)},SW=(t,e)=>{const r=DL();for(const n in t){const s=t[n];_C(s,r,n,e)}return r},_C=(t,e,r,n)=>{const s=t.length;for(let i=0;i<s;i++){const a=t[i];kW(a,e,r,n)}},kW=(t,e,r,n)=>{if(typeof t=="string"){EW(t,e,r);return}if(typeof t=="function"){jW(t,e,r,n);return}CW(t,e,r,n)},EW=(t,e,r)=>{const n=t===""?e:ML(e,t);n.classGroupId=r},jW=(t,e,r,n)=>{if(NW(t)){_C(t(n),e,r,n);return}e.validators===null&&(e.validators=[]),e.validators.push(yW(r,t))},CW=(t,e,r,n)=>{const s=Object.entries(t),i=s.length;for(let a=0;a<i;a++){const[l,u]=s[a];_C(u,ML(e,l),r,n)}},ML=(t,e)=>{let r=t;const n=e.split(D_),s=n.length;for(let i=0;i<s;i++){const a=n[i];let l=r.nextPart.get(a);l||(l=DL(),r.nextPart.set(a,l)),r=l}return r},NW=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,PW=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=Object.create(null),n=Object.create(null);const s=(i,a)=>{r[i]=a,e++,e>t&&(e=0,n=r,r=Object.create(null))};return{get(i){let a=r[i];if(a!==void 0)return a;if((a=n[i])!==void 0)return s(i,a),a},set(i,a){i in r?r[i]=a:s(i,a)}}},Mk="!",QA=":",RW=[],XA=(t,e,r,n,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),AW=t=>{const{prefix:e,experimentalParseClassName:r}=t;let n=s=>{const i=[];let a=0,l=0,u=0,h;const p=s.length;for(let x=0;x<p;x++){const w=s[x];if(a===0&&l===0){if(w===QA){i.push(s.slice(u,x)),u=x+1;continue}if(w==="/"){h=x;continue}}w==="["?a++:w==="]"?a--:w==="("?l++:w===")"&&l--}const f=i.length===0?s:s.slice(u);let g=f,v=!1;f.endsWith(Mk)?(g=f.slice(0,-1),v=!0):f.startsWith(Mk)&&(g=f.slice(1),v=!0);const _=h&&h>u?h-u:void 0;return XA(i,v,g,_)};if(e){const s=e+QA,i=n;n=a=>a.startsWith(s)?i(a.slice(s.length)):XA(RW,!1,a,void 0,!0)}if(r){const s=n;n=i=>r({className:i,parseClassName:s})}return n},TW=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((r,n)=>{e.set(r,1e6+n)}),r=>{const n=[];let s=[];for(let i=0;i<r.length;i++){const a=r[i],l=a[0]==="[",u=e.has(a);l||u?(s.length>0&&(s.sort(),n.push(...s),s=[]),n.push(a)):s.push(a)}return s.length>0&&(s.sort(),n.push(...s)),n}},IW=t=>({cache:PW(t.cacheSize),parseClassName:AW(t),sortModifiers:TW(t),postfixLookupClassGroupIds:DW(t),...bW(t)}),DW=t=>{const e=Object.create(null),r=t.postfixLookupClassGroups;if(r)for(let n=0;n<r.length;n++)e[r[n]]=!0;return e},OW=/\s+/,MW=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:i,postfixLookupClassGroupIds:a}=e,l=[],u=t.trim().split(OW);let h="";for(let p=u.length-1;p>=0;p-=1){const f=u[p],{isExternal:g,modifiers:v,hasImportantModifier:_,baseClassName:x,maybePostfixModifierPosition:w}=r(f);if(g){h=f+(h.length>0?" "+h:h);continue}let S=!!w,k;if(S){const I=x.substring(0,w);k=n(I);const P=k&&a[k]?n(x):void 0;P&&P!==k&&(k=P,S=!1)}else k=n(x);if(!k){if(!S){h=f+(h.length>0?" "+h:h);continue}if(k=n(x),!k){h=f+(h.length>0?" "+h:h);continue}S=!1}const j=v.length===0?"":v.length===1?v[0]:i(v).join(":"),C=_?j+Mk:j,R=C+k;if(l.indexOf(R)>-1)continue;l.push(R);const A=s(k,S);for(let I=0;I<A.length;++I){const P=A[I];l.push(C+P)}h=f+(h.length>0?" "+h:h)}return h},LW=(...t)=>{let e=0,r,n,s="";for(;e<t.length;
vendor: 4,637 bytes, line 383
383)(r=t[e++])&&(n=LL(r))&&(s&&(s+=" "),s+=n);return s},LL=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=LL(t[n]))&&(r&&(r+=" "),r+=e);return r},FW=(t,...e)=>{let r,n,s,i;const a=u=>{const h=e.reduce((p,f)=>f(p),t());return r=IW(h),n=r.cache.get,s=r.cache.set,i=l,l(u)},l=u=>{const h=n(u);if(h)return h;const p=MW(u,r);return s(u,p),p};return i=a,(...u)=>i(LW(...u))},$W=[],zn=t=>{const e=r=>r[t]||$W;return e.isThemeGetter=!0,e},FL=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,$L=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zW=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,UW=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,BW=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,VW=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,HW=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qW=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xc=t=>zW.test(t),tr=t=>!!t&&!Number.isNaN(Number(t)),mo=t=>!!t&&Number.isInteger(Number(t)),Rx=t=>t.endsWith("%")&&tr(t.slice(0,-1)),al=t=>UW.test(t),zL=()=>!0,WW=t=>BW.test(t)&&!VW.test(t),bC=()=>!1,GW=t=>HW.test(t),KW=t=>qW.test(t),YW=t=>!rt(t)&&!st(t),ZW=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),JW=t=>uu(t,VL,bC),rt=t=>FL.test(t),Du=t=>uu(t,HL,WW),eT=t=>uu(t,iG,tr),QW=t=>uu(t,WL,zL),XW=t=>uu(t,qL,bC),tT=t=>uu(t,UL,bC),eG=t=>uu(t,BL,KW),dy=t=>uu(t,GL,GW),st=t=>$L.test(t),qp=t=>Md(t,HL),tG=t=>Md(t,qL),rT=t=>Md(t,UL),rG=t=>Md(t,VL),nG=t=>Md(t,BL),hy=t=>Md(t,GL,!0),sG=t=>Md(t,WL,!0),uu=(t,e,r)=>{const n=FL.exec(t);return n?n[1]?e(n[1]):r(n[2]):!1},Md=(t,e,r=!1)=>{const n=$L.exec(t);return n?n[1]?e(n[1]):r:!1},UL=t=>t==="position"||t==="percentage",BL=t=>t==="image"||t==="url",VL=t=>t==="length"||t==="size"||t==="bg-size",HL=t=>t==="length",iG=t=>t==="number",qL=t=>t==="family-name",WL=t=>t==="number"||t==="weight",GL=t=>t==="shadow",aG=()=>{const t=zn("color"),e=zn("font"),r=zn("text"),n=zn("font-weight"),s=zn("tracking"),i=zn("leading"),a=zn("breakpoint"),l=zn("container"),u=zn("spacing"),h=zn("radius"),p=zn("shadow"),f=zn("inset-shadow"),g=zn("text-shadow"),v=zn("drop-shadow"),_=zn("blur"),x=zn("perspective"),w=zn("aspect"),S=zn("ease"),k=zn("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...C(),st,rt],A=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],P=()=>[st,rt,u],T=()=>[xc,"full","auto",...P()],O=()=>[mo,"none","subgrid",st,rt],G=()=>["auto",{span:["full",mo,st,rt]},mo,st,rt],M=()=>[mo,"auto",st,rt],U=()=>["auto","min","max","fr",st,rt],V=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],Y=()=>["auto",...P()],B=()=>[xc,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],z=()=>[xc,"screen","full","dvw","lvw","svw","min","max","fit",...P()],ee=()=>[xc,"screen","full","lh","dvh","lvh","svh","min","max","fit",...P()],L=()=>[t,st,rt],$=()=>[...C(),rT,tT,{position:[st,rt]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],te=()=>["auto","cover","contain",rG,JW,{size:[st,rt]}],ue=()=>[Rx,qp,Du],re=()=>["","none","full",h,st,rt],se=()=>["",tr,qp,Du],ye=()=>["solid","dashed","dotted","double"],de=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],pe=()=>[tr,Rx,rT,tT],Ie=()=>["","none",_,st,rt],Ne=()=>["none",tr,st,rt],He=()=>["none",tr,st,rt],We=()=>[tr,st,rt],at=()=>[xc,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[al],breakpoint:[al],color:[zL],container:[al],"drop-shadow":[al],ease:["in","out","in-out"],font:[YW],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[al],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[al],shadow:[al],spacing:["px",tr],text:[al],"text-shadow":[al],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",xc,rt,st,w]}],container:["container"],"container-type":[{"@container":["","normal","size",st,rt]}
vendor: 6,125 bytes, line 383
383],"container-named":[ZW],columns:[{columns:[tr,rt,st,l]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[mo,"auto",st,rt]}],basis:[{basis:[xc,"full","auto",l,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[tr,xc,"auto","initial","none",rt]}],grow:[{grow:["",tr,st,rt]}],shrink:[{shrink:["",tr,st,rt]}],order:[{order:[mo,"first","last","none",st,rt]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:G()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:G()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":U()}],"auto-rows":[{"auto-rows":U()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pbs:[{pbs:P()}],pbe:[{pbe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:Y()}],mx:[{mx:Y()}],my:[{my:Y()}],ms:[{ms:Y()}],me:[{me:Y()}],mbs:[{mbs:Y()}],mbe:[{mbe:Y()}],mt:[{mt:Y()}],mr:[{mr:Y()}],mb:[{mb:Y()}],ml:[{ml:Y()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:B()}],"inline-size":[{inline:["auto",...z()]}],"min-inline-size":[{"min-inline":["auto",...z()]}],"max-inline-size":[{"max-inline":["none",...z()]}],"block-size":[{block:["auto",...ee()]}],"min-block-size":[{"min-block":["auto",...ee()]}],"max-block-size":[{"max-block":["none",...ee()]}],w:[{w:[l,"screen",...B()]}],"min-w":[{"min-w":[l,"screen","none",...B()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...B()]}],h:[{h:["screen","lh",...B()]}],"min-h":[{"min-h":["screen","lh","none",...B()]}],"max-h":[{"max-h":["screen","lh",...B()]}],"font-size":[{text:["base",r,qp,Du]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,sG,QW]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Rx,rt]}],"font-family":[{font:[tG,XW,e]}],"font-features":[{"font-features":[rt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,st,rt]}],"line-clamp":[{"line-clamp":[tr,"none",st,eT]}],leading:[{leading:[i,...P()]}],"list-image":[{"list-image":["none",st,rt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",st,rt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ye(),"wavy"]}],"text-decoration-thickness":[{decoration:[tr,"from-font","auto",st,Du]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[tr,"auto",st,rt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"tab-size":[{tab:[mo,st,rt]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",st,rt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",st,rt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:$()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},mo,st,rt],radial:["",st,rt],conic:[mo,st,rt]},nG,eG]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:ue()}
vendor: 6,974 bytes, line 383
383],"gradient-via-pos":[{via:ue()}],"gradient-to-pos":[{to:ue()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:se()}],"border-w-x":[{"border-x":se()}],"border-w-y":[{"border-y":se()}],"border-w-s":[{"border-s":se()}],"border-w-e":[{"border-e":se()}],"border-w-bs":[{"border-bs":se()}],"border-w-be":[{"border-be":se()}],"border-w-t":[{"border-t":se()}],"border-w-r":[{"border-r":se()}],"border-w-b":[{"border-b":se()}],"border-w-l":[{"border-l":se()}],"divide-x":[{"divide-x":se()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":se()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ye(),"hidden","none"]}],"divide-style":[{divide:[...ye(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-bs":[{"border-bs":L()}],"border-color-be":[{"border-be":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...ye(),"none","hidden"]}],"outline-offset":[{"outline-offset":[tr,st,rt]}],"outline-w":[{outline:["",tr,qp,Du]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",p,hy,dy]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",f,hy,dy]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[tr,Du]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":se()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",g,hy,dy]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[tr,st,rt]}],"mix-blend":[{"mix-blend":[...de(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":de()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[tr]}],"mask-image-linear-from-pos":[{"mask-linear-from":pe()}],"mask-image-linear-to-pos":[{"mask-linear-to":pe()}],"mask-image-linear-from-color":[{"mask-linear-from":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"mask-image-t-from-pos":[{"mask-t-from":pe()}],"mask-image-t-to-pos":[{"mask-t-to":pe()}],"mask-image-t-from-color":[{"mask-t-from":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"mask-image-r-from-pos":[{"mask-r-from":pe()}],"mask-image-r-to-pos":[{"mask-r-to":pe()}],"mask-image-r-from-color":[{"mask-r-from":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"mask-image-b-from-pos":[{"mask-b-from":pe()}],"mask-image-b-to-pos":[{"mask-b-to":pe()}],"mask-image-b-from-color":[{"mask-b-from":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"mask-image-l-from-pos":[{"mask-l-from":pe()}],"mask-image-l-to-pos":[{"mask-l-to":pe()}],"mask-image-l-from-color":[{"mask-l-from":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"mask-image-x-from-pos":[{"mask-x-from":pe()}],"mask-image-x-to-pos":[{"mask-x-to":pe()}],"mask-image-x-from-color":[{"mask-x-from":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"mask-image-y-from-pos":[{"mask-y-from":pe()}],"mask-image-y-to-pos":[{"mask-y-to":pe()}],"mask-image-y-from-color":[{"mask-y-from":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[st,rt]}],"mask-image-radial-from-pos":[{"mask-radial-from":pe()}],"mask-image-radial-to-pos":[{"mask-radial-to":pe()}],"mask-image-radial-from-color":[{"mask-radial-from":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[tr]}],"mask-image-conic-from-pos":[{"mask-conic-from":pe()}],"mask-image-conic-to-pos":[{"mask-conic-to":pe()}],"mask-image-conic-from-color":[{"mask-conic-from":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:$()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",st,rt]}],filter:[{filter:["","none",st,rt]}],blur:[{blur:Ie()}],brightness:[{brightness:[tr,st,rt]}],contrast:[{contrast:[tr,st,rt]}],"drop-shadow":[{"drop-shadow":["","none",v,hy,dy]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",tr,st,rt]}],"hue-rotate":[{"hue-rotate":[tr,st,rt]}],invert:[{invert:["",tr,st,rt]}],saturate:[{saturate:[tr,st,rt]}],sepia:[{sepia:["",tr,st,rt]}],"backdrop-filter":[{"backdrop-filter":["","none",st,rt]}],"backdrop-blur":[{"backdrop-blur":Ie()}],"backdrop-brightness":[{"backdrop-brightness":[tr,st,rt]}],"backdrop-contrast":[{"backdrop-contrast":[tr,st,rt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",tr,st,rt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[tr,st,rt]}],"backdrop-invert":[{"backdrop-invert":["",tr,st,rt]}],"backdrop-opacity":[{"backdrop-opacity":[tr,st,rt]}],"backdrop-saturate":[{"backdrop-saturate":[tr,st,rt]}],"backdrop-sepia":[{"backdrop-sepia":["",tr,st,rt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",st,rt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[tr,"initial",st,rt]}],ease:[{ease:["linear","initial",S,st,rt]}],delay:[{delay:[tr,st,rt]}],animate:[{animate:["none",k,st,rt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,st,rt]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:Ne()}],"rotate-x":[{"rotate-x":Ne()}],"rotate-y":[{"rotate-y":Ne()}],"rotate-z":[{"rotate-z":Ne()}],scale:[{scale:He()}],"scale-x":[{"scale-x":He()}],"scale-y":[{"scale-y":He()}],"scale-z":[{"scale-z":He()}],"scale-3d":["scale-3d"],skew:[{skew:We()}],"skew-x":[{"skew-x":We()}
vendor: 7,099 bytes, line 383
383],"skew-y":[{"skew-y":We()}],transform:[{transform:[st,rt,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:at()}],"translate-x":[{"translate-x":at()}],"translate-y":[{"translate-y":at()}],"translate-z":[{"translate-z":at()}],"translate-none":["translate-none"],zoom:[{zoom:[mo,st,rt]}],accent:[{accent:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",st,rt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":L()}],"scrollbar-track-color":[{"scrollbar-track":L()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mbs":[{"scroll-mbs":P()}],"scroll-mbe":[{"scroll-mbe":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pbs":[{"scroll-pbs":P()}],"scroll-pbe":[{"scroll-pbe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",st,rt]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[tr,qp,Du,eT]}],stroke:[{stroke:["none",...L()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},oG=FW(aG);function ke(...t){return oG(IL(t))}function nT(t,e){return`${t} ${e}${t===1?"":"s"}`}const zh=Jb("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all cursor-pointer disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}}),we=y.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...s},i)=>{const a=n?yC:"button";return o.jsx(a,{"data-slot":"button",className:ke(zh({variant:e,size:r,className:t})),ref:i,...s})});
383we.displayName="Button";var lG=Object.defineProperty,Jf=(t,e)=>lG(t,"name",{value:e,configurable:!0}),KL=!!(typeof window<"u"&&window.document&&window.document.createElement);function Xe(t,e,{checkForDefaultPrevented:r=!0}={}){return Jf(function(s){if(t==null||t(s),r===!1||!s||!s.defaultPrevented)return e==null?void 0:e(s)},"handleEvent")}Jf(Xe,"composeEventHandlers");function cG(t){var e;if(!KL)throw new Error("Cannot access window outside of the DOM");return((e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)??window}Jf(cG,"getOwnerWindow");function Lk(t){if(!KL)throw new Error("Cannot access document outside of the DOM");return(t==null?void 0:t.ownerDocument)??document}Jf(Lk,"getOwnerDocument");function YL(t,e=!1){const{activeElement:r}=Lk(t);if(!(r!=null&&r.nodeName))return null;if(ZL(r)&&r.contentDocument)return YL(r.contentDocument.body,e);if(e){const n=r.getAttribute("aria-activedescendant");if(n){const s=Lk(r).getElementById(n);if(s)return s}}return r}Jf(YL,"getActiveElement");function ZL(t){return t.tagName==="IFRAME"}Jf(ZL,"isFrame");var uG=Object.defineProperty,la=(t,e)=>uG(t,"name",{value:e,configurable:!0});function dG(t,e){const r=y.createContext(e);r.displayName=t+"Context";const n=la(i=>{const{children:a,...l}=i,u=y.useMemo(()=>l,Object.values(l));return o.jsx(r.Provider,{value:u,children:a})},"Provider");n.displayName=t+"Provider";function s(i,a={}){const{optional:l=!1}=a,u=y.useContext(r);if(u)return u;if(e!==void 0)return e;if(!l)throw new Error(`\`${i}\` must be used within \`${t}\``)}return la(s,"useContext"),[n,s]}la(dG,"createContext");function Vn(t,e=[]){let r=[];function n(i,a){const l=y.createContext(a);l.displayName=i+"Context";const u=r.length;r=[...r,a];const h=la(f=>{var S;const{scope:g,children:v,..._}=f,x=((S=g==null?void 0:g[t])==null?void 0:S[u])||l,w=y.useMemo(()=>_,Object.values(_));return o.jsx(x.Provider,{value:w,children:v})},"Provider");h.displayName=i+"Provider";function p(f,g,v={}){var S;const{optional:_=!1}=v,x=((S=g==null?void 0:g[t])==null?void 0:S[u])||l,w=y.useContext(x);if(w)return w;if(a!==void 0)return a;if(!_)throw new Error(`\`${f}\` must be used within \`${i}\``)}return la(p,"useContext"),[h,p]}la(n,"createContext");const s=la(()=>{const i=r.map(a=>y.createContext(a));return la(function(l){const u=(l==null?void 0:l[t])||i;return y.useMemo(()=>({[`__scope${t}`]:{...l,[t]:u}}),[l,u])},"useScope")},"createScope");return s.scopeName=t,[n,JL(s,...e)]}la(Vn,"createContextScope");function JL(...t){const e=t[0];if(t.length===1)return e;const r=la(()=>{const n=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return la(function(i){const a=n.reduce((l,{useScope:u,scopeName:h})=>{const f=u(i)[`__scope${h}`];return{...l,...f}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return r.scopeName=e.scopeName,r}la(JL,"composeContextScopes");var hG=Object.defineProperty,Xn=(t,e)=>hG(t,"name",{value:e,configurable:!0});function Tg(t){const e=t+"CollectionProvider",[r,n]=Vn(e),[s,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=Xn(x=>{const{scope:w,children:S}=x,k=y.useRef(null),j=y.useRef(new Map).current;return o.jsx(s,{scope:w,itemMap:j,collectionRef:k,children:S})},"CollectionProvider");a.displayName=e;const l=t+"CollectionSlot",u=Ga(l),h=y.forwardRef((x,w)=>{const{scope:S,children:k}=x,j=i(l,S),C=Vt(w,j.collectionRef);return o.jsx(u,{ref:C,children:k})});h.displayName=l;const p=t+"CollectionItemSlot",f="data-radix-collection-item",g=Ga(p),v=y.forwardRef((x,w)=>{const{scope:S,children:k,...j}=x,C=y.useRef(null),R=Vt(w,C),A=i(p,S);return y.useEffect(()=>(A.itemMap.set(C,{ref:C,...j}),()=>void A.itemMap.delete(C))),o.jsx(g,{[f]:"",ref:R,children:k})});v.displayName=p;function _(x){const w=i(t+"CollectionConsumer",x);return y.useCallback(()=>{const k=w.collectionRef.current;if(!k)return[];const j=Array.from(k.querySelectorAll(`[${f}]`));return Array.from(w.itemMap.values()).sort((A,I)=>j.indexOf(A.ref.current)-j.indexOf(I.ref.current))},[w.collectionRef,w.itemMap])}return Xn(_,"useCollection"),[{Provider:a,Slot:h,ItemSlot:v},_,n]}Xn(Tg,"createCollection");var sT=new WeakMap,Dn,Ei,Ax=(Ei=class extends Map{constructor(r){super(r);bt(this,Dn);Je(this,Dn,[...super.keys()]),sT.set(this,!0)}set(r,n){return sT.get(this)&&(this.has(r)?X(this,Dn)[X(this,Dn).indexOf(r)]=r:X(this,Dn).push(r)),super.set(r,n),this}insert(r,n,s){const i=this.has(n),a=X(this,Dn).length,l=wC(r);let u=l>=0?l:a+l;const h=u<0||u>=a?-1:u;if(h===this.size||i&&h===this.size-1||h===-1)return this.set(n,s),this;const p=this.size+(i?0:1);l<0&&u++;const f=[...X(this,Dn)];let g,v=!1;for(let _=u;_<p;_++)if(u===_){let x=f[_];f[_]===n&&(x=f[_+1]),i&&this.delete(n),g=this.get(x),this.set(n,s)}else{!v&&f[_-1]===n&&(v=!0);const x=f[v?_:_-1],w=g;g=this.get(x),this.delete(x),this.set(x,w)}return this}with(r,n,s){const i=new Ei(this);return i.insert(r,n,s),i}before(r){const n=X(this,Dn).indexOf(r)-1;if(!(n<0))return this.entryAt(n)}setBefore(r,n,s){const i=X(this,Dn).indexOf(r);return i===-1?this:this.insert(i,n,s)}after(r){let n=X(this,Dn).indexOf(r);if(n=n===-1||n===this.size-1?-1:n+1,n!==-1)return this.entryAt(n)}setAfter(r,n,s){const i=X(this,Dn).indexOf(r);return i===-1?this:this.insert(i+1,n,s)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return Je(this,Dn,[]),super.clear()}delete(r){const n=super.delete(r);return n&&X(this,Dn).splice(X(this,Dn).indexOf(r),1),n}deleteAt(r){const n=this.keyAt(r);return n!==void 0?this.delete(n):!1}at(r){const n=s_(X(this,Dn),r);if(n!==void 0)return this.get(n)}entryAt(r){const n=s_(X(this,Dn),r);if(n!==void 0)return[n,this.get(n)]}indexOf(r){return X(this,Dn).indexOf(r)}keyAt(r){return s_(X(this,Dn),r)}from(r,n){const s=this.indexOf(r);if(s===-1)return;let i=s+n;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.at(i)}keyFrom(r,n){const s=this.indexOf(r);if(s===-1)return;let i=s+n;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.keyAt(i)}find(r,n){let s=0;for(const i of this){if(Reflect.apply(r,n,[i,s,this]))return i;s++}}findIndex(r,n){let s=0;for(const i of this){if(Reflect.apply(r,n,[i,s,this]))return s;s++}return-1}filter(r,n){const s=[];let i=0;for(const a of this)Reflect.apply(r,n,[a,i,this])&&s.push(a),i++;return new Ei(s)}map(r,n){const s=[];let i=0;for(const a of this)s.push([a[0],Reflect.apply(r,n,[a,i,this])]),i++;return new Ei(s)}reduce(...r){const[n,s]=r;let i=0,a=s??this.at(0);for(const l of this)i===0&&r.length===1?a=l:a=Reflect.apply(n,this,[a,l,i,this]),i++;return a}reduceRight(...r){const[n,s]=r;let i=s??this.at(-1);for(let a=this.size-1;a>=0;a--){const l=this.at(a);a===this.size-1&&r.length===1?i=l:i=Reflect.apply(n,this,[i,l,a,this])}return i}toSorted(r){const n=[...this.entries()].sort(r);return new Ei(n)}toReversed(){const r=new Ei;for(let n=this.size-1;n>=0;n--){const s=this.keyAt(n),i=this.get(s);r.set(s,i)}return r}toSpliced(...r){const n=[...this.entries()];return n.splice(...r),new Ei(n)}slice(r,n){const s=new Ei;let i=this.size-1;if(r===void 0)return s;r<0&&(r=r+this.size),n!==void 0&&n>0&&(i=n-1);for(let a=r;a<=i;a++){const l=this.keyAt(a),u=this.get(l);s.set(l,u)}return s}every(r,n){let s=0;for(const i of this){if(!Reflect.apply(r,n,[i,s,this]))return!1;s++}return!0}some(r,n){let s=0;for(const i of this){if(Reflect.apply(r,n,[i,s,this]))return!0;s++}return!1}},Dn=new WeakMap,Xn(Ei,"OrderedDict"),Ei);function s_(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);const r=QL(t,e);return r===-1?void 0:t[r]}Xn(s_,"at");function QL(t,e){const r=t.length,n=wC(e),s=n>=0?n:r+n;return s<0||s>=r?-1:s}Xn(QL,"toSafeIndex");function wC(t){return t!==t||t===0?0:Math.trunc(t)}Xn(wC,"toSafeInteger");function fG(t){const e=t+"CollectionProvider",[r,n]=Vn(e),[s,i]=r(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Ax,setItemMap:Xn(()=>{},"setItemMap")}),a=Xn(({state:j,...C})=>j?o.jsx(u,{...C,state:j}):o.jsx(l,{...C}),"CollectionProvider");a.displayName=e;const l=Xn(j=>{const C=w();return o.jsx(u,{...j,state:C})},"CollectionInit");l.displayName=e+"Init";const u=Xn(j=>{const{scope:C,children:R,state:A}=j,I=y.useRef(null),[P,T]=y.useState(null),O=Vt(I,T),[G,M]=A;return y.useEffect(()=>{if(!P)return;const U=tF(()=>{});return U.observe(P,{childList:!0,subtree:!0}),()=>{U.disconnect()}},[P]),o.jsx(s,{scope:C,itemMap:G,setItemMap:M,collectionRef:O,collectionRefObject:I,collectionElement:P,children:R})},"CollectionProviderImpl");u.displayName=e+"Impl";const h=t+"CollectionSlot",p=Ga(h),f=y.forwardRef((j,C)=>{const{scope:R,children:A}=j,I=i(h,R),P=Vt(C,I.collectionRef);return o.jsx(p,{ref:P,children:A})});f.displayName=h;const g=t+"CollectionItemSlot",v="data-radix-collection-item",_=Ga(g),x=y.forwardRef((j,C)=>{const{scope:R,children:A,...I}=j,P=y.useRef(null),[T,O]=y.useState(null),G=Vt(C,P,O),M=i(g,R),{setItemMap:U}=M,V=y.useRef(I);XL(V.current,I)||(V.current=I);const H=V.current;return y.useEffect(()=>{const Y=H;return U(B=>T?B.has(T)?B.set(T,{...Y,element:T}).toSorted(Fk):(B.set(T,{...Y,element:T}),B.toSorted(Fk)):B),()=>{U(B=>!T||!B.has(T)?B:(B.delete(T),new Ax(B)))}},[T,H,U]),o.jsx(_,{[v]:"",ref:G,children:A})});x.displayName=g;function w(){return y.useState(new Ax)}Xn(w,"useInitCollection");function S(j){const{itemMap:C}=i(t+"CollectionConsumer",j);return C}return Xn(S,"useCollection"),[{Provider:a,Slot:f,ItemSlot:x},{createCollectionScope:n,useCollection:S,useInitCollection:w}]}Xn(fG,"createCollection");function XL(t,e){if(t===e)return!0;
383if(typeof t!="object"||typeof e!="object"||t==null||e==null)return!1;const r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(const s of r)if(!Object.prototype.hasOwnProperty.call(e,s)||t[s]!==e[s])return!1;return!0}Xn(XL,"shallowEqual");function eF(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}Xn(eF,"isElementPreceding");function Fk(t,e){return!t[1].element||!e[1].element?0:eF(t[1].element,e[1].element)?-1:1}Xn(Fk,"sortByDocumentPosition");function tF(t){return new MutationObserver(r=>{for(const n of r)if(n.type==="childList"){t();return}})}Xn(tF,"getChildListObserver");var Xr=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},pG=Object.defineProperty,mG=(t,e)=>pG(t,"name",{value:e,configurable:!0}),gG=Id[" useId ".trim().toString()]||(()=>{}),vG=0;function Bn(t){const[e,r]=y.useState(gG());return Xr(()=>{t||r(n=>n??String(vG++))},[t]),t||(e?`radix-${e}`:"")}mG(Bn,"useId");var yG=Object.defineProperty,_G=(t,e)=>yG(t,"name",{value:e,configurable:!0}),bG=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],it=bG.reduce((t,e)=>{const r=Ga(`Primitive.${e}`),n=y.forwardRef((s,i)=>{const{asChild:a,...l}=s,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(u,{...l,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function xC(t,e){t&&ou.flushSync(()=>t.dispatchEvent(e))}_G(xC,"dispatchDiscreteCustomEvent");var wG=Object.defineProperty,xG=(t,e)=>wG(t,"name",{value:e,configurable:!0});function Pn(t){const e=y.useRef(t);return y.useEffect(()=>{e.current=t}),y.useMemo(()=>((...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)}),[])}xG(Pn,"useCallbackRef");var SG=Object.defineProperty,kG=(t,e)=>SG(t,"name",{value:e,configurable:!0}),iT=Id[" useEffectEvent ".trim().toString()],aT=Id[" useInsertionEffect ".trim().toString()];function rF(t){if(typeof iT=="function")return iT(t);const e=y.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof aT=="function"?aT(()=>{e.current=t}):Xr(()=>{e.current=t}),y.useMemo(()=>((...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)}),[])}kG(rF,"useEffectEvent");var EG=Object.defineProperty,Ig=(t,e)=>EG(t,"name",{value:e,configurable:!0}),jG=Id[" useInsertionEffect ".trim().toString()]||Xr;function $i({prop:t,defaultProp:e,onChange:r=Ig(()=>{},"onChange"),caller:n}){const[s,i,a]=nF({defaultProp:e,onChange:r}),l=t!==void 0,u=l?t:s,h=y.useCallback(p=>{var f;if(l){const g=sF(p)?p(t):p;g!==t&&((f=a.current)==null||f.call(a,g))}else i(p)},[l,t,i,a]);return[u,h]}Ig($i,"useControllableState");function nF({defaultProp:t,onChange:e}){const[r,n]=y.useState(t),s=y.useRef(r),i=y.useRef(e);return jG(()=>{i.current=e},[e]),y.useEffect(()=>{var a;s.current!==r&&((a=i.current)==null||a.call(i,r),s.current=r)},[r,s]),[r,n,i]}Ig(nF,"useUncontrolledState");function sF(t){return typeof t=="function"}Ig(sF,"isFunction");var oT=Symbol("RADIX:SYNC_STATE");function CG(t,e,r,n){const{prop:s,defaultProp:i,onChange:a,caller:l}=e,u=s!==void 0,h=rF(a),p=[{...r,state:i}];n&&p.push(n);const[f,g]=y.useReducer((w,S)=>{if(S.type===oT)return{...w,state:S.state};const k=t(w,S);return u&&!Object.is(k.state,w.state)&&h(k.state),k},...p),v=f.state,_=y.useRef(v);y.useEffect(()=>{_.current!==v&&(_.current=v,u||h(v))},[v,_,u]);const x=y.useMemo(()=>s!==void 0?{...f,state:s}:f,[f,s]);return y.useEffect(()=>{u&&!Object.is(s,f.state)&&g({type:oT,state:s})},[s,f.state,u]),[x,g]}Ig(CG,"useControllableStateReducer");var NG=Object.defineProperty,PG=(t,e)=>NG(t,"name",{value:e,configurable:!0}),RG=y.createContext(void 0);function du(t){const e=y.useContext(RG);return t||e||"ltr"}PG(du,"useDirection");var AG=Object.defineProperty,SC=(t,e)=>AG(t,"name",{value:e,configurable:!0}),Tx=!1;function iF(){const[t,e]=y.useState(Tx);return y.useEffect(()=>{Tx||(Tx=!0,e(!0))},[]),t}SC(iF,"useIsHydrated");var aF=Id[" useSyncExternalStore ".trim().toString()];function oF(){return()=>{}}SC(oF,"subscribe");function lF(){return aF(oF,()=>!0,()=>!1)}SC(lF,"useIsHydratedModern");var TG=typeof aF=="function"?lF:iF,IG=Object.defineProperty,Ld=(t,e)=>IG(t,"name",{value:e,configurable:!0}),Ix="rovingFocusGroup.onEntryFocus",DG={bubbles:!1,cancelable:!0},Qb="RovingFocusGroup",[$k,cF,OG]=Tg(Qb),[MG,Qf]=Vn(Qb,[OG]),[LG,FG]=MG(Qb),$G=y.forwardRef(Ld(function(e,r){return o.jsx($k.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx($k.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(zG,{...e,ref:r})})})},"RovingFocusGroup")),zG=y.forwardRef(Ld(function(e,r){const{__scopeRovingFocusGroup:n,orientation:s,loop:i=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:f=!1,...g}=e,v=y.useRef(null),_=Vt(r,v),x=du(a),[w,S]=$i({prop:l,defaultProp:u??null,onChange:h,caller:Qb}),[k,j]=y.useState(!1),C=Pn(p),R=cF(n),A=y.useRef(!1),[I,P]=y.useState(0);return y.useEffect(()=>{const T=v.current;if(T)return T.addEventListener(Ix,C),()=>T.removeEventListener(Ix,C)},[C]),o.jsx(LG,{scope:n,orientation:s,dir:x,loop:i,currentTabStopId:w,onItemFocus:y.useCallback(T=>
383S(T),[S]),onItemShiftTab:y.useCallback(()=>j(!0),[]),onFocusableItemAdd:y.useCallback(()=>P(T=>T+1),[]),onFocusableItemRemove:y.useCallback(()=>P(T=>T-1),[]),children:o.jsx(it.div,{tabIndex:k||I===0?-1:0,"data-orientation":s,...g,ref:_,style:{outline:"none",...e.style},onMouseDown:Xe(e.onMouseDown,()=>{A.current=!0}),onFocus:Xe(e.onFocus,T=>{const O=!A.current;if(T.target===T.currentTarget&&O&&!k){const G=new CustomEvent(Ix,DG);if(T.currentTarget.dispatchEvent(G),!G.defaultPrevented){const M=R().filter(B=>B.focusable),U=M.find(B=>B.active),V=M.find(B=>B.id===w),Y=[U,V,...M].filter(Boolean).map(B=>B.ref.current);kC(Y,f)}}A.current=!1}),onBlur:Xe(e.onBlur,()=>j(!1))})})},"RovingFocusGroupImpl")),UG="RovingFocusGroupItem",BG=y.forwardRef(Ld(function(e,r){const{__scopeRovingFocusGroup:n,focusable:s=!0,active:i=!1,tabStopId:a,children:l,...u}=e,h=Bn(),p=a||h,f=FG(UG,n),g=f.currentTabStopId===p,v=cF(n),{onFocusableItemAdd:_,onFocusableItemRemove:x,currentTabStopId:w}=f,S=TG();return Xr(()=>{if(!(!S||!s))return _(),()=>x()},[S,s,_,x]),y.useEffect(()=>{if(!(S||!s))return _(),()=>x()},[S,s,_,x]),o.jsx($k.ItemSlot,{scope:n,id:p,focusable:s,active:i,children:o.jsx(it.span,{tabIndex:g?0:-1,"data-orientation":f.orientation,...u,ref:r,onMouseDown:Xe(e.onMouseDown,k=>{s?f.onItemFocus(p):k.preventDefault()}),onFocus:Xe(e.onFocus,()=>f.onItemFocus(p)),onKeyDown:Xe(e.onKeyDown,k=>{if(k.key==="Tab"&&k.shiftKey){f.onItemShiftTab();return}if(k.target!==k.currentTarget)return;const j=dF(k,f.orientation,f.dir);if(j!==void 0){if(k.metaKey||k.ctrlKey||k.altKey||k.shiftKey)return;k.preventDefault();let R=v().filter(A=>A.focusable).map(A=>A.ref.current);if(j==="last")R.reverse();else if(j==="prev"||j==="next"){j==="prev"&&R.reverse();const A=R.indexOf(k.currentTarget);R=f.loop?hF(R,A+1):R.slice(A+1)}setTimeout(()=>kC(R))}}),children:typeof l=="function"?l({isCurrentTabStop:g,hasTabStop:w!=null}):l})})},"RovingFocusGroupItem")),VG={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function uF(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}Ld(uF,"getDirectionAwareKey");function dF(t,e,r){const n=uF(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return VG[n]}Ld(dF,"getFocusIntent");function kC(t,e=!1){const r=document.activeElement;for(const n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}Ld(kC,"focusFirst");function hF(t,e){return t.map((r,n)=>t[(e+n)%t.length])}Ld(hF,"wrapArray");var EC=$G,jC=BG,HG=Object.defineProperty,Hl=(t,e)=>HG(t,"name",{value:e,configurable:!0});function fF(t,e){return y.useReducer((r,n)=>e[r][n]??r,t)}Hl(fF,"useStateMachine");var os=Hl(t=>{const{present:e,children:r}=t,n=pF(e),s=typeof r=="function"?r({present:n.isPresent}):y.Children.only(r),i=mF(n.ref,gF(s));return typeof r=="function"||n.isPresent?y.cloneElement(s,{ref:i}):null},"Presence");function pF(t){const[e,r]=y.useState(),n=y.useRef(null),s=y.useRef(t),i=y.useRef("none"),a=y.useRef(void 0),l=t?"mounted":"unmounted",[u,h]=fF(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{u==="mounted"?(i.current=a.current??Uh(n.current),a.current=void 0):i.current="none"},[u]),Xr(()=>{const p=n.current,f=s.current;if(f!==t){const v=i.current,_=Uh(p);t?(a.current=_,h("MOUNT")):_==="none"||(p==null?void 0:p.display)==="none"?h("UNMOUNT"):h(f&&v!==_?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,h]),Xr(()=>{if(e){let p;const f=e.ownerDocument.defaultView??window,g=Hl(_=>{const w=Uh(n.current).includes(CSS.escape(_.animationName));if(_.target===e&&w&&(h("ANIMATION_END"),!s.current)){const S=e.style.animationFillMode;e.style.animationFillMode="forwards",p=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=S)})}},"handleAnimationEnd"),v=Hl(_=>{_.target===e&&(i.current=Uh(n.current))},"handleAnimationStart");return e.addEventListener("animationstart",v),e.addEventListener("animationcancel",g),e.addEventListener("animationend",g),()=>{f.clearTimeout(p),e.removeEventListener("animationstart",v),e.removeEventListener("animationcancel",g),e.removeEventListener("animationend",g)}}else h("ANIMATION_END")},[e,h]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:y.useCallback(p=>{if(p){const f=getComputedStyle(p);n.current=f,a.current=Uh(f)}else n.current=null;r(p)},[])}}Hl(pF,"usePresence");function zk(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}Hl(zk,"setRef");function mF(...t){const e=y.useRef(t);return e.current=t,y.useCallback(r=>{const n=e.current;let s=!1;const i=n.map(a=>{const l=zk(a,r);return!s&&typeof l=="function"&&(s=!0),l});if(s)return()=>{for(let a=0;a<i.length;a++){const l=i[a];typeof l=="function"?l():zk(n[a],null)}}},[])}Hl(mF,"useStableComposedRefs");function Uh(t){return(t==null?void 0:t.animationName)||"none"}Hl(Uh,"getAnimationName");function gF(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.
383isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}Hl(gF,"getElementRef");var qG=Object.defineProperty,Xf=(t,e)=>qG(t,"name",{value:e,configurable:!0}),CC="Tabs",[WG,tSe]=Vn(CC,[Qf]),vF=Qf(),[GG,NC]=WG(CC),KG=y.forwardRef(Xf(function(e,r){const{__scopeTabs:n,value:s,onValueChange:i,defaultValue:a,orientation:l="horizontal",dir:u,activationMode:h="automatic",...p}=e,f=du(u),[g,v]=$i({prop:s,onChange:i,defaultProp:a??"",caller:CC});return o.jsx(GG,{scope:n,baseId:Bn(),value:g,onValueChange:v,orientation:l,dir:f,activationMode:h,children:o.jsx(it.div,{dir:f,"data-orientation":l,...p,ref:r})})},"Tabs")),YG="TabsList",ZG=y.forwardRef(Xf(function(e,r){const{__scopeTabs:n,loop:s=!0,...i}=e,a=NC(YG,n),l=vF(n);return o.jsx(EC,{asChild:!0,...l,orientation:a.orientation,dir:a.dir,loop:s,children:o.jsx(it.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:r})})},"TabsList")),JG="TabsTrigger",QG=y.forwardRef(Xf(function(e,r){const{__scopeTabs:n,value:s,disabled:i=!1,...a}=e,l=NC(JG,n),u=vF(n),h=PC(l.baseId,s),p=RC(l.baseId,s),f=s===l.value;return o.jsx(jC,{asChild:!0,...u,focusable:!i,active:f,children:o.jsx(it.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":p,"data-state":f?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:h,...a,ref:r,onMouseDown:Xe(e.onMouseDown,g=>{!i&&g.button===0&&g.ctrlKey===!1?l.onValueChange(s):g.preventDefault()}),onKeyDown:Xe(e.onKeyDown,g=>{i||g.target!==g.currentTarget||[" ","Enter"].includes(g.key)&&l.onValueChange(s)}),onFocus:Xe(e.onFocus,()=>{const g=l.activationMode!=="manual";!f&&!i&&g&&l.onValueChange(s)})})})},"TabsTrigger")),XG="TabsContent",e7=y.forwardRef(Xf(function(e,r){const{__scopeTabs:n,value:s,forceMount:i,children:a,...l}=e,u=NC(XG,n),h=PC(u.baseId,s),p=RC(u.baseId,s),f=s===u.value,g=y.useRef(f);return y.useEffect(()=>{const v=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(v)},[]),o.jsx(os,{present:i||f,children:({present:v})=>o.jsx(it.div,{"data-state":f?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":h,hidden:!v,id:p,tabIndex:0,...l,ref:r,style:{...e.style,animationDuration:g.current?"0s":void 0},children:v&&a})})},"TabsContent"));function PC(t,e){return`${t}-trigger-${e}`}Xf(PC,"makeTriggerId");function RC(t,e){return`${t}-content-${e}`}Xf(RC,"makeContentId");var t7=KG,r7=ZG,n7=QG,s7=e7;function Dg({className:t,...e}){return o.jsx(t7,{"data-slot":"tabs",className:ke("flex flex-col gap-2",t),...e})}function Og({className:t,...e}){return o.jsx(r7,{"data-slot":"tabs-list",className:ke("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",t),...e})}function Is({className:t,...e}){return o.jsx(n7,{"data-slot":"tabs-trigger",className:ke("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...e})}function Rf({className:t,...e}){return o.jsx(s7,{"data-slot":"tabs-content",className:ke("flex-1 outline-none",t),...e})}const i7=Symbol.for("@supabase/supabase-js.traceContextExtractor");function a7(){return globalThis[i7]}var Uk=function(t,e){return Uk=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},Uk(t,e)};function rSe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Uk(t,e);function r(){this.constructor=t}
383t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Ro=function(){return Ro=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Ro.apply(this,arguments)};function ep(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function o7(t,e,r,n){function s(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function l(p){try{h(n.next(p))}catch(f){a(f)}}function u(p){try{h(n.throw(p))}catch(f){a(f)}}function h(p){p.done?i(p.value):s(p.value).then(l,u)}h((n=n.apply(t,e||[])).next())})}function nSe(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],a;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(l){a={error:l}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function l7(t,e,r){if(r||arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}const c7=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class AC extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class u7 extends AC{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class lT extends AC{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class cT extends AC{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Bk;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Bk||(Bk={}));class d7{constructor(e,{headers:r={},customFetch:n,region:s=Bk.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=c7(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return o7(this,arguments,void 0,function*(r,n={}){var s,i;let a,l,u;try{const{headers:h,method:p,body:f,signal:g,timeout:v}=n;let _={},{region:x}=n;x||(x=this.region);const w=new URL(`${this.url}/${r}`);x&&x!=="any"&&(_["x-region"]=x,w.searchParams.set("forceFunctionRegion",x));let S;const k=!!h&&Object.keys(h).some(P=>P.toLowerCase()==="content-type");f&&!k?typeof Blob<"u"&&f instanceof Blob||f instanceof ArrayBuffer?(_["Content-Type"]="application/octet-stream",S=f):typeof f=="string"?(_["Content-Type"]="text/plain",S=f):typeof FormData<"u"&&f instanceof FormData?S=f:(_["Content-Type"]="application/json",S=JSON.stringify(f)):f&&typeof f!="string"&&!(typeof Blob<"u"&&f instanceof Blob)&&!(f instanceof ArrayBuffer)&&!(typeof FormData<"u"&&f instanceof FormData)?S=JSON.stringify(f):S=f;let j=g;v&&(l=new AbortController,a=setTimeout(()=>l.abort(),v),g?(j=l.signal,u=()=>l.abort(),g.addEventListener("abort",u)):j=l.signal);const C=yield this.fetch(w.toString(),{method:p||"POST",headers:Object.assign(Object.assign(Object.assign({},_),this.headers),h),body:S,signal:j}).catch(P=>{throw new u7(P)}),R=C.headers.get("x-relay-error");if(R&&R==="true")throw new lT(C);if(!C.ok)throw new cT(C);let A=((s=C.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim().toLowerCase(),I;return A==="application/json"?I=yield C.json():A==="application/octet-stream"||A==="application/pdf"?I=yield C.blob():A==="text/event-stream"?I=C:A==="multipart/form-data"?I=yield C.formData():I=yield C.text(),{data:I,error:null,response:C}}catch(h){return{data:null,error:h,response:h instanceof cT||h instanceof lT?h.context:void 0}}finally{a&&clearTimeout(a),u&&((i=n.signal)===null||i===void 0||i.removeEventListener("abort",u))}})}}const yF=3,uT=t=>Math.min(1e3*2**t,3e4),h7=[520,503],_F=["GET","HEAD","OPTIONS"];
383var Dx=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function Vm(t){"@babel/helpers - typeof";return Vm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vm(t)}function f7(t,e){if(Vm(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Vm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function p7(t){var e=f7(t,"string");return Vm(e)=="symbol"?e:e+""}function m7(t,e,r){return(e=p7(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function dT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Jh(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?dT(Object(r),!0).forEach(function(n){m7(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):dT(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function hT(t,e){return new Promise(r=>{if(e!=null&&e.aborted){r();return}const n=setTimeout(()=>{e==null||e.removeEventListener("abort",s),r()},t);function s(){clearTimeout(n),r()}e==null||e.addEventListener("abort",s)})}function g7(t,e,r,n){return!(!n||r>=yF||!_F.includes(t)||!h7.includes(e))}var v7=class{constructor(t){var e,r,n,s,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(r=t.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(n=t.shouldStripNulls)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(s=t.urlLengthLimit)!==null&&s!==void 0?s:8e3,this.retryEnabled=(i=t.retry)!==null&&i!==void 0?i:!0,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}retry(t){return this.retryEnabled=t,this}then(t,e){var r=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const a=this.headers.get("Accept");a==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!a||a==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const n=this.fetch;let i=(async()=>{let a=0;for(;;){const h={};r.headers.forEach((f,g)=>{h[g]=f}),a>0&&(h["X-Retry-Count"]=String(a));let p;try{p=await n(r.url.toString(),{method:r.method,headers:h,body:JSON.stringify(r.body,(f,g)=>
383typeof g=="bigint"?g.toString():g),signal:r.signal})}catch(f){if((f==null?void 0:f.name)==="AbortError"||(f==null?void 0:f.code)==="ABORT_ERR"||!_F.includes(r.method))throw f;if(r.retryEnabled&&a<yF){const g=uT(a);a++,await hT(g,r.signal);continue}throw f}if(g7(r.method,p.status,a,r.retryEnabled)){var l,u;const f=(l=(u=p.headers)===null||u===void 0?void 0:u.get("Retry-After"))!==null&&l!==void 0?l:null,g=f!==null?Math.max(0,parseInt(f,10)||0)*1e3:uT(a);await p.text(),a++,await hT(g,r.signal);continue}return await r.processResponse(p)}})();return this.shouldThrowOnError||(i=i.catch(a=>{var l;let u="",h="",p="";const f=a==null?void 0:a.cause;if(f){var g,v,_,x;const k=(g=f==null?void 0:f.message)!==null&&g!==void 0?g:"",j=(v=f==null?void 0:f.code)!==null&&v!==void 0?v:"";u=`${(_=a==null?void 0:a.name)!==null&&_!==void 0?_:"FetchError"}: ${a==null?void 0:a.message}`,u+=`
384
385Caused by: ${(x=f==null?void 0:f.name)!==null&&x!==void 0?x:"Error"}: ${k}`,j&&(u+=` (${j})`),f!=null&&f.stack&&(u+=`
386${f.stack}`)}else{var w;u=(w=a==null?void 0:a.stack)!==null&&w!==void 0?w:""}const S=this.url.toString().length;return(a==null?void 0:a.name)==="AbortError"||(a==null?void 0:a.code)==="ABORT_ERR"?(p="",h="Request was aborted (timeout or manual cancellation)",S>this.urlLengthLimit&&(h+=`. Note: Your request URL is ${S} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((f==null?void 0:f.name)==="HeadersOverflowError"||(f==null?void 0:f.code)==="UND_ERR_HEADERS_OVERFLOW")&&(p="",h="HTTP headers exceeded server limits (typically 16KB)",S>this.urlLengthLimit&&(h+=`. Your request URL is ${S} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(l=a==null?void 0:a.name)!==null&&l!==void 0?l:"FetchError"}: ${a==null?void 0:a.message}`,details:u,hint:h,code:p},data:null,count:null,status:0,statusText:""}})),i.then(t,e)}async processResponse(t){var e=this;let r=null,n=null,s=null,i=t.status,a=t.statusText;if(t.ok){var l,u;if(e.method!=="HEAD"){var h;const v=await t.text();if(v!=="")if(e.headers.get("Accept")==="text/csv")n=v;else if(e.headers.get("Accept")&&(!((h=e.headers.get("Accept"))===null||h===void 0)&&h.includes("application/vnd.pgrst.plan+text")))n=v;else try{n=JSON.parse(v)}catch{if(r={message:v},n=null,e.shouldThrowOnError)throw new Dx({message:v,details:"",hint:"",code:""})}}const f=(l=e.headers.get("Prefer"))===null||l===void 0?void 0:l.match(/count=(exact|planned|estimated)/),g=(u=t.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");if(f&&g&&g.length>1&&(s=parseInt(g[1])),e.isMaybeSingle&&Array.isArray(n))if(n.length>1){if(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,s=null,i=406,a="Not Acceptable",e.shouldThrowOnError){var p;throw new Dx(Jh(Jh({},r),{},{hint:(p=r.hint)!==null&&p!==void 0?p:""}))}}else n.length===1?n=n[0]:n=null}else{const f=await t.text();try{r=JSON.parse(f),Array.isArray(r)&&t.status===404&&(n=[],r=null,i=200,a="OK")}catch{t.status===404&&f===""?(i=204,a="No Content"):r={message:f}}if(r&&e.shouldThrowOnError)throw new Dx(r)}return{success:r===null,error:r,data:n,count:s,status:i,statusText:a}}returns(){return this}overrideTypes(){return this}},y7=class extends v7{throwOnError(){return super.throwOnError()}select(t){let e=!1;const r=(t??"*").split("").map(n=>/\s/.test(n)&&!e?"":(n==='"'&&(e=!e),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:n,referencedTable:s=n}={}){const i=s?`${s}.order`:"order",a=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${a?`${a},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){const n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:n=r}={}){const s=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${t}`),this.url.searchParams.set(i,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
386explain({analyze:t=!1,verbose:e=!1,settings:r=!1,buffers:n=!1,wal:s=!1,format:i="text"}={}){var a;const l=[t?"analyze":null,e?"verbose":null,r?"settings":null,n?"buffers":null,s?"wal":null].filter(Boolean).join("|"),u=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${u}"; options=${l};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const fT=new RegExp("[,()]");var Bh=class extends y7{throwOnError(){return super.throwOnError()}eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&fT.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&fT.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`not.in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:n}={}){let s="";n==="plain"?s="pl":n==="phrase"?s="ph":n==="websearch"&&(s="w");const i=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${s}fts${i}.${e}`),this}match(t){return Object.entries(t).filter(([e,r])=>r!==void 0).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){const n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},_7=class{constructor(t,{headers:e={},schema:r,fetch:n,urlLengthLimit:s=8e3,retry:i}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=n,this.urlLengthLimit=s,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:r=!1,count:n}=e??{},s=r?"HEAD":"GET";let i=!1;const a=(t??"*").split("").map(h=>/\s/.test(h)&&!i?"":(h==='"'&&(i=!i),h)).join(""),{url:l,headers:u}=this.cloneRequestState();return l.searchParams.set("select",a),n&&u.append("Prefer",`count=${n}`),new Bh({method:s,url:l,headers:u,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(t,{count:e,defaultToNull:r=!0}={}){var n;const s="POST",{url:i,headers:a}=this.cloneRequestState();if(e&&a.append("Prefer",`count=${e}`),r||a.append("Prefer","missing=default"),Array.isArray(t)){const l=t.reduce((u,h)=>u.concat(Object.keys(h)),[]);if(l.length>0){const u=[...new Set(l)].map(h=>`"${h}"`);i.searchParams.set("columns",u.join(","))}}return new Bh({method:s,url:i,headers:a,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:n,defaultToNull:s=!0}={}){var i;const a="POST",{url:l,headers:u}=this.cloneRequestState();if(u.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&l.searchParams.set("on_conflict",e),n&&u.append("Prefer",`count=${n}`),s||u.append("Prefer","missing=default"),Array.isArray(t)){const h=t.reduce((p,f)=>p.concat(Object.keys(f)),[]);if(h.length>0){const p=[...new Set(h)].map(f=>`"${f}"`);l.searchParams.set("columns",p.join(","))}}return new Bh({method:a,url:l,headers:u,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(t,{count:e}={}){var r;const n="PATCH",{url:s,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new Bh({method:n,url:s,headers:i,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:t}={}){var e;const r="DELETE",{url:n,headers:s}=this.cloneRequestState();return t&&s.append("Prefer",`count=${t}`),new Bh({method:r,url:n,headers:s,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}},b7=class bF{constructor(e,{headers:r={},schema:n,fetch:s,timeout:i,urlLengthLimit:a=8e3,retry:l}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=a;const u=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(h,p)=>{const f=new AbortController,g=setTimeout(()=>f.abort(),i),v=p==null?void 0:p.signal;if(v){if(v.aborted)return clearTimeout(g),u(h,p);const _=()=>{clearTimeout(g),f.abort()};return v.addEventListener("abort",_,{once:!0}),u(h,Jh(Jh({},p),{}
386,{signal:f.signal})).finally(()=>{clearTimeout(g),v.removeEventListener("abort",_)})}return u(h,Jh(Jh({},p),{},{signal:f.signal})).finally(()=>clearTimeout(g))}:this.fetch=u,this.retry=l}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new _7(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(e){return new bF(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,r={},{head:n=!1,get:s=!1,count:i}={}){var a;let l;const u=new URL(`${this.url}/rpc/${e}`);let h;const p=v=>v!==null&&typeof v=="object"&&(!Array.isArray(v)||v.some(p)),f=n&&Object.values(r).some(p);f?(l="POST",h=r):n||s?(l=n?"HEAD":"GET",Object.entries(r).filter(([v,_])=>_!==void 0).map(([v,_])=>[v,Array.isArray(_)?`{${_.join(",")}}`:`${_}`]).forEach(([v,_])=>{u.searchParams.append(v,_)})):(l="POST",h=r);const g=new Headers(this.headers);return f?g.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&g.set("Prefer",`count=${i}`),new Bh({method:l,url:u,headers:g,schema:this.schemaName,body:h,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class w7{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const r=globalThis;if(typeof globalThis<"u"&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};const n=typeof global<"u"?global:void 0;if(n&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};if(typeof globalThis<"u"&&typeof r.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&r.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const s=globalThis.process;if(s){const i=s.versions;if(i&&i.node)return{type:"unsupported",error:"Node.js detected but native WebSocket not found.",workaround:"Ensure you are running Node.js 22+ or provide a WebSocket implementation via the transport option."}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.wsConstructor)return e.wsConstructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=`
387
388Suggested solution: ${e.workaround}`),new Error(r)}static isWebSocketSupported(){try{return this.detectEnvironment().type==="native"}catch{return!1}}}const x7="2.112.2",S7=`realtime-js/${x7}`,k7="1.0.0",wF="2.0.0",E7=wF,j7=1e4,C7=100,Ic={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},xF={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Vk={connecting:"connecting",closing:"closing",closed:"closed"};class N7{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,r){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var r;return this._isArrayBuffer((r=e.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var r,n;const s=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(e){var r,n;const s=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:{},a=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(e,r,n){var s,i;const a=new TextEncoder,l=a.encode(e.topic),u=a.encode((s=e.ref)!==null&&s!==void 0?s:""),h=a.encode((i=e.join_ref)!==null&&i!==void 0?i:""),p=a.encode(e.payload.event),f=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},g=a.encode(Object.keys(f).length===0?"":JSON.stringify(f));if(h.length>255)throw new Error(`joinRef length ${h.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`ref length ${u.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`topic length ${l.length} exceeds maximum of 255`);if(p.length>255)throw new Error(`userEvent length ${p.length} exceeds maximum of 255`);if(g.length>255)throw new Error(`metadata length ${g.length} exceeds maximum of 255`);const v=this.USER_BROADCAST_PUSH_META_LENGTH+h.length+u.length+l.length+p.length+g.length,_=new ArrayBuffer(this.HEADER_LENGTH+v),x=new DataView(_),w=new Uint8Array(_);let S=0;x.setUint8(S++,this.KINDS.userBroadcastPush),x.setUint8(S++,h.length),x.setUint8(S++,u.length),x.setUint8(S++,l.length),x.setUint8(S++,p.length),x.setUint8(S++,g.length),x.setUint8(S++,r),w.set(h,S),S+=h.length,w.set(u,S),S+=u.length,w.set(l,S),S+=l.length,w.set(p,S),S+=p.length,w.set(g,S),S+=g.length;var k=new Uint8Array(_.byteLength+n.byteLength);return k.set(new Uint8Array(_),0),k.set(new Uint8Array(n),_.byteLength),k.buffer}decode(e,r){if(this._isArrayBuffer(e)){let n=this._binaryDecode(e);return r(n)}if(typeof e=="string"){const n=JSON.parse(e),[s,i,a,l,u]=n;return r({join_ref:s,ref:i,topic:a,event:l,payload:u})}return r({})}_binaryDecode(e){const r=new DataView(e),n=r.getUint8(0),s=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,r,s)}}_decodeUserBroadcast(e,r,n){const s=r.getUint8(1),i=r.getUint8(2),a=r.getUint8(3),l=r.getUint8(4);let u=this.HEADER_LENGTH+4;const h=n.decode(e.slice(u,u+s));u=u+s;const p=n.decode(e.slice(u,u+i));u=u+i;const f=n.decode(e.slice(u,u+a));u=u+a;const g=e.slice(u,e.byteLength),v=l===this.JSON_ENCODING?JSON.parse(n.decode(g)):g,_={type:this.BROADCAST_EVENT,event:p,payload:v};return a>0&&(_.meta=JSON.parse(f)),{join_ref:null,ref:null,topic:h,event:this.BROADCAST_EVENT,payload:_}}_isArrayBuffer(e){var r;return e instanceof ArrayBuffer||((r=e==null?void 0:e.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(e,r){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([n])=>r.includes(n)))}}var Vr;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.t
vendor: 8,724 bytes, line 388
388srange="tsrange",t.tstzrange="tstzrange"})(Vr||(Vr={}));const pT=(t,e,r={})=>{var n;const s=(n=r.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((i,a)=>(i[a]=P7(a,t,e,s),i),{}):{}},P7=(t,e,r,n)=>{const s=e.find(l=>l.name===t),i=s==null?void 0:s.type,a=r[t];return i&&!n.includes(i)?SF(i,a):Hk(a)},SF=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return I7(e,r)}switch(t){case Vr.bool:return R7(e);case Vr.float4:case Vr.float8:case Vr.int2:case Vr.int4:case Vr.int8:case Vr.numeric:case Vr.oid:return A7(e);case Vr.json:case Vr.jsonb:return T7(e);case Vr.timestamp:return D7(e);case Vr.abstime:case Vr.date:case Vr.daterange:case Vr.int4range:case Vr.int8range:case Vr.money:case Vr.reltime:case Vr.text:case Vr.time:case Vr.timestamptz:case Vr.timetz:case Vr.tsrange:case Vr.tstzrange:return Hk(e);default:return Hk(e)}},Hk=t=>t,R7=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},A7=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},T7=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},I7=(t,e)=>{if(typeof t!="string")return t;const r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let i;const a=t.slice(1,r);try{i=JSON.parse("["+a+"]")}catch{i=a?a.split(","):[]}return i.map(l=>SF(e,l))}return t},D7=t=>typeof t=="string"?t.replace(" ","T"):t,kF=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var af=t=>typeof t=="function"?t:function(){return t},O7=typeof self<"u"?self:null,Vh=typeof window<"u"?window:null,So=O7||Vh||globalThis,M7="2.0.0",L7=1e4,F7=1e3,$7=100,No={connecting:0,open:1,closing:2,closed:3},Qs={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},vl={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},qk={longpoll:"longpoll",websocket:"websocket"},z7={complete:4},Wk="base64url.bearer.phx.",fy=class{constructor(t,e,r,n){this.channel=t,this.event=e,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(t){this.timeout=t,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:t,response:e,_ref:r}){this.recHooks.filter(n=>n.status===t).forEach(n=>n.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},EF=class{constructor(t,e){this.callback=t,this.timerCalc=e,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},U7=class{constructor(t,e,r){this.state=Qs.closed,this.topic=t,this.params=af(e||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new fy(this,vl.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new EF(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=Qs.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=Qs.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=Qs.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=Qs.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new fy(this,vl.leave,af({}),this.timeout).send(),this.state=Qs.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(vl.reply,(n,s)=>{this.trigger(this.replyEventName(s),n)})}join(t=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Qs.closed,this.bindings=[]}onClose(t){this.on(vl.close,t)}onError(t){return this.on(vl.error,e=>t(e))}on(t,e){let r=this.bindingRef++;return this.bindings.push({event:t,ref:r,callback:e}),r}off(t,e){this.bindings=this.bindings.filter(r=>!(r.event===t&&(typeof e>"u"||e===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,r=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new fy(this,t,function(){return e},r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Qs.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(vl.close,"leave")},r=new fy(this,vl.leave,af({}),t);return r.receive("ok",()=>e()).receive("timeout",()=>e()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(t,e,r){return e}filterBindings(t,e,r){return!0}isMember(t,e,r,n){return this.topic!==t?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:r,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Qs.joining,this.joinPush.resend(t))}trigger(t,e,r,n){let s=this.onMessage(t,e,r,n);if(e&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(a=>a.event===t&&this.filterBindings(a,e,r));for(let a=0;a<i.length;a++)i[a].callback(s,r,n||this.joinRef())}replyEventName(t){return`chan_reply_${t}`}isClosed(){return this.state===Qs.closed}isErrored(){return this.state===Qs.errored}isJoined(){return this.state===Qs.joined}isJoining(){return this.state===Qs.joining}isLeaving(){return this.state===Qs.leaving}},O_=class{static request(t,e,r,n,s,i,a){if(So.XDomainRequest){let l=new So.XDomainRequest;return this.xdomainRequest(l,t,e,n,s,i,a)}else if(So.XMLHttpRequest){let l=new So.XMLHttpRequest;return this.xhrRequest(l,t,e,r,n,s,i,a)}else{if(So.fetch&&So.AbortController)return this.fetchRequest(t,e,r,n,s,i,a);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(t,e,r,n,s,i,a){let l={method:t,headers:r,body:n},u=null;return s&&(u=new AbortController,setTimeout(()=>u.abort(),s),l.signal=u.signal),So.fetch(e,l).then(h=>h.text()).then(h=>this.parseJSON(h)).then(h=>a&&a(h)).catch(h=>{h.name==="AbortError"&&i?i():a&&a(null)}),u}static xdomainRequest(t,e,r,n,s,i,a){return t.timeout=s,t.open(e,r),t.onload=()=>{let l=this.parseJSON(t.responseText);a&&a(l)},i&&(t.ontimeout=i),t.onprogress=()=>{},t.send(n),t}static xhrRequest(t,e,r,n,s,i,a,l){t.open(e,r,!0),t.timeout=i;
vendor: 15,284 bytes, lines 388-389
388for(let[u,h]of Object.entries(n))t.setRequestHeader(u,h);return t.onerror=()=>l&&l(null),t.onreadystatechange=()=>{if(t.readyState===z7.complete&&l){let u=this.parseJSON(t.responseText);l(u)}},a&&(t.ontimeout=a),t.send(s),t}static parseJSON(t){if(!t||t==="")return null;try{return JSON.parse(t)}catch{return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let r=[];for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let s=e?`${e}[${n}]`:n,i=t[n];typeof i=="object"?r.push(this.serialize(i,s)):r.push(encodeURIComponent(s)+"="+encodeURIComponent(i))}return r.join("&")}static appendParams(t,e){if(Object.keys(e).length===0)return t;let r=t.match(/\?/)?"&":"?";return`${t}${r}${this.serialize(e)}`}},B7=t=>{let e="",r=new Uint8Array(t),n=r.byteLength;for(let s=0;s<n;s++)e+=String.fromCharCode(r[s]);return btoa(e)},_h=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(Wk)&&(this.authToken=atob(e[1].slice(Wk.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=No.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+qk.websocket),"$1/"+qk.longpoll)}endpointURL(){return O_.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,r){this.close(t,e,r),this.readyState=No.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===No.open||this.readyState===No.connecting}poll(){const t={Accept:"application/json"};this.authToken&&(t["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",t,null,()=>this.ontimeout(),e=>{if(e){var{status:r,token:n,messages:s}=e;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=n}else r=0;switch(r){case 200:s.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=No.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${r}`)}})}send(t){typeof t!="string"&&(t=B7(t)),this.currentBatch?this.currentBatch.push(t):this.awaitingBatchAck?this.batchBuffer.push(t):(this.currentBatch=[t],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(t,e=0){this.awaitingBatchAck=!0;const r=e+$7,n=t.slice(e,r);this.ajax("POST",{"Content-Type":"application/x-ndjson"},n.join(`
389`),()=>this.onerror("timeout"),s=>{!s||s.status!==200?(this.awaitingBatchAck=!1,this.onerror(s&&s.status),this.closeAndRetry(1011,"internal server error",!1)):r<t.length?this.batchSend(t,r):this.batchBuffer.length>0?(this.batchSend(this.batchBuffer),this.batchBuffer=[]):this.awaitingBatchAck=!1})}close(t,e,r){for(let s of this.reqs)s.abort();this.readyState=No.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(t,e,r,n,s){let i,a=()=>{this.reqs.delete(i),n()};i=O_.request(t,this.endpointURL(),e,r,this.timeout,a,l=>{this.reqs.delete(i),this.isActive()&&s(l)}),this.reqs.add(i)}},V7=class gm{constructor(e,r={}){let n=r.events||{state:"presence_state",diff:"presence_diff"};this.state=Object.create(null),this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,s=>{let{onJoin:i,onLeave:a,onSync:l}=this.caller;this.joinRef=this.channel.joinRef(),this.state=gm.syncState(this.state,s,i,a),this.pendingDiffs.forEach(u=>{this.state=gm.syncDiff(this.state,u,i,a)}),this.pendingDiffs=[],l()}),this.channel.on(n.diff,s=>{let{onJoin:i,onLeave:a,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=gm.syncDiff(this.state,s,i,a),l())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return gm.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,r,n,s){let i=this.toNullProtoObj(this.clone(e));r=this.toNullProtoObj(r);let a=Object.create(null),l=Object.create(null);return this.map(i,(u,h)=>{r[u]||(l[u]=h)}),this.map(r,(u,h)=>{let p=i[u];if(p){let f=h.metas.map(x=>x.phx_ref),g=p.metas.map(x=>x.phx_ref),v=h.metas.filter(x=>g.indexOf(x.phx_ref)<0),_=p.metas.filter(x=>f.indexOf(x.phx_ref)<0);v.length>0&&(a[u]=h,a[u].metas=v),_.length>0&&(l[u]=this.clone(p),l[u].metas=_)}else a[u]=h}),this.syncDiff(i,{joins:a,leaves:l},n,s)}static syncDiff(e,r,n,s){e=this.toNullProtoObj(e);let{joins:i,leaves:a}=this.clone(r);return n||(n=function(){}),s||(s=function(){}),this.map(i,(l,u)=>{let h=e[l];if(e[l]=this.clone(u),h){let p=e[l].metas.map(g=>g.phx_ref),f=h.metas.filter(g=>p.indexOf(g.phx_ref)<0);e[l].metas.unshift(...f)}n(l,h,u)}),this.map(a,(l,u)=>{let h=e[l];if(!h)return;let p=u.metas.map(f=>f.phx_ref);h.metas=h.metas.filter(f=>p.indexOf(f.phx_ref)<0),s(l,h,u),h.metas.length===0&&delete e[l]}),e}static list(e,r){return r||(r=function(n,s){return s}),this.map(e,(n,s)=>r(n,s))}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static toNullProtoObj(e){if(Object.getPrototypeOf(e)===null)return e;let r=Object.create(null);return Object.getOwnPropertyNames(e).forEach(n=>{r[n]=e[n]}),r}static clone(e){return JSON.parse(JSON.stringify(e))}},py={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(r))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[r,n,s,i,a]=JSON.parse(t);return e({join_ref:r,ref:n,topic:s,event:i,payload:a})}},binaryEncode(t){let{join_ref:e,ref:r,event:n,topic:s,payload:i}=t,a=new TextEncoder,l=a.encode(e),u=a.encode(r),h=a.encode(s),p=a.encode(n);this.assertFieldSize(l.byteLength,"join_ref"),this.assertFieldSize(u.byteLength,"ref"),this.assertFieldSize(h.byteLength,"topic"),this.assertFieldSize(p.byteLength,"event");let f=this.META_LENGTH+l.byteLength+u.byteLength+h.byteLength+p.byteLength,g=new ArrayBuffer(this.HEADER_LENGTH+f),v=new Uint8Array(g),_=new DataView(g),x=0;_.setUint8(x++,this.KINDS.push),_.setUint8(x++,l.byteLength),_.setUint8(x++,u.byteLength),_.setUint8(x++,h.byteLength),_.setUint8(x++,p.byteLength),v.set(l,x),x+=l.byteLength,v.set(u,x),x+=u.byteLength,v.set(h,x),x+=h.byteLength,v.set(p,x),x+=p.byteLength;var w=new Uint8Array(g.byteLength+i.byteLength);return w.set(v,0),w.set(new Uint8Array(i),g.byteLength),w.buffer},assertFieldSize(t,e){if(t>255)throw new Error(`unable to convert ${e} to binary: must be less than or equal to 255 bytes, but is ${t} bytes`)},binaryDecode(t){let e=new DataView(t),r=e.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(t,e,n);case this.KINDS.reply:return this.decodeReply(t,e,n);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,n)}},decodePush(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=e.getUint8(3),a=this.HEADER_LENGTH+this.META_LENGTH-1,l=r.decode(t.slice(a,a+n));a=a+n;let u=r.decode(t.slice(a,a+s));a=a+s;let h=r.decode(t.slice(a,a+i));a=a+i;let p=t.slice(a,t.byteLength);return{join_ref:l,ref:null,topic:u,event:h,payload:p}},decodeReply(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=e.getUint8(3),a=e.getUint8(4),l=this.HEADER_LENGTH+this.META_LENGTH,u=r.decode(t.slice(l,l+n));l=l+n;let h=r.decode(t.slice(l,l+s));l=l+s;let p=r.decode(t.slice(l,l+i));l=l+i;let f=r.decode(t.slice(l,l+a));l=l+a;let g=t.slice(l,t.byteLength),v={status:f,response:g};return{join_ref:u,ref:h,topic:p,event:vl.reply,payload:v}},decodeBroadcast(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=this.HEADER_LENGTH+2,a=r.decode(t.slice(i,i+n));i=i+n;let l=r.decode(t.slice(i,i+s));i=i+s;let u=t.slice(i,t.byteLength);return{join_ref:null,ref:null,topic:a,event:l,payload:u}}},H7=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||L7,this.transport=e.transport||So.WebSocket||_h,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=So&&So.sessionStorage}catch{}this.sessionStore=e.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=py.encode.bind(py),this.defaultDecoder=py.decode.bind(py),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==_h?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;Vh&&Vh.addEventListener&&(Vh.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),n=this.connectClock)}),Vh.addEventListener("pageshow",s=>{n===this.connectClock&&(n=null,this.connect())}),Vh.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=e.autoSendHeartbeat??!0,this.heartbeatCallback=e.heartbeatCallback??(()=>{}),this.rejoinAfterMs=s=>e.rejoinAfterMs?e.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>e.reconnectAfterMs?e.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(s,i,a)=>{console.log(`${s}: ${i}`,a)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=af(e.params||{}),this.endPoint=`${t}/${qk.websocket}`,this.vsn=e.vsn||M7,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new EF(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken&&af(e.authToken)}getLongPollTransport(){return _h}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=O_.appendParams(O_.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return t.charAt(0)!=="/"?t:t.charAt(1)==="/"?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,t&&t()},e,r)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=af(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==_h?this.connectWithFallback(_h,this.longPollFallbackMs):this.transportConnect())}log(t,e,r){this.logger&&this.logger(t,e,r)}hasLogger(){return this.logger!==null}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}onHeartbeat(t){this.heartbeatCallback=t}ping(t){if(!this.isConnected())return!1;let e=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let n=this.onMessage(s=>{s.ref===e&&(this.off([n]),t(Date.now()-r))});return!0}transportName(t){switch(t){case _h:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${Wk}${btoa(this.authToken()).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),t),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(t){return this.sessionStore&&this.sessionStore.getItem(t)}storeSession(t,e){this.sessionStore&&this.sessionStore.setItem(t,e)}connectWithFallback(t,e=2500){clearTimeout(this.fallbackTimer);let r=!1,n=!0,s,i,a=this.transportName(t),l=u=>{this.log("transport",`falling back to ${a}...`,u),this.off([s,i]),n=!1,this.replaceTransport(t),this.transportConnect()};if(this.getSession(`phx:fallback:${a}`))return l("memorized");this.fallbackTimer=setTimeout(l,e),i=this.onError(u=>{this.log("transport","error",u),n&&!r&&(clearTimeout(this.fallbackTimer),l(u))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!n){let u=this.transportName(t);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${u}`,"true"),this.log("transport",`established ${u} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(l,e),this.ping(u=>{this.log("transport","connected to primary after",u),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),F7,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,r){if(!this.conn)return t&&t();const n=this.conn;this.waitForBufferDone(n,()=>{e?n.close(e,r||""):n.close(),this.waitForSocketClosed(n,()=>{this.conn===n&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){}
vendor: 5,018 bytes, line 389
389,this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e,r=1){if(r===5||!t.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(t,e,r+1)},150*r)}waitForSocketClosed(t,e,r=1){if(r===5||t.readyState===No.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(t,e,r+1)},150*r)}onConnClose(t){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(t),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",t)}onConnError(t){this.hasLogger()&&this.log("transport","error",t);let e=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",t,e,r),(e===this.transport||r>0)&&this.triggerChanError(t)}triggerChanError(t){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(vl.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case No.connecting:return"connecting";case No.open:return"open";case No.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e!==t)}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([r])=>t.indexOf(r)===-1)}channel(t,e={}){let r=new U7(t,e,this);return this.channels.push(r),r}push(t){if(this.hasLogger()){let{topic:e,event:r,payload:n,ref:s,join_ref:i}=t;this.log("push",`${e} ${r} (${i}, ${s})`,n)}this.isConnected()?this.encode(t,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(t,e=>this.conn.send(e)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,e=>{let{topic:r,event:n,payload:s,ref:i,join_ref:a}=e;if(i&&i===this.pendingHeartbeatRef){const l=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(s.status==="ok"?"ok":"error",l)}catch(u){this.log("error","error in heartbeat callback",u)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${s.status||""} ${r} ${n} ${i&&"("+i+")"||""}`.trim(),s);for(let l=0;l<this.channels.length;l++){const u=this.channels[l];u.isMember(r,n,s,a)&&u.trigger(n,s,i,a)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(t,...e){try{this.stateChangeCallbacks[t].forEach(([r,n])=>{try{n(...e)}catch(s){this.log("error",`error in ${t} callback`,s)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}leaveOpenTopic(t){let e=this.channels.find(r=>r.topic===t&&(r.isJoined()||r.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}};class Pm{constructor(e,r){const n=W7(r);this.presence=new V7(e.getChannel(),n),this.presence.onJoin((s,i,a)=>{const l=Pm.onJoinPayload(s,i,a);e.getChannel().trigger("presence",l)}),this.presence.onLeave((s,i,a)=>{const l=Pm.onLeavePayload(s,i,a);e.getChannel().trigger("presence",l)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return Pm.transformState(this.presence.state)}static transformState(e){return e=q7(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{const s=e[n];return r[n]=i_(s),r},{})}static onJoinPayload(e,r,n){const s=mT(r),i=i_(n);return{event:"join",key:e,currentPresences:s,newPresences:i}}static onLeavePayload(e,r,n){const s=mT(r),i=i_(n);return{event:"leave",key:e,currentPresences:s,leftPresences:i}}}function i_(t){return t.metas.map(e=>{const r=Object.getOwnPropertyDescriptors(e),n=Object.defineProperties({},r);return n.presence_ref=n.phx_ref,delete n.phx_ref,delete n.phx_ref_prev,n})}function q7(t){return JSON.parse(JSON.stringify(t))}function W7(t){return(t==null?void 0:t.events)&&{events:t.events}}function mT(t){return t!=null&&t.metas?i_(t):[]}var gT;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(gT||(gT={}));class G7{get state(){return this.presenceAdapter.state}constructor(e,r){this.channel=e,this.presenceAdapter=new Pm(this.channel.channelAdapter,r)}}function K7(t){if(t instanceof Error)return t;if(typeof t=="string")return new Error(t);if(t&&typeof t=="object"){const e=t;
389if(typeof e.code=="number"){const r=typeof e.reason=="string"&&e.reason?` (${e.reason})`:"";return new Error(`socket closed: ${e.code}${r}`,{cause:t})}return new Error("channel error: transport failure",{cause:t})}return new Error("channel error: connection lost")}class Y7{constructor(e,r,n){const s=Z7(n);this.channel=e.getSocket().channel(r,s),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,r){return this.channel.on(e,r)}off(e,r){this.channel.off(e,r)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,r,n){let s;try{s=this.channel.push(e,r,n)}catch{throw new Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>C7){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return s}updateJoinPayload(e){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),e)}canPush(){return this.socket.isConnected()&&this.state===Ic.joined}isJoined(){return this.state===Ic.joined}isJoining(){return this.state===Ic.joining}isClosed(){return this.state===Ic.closed}isLeaving(){return this.state===Ic.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function Z7(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}const J7=/[,()"\\]/,Q7=t=>J7.test(t)||t!==t.trim(),X7=t=>`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,vT=t=>{const e=t===null?"null":String(t);return Q7(e)?X7(e):e},eK=t=>t===null?"null":String(t),tK=(t,e)=>{if(t==="in"){const r=Array.isArray(e)?e:[e];if(r.length===0)throw new Error("Realtime `in` filter requires at least one value.");return`in.(${Array.from(new Set(r)).map(s=>vT(s)).join(",")})`}return t==="is"?`is.${eK(e)}`:`${t}.${vT(e)}`};class rK{constructor(){this.filters=[]}add(e,r,n,s=!1){const i=s?"not.":"";return this.filters.push(`${e}=${i}${tK(r,n)}`),this}eq(e,r){return this.add(e,"eq",r)}neq(e,r){return this.add(e,"neq",r)}gt(e,r){return this.add(e,"gt",r)}gte(e,r){return this.add(e,"gte",r)}lt(e,r){return this.add(e,"lt",r)}lte(e,r){return this.add(e,"lte",r)}in(e,r){return this.add(e,"in",r)}like(e,r){return this.add(e,"like",r)}ilike(e,r){return this.add(e,"ilike",r)}match(e,r){return this.add(e,"match",r)}imatch(e,r){return this.add(e,"imatch",r)}is(e,r){return this.add(e,"is",r)}isDistinct(e,r){return this.add(e,"isdistinct",r)}not(e,r,n){return this.add(e,r,n,!0)}build(){return this.filters.join(",")}toString(){return this.build()}}var yT;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(yT||(yT={}));var rd;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(rd||(rd={}));var yl;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(yl||(yl={}));class _l{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,r={config:{}},n){var s,i;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new Y7(this.socket.socketAdapter,e,this.params),this.presence=new G7(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=kF(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||i===void 0)&&i.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,r=this.timeout){var n,s,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:a,presence:l,private:u}}=this.params,h=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(v=>v.filter))!==null&&s!==void 0?s:[],p=!!this.bindings[rd.PRESENCE]&&this.bindings[rd.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,f={},g={broadcast:a,presence:Object.assign(Object.assign({},l),{enabled:p}),postgres_changes:h,private:u};this.socket.accessTokenValue&&(f.access_token=this.socket.accessTokenValue),this._onError(v=>{e==null||e(yl.CHANNEL_ERROR,K7(v))}),this._onClose(()=>e==null?void 0:e(yl.CLOSED)),this.updateJoinPayload(Object.assign({config:g},f)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:v})=>
389{if(this.socket._isManualToken()||this.socket.setAuth(),v===void 0){e==null||e(yl.SUBSCRIBED);return}this._updatePostgresBindings(v,e)}).receive("error",v=>{this.state=Ic.errored;const _=Object.values(v).join(", ")||"error";e==null||e(yl.CHANNEL_ERROR,new Error(_,{cause:v}))}).receive("timeout",()=>{e==null||e(yl.TIMED_OUT)})}return this}_updatePostgresBindings(e,r){var n;const s=this.bindings.postgres_changes,i=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0,a=[];for(let l=0;l<i;l++){const u=s[l],{filter:{event:h,schema:p,table:f,filter:g}}=u,v=e&&e[l];if(v&&v.event===h&&_l.isFilterValueEqual(v.schema,p)&&_l.isFilterValueEqual(v.table,f)&&_l.isFilterValueEqual(v.filter,g))a.push(Object.assign(Object.assign({},u),{id:v.id}));else{this.unsubscribe(),this.state=Ic.errored,r==null||r(yl.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=a,this.state!=Ic.errored&&r&&r(yl.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){const s=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=e===rd.PRESENCE||e===rd.POSTGRES_CHANGES;if(s&&i)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,r,n)}async httpSend(e,r,n={}){var s;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const i=r instanceof ArrayBuffer||ArrayBuffer.isView(r),a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":i?"application/octet-stream":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l=new URL(this.broadcastEndpointURL);l.pathname+=`/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(e)}`,this.private&&l.searchParams.set("private","true");const u={method:"POST",headers:a,body:i?r:JSON.stringify(r)},h=await this._fetchWithTimeout(l.toString(),u,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);if(h.status===202)return{success:!0};if(h.status===404)return Promise.reject(new Error("httpSend() requires Realtime server v2.97.0 or newer; the endpoint returned 404. Update your Supabase CLI to a recent version, or upgrade the Realtime server in your self-hosted setup. See https://github.com/supabase/supabase-js/blob/master/packages/core/realtime-js/migrations/httpsend-server-version.md"));let p=h.statusText;try{const f=await h.json();p=f.error||f.message||p}catch{}return Promise.reject(new Error(p))}async send(e,r={}){var n,s;if(!this.channelAdapter.canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated 
389in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:a}=e,l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const u={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:a,private:this.private}]})};try{const h=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((s=h.body)===null||s===void 0?void 0:s.cancel()),h.ok?"ok":"error"}catch(h){return h instanceof Error&&h.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var a,l,u;const h=this.channelAdapter.push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((u=(l=(a=this.params)===null||a===void 0?void 0:a.config)===null||l===void 0?void 0:l.broadcast)===null||u===void 0)&&u.ack)&&i("ok"),h.receive("ok",()=>i("ok")),h.receive("error",()=>i("error")),h.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,r,n){const s=new AbortController,i=setTimeout(()=>s.abort(),n),a=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:s.signal}));return clearTimeout(i),a}_on(e,r,n){var s;const i=e.toLocaleLowerCase(),a=r==null?void 0:r.filter;if((a instanceof rK||typeof a=="object"&&a!==null&&typeof a.build=="function")&&(r=Object.assign(Object.assign({},r),{filter:a.build()})),i===rd.POSTGRES_CHANGES&&((s=this.bindings[i])===null||s===void 0?void 0:s.find(p=>_l.isSamePostgresFilter(p.filter,r))))return this.socket.log("error",`duplicate \`postgres_changes\` binding for ${this.topic} ignored`,r),this;const l=this.channelAdapter.on(e,n),u={type:i,filter:r,callback:n,ref:l};return this.bindings[i]?this.bindings[i].push(u):this.bindings[i]=[u],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,r,n)=>{var s,i,a,l,u,h,p;const f=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(f,n))return!1;const g=(s=this.bindings[f])===null||s===void 0?void 0:s.find(v=>v.ref===e.ref);if(!g)return!0;if(["broadcast","presence","postgres_changes"].includes(f))if("id"in g){const v=g.id,_=(i=g.filter)===null||i===void 0?void 0:i.event;return v&&((a=r.ids)===null||a===void 0?void 0:a.includes(v))&&(_==="*"||(_==null?void 0:_.toLocaleLowerCase())===((l=r.data)===null||l===void 0?void 0:l.type.toLocaleLowerCase()))}else{const v=(h=(u=g==null?void 0:g.filter)===null||u===void 0?void 0:u.event)===null||h===void 0?void 0:h.toLocaleLowerCase();return v==="*"||v===((p=r==null?void 0:r.event)===null||p===void 0?void 0:p.toLocaleLowerCase())}else return g.type.toLocaleLowerCase()===f})}_notThisChannelEvent(e,r){const{close:n,error:s,leave:i,join:a}=xF;return r&&[n,s,i,a].includes(e)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,r,n)=>{if(typeof r=="object"&&"ids"in r){const s=r.data,{schema:i,table:a,commit_timestamp:l,type:u,errors:h}=s;return Object.assign(Object.assign({},{schema:i,table:a,commit_timestamp:l,eventType:u,new:{},old:{},errors:h}),this._getPayloadRecords(s))}return r})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in e.bindings)for(const n of e.bindings[r])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,r){return(e??void 0)===(r??void 0)}static isSamePostgresFilter(e,r){var n,s,i,a;const l=(s=(n=e==null?void 0:e.select)===null||n===void 0?void 0:n.join())!==null&&s!==void 0?s:void 0,u=(a=(i=r==null?void 0:r.select)===null||i===void 0?void 0:i.join())!==null&&a!==void 0?a:void 0;return(e==null?void 0:e.event)===(r==null?void 0:r.event)&&_l.isFilterValueEqual(e==null?void 0:e.sc
389hema,r==null?void 0:r.schema)&&_l.isFilterValueEqual(e==null?void 0:e.table,r==null?void 0:r.table)&&_l.isFilterValueEqual(e==null?void 0:e.filter,r==null?void 0:r.filter)&&l===u}_getPayloadRecords(e){const r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=pT(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=pT(e.columns,e.old_record)),r}}class nK{constructor(e,r){this.socket=new H7(e,r)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,r,n,s=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),s),this.socket.disconnect(()=>{e(),i("ok")},r,n)})}push(e){this.socket.push(e)}log(e,r,n){this.socket.log(e,r,n)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==Vk.connecting}isDisconnecting(){return this.socket.connectionState()==Vk.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const _T={HEARTBEAT_INTERVAL:25e3},sK=[1e3,2e3,5e3,1e4],iK=1e4;function aK(){const t=new Map;return{get length(){return t.size},clear(){t.clear()},getItem(e){return t.has(e)?t.get(e):null},key(e){var r;return(r=Array.from(t.keys())[e])!==null&&r!==void 0?r:null},removeItem(e){t.delete(e)},setItem(e,r){t.set(e,String(r))}}}function oK(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return aK()}const lK=`
390  addEventListener("message", (e) => {
391    if (e.data.event === "start") {
392      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
393    }
394  });`;class cK{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,r){var n;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new N7,this._manuallySetToken=!1,this._authPromise=null,this._authGeneration=0,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=i=>i?(...a)=>i(...a):(...a)=>fetch(...a),!(!((n=r==null?void 0:r.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey;const s=this._initializeOptions(r);this.socketAdapter=new nK(e,s),this.httpEndpoint=kF(e),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const r=e.message;throw new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,r){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,r)}getChannels(){return this.channels}async removeChannel(e){const r=await e.unsubscribe();return r==="ok"&&e.teardown(),r}async removeAllChannels(){const e=this.channels.map(async n=>{const s=await n.unsubscribe();return n.teardown(),s}),r=await Promise.all(e);return await this.disconnect(),r}log(e,r,n){this.socketAdapter.log(e,r,n)}connectionState(){return this.socketAdapter.connectionState()||Vk.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,r={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(i=>i.topic===n);if(s)return s;{const i=new _l(`realtime:${e}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){const r=++this._authGeneration,n=this._performAuth(e,r);r===this._authGeneration&&(this._authPromise=n);try{await n}finally{this._authPromise===n&&(this._authPromise=null)}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}
394this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e,r){let n,s=!1;if(e)n=e,s=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(i){this.log("error","Error fetching access token from callback",i),n=this.accessTokenValue}else n=this.accessTokenValue;r===this._authGeneration&&(this.accessToken?this._manuallySetToken=!1:s&&(this._manuallySetToken=!0),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(i=>{const a={access_token:n,version:S7};i.updateJoinPayload(a),i.joinedOnce&&i.channelAdapter.isJoined()&&i.channelAdapter.push(xF.access_token,{access_token:n})})))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${e}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(r,n)=>{r!=="disconnected"&&(r=="sent"&&this._setAuthSafely(),e&&e(r,n))}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let r;if(e)r=e;else{const n=new Blob([lK],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_initializeOptions(e){var r,n,s,i,a,l,u,h,p,f,g,v;this.worker=(r=e==null?void 0:e.worker)!==null&&r!==void 0?r:!1,this.accessToken=(n=e==null?void 0:e.accessToken)!==null&&n!==void 0?n:null;const _={};_.timeout=(s=e==null?void 0:e.timeout)!==null&&s!==void 0?s:j7,_.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:_T.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(a=e==null?void 0:e.disconnectOnEmptyChannelsAfterMs)!==null&&a!==void 0?a:2*((l=e==null?void 0:e.heartbeatIntervalMs)!==null&&l!==void 0?l:_T.HEARTBEAT_INTERVAL),_.transport=(u=e==null?void 0:e.transport)!==null&&u!==void 0?u:w7.getWebSocketConstructor(),_.params=e==null?void 0:e.params,_.logger=e==null?void 0:e.logger,_.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),_.sessionStorage=(h=e==null?void 0:e.sessionStorage)!==null&&h!==void 0?h:oK(),_.reconnectAfterMs=(p=e==null?void 0:e.reconnectAfterMs)!==null&&p!==void 0?p:(k=>sK[k-1]||iK);let x,w;const S=(f=e==null?void 0:e.vsn)!==null&&f!==void 0?f:E7;switch(S){case k7:x=(k,j)=>j(JSON.stringify(k)),w=(k,j)=>j(JSON.parse(k));break;case wF:x=this.serializer.encode.bind(this.serializer),w=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${_.vsn}`)}if(_.vsn=S,_.encode=(g=e==null?void 0:e.encode)!==null&&g!==void 0?g:x,_.decode=(v=e==null?void 0:e.decode)!==null&&v!==void 0?v:w,_.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,_.params=Object.assign(Object.assign({},_.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl,_.autoSendHeartbeat=!this.worker}return _}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}
394var Hm=class extends Error{constructor(t,e){var r;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((r=e.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function uK(t,e,r){const n=new URL(e,t);if(r)for(const[s,i]of Object.entries(r))i!==void 0&&n.searchParams.set(s,i);return n.toString()}async function dK(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function hK(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:i,headers:a}){const l=uK(t.baseUrl,n,s),u=await dK(t.auth),h=await e(l,{method:r,headers:{...i?{"Content-Type":"application/json"}:{},...u,...a},body:i?JSON.stringify(i):void 0}),p=await h.text(),f=(h.headers.get("content-type")||"").includes("application/json"),g=f&&p?JSON.parse(p):p;if(!h.ok){const v=f?g:void 0,_=v==null?void 0:v.error;throw new Hm((_==null?void 0:_.message)??`Request failed with status ${h.status}`,{status:h.status,icebergType:_==null?void 0:_.type,icebergCode:_==null?void 0:_.code,details:v})}return{status:h.status,headers:h.headers,data:g}}}}function my(t){return t.join("�")}var fK=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:my(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(t,e){const r={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${my(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${my(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${my(t.namespace)}`}),!0}catch(e){if(e instanceof Hm&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof Hm&&r.status===409)return;throw r}}};function bh(t){return t.join("�")}var pK=class{constructor(t,e="",r){this.client=t,this.prefix=e,this.accessDelegation=r}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${bh(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${bh(t.namespace)}/tables`,body:e,headers:r})).data.metadata}async updateTable(t,e){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${bh(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${bh(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${bh(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${bh(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof Hm&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof Hm&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},mK=class{constructor(t){var n;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=hK({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(n=t.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new fK(this.client,e),this.tableOps=new pK(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}
394async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}};function qm(t){"@babel/helpers - typeof";return qm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qm(t)}function gK(t,e){if(qm(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(qm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function vK(t){var e=gK(t,"string");return qm(e)=="symbol"?e:e+""}function yK(t,e,r){return(e=vK(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Pt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?bT(Object(r),!0).forEach(function(n){yK(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bT(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Xb=class extends Error{constructor(t,e="storage",r,n){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function ew(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Gk=class extends Xb{constructor(t,e,r,n="storage",s){super(t,n,e,r),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=r,this.co
394de=s}toJSON(){return Pt(Pt({},super.toJSON()),{},{code:this.code})}},jF=class extends Xb{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function M_(t,e,r){const n=Pt({},t),s=e.toLowerCase();for(const i of Object.keys(n))i.toLowerCase()===s&&delete n[i];return n[s]=r,n}function _K(t){const e={};for(const[r,n]of Object.entries(t))e[r.toLowerCase()]=n;return e}const bK=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),wK=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Kk=t=>{if(Array.isArray(t))return t.map(r=>Kk(r));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([r,n])=>{const s=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=Kk(n)}),e},xK=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),CF=t=>t.split("/").map(encodeURIComponent).join("/"),wT=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error;if(typeof e.error=="object"&&e.error!==null){const r=e.error;if(typeof r.message=="string")return r.message}}return JSON.stringify(t)},SK=async(t,e,r,n)=>{if(t!==null&&typeof t=="object"&&"json"in t&&typeof t.json=="function"){const s=t;let i=parseInt(String(s.status),10);Number.isFinite(i)||(i=500),s.json().then(a=>{const l=(a==null?void 0:a.statusCode)||(a==null?void 0:a.code)||i+"";e(new Gk(wT(a),i,l,n,a==null?void 0:a.code))}).catch(()=>{const a=i+"";e(new Gk(s.statusText||`HTTP ${i} error`,i,a,n))})}else e(new jF(wT(t),t,n))},kK=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!n)return Pt(Pt({},s),r);if(wK(n)){var i;const a=(e==null?void 0:e.headers)||{};let l;for(const[u,h]of Object.entries(a))u.toLowerCase()==="content-type"&&(l=h);s.headers=M_(a,"Content-Type",(i=l)!==null&&i!==void 0?i:"application/json"),s.body=JSON.stringify(n)}else s.body=n;return e!=null&&e.duplex&&(s.duplex=e.duplex),Pt(Pt({},s),r)};async function Wp(t,e,r,n,s,i,a){return new Promise((l,u)=>{t(r,kK(e,n,s,i)).then(h=>{if(!h.ok)throw h;if(n!=null&&n.noResolveJson)return h;if(a==="vectors"){const p=h.headers.get("content-type");if(h.headers.get("content-length")==="0"||h.status===204)return{};if(!p||!p.includes("application/json"))return{}}return h.json()}).then(h=>l(h)).catch(h=>SK(h,u,n,a))})}function NF(t="storage"){return{get:async(e,r,n,s)=>Wp(e,"GET",r,n,s,void 0,t),post:async(e,r,n,s,i)=>Wp(e,"POST",r,s,i,n,t),put:async(e,r,n,s,i)=>Wp(e,"PUT",r,s,i,n,t),head:async(e,r,n,s)=>Wp(e,"HEAD",r,Pt(Pt({},n),{},{noResolveJson:!0}),s,void 0,t),remove:async(e,r,n,s,i)=>Wp(e,"DELETE",r,s,i,n,t)}}const EK=NF("storage"),{get:Wm,post:za,put:Yk,head:jK,remove:Gm}=EK,Ri=NF("vectors");var tp=class{constructor(t,e={},r,n="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=_K(e),this.fetch=bK(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=M_(this.headers,t,e),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ew(r))return{data:null,error:r};throw r}}};let PF;PF=Symbol.toStringTag;var CK=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[PF]="StreamDownloadBuilder",this.promise=null}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(ew(e))return{data:null,error:e};throw e}}};let RF;RF=Symbol.toStringTag;var NK=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[RF]="BlobDownloadBuilder",this.promise=null}asStream(){return new CK(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(ew(e))return{data:null,error:e};throw e}}};const Ox={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},xT={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var PK=class extends tp{constructor(t,e={},r,n){super(t,e,n,"storage"),this.bucketId=r}async uploadOrUpdate(t,e,r,n){var s=this;return s.handleOperation(async()=>{let i;const a=Pt(Pt({},xT),n);let l=Pt(Pt({},s.headers),t==="POST"&&{"x-upsert":String(a.upsert)});const u=a.metadata;if(typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),u&&i.append("metadata",s.encodeMetadata(u)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.has("cacheControl")||i.append("cacheControl",a.cacheControl),u&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(u))):(i=r,l["cache-control"]=`max-age=${a.cacheControl}`,l["content-type"]=a.contentType,u&&(l["x-metadata"]=s.toBase64(s.encodeMetadata(u))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!a.duplex&&(a.duplex="half")),n!=null&&n.headers)for(const[g,v]of Object.entries(n.headers))l=M_(l,g,v);const h=s._removeEmptyFolders(e),p=s._getFinalPath(h),f=await(t=="PUT"?Yk:za)(s.fetch,`${s.url}/object/${p}`,i,Pt({headers:l},a!=null&&a.duplex?{duplex:a.duplex}:{}));return{path:h,id:f.Id,fullPath:f.Key}})}async upload(t,e,r){return this.uploadOrUpdate("POST",t,e,r)}
394async uploadToSignedUrl(t,e,r,n){var s=this;const i=s._removeEmptyFolders(t),a=s._getFinalPath(i),l=new URL(s.url+`/object/upload/sign/${a}`);return l.searchParams.set("token",e),s.handleOperation(async()=>{let u;const h=Pt(Pt({},xT),n);let p=Pt(Pt({},s.headers),{"x-upsert":String(h.upsert)});const f=h.metadata;if(typeof Blob<"u"&&r instanceof Blob?(u=new FormData,u.append("cacheControl",h.cacheControl),f&&u.append("metadata",s.encodeMetadata(f)),u.append("",r)):typeof FormData<"u"&&r instanceof FormData?(u=r,u.has("cacheControl")||u.append("cacheControl",h.cacheControl),f&&!u.has("metadata")&&u.append("metadata",s.encodeMetadata(f))):(u=r,p["cache-control"]=`max-age=${h.cacheControl}`,p["content-type"]=h.contentType,f&&(p["x-metadata"]=s.toBase64(s.encodeMetadata(f))),(typeof ReadableStream<"u"&&u instanceof ReadableStream||u&&typeof u=="object"&&"pipe"in u&&typeof u.pipe=="function")&&!h.duplex&&(h.duplex="half")),n!=null&&n.headers)for(const[g,v]of Object.entries(n.headers))p=M_(p,g,v);return{path:i,fullPath:(await Yk(s.fetch,l.toString(),u,Pt({headers:p},h!=null&&h.duplex?{duplex:h.duplex}:{}))).Key}})}async createSignedUploadUrl(t,e){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(t);const s=Pt({},r.headers);e!=null&&e.upsert&&(s["x-upsert"]="true");const i=await za(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),a=new URL(r.url+i.url),l=a.searchParams.get("token");if(!l)throw new Xb("No token returned by API");return{signedUrl:a.toString(),path:t,token:l}})}async update(t,e,r){return this.uploadOrUpdate("PUT",t,e,r)}async move(t,e,r){var n=this;return n.handleOperation(async()=>await za(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers}))}async copy(t,e,r){var n=this;return n.handleOperation(async()=>({path:(await za(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(t,e,r){var n=this;return n.handleOperation(async()=>{let s=n._getFinalPath(t);const i=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let a=await za(n.fetch,`${n.url}/object/sign/${s}`,Pt({expiresIn:e},i?{transform:r.transform}:{}),{headers:n.headers});const l=new URLSearchParams;r!=null&&r.download&&l.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&l.set("cacheNonce",String(r.cacheNonce));const u=l.toString();return{signedUrl:encodeURI(`${n.url}${a.signedURL}${u?`&${u}`:""}`)}})}async createSignedUrls(t,e,r){var n=this;return n.handleOperation(async()=>{const s=await za(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:e,paths:t},{headers:n.headers}),i=new URLSearchParams;r!=null&&r.download&&i.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&i.set("cacheNonce",String(r.cacheNonce));const a=i.toString();return s.map(l=>Pt(Pt({},l),{},{signedUrl:l.signedURL?encodeURI(`${n.url}${l.signedURL}${a?`&${a}`:""}`):null}))})}download(t,e,r){const n=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",s=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(s,e.transform),(e==null?void 0:e.cacheNonce)!=null&&s.set("cacheNonce",String(e.cacheNonce));const i=s.toString(),a=this._getFinalPath(t),l=()=>Wm(this.fetch,`${this.url}/${n}/${a}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new NK(l,this.shouldThrowOnError)}async info(t){var e=this;const r=e._getFinalPath(t);return e.handleOperation(async()=>Kk(await Wm(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})))}async exists(t){var e=this;const r=e._getFinalPath(t);try{return await jK(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(ew(s)){var n;const i=s instanceof Gk?s.status:s instanceof jF?(n=s.originalError)===null||n===void 0?void 0:n.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:s}}throw s}}getPublicUrl(t,e){const r=this._getFinalPath(t),n=new URLSearchParams;e!=null&&e.download&&n.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(n,e.transform),(e==null?void 0:e.cacheNonce)!=null&&n.set("cacheNonce",String(e.cacheNonce));const s=n.toString(),i=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${r}`)+(s?`?${s}`:"")}}}async remove(t){var e=this;return e.handleOperation(async()=>await Gm(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async purgeCache(t,e,r){var n=this;return n.handleOperation(async()=>{const s=CF(n._getFinalPath(t)),i=new URLSearchParams;e!=null&&e.transformations&&i.set("transformations","true");const a=i.toString();return await Gm(n.fetch,`${n.url}/cdn/${s}${a?`?${a}`:""}`,{},{headers:n.headers},r)})}async list(t,e,r){var n=this;return n.handleOperation(async()=>{const s=e!=null&&e.sortBy?Pt(Pt({},Ox.sortBy),e.sortBy):Ox.sortBy,i=Pt(Pt(Pt({},Ox),e),{},{sortBy:s,prefix:t||""});return await za(n.fetch,`${n.url}/object/list/${n.bucketId}`,i,{headers:n.headers},r)})}async listV2(t,e){var r=this;return r.handleOperation(async()=>{const n=Pt({},t);return await za(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},e)})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(t,e){return e.width&&t.set("width",e.width.toString()),e.height&&t.set("height",e.height.toString()),e.resize&&t.set("resize",e.resize),e.format&&t.set("format",e.format),e.quality&&t.set("qual
394ity",e.quality.toString()),t}};const RK="2.112.2",Mg={"X-Client-Info":`storage-js/${RK}`};var AK=class extends tp{constructor(t,e={},r,n){const s=new URL(t);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));const i=s.href.replace(/\/$/,""),a=Pt(Pt({},Mg),e);super(i,a,r,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=e.listBucketOptionsToQueryString(t);return await Wm(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Wm(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var r=this;return r.handleOperation(async()=>await za(r.fetch,`${r.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async updateBucket(t,e){var r=this;return r.handleOperation(async()=>await Yk(r.fetch,`${r.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await za(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Gm(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}async purgeBucketCache(t,e,r){var n=this;return n.handleOperation(async()=>{const s=new URLSearchParams;e!=null&&e.transformations&&s.set("transformations","true");const i=s.toString();return await Gm(n.fetch,`${n.url}/cdn/${CF(t)}${i?`?${i}`:""}`,{},{headers:n.headers},r)})}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},TK=class extends tp{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=Pt(Pt({},Mg),e);super(n,s,r,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await za(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&r.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&r.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&r.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&r.set("sortOrder",t.sortOrder),t!=null&&t.search&&r.set("search",t.search);const n=r.toString(),s=n?`${e.url}/bucket?${n}`:`${e.url}/bucket`;return await Wm(e.fetch,s,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Gm(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!xK(t))throw new Xb("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new mK({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(s,i){const a=s[i];return typeof a!="function"?a:async(...l)=>{try{return{data:await a.apply(s,l),error:null}}catch(u){if(n)throw u;return{data:null,error:u}}}}})}},IK=class extends tp{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=Pt(Pt({},Mg),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await Ri.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var r=this;return r.handleOperation(async()=>await Ri.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await Ri.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var r=this;return r.handleOperation(async()=>await Ri.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{})}},DK=class extends tp{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=Pt(Pt({},Mg),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Ri.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await Ri.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");
394if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(async()=>await Ri.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await Ri.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Ri.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},OK=class extends tp{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=Pt(Pt({},Mg),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Ri.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Ri.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await Ri.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Ri.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},MK=class extends OK{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new LK(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,r=this;return e().call(r,t)}async getBucket(t){var e=()=>super.getBucket,r=this;return e().call(r,t)}async listBuckets(t={}){var e=()=>super.listBuckets,r=this;return e().call(r,t)}async deleteBucket(t){var e=()=>super.deleteBucket,r=this;return e().call(r,t)}},LK=class extends IK{constructor(t,e,r,n){super(t,e,n),this.vectorBucketName=r}async createIndex(t){var e=()=>super.createIndex,r=this;return e().call(r,Pt(Pt({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,Pt(Pt({},t),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,r=this;return e().call(r,r.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,r=this;return e().call(r,r.vectorBucketName,t)}index(t){return new FK(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},FK=class extends DK{constructor(t,e,r,n,s){super(t,e,s),this.vectorBucketName=r,this.indexName=n}async putVectors(t){var e=()=>super.putVectors,r=this;return e().call(r,Pt(Pt({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,Pt(Pt({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,Pt(Pt({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,Pt(Pt({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,Pt(Pt({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},$K=class extends AK{constructor(t,e={},r,n){super(t,e,r,n)}from(t){return new PK(this.url,this.headers,t,this.fetch)}get vectors(){return new MK(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new TK(this.url+"/iceberg",this.headers,this.fetch)}};const AF="2.112.2",bl=30*1e3,vm=3,Mx=vm*bl,zK=2*bl,UK="http://localhost:9999",BK="supabase.auth.token",VK={"X-Client-Info":`gotrue-js/${AF}`},Zk="X-Supabase-Api-Version",TF={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},HK=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,od="sb_flow_id",qK=5,WK=600*1e3;let Km=class extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}};function Qe(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class GK extends Km{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.co
394de=n}}function ST(t){return Qe(t)&&t.name==="AuthApiError"}class qa extends Km{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class Ho extends Km{constructor(e,r,n,s){super(e,n,s),this.name=r,this.status=n}}class Kn extends Ho{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function gy(t){return Qe(t)&&t.name==="AuthSessionMissingError"}class wh extends Ho{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class vy extends Ho{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class yy extends Ho{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function KK(t){return Qe(t)&&t.name==="AuthImplicitGrantRedirectError"}class kT extends Ho{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class YK extends Ho{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class a_ extends Ho{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function _y(t){return Qe(t)&&t.name==="AuthRetryableFetchError"}class ET extends Ho{constructor(e="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(e,"AuthRefreshDiscardedError",409,void 0)}}function ZK(t){return Qe(t)&&t.name==="AuthRefreshDiscardedError"}class jT extends Ho{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class L_ extends Ho{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const F_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),CT=` 	
395\r=`.split(""),JK=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<CT.length;e+=1)t[CT[e].charCodeAt(0)]=-2;for(let e=0;e<F_.length;e+=1)t[F_[e].charCodeAt(0)]=e;return t})();function NT(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(F_[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(F_[n]),e.queuedBits-=6}}function IF(t,e,r){const n=JK[t];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function PT(t){const e=[],r=a=>{e.push(String.fromCodePoint(a))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=a=>{eY(a,n,r)};for(let a=0;a<t.length;a+=1)IF(t.charCodeAt(a),s,i);return e.join("")}function QK(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function XK(t,e){for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);if(n>55295&&n<=56319){const s=(n-55296)*1024&65535;n=(t.charCodeAt(r+1)-56320&65535|s)+65536,r+=1}QK(n,e)}}function eY(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let n=1;n<6;n+=1)if((t>>7-n&1)===0){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&r(e.codepoint)}}function of(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};for(let s=0;s<t.length;
395s+=1)IF(t.charCodeAt(s),r,n);return new Uint8Array(e)}function tY(t){const e=[];return XK(t,r=>e.push(r)),new Uint8Array(e)}function ld(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};return t.forEach(s=>NT(s,r,n)),NT(null,r,n),e.join("")}function rY(t){return Math.round(Date.now()/1e3)+t}function nY(){return Symbol("auth-callback")}const ss=()=>typeof window<"u"&&typeof document<"u",Ou={tested:!1,writable:!1},DF=()=>{if(!ss())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Ou.tested)return Ou.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Ou.tested=!0,Ou.writable=!0}catch{Ou.tested=!0,Ou.writable=!1}return Ou.writable};function RT(t){const e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((s,i)=>{e[i]=s})}catch{}return r.searchParams.forEach((n,s)=>{e[s]=n}),e}const OF=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),sY=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",Al=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},vs=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return null}},oi=async(t,e)=>{await t.removeItem(e)};class tw{constructor(){this.promise=new tw.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}tw.promiseConstructor=Promise;function by(t){const e=t.split(".");if(e.length!==3)throw new L_("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!HK.test(e[n]))throw new L_("JWT not in base64url format");return{header:JSON.parse(PT(e[0])),payload:JSON.parse(PT(e[1])),signature:of(e[2]),raw:{header:e[0],payload:e[1]}}}async function iY(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function aY(t,e){return new Promise((n,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const a=await t(i);if(!e(i,null,a)){n(a);return}}catch(a){if(!e(i,a)){s(a);return}}})()})}function MF(t){return("0"+t.toString(16)).substr(-2)}function oY(){const e=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let s="";for(let i=0;i<56;i++)s+=r.charAt(Math.floor(Math.random()*n));return s}return crypto.getRandomValues(e),Array.from(e,MF).join("")}async function lY(t){const r=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",r),s=new Uint8Array(n);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function cY(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const r=await lY(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}const uY=/^[a-zA-Z0-9_-]{8,64}$/;function o_(t){return typeof t=="string"&&uY.test(t)?t:null}function dY(){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){const e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,MF).join("")}let t="";for(let e=0;e<32;e++)t+=Math.floor(Math.random()*16).toString(16);return t}const Af=(t,e)=>`${t}-flow-${e}-code-verifier`,Ym=t=>`${t}-flows-code-verifier`;async function TC(t,e){const r=await vs(t,Ym(e));return Array.isArray(r)?r.filter(n=>o_(n)!==null):[]}async function hY(t,e,r,n,s){await Al(t,Af(e,r),n);const i=(await TC(t,e)).filter(a=>a!==r);for(i.push(r);i.length>qK;){const a=i.shift();await oi(t,Af(e,a)),s==null||s(a)}await Al(t,Ym(e),i),await Al(t,`${e}-code-verifier`,n)}async function fY(t,e,r){if(r){const s=await vs(t,Af(e,r));return{verifier:typeof s=="string"?s:null,flowId:r}}const n=await vs(t,`${e}-code-verifier`);return{verifier:typeof n=="string"?n:null,flowId:null}}async function Ia(t,e,r){const n=`${e}-code-verifier`;if(!r){await oi(t,n);return}const s=Af(e,r),i=await vs(t,s);await oi(t,s);const a=await TC(t,e),l=a.filter(u=>u!==r);l.length!==a.length&&(l.length>0?await Al(t,Ym(e),l):await oi(t,Ym(e))),i!=null&&i===await vs(t,n)&&await oi(t,n)}async function pY(t,e){const r=await TC(t,e);for(const n of r)await oi(t,Af(e,n));await oi(t,Ym(e)),await oi(t,`${e}-code-verifier`)}function mY(t,e){const r=t.indexOf("#");let n=r===-1?t:t.slice(0,r);const s=r===-1?"":t.slice(r),i=n.indexOf("?");if(i!==-1){const l=n.slice(0,i),u=n.slice(i+1).split("&").filter(h=>h!==""&&h!==od&&!h.startsWith(`${od}=`));n=u.length>0?`${l}?${u.join("&")}`:l}const a=n.includes("?")?"&":"?";return`${n}${a}${od}=${encodeURIComponent(e)}${s}`}async function gY(t,e,r=!1,n){const s=oY();let i=s;r&&(i+="/recovery");const a=dY();await hY(t,e,a,i,n);const l=await cY(s);return[l,s===l?"plain":"s256",a]}const vY=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function yY(t){const e=t.headers.get(Zk);if(!e||!e.match(vY))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function _Y(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function bY(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const wY=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ol(t){if(!wY.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function La(t){if(!t.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function Lx(){const t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;
395if(typeof r=="symbol"){const n=r.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function xY(t,e){return new Proxy(t,{get:(r,n,s)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const i=n.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,n,s)}return!e.value&&typeof n=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(r,n,s)}})}function AT(t){return JSON.parse(JSON.stringify(t))}const Yu=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error}return JSON.stringify(t)},TT=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function IT(t){var e;if(!sY(t))throw new a_(Yu(t),0);let r;try{r=await t.json()}catch(i){throw TT.includes(t.status)?new a_(t.statusText||`HTTP ${t.status}`,t.status):new qa(Yu(i),i)}if(TT.includes(t.status))throw new a_(Yu(r),t.status);let n;const s=yY(t);if(s&&s.getTime()>=TF["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new jT(Yu(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new Kn}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((i,a)=>i&&typeof a=="string",!0))throw new jT(Yu(r),t.status,r.weak_password.reasons);throw new GK(Yu(r),t.status||500,n)}const SY=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))};async function ct(t,e,r,n){var s;const i=Object.assign({},n==null?void 0:n.headers);i[Zk]||(i[Zk]=TF["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);const a=(s=n==null?void 0:n.query)!==null&&s!==void 0?s:{};n!=null&&n.redirectTo&&(a.redirect_to=n.redirectTo);const l=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",u=await kY(t,e,r+l,{headers:i,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(u):{data:Object.assign({},u),error:null}}async function kY(t,e,r,n,s,i){const a=SY(e,n,s,i);let l;try{l=await t(r,Object.assign({},a))}catch(u){throw new a_(Yu(u),0)}if(l.ok||await IT(l),n!=null&&n.noResolveJson)return l;try{return await l.json()}catch(u){await IT(u)}}function ra(t){var e;let r=null;CY(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=rY(t.expires_in)));const n=(e=t.user)!==null&&e!==void 0?e:typeof(t==null?void 0:t.id)=="string"?t:null;return{data:{session:r,user:n},error:null}}function DT(t){const e=ra(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Dc(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function EY(t){return{data:t,error:null}}function jY(t){const{action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i}=t,a=ep(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i},u=Object.assign({},a);return{data:{properties:l,user:u},error:null}}function OT(t){return t}function CY(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const Fx=["global","local","others"];class NY{constructor({url:e="",headers:r={},fetch:n,experimental:s}){this.url=e,this.headers=r,this.fetch=OF(n),this.experimental=s??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}
vendor: 4,780 bytes, line 395
395async signOut(e,r=Fx[0]){if(Fx.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Fx.join(", ")}`);try{return await ct(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Qe(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,r={}){try{return await ct(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Dc})}catch(n){if(Qe(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:r}=e,n=ep(e,["options"]),s=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(s.new_email=n==null?void 0:n.newEmail,delete s.newEmail),await ct(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:jY,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(Qe(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await ct(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Dc})}catch(r){if(Qe(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,n,s,i,a,l,u;try{const h={nextPage:null,lastPage:0,total:0},p=await ct(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:OT});if(p.error)throw p.error;const f=await p.json(),g=(a=p.headers.get("x-total-count"))!==null&&a!==void 0?a:0,v=(u=(l=p.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&u!==void 0?u:[];return v.length>0&&(v.forEach(_=>{const x=parseInt(_.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(_.split(";")[1].split("=")[1]);h[`${w}Page`]=x}),h.total=parseInt(g)),{data:Object.assign(Object.assign({},f),h),error:null}}catch(h){if(Qe(h))return{data:{users:[]},error:h};throw h}}async getUserById(e){ol(e);try{return await ct(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Dc})}catch(r){if(Qe(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){ol(e);try{return await ct(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:Dc})}catch(n){if(Qe(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){ol(e);try{return await ct(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:Dc})}catch(n){if(Qe(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){ol(e.userId);try{const{data:r,error:n}=await ct(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:r,error:n}}catch(r){if(Qe(r))return{data:null,error:r};throw r}}async _deleteFactor(e){ol(e.userId),ol(e.id);try{return{data:await ct(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if(Qe(r))return{data:null,error:r};throw r}}async _listOAuthClients(e){var r,n,s,i,a,l,u;try{const h={nextPage:null,lastPage:0,total:0},p=await ct(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:OT});if(p.error)throw p.error;const f=await p.json(),g=(a=p.headers.get("x-total-count"))!==null&&a!==void 0?a:0,v=(u=(l=p.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&u!==void 0?u:[];return v.length>0&&(v.forEach(_=>{const x=parseInt(_.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(_.split(";")[1].split("=")[1]);h[`${w}Page`]=x}),h.total=parseInt(g)),{data:Object.assign(Object.assign({},f),h),error:null}}catch(h){if(Qe(h))return{data:{clients:[]},error:h};throw h}}async _createOAuthClient(e){try{return await ct(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Qe(r))return{data:null,error:r};throw r}}async _getOAuthClient(e){try{return await ct(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Qe(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{return await ct(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Qe(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{return await ct(this.fetch,"DELET
395E",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(Qe(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(e){try{return await ct(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Qe(r))return{data:null,error:r};throw r}}async _listCustomProviders(e){try{const r={};return e!=null&&e.type&&(r.type=e.type),await ct(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:n=>{var s;return{data:{providers:(s=n==null?void 0:n.providers)!==null&&s!==void 0?s:[]},error:null}}})}catch(r){if(Qe(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(e){try{return await ct(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Qe(r))return{data:null,error:r};throw r}}async _getCustomProvider(e){try{return await ct(this.fetch,"GET",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Qe(r))return{data:null,error:r};throw r}}async _updateCustomProvider(e,r){try{return await ct(this.fetch,"PUT",`${this.url}/admin/custom-providers/${e}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Qe(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(e){try{return await ct(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(Qe(r))return{data:null,error:r};throw r}}async _adminListPasskeys(e){La(this.experimental),ol(e.userId);try{return await ct(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Qe(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(e){La(this.experimental),ol(e.userId),ol(e.passkeyId);try{return await ct(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(Qe(r))return{data:null,error:r};throw r}}}function MT(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}globalThis&&DF()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class PY extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}function RY(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function LF(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function AY(t){return parseInt(t,16)}function TY(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function IY(t){var e;const{chainId:r,domain:n,expirationTime:s,issuedAt:i=new Date,nonce:a,notBefore:l,requestId:u,resources:h,scheme:p,uri:f,version:g}=t;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(a&&a.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!f)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(g!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${g}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
396`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const v=LF(t.address),_=p?`${p}://${n}`:n,x=t.statement?`${t.statement}
397`:"",w=`${_} wants you to sign in with your Ethereum account:
398${v}
399
400${x}`;let S=`URI: ${f}
401Version: ${g}
402Chain ID: ${r}${a?`
403Nonce: ${a}`:""}
404Issued At: ${i.toISOString()}`;if(s&&(S+=`
405Expiration Time: ${s.toISOString()}`),l&&(S+=`
406Not Before: ${l.toISOString()}`),u&&(S+=`
407Request ID: ${u}`),h){let k=`
408Resources:`;
408for(const j of h){if(!j||typeof j!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${j}`);k+=`
409- ${j}`}S+=k}return`${w}
410${S}`}class On extends Error{constructor({message:e,code:r,cause:n,name:s}){var i;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(i=s??(n instanceof Error?n.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=r}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class $_ extends On{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}}function DY({error:t,options:e}){var r,n,s;const{publicKey:i}=e;if(!i)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new On({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=i.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new On({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new On({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new On({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new On({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new On({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return i.pubKeyCredParams.filter(l=>l.type==="public-key").length===0?new On({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new On({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const a=window.location.hostname;if(FF(a)){if(i.rp.id!==a)return new On({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new On({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new On({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new On({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new On({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function OY({error:t,options:e}){const{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new On({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new On({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const n=window.location.hostname;if(FF(n)){if(r.rpId!==n)return new On({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new On({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new On({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ER
410ROR",cause:t})}return new On({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class MY{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const Jk=new MY;function LT(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:r,excludeCredentials:n}=t,s=ep(t,["challenge","user","excludeCredentials"]),i=of(e).buffer,a=Object.assign(Object.assign({},r),{id:of(r.id).buffer}),l=Object.assign(Object.assign({},s),{challenge:i,user:a});if(n&&n.length>0){l.excludeCredentials=new Array(n.length);for(let u=0;u<n.length;u++){const h=n[u];l.excludeCredentials[u]=Object.assign(Object.assign({},h),{id:of(h.id).buffer,type:h.type||"public-key",transports:h.transports})}}return l}function FT(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:r}=t,n=ep(t,["challenge","allowCredentials"]),s=of(e).buffer,i=Object.assign(Object.assign({},n),{challenge:s});if(r&&r.length>0){i.allowCredentials=new Array(r.length);for(let a=0;a<r.length;a++){const l=r[a];i.allowCredentials[a]=Object.assign(Object.assign({},l),{id:of(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return i}function $T(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t;return{id:t.id,rawId:t.id,response:{attestationObject:ld(new Uint8Array(t.response.attestationObject)),clientDataJSON:ld(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function zT(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t,n=t.getClientExtensionResults(),s=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:ld(new Uint8Array(s.authenticatorData)),clientDataJSON:ld(new Uint8Array(s.clientDataJSON)),signature:ld(new Uint8Array(s.signature)),userHandle:s.userHandle?ld(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function FF(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function z_(){var t,e;return!!(ss()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function $F(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new $_("Browser returned unexpected credential type",e)}:{data:null,error:new $_("Empty credential response",e)}}catch(e){return{data:null,error:DY({error:e,options:t})}}}async function zF(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new $_("Browser returned unexpected credential type",e)}:{data:null,error:new $_("Empty credential response",e)}}catch(e){return{data:null,error:OY({error:e,options:t})}}}const LY={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},FY={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function U_(...t){const e=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),r=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),n={};for(const s of t)if(s)for(const i in s){const a=s[i];if(a!==void 0)if(Array.isArray(a))n[i]=a;
410else if(r(a))n[i]=a;else if(e(a)){const l=n[i];e(l)?n[i]=U_(l,a):n[i]=U_(a)}else n[i]=a}return n}function $Y(t,e){return U_(LY,t,e||{})}function zY(t,e){return U_(FY,t,e||{})}class UY{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:r,friendlyName:n,signal:s},i){var a;try{const{data:l,error:u}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!l)return{data:null,error:u};const h=s??Jk.createNewAbortSignal();if(l.webauthn.type==="create"){const{user:p}=l.webauthn.credential_options.publicKey;if(!p.name){const f=n;if(f)p.name=`${p.id}:${f}`;else{const v=(await this.client.getUser()).data.user,_=((a=v==null?void 0:v.user_metadata)===null||a===void 0?void 0:a.name)||(v==null?void 0:v.email)||(v==null?void 0:v.id)||"User";p.name=`${p.id}:${_}`}}p.displayName||(p.displayName=p.name)}switch(l.webauthn.type){case"create":{const p=$Y(l.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:f,error:g}=await $F({publicKey:p,signal:h});return f?{data:{factorId:e,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:f}},error:null}:{data:null,error:g}}case"request":{const p=zY(l.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:f,error:g}=await zF(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:p,signal:h}));return f?{data:{factorId:e,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:f}},error:null}:{data:null,error:g}}}}catch(l){return Qe(l)?{data:null,error:l}:{data:null,error:new qa("Unexpected error in challenge",l)}}}async _verify({challengeId:e,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!r)return{data:null,error:new Km("rpId is required for WebAuthn authentication")};try{if(!z_())return{data:null,error:new qa("Browser does not support WebAuthn",null)};const{data:a,error:l}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:n},signal:s},{request:i});if(!a)return{data:null,error:l};const{webauthn:u}=a;return this._verify({factorId:e,challengeId:a.challengeId,webauthn:{type:u.type,rpId:r,rpOrigins:n,credential_response:u.credential_response}})}catch(a){return Qe(a)?{data:null,error:a}:{data:null,error:new qa("Unexpected error in authenticate",a)}}}async _register({friendlyName:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!r)return{data:null,error:new Km("rpId is required for WebAuthn registration")};try{if(!z_())return{data:null,error:new qa("Browser does not support WebAuthn",null)};const{data:a,error:l}=await this._enroll({friendlyName:e});if(!a)return await this.client.mfa.listFactors().then(p=>{var f;return(f=p.data)===null||f===void 0?void 0:f.all.find(g=>g.factor_type==="webauthn"&&g.friendly_name===e&&g.status!=="unverified")}).then(p=>p?this.client.mfa.unenroll({factorId:p==null?void 0:p.id}):void 0),{data:null,error:l};const{data:u,error:h}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:s},{create:i});return u?this._verify({factorId:a.id,challengeId:u.challengeId,webauthn:{rpId:r,rpOrigins:n,type:u.webauthn.type,credential_response:u.webauthn.credential_response}}):{data:null,error:h}}catch(a){return Qe(a)?{data:null,error:a}:{data:null,error:new qa("Unexpected error in register",a)}}}}RY();const BY={url:UK,storageKey:BK,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:VK,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},xh={};class Zm{get jwks(){var e,r;return(r=(e=xh[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){xh[this.storageKey]=Object.assign(Object.assign({},xh[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=xh[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){xh[this.storageKey]=Object.assign(Object.assign({},xh[this.storageKey]),{cachedAt:e})}constructor(e){var r,n,s;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this._pendingInitNotifications=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},BY),e);if(this.storageKey=i.storageKey,this.instanceID=(r=Zm.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Zm.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.instanceID>0&&ss()){const a=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.experimental=(n=i.experimental)!==null&&n!==void 0?n:{},this.admin=new NY({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=OF(i.fetch),this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,i.lock!=null&&(this.lock=i.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new UY(this)}
410,this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:DF()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=MT(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=MT(this.memoryStorage)),ss()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a),(a.data.event==="TOKEN_REFRESHED"||a.data.event==="SIGNED_IN")&&(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(a.data.event,a.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}i.skipAutoInitialize||this.initialize().catch(a=>{this._debug("#initialize()","error",a)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${AF}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){var e;if(this.initializePromise)return await this.initializePromise;this._pendingInitNotifications=[],this.initializePromise=(async()=>this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())();const r=await this.initializePromise,n=(e=this._pendingInitNotifications)!==null&&e!==void 0?e:[];this._pendingInitNotifications=null;for(const s of n)await this._notifyAllSubscribers(s.event,s.session,s.broadcast);return r}async _initialize(){var e;try{let r={},n="none";if(ss()&&(r=RT(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),ss()&&this.detectSessionInUrl&&n!=="none"){const{data:s,error:i}=await this._getSessionFromURL(r,n);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),KK(i)){const u=(e=i.details)===null||e===void 0?void 0:e.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:a,redirectType:l}=s;return this._debug("#_initialize()","detected session in URL",a,"redirect type",l),await this._saveSession(a),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return Qe(r)?this._returnResult({error:r}):this._returnResult({error:new qa("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,s;try{const i=await ct(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}},xform:ra}),{data:a,error:l}=i;if(l||!a)return this._returnResult({data:{user:null,session:null},error:l});const u=a.session,h=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:h,session:u},error:null})}catch(i){if(Qe(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(e){var r,n,s;let i=null;try{let a;if("email"in e){const{email:f,password:g,options:v}=e;let _=null,x=null;this.flowType==="pkce"&&([_,x,i]=await this._getCodeChallengeAndMethod()),a=await ct(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:this._maybeAppendFlowIdToRedirect(v==null?void 0:v.emailRedirectTo,i),body:{email:f,password:g,data:(r=v==null?void 0:v.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:v==null?void 0:v.captchaToken},code_challenge:_,code_challenge_method:x},xform:ra})}else if("phone"in e){const{phone:f,password:g,options:v}=e;a=await ct(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:f,password:g,data:(n=v==null?void 0:v.data)!==null&&n!==void 0?n:{},channel:(s=v==null?void 0:v.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:v==null?void 0:v.captchaToken}},xform:ra})}else throw new vy("You must provide either an email or phone number and a password");const{data:l,error:u}=a;if(u||!l)return await Ia(this.storage,this.storageKey,i),this._returnResult({data:{user:null,session:null},error:u});const h=l.session,p=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",h)),this._returnResult({data:{user:p,session:h},error:null})}
410catch(a){if(await Ia(this.storage,this.storageKey,i),Qe(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithPassword(e){try{let r;if("email"in e){const{email:i,password:a,options:l}=e;r=await ct(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:a,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:DT})}else if("phone"in e){const{phone:i,password:a,options:l}=e;r=await ct(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:a,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:DT})}else throw new vy("You must provide either an email or phone number and a password");const{data:n,error:s}=r;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!n||!n.session||!n.user){const i=new wh;return this._returnResult({data:{user:null,session:null},error:i})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:s})}catch(r){if(Qe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,n,s,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(s=e.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e,r){return await this.initializePromise,this.lock!=null?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e,r)):this._exchangeCodeForSession(e,r)}async signInWithWeb3(e){const{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,n,s,i,a,l,u,h,p,f,g;let v,_;if("message"in e)v=e.message,_=e.signature;else{const{chain:x,wallet:w,statement:S,options:k}=e;let j;if(ss())if(typeof w=="object")j=w;else{const T=window;if("ethereum"in T&&typeof T.ethereum=="object"&&"request"in T.ethereum&&typeof T.ethereum.request=="function")j=T.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof w!="object"||!(k!=null&&k.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");j=w}const C=new URL((r=k==null?void 0:k.url)!==null&&r!==void 0?r:window.location.href),R=await j.request({method:"eth_requestAccounts"}).then(T=>T).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!R||R.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const A=LF(R[0]);let I=(n=k==null?void 0:k.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!I){const T=await j.request({method:"eth_chainId"});I=AY(T)}const P={domain:C.host,address:A,statement:S,uri:C.href,version:"1",chainId:I,nonce:(s=k==null?void 0:k.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(a=(i=k==null?void 0:k.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(l=k==null?void 0:k.signInWithEthereum)===null||l===void 0?void 0:l.expirationTime,notBefore:(u=k==null?void 0:k.signInWithEthereum)===null||u===void 0?void 0:u.notBefore,requestId:(h=k==null?void 0:k.signInWithEthereum)===null||h===void 0?void 0:h.requestId,resources:(p=k==null?void 0:k.signInWithEthereum)===null||p===void 0?void 0:p.resources};v=IY(P),_=await j.request({method:"personal_sign",params:[TY(v),A]})}try{const{data:x,error:w}=await ct(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:v,signature:_},!((f=e.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(g=e.options)===null||g===void 0?void 0:g.captchaToken}}:null),xform:ra});if(w)throw w;if(!x||!x.session||!x.user){const S=new wh;return this._returnResult({data:{user:null,session:null},error:S})}return x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("SIGNED_IN",x.session)),this._returnResult({data:Object.assign({},x),error:w})}
410catch(x){if(Qe(x))return this._returnResult({data:{user:null,session:null},error:x});throw x}}async signInWithSolana(e){var r,n,s,i,a,l,u,h,p,f,g,v;let _,x;if("message"in e)_=e.message,x=e.signature;else{const{chain:w,wallet:S,statement:k,options:j}=e;let C;if(ss())if(typeof S=="object")C=S;else{const A=window;if("solana"in A&&typeof A.solana=="object"&&("signIn"in A.solana&&typeof A.solana.signIn=="function"||"signMessage"in A.solana&&typeof A.solana.signMessage=="function"))C=A.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof S!="object"||!(j!=null&&j.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");C=S}const R=new URL((r=j==null?void 0:j.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in C&&C.signIn){const A=await C.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},j==null?void 0:j.signInWithSolana),{version:"1",domain:R.host,uri:R.href}),k?{statement:k}:null));let I;if(Array.isArray(A)&&A[0]&&typeof A[0]=="object")I=A[0];else if(A&&typeof A=="object"&&"signedMessage"in A&&"signature"in A)I=A;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in I&&"signature"in I&&(typeof I.signedMessage=="string"||I.signedMessage instanceof Uint8Array)&&I.signature instanceof Uint8Array)_=typeof I.signedMessage=="string"?I.signedMessage:new TextDecoder().decode(I.signedMessage),x=I.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in C)||typeof C.signMessage!="function"||!("publicKey"in C)||typeof C!="object"||!C.publicKey||!("toBase58"in C.publicKey)||typeof C.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");_=[`${R.host} wants you to sign in with your Solana account:`,C.publicKey.toBase58(),...k?["",k,""]:[""],"Version: 1",`URI: ${R.href}`,`Issued At: ${(s=(n=j==null?void 0:j.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=j==null?void 0:j.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${j.signInWithSolana.notBefore}`]:[],...!((a=j==null?void 0:j.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${j.signInWithSolana.expirationTime}`]:[],...!((l=j==null?void 0:j.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${j.signInWithSolana.chainId}`]:[],...!((u=j==null?void 0:j.signInWithSolana)===null||u===void 0)&&u.nonce?[`Nonce: ${j.signInWithSolana.nonce}`]:[],...!((h=j==null?void 0:j.signInWithSolana)===null||h===void 0)&&h.requestId?[`Request ID: ${j.signInWithSolana.requestId}`]:[],...!((f=(p=j==null?void 0:j.signInWithSolana)===null||p===void 0?void 0:p.resources)===null||f===void 0)&&f.length?["Resources",...j.signInWithSolana.resources.map(I=>`- ${I}`)]:[]].join(`
411`);const A=await C.signMessage(new TextEncoder().encode(_),"utf8");if(!A||!(A instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");x=A}}try{const{data:w,error:S}=await ct(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:_,signature:ld(x)},!((g=e.options)===null||g===void 0)&&g.captchaToken?{gotrue_meta_security:{captcha_token:(v=e.options)===null||v===void 0?void 0:v.captchaToken}}:null),xform:ra});if(S)throw S;if(!w||!w.session||!w.user){const k=new wh;return this._returnResult({data:{user:null,session:null},error:k})}return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),this._returnResult({data:Object.assign({},w),error:S})}catch(w){if(Qe(w))return this._returnResult({data:{user:null,session:null},error:w});throw w}}async _exchangeCodeForSession(e,r){const n=(r==null?void 0:r.flowId)!=null,s=n?o_(r==null?void 0:r.flowId):ss()?o_(RT(window.location.href)[od]):null;n&&!s&&this._debug("#_exchangeCodeForSession()","provided flowId is not a valid flow id",r==null?void 0:r.flowId);const{verifier:i,flowId:a}=n&&!s?{verifier:null,flowId:null}:await fY(this.storage,this.storageKey,s),[l,u]=(i??"").split("/");try{if(!l&&this.flowType==="pkce")throw new YK;const{data:h,error:p}=await ct(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:l},xform:ra});if(await Ia(this.storage,this.storageKey,a),p)throw p;if(!h||!h.session||!h.user){const f=new wh;return this._returnResult({data:{user:null,session:null,redirectType:null},error:f})}return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers(u==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",h.session)),this._returnResult({data:Object.assign(Object.assign({},h),{redirectType:u??null}),error:p})}catch(h){if(await Ia(this.storage,this.storageKey,a),Qe(h))return this._returnResult({data:{user:null,session:null,redirectType:null},error:h});throw h}}async signInWithIdToken(e){try{const{options:r,provider:n,token:s,access_token:i,nonce:a}=e,l=await ct(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:i,nonce:a,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:ra}),{data:u,error:h}=l;if(h)return this._returnResult({data:{user:null,session:null},error:h});if(!u||!u.session||!u.user){const p=new wh;return this._returnResult({data:{user:null,session:null},error:p})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),this._returnResult({data:u,error:h})}catch(r){if(Qe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,n,s,i,a;let l=null;try{if("email"in e){const{email:u,options:h}=e;let p=null,f=null;this.flowType==="pkce"&&([p,f,l]=await this._getCodeChallengeAndMethod());const{error:g}=await ct(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:u,data:(r=h==null?void 0:h.data)!==null&&r!==void 0?r:{},create_user:(n=h==null?void 0:h.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},code_challenge:p,code_challenge_method:f},redirectTo:this._maybeAppendFlowIdToRedirect(h==null?void 0:h.emailRedirectTo,l)});return this._returnResult({data:{user:null,session:null},error:g})}if("phone"in e){const{phone:u,options:h}=e,{data:p,error:f}=await ct(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:u,data:(s=h==null?void 0:h.data)!==null&&s!==void 0?s:{}
411,create_user:(i=h==null?void 0:h.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},channel:(a=h==null?void 0:h.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:p==null?void 0:p.message_id},error:f})}throw new vy("You must provide either an email or phone number.")}catch(u){if(await Ia(this.storage,this.storageKey,l),Qe(u))return this._returnResult({data:{user:null,session:null},error:u});throw u}}async verifyOtp(e){var r,n;try{let s,i;"options"in e&&(s=(r=e.options)===null||r===void 0?void 0:r.redirectTo,i=(n=e.options)===null||n===void 0?void 0:n.captchaToken);const{data:a,error:l}=await ct(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:ra});if(l)throw l;if(!a)throw new Error("An error occurred on token verification.");const u=a.session,h=a.user;return u!=null&&u.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),this._returnResult({data:{user:h,session:u},error:null})}catch(s){if(Qe(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(e){var r,n,s,i;let a=null;try{let l=null,u=null;this.flowType==="pkce"&&([l,u,a]=await this._getCodeChallengeAndMethod());const h=await ct(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:this._maybeAppendFlowIdToRedirect((r=e.options)===null||r===void 0?void 0:r.redirectTo,a)}),!((n=e==null?void 0:e.options)===null||n===void 0)&&n.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:l,code_challenge_method:u}),headers:this.headers,xform:EY});return!((s=h.data)===null||s===void 0)&&s.url&&ss()&&!(!((i=e.options)===null||i===void 0)&&i.skipBrowserRedirect)&&window.location.assign(h.data.url),this._returnResult(h)}catch(l){if(await Ia(this.storage,this.storageKey,a),Qe(l))return this._returnResult({data:null,error:l});throw l}}async reauthenticate(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new Kn;const{error:s}=await ct(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(e){if(Qe(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){let r=null;try{const n=`${this.url}/resend`;if("email"in e){const{email:s,type:i,options:a}=e;let l=null,u=null;this.flowType==="pkce"&&([l,u,r]=await this._getCodeChallengeAndMethod());const{error:h}=await ct(this.fetch,"POST",n,{headers:this.headers,body:{email:s,type:i,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken},code_challenge:l,code_challenge_method:u},redirectTo:this._maybeAppendFlowIdToRedirect(a==null?void 0:a.emailRedirectTo,r)});return h&&await Ia(this.storage,this.storageKey,r),this._returnResult({data:{user:null,session:null},error:h})}else if("phone"in e){const{phone:s,type:i,options:a}=e,{data:l,error:u}=await ct(this.fetch,"POST",n,{headers:this.headers,body:{phone:s,type:i,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:l==null?void 0:l.message_id},error:u})}throw new vy("You must provide either an email or phone number and a type")}catch(n){if(await Ia(this.storage,this.storageKey,r),Qe(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await e(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lock!=null&&!this.lockAcquired&&this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const r=await vs(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not val
411id"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=e.expires_at?e.expires_at*1e3-Date.now()<Mx:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const a=await vs(this.userStorage,this.storageKey+"-user");a!=null&&a.user?e.user=a.user:e.user=Lx()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};e.user=xY(e.user,a),a.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:s,error:i}=await this._callRefreshToken(e.refresh_token);if(i){if(!!(e.expires_at&&e.expires_at*1e3>Date.now())){const l=await vs(this.storage,this.storageKey);if(l&&l.refresh_token===e.refresh_token)return this._returnResult({data:{session:e},error:null})}return this._returnResult({data:{session:null},error:i})}return this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;let r;return this.lock!=null?r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):r=await this._getUser(),r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(e){try{return e?await ct(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Dc}):await this._useSession(async r=>{var n,s,i;const{data:a,error:l}=r;if(l)throw l;return!(!((n=a.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Kn}:await ct(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=a.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:Dc})})}catch(r){if(Qe(r))return gy(r)&&await this._removeSession(),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,r)):await this._updateUser(e,r)}async _updateUser(e,r={}){let n=null;try{return await this._useSession(async s=>{const{data:i,error:a}=s;
411if(a)throw a;if(!i.session)throw new Kn;const l=i.session;let u=null,h=null;this.flowType==="pkce"&&e.email!=null&&([u,h,n]=await this._getCodeChallengeAndMethod());const{data:p,error:f}=await ct(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:this._maybeAppendFlowIdToRedirect(r==null?void 0:r.emailRedirectTo,n),body:Object.assign(Object.assign({},e),{code_challenge:u,code_challenge_method:h}),jwt:l.access_token,xform:Dc});if(f)throw f;return l.user=p.user,await this._saveSession(l),await this._notifyAllSubscribers("USER_UPDATED",l),this._returnResult({data:{user:l.user},error:null})})}catch(s){if(await Ia(this.storage,this.storageKey,n),Qe(s))return this._returnResult({data:{user:null},error:s});throw s}}async setSession(e){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Kn;const r=Date.now()/1e3;let n=r,s=!0,i=null;const{payload:a}=by(e.access_token);if(a.exp&&(n=a.exp,s=n<=r),s){const{data:l,error:u}=await this._callRefreshToken(e.refresh_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!l)return{data:{user:null,session:null},error:null};i=l}else{const{data:l,error:u}=await this._getUser(e.access_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});i={access_token:e.access_token,refresh_token:e.refresh_token,user:l.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(r){if(Qe(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){const{data:a,error:l}=r;if(l)throw l;e=(n=a.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new Kn;const{data:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(Qe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){var n;try{if(!ss())throw new yy("No browser detected.");if(e.error||e.error_description||e.error_code)throw new yy(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new kT("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new yy("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new kT("No code detected.");const{data:j,error:C}=await this._exchangeCodeForSession(e.code,{flowId:e[od]});if(C)throw C;const R=new URL(window.location.href);return R.searchParams.delete("code"),R.searchParams.delete(od),window.history.replaceState(window.history.state,"",R.toString()),{data:{session:j.session,redirectType:(n=j.redirectType)!==null&&n!==void 0?n:null},error:null}}const{provider_token:s,provider_refresh_token:i,access_token:a,refresh_token:l,expires_in:u,expires_at:h,token_type:p}=e;if(!a||!u||!l||!p)throw new yy("No session defined in URL");const f=Math.round(Date.now()/1e3),g=parseInt(u);let v=f+g;h&&(v=parseInt(h));const _=v-f;_*1e3<=bl&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${_}s, should have been closer to ${g}s`);const x=v-g;f-x>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",x,v,f):f-x<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",x,v,f);const{data:w,error:S}=await this._getUser(a);if(S)throw S;const k={provider_token:s,provider_refresh_token:i,access_token:a,expires_in:g,expires_at:v,refresh_token:l,token_type:p,user:w.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:k,redirectType:e.type},error:null})}catch(s){if(Qe(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error||e.error_description||e.error_code)}
411async _isPKCECallback(e){if(!e.code)return!1;const r=o_(e[od]);return r&&await vs(this.storage,Af(this.storageKey,r))?!0:!!await vs(this.storage,`${this.storageKey}-code-verifier`)}async signOut(e={scope:"global"}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;const s=async()=>{await this._removeSession()},{data:i,error:a}=r;if(a&&!gy(a))return this._returnResult({error:a});const l=(n=i.session)===null||n===void 0?void 0:n.access_token;if(l){const{error:u}=await this.admin.signOut(l,e);if(u&&!(ST(u)&&(u.status===404||u.status===401||u.status===403)||gy(u)))return e!=="others"&&await s(),this._returnResult({error:u})}return e!=="others"&&await s(),this._returnResult({error:null})})}onAuthStateChange(e){const r=nY(),n={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)}):await this._emitInitialSession(r)))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,s;try{const{data:{session:i},error:a}=r;if(a)throw a;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),gy(i)||_y(i)||ST(i)&&(i.code==="refresh_token_not_found"||i.code==="refresh_token_already_used"||i.code==="session_expired")?console.warn(i):console.error(i)}})}async resetPasswordForEmail(e,r={}){let n=null,s=null,i=null;this.flowType==="pkce"&&([n,s,i]=await this._getCodeChallengeAndMethod(!0));try{return await ct(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:s,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:this._maybeAppendFlowIdToRedirect(r.redirectTo,i)})}
411catch(a){if(await Ia(this.storage,this.storageKey,i),Qe(a))return this._returnResult({data:null,error:a});throw a}}async getUserIdentities(){var e;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if(Qe(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;let n=null;try{const{data:s,error:i}=await this._useSession(async a=>{var l,u,h,p,f;const{data:g,error:v}=a;if(v)throw v;const{url:_,flowId:x}=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(l=e.options)===null||l===void 0?void 0:l.redirectTo,scopes:(u=e.options)===null||u===void 0?void 0:u.scopes,queryParams:(h=e.options)===null||h===void 0?void 0:h.queryParams,skipBrowserRedirect:!0});return n=x,await ct(this.fetch,"GET",_,{headers:this.headers,jwt:(f=(p=g.session)===null||p===void 0?void 0:p.access_token)!==null&&f!==void 0?f:void 0})});if(i)throw i;return ss()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),this._returnResult({data:{provider:e.provider,url:s==null?void 0:s.url,flowId:n},error:null})}catch(s){if(Qe(s))return this._returnResult({data:{provider:e.provider,url:null,flowId:n},error:s});throw s}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var n;try{const{error:s,data:{session:i}}=r;if(s)throw s;const{options:a,provider:l,token:u,access_token:h,nonce:p}=e,f=await ct(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=i==null?void 0:i.access_token)!==null&&n!==void 0?n:void 0,body:{provider:l,id_token:u,access_token:h,nonce:p,link_identity:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:ra}),{data:g,error:v}=f;return v?this._returnResult({data:{user:null,session:null},error:v}):!g||!g.session||!g.user?this._returnResult({data:{user:null,session:null},error:new wh}):(g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("USER_UPDATED",g.session)),this._returnResult({data:g,error:v}))}catch(s){if(await Ia(this.storage,this.storageKey,null),Qe(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,s;const{data:i,error:a}=r;if(a)throw a;return await ct(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(s=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0})})}catch(r){if(Qe(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){const r="#_refreshAccessToken()";this._debug(r,"begin");try{const n=Date.now();return await aY(async s=>(s>0&&await iY(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await ct(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:ra})),(s,i)=>{const a=200*Math.pow(2,s);return i&&_y(i)&&Date.now()+a-n<bl})}catch(n){if(this._debug(r,"error",n),Qe(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){const{url:n,flowId:s}=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),ss()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n,flowId:s},error:null}}async _recoverAndRefresh(){var e,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const s=await vs(this.storage,this.storageKey);if(s&&this.userStorage){let a=await vs(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:s.user},await Al(this.userStorage,this.storageKey+"-user",a)),s.user=(e=a==null?void 0:a.user)!==null&&e!==void 0?e:Lx()}else if(s&&!s.user&&!s.user){const a=await vs(this.storage,this.storageKey+"-user");a&&(a!=null&&a.user)?(s.user=a.user,await oi(this.storage,this.storageKey+"-user"),await Al(this.storage,this.storageKey,s)):s.user=Lx()}if(this._debug(n,"session from storage",s),!this._isValidSession(s)){this._debug(n,"session is not val
411id"),s!==null&&await this._removeSession();return}const i=((r=s.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Mx;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${Mx}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:a}=await this._callRefreshToken(s.refresh_token);a&&(ZK(a)?this._debug(n,"refresh discarded by commit guard",a):this._debug(n,"refresh failed",a))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:a,error:l}=await this._getUser(s.access_token);!l&&(a!=null&&a.user)?(s.user=a.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(n,"error getting user data, skipping SIGNED_IN notification",a)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(n,"error",s),_y(s)?console.warn(s):console.error(s);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new Kn;if(this.refreshingDeferred)return this.refreshingDeferred.promise;if(this.lastRefreshFailure&&this.lastRefreshFailure.refreshToken===e&&Date.now()<this.lastRefreshFailure.expiresAt)return this._debug("#_callRefreshToken()","returning cached failure (cooldown active)"),this.lastRefreshFailure.result;const s="#_callRefreshToken()";this._debug(s,"begin");try{this.refreshingDeferred=new tw;const i=await vs(this.storage,this.storageKey),{data:a,error:l}=await this._refreshAccessToken(e);if(l)throw l;if(!a.session)throw new Kn;const u=await vs(this.storage,this.storageKey);if(i!==null&&(u===null||u.refresh_token!==i.refresh_token)){this._debug(s,"commit guard: storage changed since refresh started, discarding rotated tokens",{startedWith:"present",nowHolds:u?"replaced":"cleared"});const g={data:null,error:new ET};return this.refreshingDeferred.resolve(g),g}const p=this._sessionRemovalEpoch;if(await this._saveSession(a.session),this._sessionRemovalEpoch!==p){this._debug(s,"commit guard (post-save): _removeSession ran during _saveSession, undoing write"),await oi(this.storage,this.storageKey),this.userStorage&&await oi(this.userStorage,this.storageKey+"-user");const g={data:null,error:new ET};return this.refreshingDeferred.resolve(g),g}await this._notifyAllSubscribers("TOKEN_REFRESHED",a.session);const f={data:a.session,error:null};return this.lastRefreshFailure=null,this.refreshingDeferred.resolve(f),f}catch(i){if(this._debug(s,"error",i),Qe(i)){const a={data:null,error:i};if(!_y(i)){const l=await vs(this.storage,this.storageKey);!!(l!=null&&l.expires_at&&l.expires_at*1e3>Date.now())?this._debug(s,"proactive refresh failed, access token still valid — preserving session"):await this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:a,expiresAt:Date.now()+zK},(r=this.refreshingDeferred)===null||r===void 0||r.resolve(a),a}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,r,n=!0){if(this._pendingInitNotifications!==null&&n){this._pendingInitNotifications.push({event:e,session:r,broadcast:n});return}const s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});const i=[],a=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(e,r)}catch(u){i.push(u)}});if(await Promise.all(a),i.length>0){for(let l=0;l<i.length;l+=1)console.error(i[l]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;const r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await Al(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const i=AT(s);await Al(this.storage,this.storageKey,i)}else{const s=AT(r);await Al(this.storage,this.storageKey,s)}}async _removeSession(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.lastRefreshFailure=null,this.suppressGetSessionWarning=!1,await oi(this.storage,this.storageKey),await pY(this.storage,this.storageKey),await oi(this.storage,this.storageKey+"-user"),this.userStorage&&await oi(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&ss()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
411catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),bl);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),(e=this.broadcastChannel)===null||e===void 0||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug("#_autoRefreshTokenTick()","begin"),this.lock!=null){try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((n.expires_at*1e3-e)/bl);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${bl}ms, refresh threshold is ${vm} ticks`),s<=vm&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e instanceof PY)this._debug("auto refresh token tick lock not available");else throw e}return}if(this.refreshingDeferred!==null){this._debug("#_autoRefreshTokenTick()","refresh already in flight, skipping");return}try{const e=Date.now();try{await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((n.expires_at*1e3-e)/bl);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${bl}ms, refresh threshold is ${vm} ticks`),s<=vm&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!ss()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const r=`#_onVisibilityChanged(${e})`;if(this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,this.lock!=null)await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()});else{if(document.visibilityState!=="visible"){this._debug(r,"visibilityState is no longer visible, skipping recovery");return}await this._recoverAndRefresh()}}else document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,n){let s=n==null?void 0:n.redirectTo,i=null,a=null,l=null;this.flowType==="pkce"&&([i,a,l]=await this._getCodeChallengeAndMethod(),s=this._maybeAppendFlowIdToRedirect(s,l));const u=[`provider=${encodeURIComponent(r)}`];if(s&&u.push(`redirect_to=${encodeURIComponent(s)}
411`),n!=null&&n.scopes&&u.push(`scopes=${encodeURIComponent(n.scopes)}`),i!=null&&a!=null){const h=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(a)}`});u.push(h.toString())}if(n!=null&&n.queryParams){const h=new URLSearchParams(n.queryParams);u.push(h.toString())}return n!=null&&n.skipBrowserRedirect&&u.push(`skip_http_redirect=${n.skipBrowserRedirect}`),{url:`${e}?${u.join("&")}`,flowId:l}}_maybeAppendFlowIdToRedirect(e,r){return!e||!r||!this.experimental.appendPkceFlowIdToRedirects?e??void 0:mY(e,r)}async _getCodeChallengeAndMethod(e=!1){return gY(this.storage,this.storageKey,e,r=>this._debug("#_getCodeChallengeAndMethod()","evicted oldest pending PKCE verifier slot",r))}async _unenroll(e){try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;return i?this._returnResult({data:null,error:i}):await ct(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(Qe(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,s;const{data:i,error:a}=r;if(a)return this._returnResult({data:null,error:a});const l=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:u,error:h}=await ct(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return h?this._returnResult({data:null,error:h}):(e.factorType==="totp"&&u.type==="totp"&&(!((s=u==null?void 0:u.totp)===null||s===void 0)&&s.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),this._returnResult({data:u,error:null}))})}catch(r){if(Qe(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){const r=async()=>{try{return await this._useSession(async n=>{var s;const{data:i,error:a}=n;if(a)return this._returnResult({data:null,error:a});const l=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?$T(e.webauthn.credential_response):zT(e.webauthn.credential_response)})}:{code:e.code}),{data:u,error:h}=await ct(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:l,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});return h?this._returnResult({data:null,error:h}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+u.expires_in},u)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",u),this._returnResult({data:u,error:h}))})}catch(n){if(Qe(n))return this._returnResult({data:null,error:n});throw n}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()}async _challenge(e){const r=async()=>{try{return await this._useSession(async n=>{var s;const{data:i,error:a}=n;if(a)return this._returnResult({data:null,error:a});const l=await ct(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});if(l.error)return l;const{data:u}=l;if(u.type!=="webauthn")return{data:u,error:null};switch(u.webauthn.type){case"create":return{data:Object.assign(Object.assign({},u),{webauthn:Object.assign(Object.assign({},u.webauthn),{credential_options:Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:LT(u.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},u),{webauthn:Object.assign(Object.assign({},u.webauthn),{credential_options:Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:FT(u.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(Qe(n))return this._returnResult({data:null,error:n});throw n}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()}async _challengeAndVerify(e){const{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;const{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};const s={all:[],phone:[],totp:[],webauthn:[]};for(const i of(e=r==null?void 0:r.factors)!==null&&e!==void 0?e:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(e){var r,n,s,i;if(e)try{const{payload:v}=by(e);let _=null;v.aal&&(_=v.aal);let x=_;const{data:{user:w},error:S}=await this.getUser(e);if(S)return this._returnResult({data:null,error:S});((n=(r=w==null?void 0:w.factors)===null||r===void 0?void 0:r.filter(C=>C.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(x="aal2");const j=v.amr||[];return{data:{currentLevel:_,nextLevel:x,currentAuthenticationMethods:j},error:null}}catch(v){if(Qe(v))return this._returnResult({data:null,error:v});throw v}const{data:{session:a},error:l}
411=await this.getSession();if(l)return this._returnResult({data:null,error:l});if(!a)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:u}=by(a.access_token);let h=null;u.aal&&(h=u.aal);let p=h;((i=(s=a.user.factors)===null||s===void 0?void 0:s.filter(v=>v.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(p="aal2");const g=u.amr||[];return{data:{currentLevel:h,nextLevel:p,currentAuthenticationMethods:g},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?await ct(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Kn})})}catch(r){if(Qe(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Kn});const a=await ct(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:l=>({data:l,error:null})});return a.data&&a.data.redirect_url&&ss()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(Qe(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Kn});const a=await ct(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:l=>({data:l,error:null})});return a.data&&a.data.redirect_url&&ss()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(Qe(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;return n?this._returnResult({data:null,error:n}):r?await ct(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Kn})})}catch(e){if(Qe(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?(await ct(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Kn})})}catch(r){if(Qe(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(l=>l.kid===e);if(n)return n;const s=Date.now();if(n=this.jwks.keys.find(l=>l.kid===e),n&&this.jwks_cached_at+WK>s)return n;const{data:i,error:a}=await ct(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,n=i.keys.find(l=>l.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){const{data:v,error:_}
411=await this.getSession();if(_||!v.session)return this._returnResult({data:null,error:_});n=v.session.access_token}const{header:s,payload:i,signature:a,raw:{header:l,payload:u}}=by(n);if(!(r!=null&&r.allowExpired))try{_Y(i.exp)}catch(v){throw new L_(v instanceof Error?v.message:"JWT validation failed")}const h=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!h){const{error:v}=await this.getUser(n);if(v)throw v;return{data:{claims:i,header:s,signature:a},error:null}}const p=bY(s.alg),f=await crypto.subtle.importKey("jwk",h,p,!0,["verify"]);if(!await crypto.subtle.verify(p,f,a,tY(`${l}.${u}`)))throw new L_("Invalid JWT signature");return{data:{claims:i,header:s,signature:a},error:null}}catch(n){if(Qe(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(e){var r,n,s;La(this.experimental);try{if(!z_())return this._returnResult({data:null,error:new qa("Browser does not support WebAuthn",null)});const{data:i,error:a}=await this._startPasskeyAuthentication({options:{captchaToken:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}});if(a||!i)return this._returnResult({data:null,error:a});const l=FT(i.options),u=(s=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.signal)!==null&&s!==void 0?s:Jk.createNewAbortSignal(),{data:h,error:p}=await zF({publicKey:l,signal:u});if(p||!h)return this._returnResult({data:null,error:p??new qa("WebAuthn ceremony failed",null)});const f=zT(h);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:f})}catch(i){if(Qe(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(e){var r,n;La(this.experimental);try{if(!z_())return this._returnResult({data:null,error:new qa("Browser does not support WebAuthn",null)});const{data:s,error:i}=await this._startPasskeyRegistration();if(i||!s)return this._returnResult({data:null,error:i});const a=LT(s.options),l=(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:Jk.createNewAbortSignal(),{data:u,error:h}=await $F({publicKey:a,signal:l});if(h||!u)return this._returnResult({data:null,error:h??new qa("WebAuthn ceremony failed",null)});const p=$T(u);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:p})}catch(s){if(Qe(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){La(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Kn});const{data:s,error:i}=await ct(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:r.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if(Qe(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){La(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Kn});const{data:i,error:a}=await ct(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:n.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(r){if(Qe(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(e){var r;La(this.experimental);try{const{data:n,error:s}=await ct(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:n,error:null})}catch(n){if(Qe(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(e){La(this.experimental);try{const{data:r,error:n}=await ct(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:ra});return n?this._returnResult({data:null,error:n}):(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:r,error:null}))}catch(r){if(Qe(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){La(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Kn});const{data:s,error:i}=await ct(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:a=>({data:a,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if(Qe(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){La(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Kn});const{data:i,error:a}=await ct(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,body:{friendly_name:e.friendlyName}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(r){if(Qe(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(e){La(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Kn});const{error:i}
411=await ct(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(r){if(Qe(r))return this._returnResult({data:null,error:r});throw r}}}Zm.nextInstanceID={};const VY=Zm,HY="2.112.2";let ym="",B_;if(typeof Deno<"u"){var $x;ym="deno",B_=($x=Deno.version)===null||$x===void 0?void 0:$x.deno}else if(typeof document<"u")ym="web";else if(typeof navigator<"u"&&navigator.product==="ReactNative")ym="react-native";else{var zx;ym="node";const t=globalThis.process;B_=t==null||(zx=t.version)===null||zx===void 0?void 0:zx.replace(/^v/,"")}const UF=[`runtime=${ym}`];B_&&UF.push(`runtime-version=${B_}`);const qY={"X-Client-Info":`supabase-js/${HY}; ${UF.join("; ")}`},WY={headers:qY},GY={schema:"public"},KY={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},YY={},ZY={enabled:!1,respectSamplingDecision:!0};function JY(t){if(!t||typeof t!="string")return null;const e=t.split("-");if(e.length!==4)return null;const[r,n,s,i]=e;if(r.length!==2||n.length!==32||s.length!==16||i.length!==2)return null;const a=/^[0-9a-f]+$/i;return!a.test(r)||!a.test(n)||!a.test(s)||!a.test(i)||n==="00000000000000000000000000000000"||s==="0000000000000000"?null:{version:r,traceId:n,parentId:s,traceFlags:i,isSampled:(parseInt(i,16)&1)===1}}function QY(t,e){if(!t||!e||e.length===0)return!1;let r;if(t instanceof URL)r=t;else try{r=new URL(t)}catch{return!1}for(const n of e)try{if(typeof n=="string"){if(XY(r.hostname,n))return!0}else if(n instanceof RegExp){if(n.test(r.hostname))return!0}else if(typeof n=="function"&&n(r))return!0}catch{continue}return!1}function XY(t,e){if(e===t)return!0;if(e.startsWith("*.")){const r=e.slice(2);if(t.endsWith(r)&&(t===r||t.endsWith("."+r)))return!0}return!1}function eZ(t){const e=[];try{const r=new URL(t);e.push(r.hostname)}catch{}return e.push("*.supabase.co","*.supabase.in"),e.push("localhost","127.0.0.1","[::1]"),e}function Jm(t){"@babel/helpers - typeof";return Jm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jm(t)}function tZ(t,e){if(Jm(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Jm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function rZ(t){var e=tZ(t,"string");return Jm(e)=="symbol"?e:e+""}function nZ(t,e,r){return(e=rZ(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function UT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function yn(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?UT(Object(r),!0).forEach(function(n){nZ(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):UT(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}const sZ=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),iZ=()=>Headers,BF=t=>t.startsWith("sb_publishable_")||t.startsWith("sb_secret_"),aZ="sb_temp_",BT=new Set,oZ=t=>{var e,r;if(!t.startsWith("sb_")||BF(t)||t.startsWith(aZ))return;const n=(e=(r=t.match(/^sb_[a-zA-Z0-9]+_/))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:"unknown";BT.has(n)||(BT.add(n),console.warn("@supabase/supabase-js: Unrecognized Supabase API key format. The client will proceed and send this key as-is; if you see authentication errors you may need to upgrade @supabase/supabase-js to a version that recognizes this key type."))},VT=(t,e,r,n,s,i)=>{const a=sZ(n),l=iZ(),u=(s==null?void 0:s.enabled)===!0,h=(s==null?void 0:s.respectSamplingDecision)!==!1,p=u?eZ(e):null,f=!(i!=null&&i.omitApiKeyAsBearer&&BF(t));return async(g,v)=>{const _=await r();let x=new l(v==null?void 0:v.headers);if(x.has("apikey")||x.set("apikey",t),!x.has("Authorization")){const w=_??(f?t:null);w&&x.set("Authorization",`Bearer ${w}`)}if(p){const w=lZ(g,p,h);w&&(w.traceparent&&!x.has("traceparent")&&x.set("traceparent",w.traceparent),w.tracestate&&!x.has("tracestate")&&x.set("tracestate",w.tracestate),w.baggage&&!x.has("baggage")&&x.set("baggage",w.baggage))}return a(g,yn(yn({},v),{},{headers:x}))}};let HT=!1;function lZ(t,e,r){const n=a7();if(!n)return HT||(HT=!0,console.warn("@supabase/supabase-js: tracePropagation is enabled but the tracing runtime is not loaded, so trace headers will not be attached. Add `import '@supabase/supabase-js/tracing'` at your application entry point (requires the OpenTelemetry API package to be installed). The CDN/UMD build does not support trace propagation.")),null;if(!QY(typeof t=="string"||t instanceof URL?t:t.url,e))return null;const s=n();if(!s||!s.traceparent)return null;if(r){const i=JY(s.traceparent);if(i&&!i.isSampled)return null}return s}function qT(t){return typeof t=="boolean"?{enabled:t}:t}function cZ(t){return t.endsWith("/")?t:t+"/"}function uZ(t,e){var r,n,s,i,a,l;const{db:u,auth:h,realtime:p,global:f}=t,{db:g,auth:v,realtime:_,global:x}=e,w=qT(t.tracePropagation),S=qT(e.tracePropagation),k={db:yn(yn({},g),u),auth:yn(yn({},v),h),realtime:yn(yn({},_),p),storage:{},global:yn(yn(yn({},x),f),{},{headers:yn(yn({},(r=x==null?void 0:x.headers)!==null&&r!==void 0?r:{}),(n=f==null?void 0:f.headers)!==null&&n!==void 0?n:{})}),tracePropagation:{enabled:(s=(i=w==null?void 0:w.enabled)!==null&&i!==void 0?i:S==null?void 0:S.enabled)!==null&&s!==void 0?s:!1,respectSamplingDecision:(a=(l=w==null?void 0:w.respectSamplingDecision)!==null&&l!==void 0?l:S==null?void 0:S.respectSamplingDecision)!==null&&a!==void 0?a:!0},accessToken:async()=>""};return t.accessToken?k.accessToken=t.accessToken:delete k.accessToken,k}function dZ(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");
411if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(cZ(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var hZ=class extends VY{constructor(t){super(t)}},fZ=class{constructor(t,e,r){var n,s;this.supabaseUrl=t,this.supabaseKey=e;const i=dZ(t);if(!e)throw new Error("supabaseKey is required.");oZ(e),this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const a=`sb-${i.hostname.split(".")[0]}-auth-token`,l={db:GY,realtime:YY,auth:yn(yn({},KY),{},{storageKey:a}),global:WY,tracePropagation:ZY},u=uZ(r??{},l);if(this.settings=u,this.storageKey=(n=u.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(s=u.global.headers)!==null&&s!==void 0?s:{},u.accessToken)this.accessToken=u.accessToken,this.auth=new Proxy({},{get:(p,f)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(f)} is not possible`)}});else{var h;this.auth=this._initSupabaseAuthClient((h=u.auth)!==null&&h!==void 0?h:{},this.headers,u.global.fetch)}this.fetch=VT(e,t,this._getSessionToken.bind(this),u.global.fetch,u.tracePropagation),this.functionsFetch=VT(e,t,this._getSessionToken.bind(this),u.global.fetch,u.tracePropagation,{omitApiKeyAsBearer:!0}),this.realtime=this._initRealtimeClient(yn({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},u.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(p=>this.realtime.setAuth(p)).catch(p=>console.warn("Failed to set initial Realtime auth token:",p)),this.rest=new b7(new URL("rest/v1",i).href,{headers:this.headers,schema:u.db.schema,fetch:this.fetch,timeout:u.db.timeout,urlLengthLimit:u.db.urlLengthLimit,retry:u.db.retry}),this.storage=new $K(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),u.accessToken||this._listenForAuthEvents()}get functions(){return new d7(this.functionsUrl.href,{headers:this.headers,customFetch:this.functionsFetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,r)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getSessionToken(){var t=this,e,r;if(t.accessToken)return await t.accessToken();const{data:n}=await t.auth.getSession();return(e=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:null}async _getAccessToken(){var t=this,e;return(e=await t._getSessionToken())!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,storageKey:i,flowType:a,lock:l,debug:u,throwOnError:h,experimental:p,lockAcquireTimeout:f,skipAutoInitialize:g},v,_){const x={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new hZ({url:this.authUrl.href,headers:yn(yn({},x),v),storageKey:i,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,flowType:a,lock:l,debug:u,throwOnError:h,experimental:p,fetch:_,lockAcquireTimeout:f,skipAutoInitialize:g,hasCustomAuthorizationHeader:Object.keys(this.headers).some(w=>w.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new cK(this.realtimeUrl.href,yn(yn({},t),{},{params:yn(yn({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN"||t==="INITIAL_SESSION")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const pZ=(t,e,r)=>new fZ(t,e,r);function mZ(){if(typeof window<"u"||globalThis.Deno!==void 0)return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const r=e.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=20:!1}mZ()&&console.warn("⚠️  Node.js 20 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to N
411ode.js 22 or later. For more information, visit: https://github.com/orgs/supabase/discussions/45715");const Ye=pZ("https://supabase.3dtrees.earth","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlIiwiaWF0IjoxNzQ3MTczNjAwLCJleHAiOjE5MDQ5NDAwMDB9.1yEpYS6xoWITiyoO9IR3BXWZhmWQF7GJV0fouXvdMRs");var me=typeof window<"u"?window:void 0,bs=typeof globalThis<"u"?globalThis:me,Os=bs==null?void 0:bs.navigator,Ue=bs==null?void 0:bs.document,Zr=bs==null?void 0:bs.location,IC=bs==null?void 0:bs.fetch,Qk=bs!=null&&bs.XMLHttpRequest&&"withCredentials"in new bs.XMLHttpRequest?bs.XMLHttpRequest:void 0,WT=bs==null?void 0:bs.AbortController,gZ=bs==null?void 0:bs.CompressionStream,ri=Os==null?void 0:Os.userAgent;function VF(){return!(!me||me.navigator.onLine===!1)}var Gp=typeof globalThis<"u"?globalThis:me;Gp&&typeof self>"u"&&(Gp.self=Gp),Gp&&typeof File>"u"&&(Gp.File=function(){});var yt=me??{},Er={DEBUG:!1,LIB_VERSION:"0.4.0",LIB_NAME:"browser-common"};function GT(t,e,r,n,s,i,a){try{var l=t[i](a),u=l.value}catch(h){return void r(h)}l.done?e(u):Promise.resolve(u).then(n,s)}function Hr(t){return function(){var e=this,r=arguments;return new Promise((function(n,s){var i=t.apply(e,r);function a(u){GT(i,n,s,a,l,"next",u)}function l(u){GT(i,n,s,a,l,"throw",u)}a(void 0)}))}}function Ce(){return Ce=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Ce.apply(null,arguments)}function HF(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;r[n]=t[n]}return r}var KT=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function YT(t){return typeof t=="string"||t}function ZT(t){return typeof t=="string"?t:void 0}var Kp,vZ=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],wl=(function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t})({}),JT=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({}),yZ=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],_Z=["token"],qF="NativeGzipValidationError",Xk=t=>t.length>=2&&t[0]===31&&t[1]===139,QT=(t,e)=>t===JT.GZipJS||e===JT.GZipJS||e==="gzip",XT=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError",wy=t=>
411{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=qF,e},bZ=(function(){var t=Hr((function*(e,r){18>e.size&&wy("too-short");var n=new Uint8Array(yield e.slice(0,10).arrayBuffer());Xk(n)&&n[2]===8||wy("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(a=>{for(var l=(()=>{if(Kp)return Kp;Kp=[];for(var p=0;256>p;p++){for(var f=p,g=0;8>g;g++)f=1&f?3988292384^f>>>1:f>>>1;Kp[p]=f>>>0}return Kp})(),u=4294967295,h=0;a.length>h;h++)u=l[255&(u^a[h])]^u>>>8;return(4294967295^u)>>>0})(r)&&wy("invalid-crc");var i=r.length>>>0;s.getUint32(4,!0)!==i&&wy("invalid-size")}));return function(e,r){return t.apply(this,arguments)}})();function eE(){return eE=Hr((function*(t,e,r){e===void 0&&(e=!0);try{var n=new TextEncoder().encode(t),s=new globalThis.CompressionStream("gzip"),i=s.writable.getWriter(),a=i.write(n).then((()=>i.close())).catch((function(){var h=Hr((function*(p){try{yield i.abort(p)}catch{}throw p}));return function(p){return h.apply(this,arguments)}})()),l=new Response(s.readable).blob(),u=(yield Promise.all([l,a]))[0];return yield bZ(u,n),u}catch(h){if(r!=null&&r.rethrow)throw h;return e&&console.error("Failed to gzip compress data",h),null}})),eE.apply(this,arguments)}var wZ=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],eI=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var r=t.toLowerCase();return wZ.concat(e).some((n=>{var s=n.toLowerCase();return r.indexOf(s)!==-1}))};function Lt(t,e){return t.indexOf(e)!==-1}var rw=function(t){return t.trim()},tE=function(t){return t.replace(/^\$/,"")};function WF(t){var e,r=[];return(e=JSON.stringify(t,(function(n,s){if(typeof s=="bigint")return s.toString();if(typeof s!="function"&&typeof s!="symbol"){if(s instanceof Error)return{name:s.name,message:s.message,stack:s.stack};if(s&&typeof s=="object"){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(s))return"[Circular]";r.push(s)}return s}})))!==null&&e!==void 0?e:"null"}var GF=Object.prototype,KF=GF.hasOwnProperty,nw=GF.toString,zt=Array.isArray||function(t){return nw.call(t)==="[object Array]"},Ni=t=>typeof t=="function",Fr=t=>t===Object(t)&&!zt(t),Ml=t=>{if(Fr(t)){for(var e in t)if(KF.call(t,e))return!1;return!0}return!1},Le=t=>t===void 0,pr=t=>nw.call(t)=="[object String]",rE=t=>pr(t)&&t.trim().length===0,Fs=t=>t===null,Wt=t=>Le(t)||Fs(t),bn=t=>nw.call(t)=="[object Number]"&&t==t,fl=t=>bn(t)&&t>0,Wa=t=>nw.call(t)==="[object Boolean]",xZ=t=>t instanceof FormData,SZ=t=>Lt(yZ,t),kZ=t=>Lt(_Z,t);function YF(t){return t===null||typeof t!="object"}function V_(t,e){return{}.toString.call(t)==="[object "+e+"]"}function DC(t){return typeof Event<"u"&&ZF(t,Event)}function ZF(t,e){try{return t instanceof e}catch{return!1}}var EZ=[!0,"true",1,"1","yes"],Ux=t=>Lt(EZ,t),jZ=[!1,"false",0,"0","no"];function Ao(t,e,r,n,s){return e>r&&(n.warn("min cannot be greater than max."),e=r),bn(t)?t>r?(n.warn(" cannot be  greater than max: "+r+". Using max value instead."),r):e>t?(n.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(n.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+s),Ao(s||r,e,r,n))}class CZ{constructor(e){this.tt={},this.et=e.et,this.it=Ao(e.bucketSize,0,100,e.rt),this.nt=Ao(e.refillRate,0,this.it,e.rt),this.st=Ao(e.refillInterval,0,864e5,e.rt)}ot(e,r){var n=Math.floor((r-e.lastAccess)/this.st);n>0&&(e.tokens=Math.min(e.tokens+n*this.nt,this.it),e.lastAccess=e.lastAccess+n*this.st)}consumeRateLimit(e){var r,n=Date.now(),s=String(e),i=this.tt[s];return i?this.ot(i,n):this.tt[s]=i={tokens:this.it,lastAccess:n},i.tokens===0||(i.tokens--,i.tokens===0&&((r=this.et)==null||r.call(this,e)),i.tokens===0)}stop(){this.tt={}}}var Oi="Mobile",H_="iOS",Ll="Android",Tf="Tablet",JF=Ll+" "+Tf,QF="iPad",XF="Apple",e$=XF+" Watch",Rm="Safari",If="BlackBerry",t$="Samsung",r$=t$+"Browser",n$=t$+" Internet",_d="Chrome",NZ=_d+" OS",s$=_d+" "+H_,OC="Internet Explorer",i$=OC+" "+Oi,MC="Opera",PZ=MC+" Mini",LC="Edge",a$="Microsoft "+LC,lf="Firefox",o$=lf+" "+H_,Qm="Nintendo",Xm="PlayStation",cf="Xbox",l$=Ll+" "+Oi,c$=Oi+" "+Rm,_m="Windows",nE=_m+" Phone",tI="Nokia",sE="Ouya",u$="Generic",RZ=u$+" "+Oi.toLowerCase(),d$=u$+" "+Tf.toLowerCase(),iE="Konqueror",h$="Oculus Browser",q_="Vivaldi",f$="Yandex",W_="Whale",aE="DuckDuckGo",p$="Pale Moon",G_="Waterfox",Am="Brave",m$="Google Search App",nn="(\\d+(\\.\\d+)?)",Bx=new RegExp("Version/"+nn),AZ=new RegExp(cf,"i"),TZ=new RegExp(Xm+" \\w+","i"),IZ=new RegExp(Qm+" \\w+","i"),FC=new RegExp(If+"|PlayBook|BB10","i"),DZ={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},g$=function(t,e,r,n){e=e||"";var s=(function(i){return i!=null&&i.brave?Am:null})(r);return s||(n!=null&&n.detectGoogleSearchApp&&Lt(t,"GSA/")?m$:Lt(t," OPR/")&&Lt(t,"Mini")?PZ:Lt(t," OPR/")?MC:FC.test(t)?If:Lt(t,"IE"+Oi)||Lt(t,"WPDesktop")?i$:Lt(t,"OculusBrowser")?h$:Lt(t,r$)?
411n$:Lt(t,LC)||Lt(t,"Edg/")?a$:Lt(t,q_+"/")?q_:Lt(t,"YaBrowser/")?f$:Lt(t,W_+"/")?W_:Lt(t,aE+"/")||Lt(t,"Ddg/")?aE:Lt(t,"FBIOS")?"Facebook "+Oi:Lt(t,"UCWEB")||Lt(t,"UCBrowser")?"UC Browser":Lt(t,"CriOS")?s$:Lt(t,"CrMo")||Lt(t,_d)?_d:Lt(t,Ll)&&Lt(t,Rm)?l$:Lt(t,"FxiOS")?o$:Lt(t.toLowerCase(),iE.toLowerCase())?iE:Lt(t,Am+"/")?Am:((i,a)=>a&&Lt(a,XF)||(function(l){return Lt(l,Rm)&&!Lt(l,_d)&&!Lt(l,Ll)})(i))(t,e)?Lt(t,Oi)?c$:Rm:Lt(t,"PaleMoon/")?p$:Lt(t,G_+"/")?G_:Lt(t,lf)?lf:Lt(t,"MSIE")||Lt(t,"Trident/")?OC:Lt(t,"Gecko")?lf:"")},OZ={[i$]:[new RegExp("rv:"+nn)],[a$]:[new RegExp(LC+"?\\/"+nn)],[_d]:[new RegExp("("+_d+"|CrMo)\\/"+nn)],[s$]:[new RegExp("CriOS\\/"+nn)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+nn)],[Rm]:[Bx],[c$]:[Bx],[MC]:[new RegExp("(Opera|OPR)\\/"+nn)],[lf]:[new RegExp(lf+"\\/"+nn)],[o$]:[new RegExp("FxiOS\\/"+nn)],[iE]:[new RegExp("Konqueror[:/]?"+nn,"i")],[If]:[new RegExp(If+" "+nn),Bx],[l$]:[new RegExp("android\\s"+nn,"i")],[n$]:[new RegExp(r$+"\\/"+nn)],[h$]:[new RegExp("OculusBrowser\\/"+nn)],[q_]:[new RegExp(q_+"\\/"+nn)],[f$]:[new RegExp("YaBrowser\\/"+nn)],[W_]:[new RegExp(W_+"\\/"+nn)],[Am]:[new RegExp(Am+"\\/"+nn)],[aE]:[new RegExp("(DuckDuckGo|Ddg)\\/"+nn)],[p$]:[new RegExp("PaleMoon\\/"+nn)],[G_]:[new RegExp(G_+"\\/"+nn)],[m$]:[new RegExp("GSA\\/"+nn)],[OC]:[new RegExp("(rv:|MSIE )"+nn)],Mozilla:[new RegExp("rv:"+nn)]},MZ=function(t,e,r,n){var s=g$(t,e,r,n),i=OZ[s];if(Le(i))return null;for(var a=0;i.length>a;a++){var l=t.match(i[a]);if(l)return parseFloat(l[l.length-2])}return null},rI=[[new RegExp(cf+"; "+cf+" (.*?)[);]","i"),t=>[cf,t&&t[1]||""]],[new RegExp(Qm,"i"),[Qm,""]],[new RegExp(Xm,"i"),[Xm,""]],[FC,[If,""]],[new RegExp(_m,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[nE,""];if(new RegExp(Oi).test(e)&&!/IEMobile\b/.test(e))return[_m+" "+Oi,""];var r=/Windows NT ([0-9.]+)/i.exec(e);if(r&&r[1]){var n=DZ[r[1]]||"";return/arm/i.test(e)&&(n="RT"),[_m,n]}return[_m,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[H_,[t[3],t[4],t[5]||"0"].join(".")]:[H_,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=Le(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Ll+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ll+")","i"),t=>t&&t[2]?[Ll,[t[2],t[3],t[4]||"0"].join(".")]:[Ll,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[NZ,""]],[/Linux|debian/i,["Linux",""]]],nI=function(t){return IZ.test(t)?Qm:TZ.test(t)?Xm:AZ.test(t)?cf:new RegExp(sE,"i").test(t)?sE:new RegExp("("+nE+"|WPDesktop)","i").test(t)?nE:/iPad/.test(t)?QF:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?e$:FC.test(t)?If:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(tI,"i").test(t)?tI:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Oi).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Ll:JF:new RegExp("(pda|"+Oi+")","i").test(t)?RZ:new RegExp(Tf,"i").test(t)&&!new RegExp(Tf+" pc","i").test(t)?d$:""},LZ=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function sI(t,e){return typeof(r=t)=="string"&&LZ.test(r)?t:e();var r}function tu(t){return t&&t.split("#")[0]}function $C(t,e){var r=setTimeout(t,e);return r!=null&&r.unref&&(r==null||r.unref()),r}function iI(t,e,r){return v$.apply(this,arguments)}function v$(){return(v$=Hr((function*(t,e,r){var n;try{return yield Promise.race([t,new Promise(((s,i)=>{n=$C((()=>{try{r==null||r(),s()}catch(a){i(a)}}),e)}))])}finally{clearTimeout(n)}}))).apply(this,arguments)}var FZ=t=>t instanceof Error,y$={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},$Z=y$.info;function _$(t){if(Wa(t))return{boolValue:t};if(typeof t=="number")return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if(typeof t=="string")return{stringValue:t};if(zt(t))return{arrayValue:{values:t.map((e=>_$(e)))}};try{return{stringValue:JSON.stringify(t)}}catch{return{stringValue:String(t)}}}function K_(t){var e=[];for(var r in t){var n=t[r];Fs(n)||Le(n)||e.push({key:r,value:_$(n)})}return e}function zZ(t,e){var r=y$[t.level||"info"]||$Z,n=r.text,s=r.number,i=String(Date.now())+"000000",a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.windowId&&(a["window.id"]=e.windowId),Wt(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),Wt(e.lastActivityTimestamp)||(a.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(a["url.full"]=e.currentUrl),e.screenName&&(a["screen.name"]=e.screenName),e.a
411ppState&&(a["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(a.feature_flags=e.activeFeatureFlags);var l=Ce({},a,t.attributes||{}),u={timeUnixNano:i,observedTimeUnixNano:i,severityNumber:s,severityText:n,body:{stringValue:t.body},attributes:K_(l)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),Le(t.trace_flags)||(u.flags=t.trace_flags),u}function b$(t,e,r){return Ce({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":r})}function w$(t,e,r,n){return{resourceLogs:[{resource:{attributes:K_(e)},scopeLogs:[{scope:{name:r,version:n},logRecords:t}]}]}}let UZ=class{constructor(e,r,n,s,i,a,l){var u;a===void 0&&(a=()=>Promise.resolve()),this._instance=e,this.Ne=r,this.rt=n,this.ut=s,this.ht=i,this.dt=a,this.vt=l,this.ct=null,this.ft=0,this.yt=0,this.bt=0,this._t=0,this.wt=!1,this.kt=r.maxBufferSize,this.xt=Math.max((u=r.maxQueueSize)!==null&&u!==void 0?u:r.maxBufferSize,r.maxBufferSize),this.St=r.flushIntervalMs,this.Ct=r.maxBatchRecordsPerPost,this.Mt=r.rateCapWindowMs,this.Tt=r.maxLogsPerInterval}reset(){this.Et(),this.ct=null,this.bt=0,this._t=0,this.wt=!1,this.ft=0,this.yt=0,this.Ct=this.Ne.maxBatchRecordsPerPost}onReconnect(){this.yt=0,this.It()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var r=this.Pt(e);if(r!==null)if(r.body){if(this.Rt()){var n={record:zZ(r,this.ut())};this.ht((()=>this.At(n)))}}else this.rt.info("Log was rejected in beforeSend function")}}Pt(e){var r=this.Ne.beforeSend;if(!r)return e;var n=zt(r)?r:[r],s=e;for(var i of n)try{var a=i(s);if(!a)return this.rt.info("Log was rejected in beforeSend function"),null;s=a}catch(l){return this.rt.error("Error in beforeSend function for log:",l),null}return s}Rt(){if(this.Tt===void 0)return!0;var e=Date.now(),r=e-this.bt;return this.Mt>r&&r>=0||(this.bt=e,this._t=0,this.wt=!1),this.Tt>this._t?(this._t++,!0):(this.wt||(this.rt.warn("captureLog dropping logs: exceeded "+this.Tt+" logs per "+this.Mt+"ms"),this.wt=!0),!1)}flush(){var e=this;return Hr((function*(){if(!e._instance.isDisabled)return e.ct||(e.ct=e.Ft().finally((()=>{e.ct=null}))),e.ct}))()}Ft(){var e=this;return Hr((function*(){var r;e.Et();var n=(r=e._instance.getPersistedProperty(wl.LogsQueue))!==null&&r!==void 0?r:[];if(n.length!==0)for(var s=n.length,i=0;n.length>0&&s>i;){var a,l;e.ft=0;var u=Math.min(n.length,e.Ct),h=n.slice(0,u),p=w$(h.map((g=>g.record)),e.Lt(),(a=e.vt)!==null&&a!==void 0?a:e._instance.getLibraryId(),e._instance.getLibraryVersion()),f=yield e._instance.Ot(p);if(f.kind==="too-large"&&h.length>1)e.Ct=Math.max(1,Math.floor(h.length/2)),e.rt.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+e.Ct);else if(f.kind==="retry-later"||(f.kind==="too-large"?e.rt.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):f.kind==="ok"&&e.Ne.maxBatchRecordsPerPost>e.Ct&&(e.Ct=Math.min(e.Ne.maxBatchRecordsPerPost,e.Ct+1)),yield e.Dt(h.length),n=(l=e._instance.getPersistedProperty(wl.LogsQueue))!==null&&l!==void 0?l:[],i+=h.length,f.kind==="fatal"))throw f.error}}))()}Dt(e){var r=this;return Hr((function*(){var n,s=Math.max(0,e-r.ft),i=(n=r._instance.getPersistedProperty(wl.LogsQueue))!==null&&n!==void 0?n:[];r._instance.setPersistedProperty(wl.LogsQueue,i.slice(s)),yield r.dt()}))()}Lt(){return b$(this.Ne,this._instance.getLibraryId(),this._instance.getLibraryVersion())}At(e){var r;if(!this._instance.optedOut){var n=(r=this._instance.getPersistedProperty(wl.LogsQueue))!==null&&r!==void 0?r:[];this.xt>n.length||(n.shift(),this.ft++,this.rt.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(wl.LogsQueue,n),this.kt>n.length?this.$t():this.It()}}$t(e){e===void 0&&(e=this.St),this.Nt||(this.Nt=$C((()=>{this.Nt=void 0,this.It()}),e))}qt(){var e=Math.min(Math.max(0,this.yt-1),6);return this.St*Math.pow(2,e)}jt(){var e=this._instance.getPersistedProperty(wl.LogsQueue);return!!e&&e.length>0}shutdown(e){var r=this;return Hr((function*(){r.Et();var n=r.flush().catch((()=>{}));e!==void 0?yield iI(n,e):yield n}
411))()}flushWithTimeout(e){var r=this;return Hr((function*(){var n=r.flush();yield iI(n,e,(()=>{n.catch((()=>{}))}))}))()}It(){this.flush().then((()=>{this.yt=0}),(e=>{this.yt++,this.rt.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.jt()&&this.$t(this.qt())}))}Et(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}};var Vx=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function aI(t){return String(t)+"000000"}function oI(t,e,r,n){var s="";return n&&(s=Object.keys(n).sort().map((i=>JSON.stringify(i)+":"+JSON.stringify(n[i]))).join(",")),t+"\0"+e+"\0"+(r??"")+"\0"+s}let BZ=class{constructor(e,r,n){this._instance=e,this.Ne=r,this.rt=n,this.Bt=new Map,this.ct=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Wt=0}count(e,r,n){r===void 0&&(r=1),this.Vt({name:e,type:"count",value:r,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(e,r,n){this.Vt({name:e,type:"gauge",value:r,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(e,r,n){this.Vt({name:e,type:"histogram",value:r,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var e=this,r=this.ct,n=(function(){var i=Hr((function*(){r&&(yield r.catch((()=>{}))),yield e.Zt()}));return function(){return i.apply(this,arguments)}})(),s=n().finally((()=>{this.ct===s&&(this.ct=null)}));return this.ct=s,s}drainWindow(){if(this.Bt.size===0)return null;var e=this.Bt;return this.Bt=new Map,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Gt(e)}reset(){this.Wt++,this.Et(),this.Bt=new Map,this.ct=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set}Vt(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var r=this.Pt(e);if(r!==null)if(r.name&&typeof r.name=="string")if(typeof r.value=="number"&&Number.isFinite(r.value))if(r.type==="count"&&0>r.value)this.rt.warn("Dropping count '"+r.name+"': counters are monotonic, value must be >= 0");else{var n,s;try{n=r.attributes?Ce({},r.attributes):void 0,s=oI(r.type,r.name,r.unit,n)}catch(l){return void this.rt.warn("Dropping metric '"+r.name+"': attributes could not be serialized",l)}var i=this.Bt.get(s);if(!i){if(!this.Qt())return;i={name:r.name,type:r.type,unit:r.unit,attributes:n,windowStartMs:Date.now()},this.Bt.set(s,i)}var a=this.Ut.get(r.name);a===void 0?this.Ut.set(r.name,r.type):a===r.type||this.zt.has(r.name)||(this.zt.add(r.name),this.rt.warn("Metric name '"+r.name+"' is already used as a "+a+"; recording it as a "+r.type+" too will blend both series in charts. Use a distinct name.")),this.Kt(i,r.value),this.$t()}else this.rt.warn("Dropping metric '"+r.name+"': value must be a finite number");else this.rt.warn("Dropping metric with empty name")}}Qt(){return this.Ne.maxSeriesPerFlush>this.Bt.size||(this.Ht||(this.Ht=!0,this.rt.warn("Metric series cap reached ("+this.Ne.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Kt(e,r){var n;switch(e.type){case"count":e.total=((n=e.total)!==null&&n!==void 0?n:0)+r;break;case"gauge":e.last=r;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:r,max:r,bucketCounts:new Array(Vx.length+1).fill(0)});var s=e.hist;s.count+=1,s.sum+=r,s.min=Math.min(s.min,r),s.max=Math.max(s.max,r),s.bucketCounts[(function(i,a){for(var l=0;a.length>l;l++)if(a[l]>=i)return l;return a.length})(r,Vx)]+=1}}Pt(e){var r=this.Ne.beforeSend;if(!r)return e;var n=zt(r)?r:[r],s=e;for(var i of n)try{var a=i(s);if(!a)return this.rt.info("Metric was rejected in beforeSend function"),null;s=a}catch(l){return this.rt.error("Error in beforeSend function for metric:",l),null}return s}$t(){this.Nt||(this.Nt=$C((()=>{this.Nt=void 0,this.flush().catch((e=>{this.rt.error("Metrics flush failed:",e)}))}),this.Ne.flushIntervalMs))}Et(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}Zt(){var e=this;return Hr((function*(){if(e.Bt.size!==0){var r=e.Bt;e.Bt=new Map,e.Ht=!1,e.Ut=new Map,e.zt=new Set;var n=e.Wt,s=yield e._instance.Jt(e.Gt(r));if(n===e.Wt)switch(s.kind){case"ok":return;case"retry-later":return e.Yt(r),void e.$t();case"too-large":return void e.rt.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.rt.error("Failed to send metrics batch:",s.error)}}}))()}Gt(e){return r=this.Xt(e),n=(function(a,l,u){return Ce({},a.resourceAttributes,{"service.name":a.serviceName||"unknown_service"},a.environment&&{"deployment.environment":a.environment},a.serviceVersion&&{"service.version":a.serviceVersion},{"telemetry.sdk.name":l,"telemetry.sdk.version":u})})(this.Ne,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),i=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:K_(n)},scopeMetrics:[{scope:{name:s,version:i},metrics:r}]}]};var r,n,s,i}Xt(e){var r=aI(Date.now()),n=new Map;
411for(var s of e.values()){var i,a=oI(s.type,s.name,s.unit,void 0),l=n.get(a);l||(l=Ce({name:s.name},s.unit&&{unit:s.unit}),s.type==="count"?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:s.type==="gauge"?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},n.set(a,l));var u=K_((i=s.attributes)!==null&&i!==void 0?i:{}),h=aI(s.windowStartMs);if(s.type==="count"){var p,f={attributes:u,startTimeUnixNano:h,timeUnixNano:r,asDouble:(p=s.total)!==null&&p!==void 0?p:0};l.sum.dataPoints.push(f)}else if(s.type==="gauge"){var g,v={attributes:u,timeUnixNano:r,asDouble:(g=s.last)!==null&&g!==void 0?g:0};l.gauge.dataPoints.push(v)}else s.hist&&l.histogram.dataPoints.push({attributes:u,startTimeUnixNano:h,timeUnixNano:r,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:Vx})}return Array.from(n.values())}Yt(e){var r,n;for(var s of e){var i=s[0],a=s[1],l=this.Bt.get(i);if(l)switch(l.windowStartMs=Math.min(l.windowStartMs,a.windowStartMs),l.type){case"count":l.total=((r=l.total)!==null&&r!==void 0?r:0)+((n=a.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(a.hist)if(l.hist){l.hist.count+=a.hist.count,l.hist.sum+=a.hist.sum,l.hist.min=Math.min(l.hist.min,a.hist.min),l.hist.max=Math.max(l.hist.max,a.hist.max);for(var u=0;l.hist.bucketCounts.length>u;u++)l.hist.bucketCounts[u]+=a.hist.bucketCounts[u]}else l.hist=a.hist}else this.Qt()&&this.Bt.set(i,a)}}};var xy,lI,Hx;function VZ(t){var e=globalThis._posthogChunkIds;if(e){var r=Object.keys(e);return Hx&&r.length===lI||(lI=r.length,Hx=r.reduce(((n,s)=>{xy||(xy={});var i=xy[s];if(i)n[i[0]]=i[1];else for(var a=t(s),l=a.length-1;l>=0;l--){var u=a[l],h=u==null?void 0:u.filename,p=e[s];if(h&&p){n[h]=p,xy[s]=[h,p];break}}return n}),{})),Hx}}class HZ{constructor(e,r,n){n===void 0&&(n=[]),this.coercers=e,this.stackParser=r,this.modifiers=n}buildFromUnknown(e,r){r===void 0&&(r={});var n=r&&r.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(n,r,0).apply(e),i=this.buildParsingContext(r),a=this.parseStacktrace(s,i);return{$exception_list:this.convertToExceptionList(a,n),$exception_level:"error"}}modifyFrames(e){var r=this;return Hr((function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&zt(n.stacktrace.frames)&&(n.stacktrace.frames=yield r.applyModifiers(n.stacktrace.frames));return e}))()}coerceFallback(e){var r;return{type:"Error",value:"Unknown error",stack:(r=e.syntheticException)==null?void 0:r.stack,synthetic:!0}}parseStacktrace(e,r){var n,s;return e.cause!=null&&(n=this.parseStacktrace(e.cause,r)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?r.skipFirstLines:0),r.chunkIdMap)),Ce({},e,{cause:n,stack:s})}applyChunkIds(e,r){return e.map((n=>(n.filename&&r&&(n.chunk_id=r[n.filename]),n)))}applyCoercers(e,r){for(var n of this.coercers)if(n.match(e))return n.coerce(e,r);return this.coerceFallback(r)}applyModifiers(e){var r=this;return Hr((function*(){var n=e;for(var s of r.modifiers)n=yield s(n);return n}))()}convertToExceptionList(e,r){var n,s,i,a={type:e.type,value:e.value,mechanism:{type:(n=r.type)!==null&&n!==void 0?n:"generic",handled:(s=r.handled)===null||s===void 0||s,synthetic:(i=e.synthetic)!==null&&i!==void 0&&i}};e.stack&&(a.stacktrace={type:"raw",frames:e.stack});var l=[a];return e.cause!=null&&l.push(...this.convertToExceptionList(e.cause,Ce({},r,{handled:!0}))),l}buildParsingContext(e){var r;return{chunkIdMap:VZ(this.stackParser),skipFirstLines:(r=e.skipFirstLines)!==null&&r!==void 0?r:1}}buildCoercingContext(e,r,n){n===void 0&&(n=0);var s=(i,a)=>
411{if(4>=a){var l=this.buildCoercingContext(e,r,a);return this.applyCoercers(i,l)}};return Ce({},r,{syntheticException:n==0?r.syntheticException:void 0,mechanism:e,apply:i=>s(i,n),next:i=>s(i,n+1)})}}var Df="?";function oE(t,e,r,n,s){var i={platform:t,filename:e,function:r==="<anonymous>"?Df:r,in_app:!0};return Le(n)||(i.lineno=n),Le(s)||(i.colno=s),i}var x$=(t,e)=>{var r=t.indexOf("safari-extension")!==-1,n=t.indexOf("safari-web-extension")!==-1;return r||n?[t.indexOf("@")!==-1?t.split("@")[0]:Df,r?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},qZ=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,WZ=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,GZ=/\((\S*)(?::(\d+))(?::(\d+))\)/,KZ=(t,e)=>{var r=qZ.exec(t);if(r)return oE(e,r[1],Df,+r[2],+r[3]);var n=WZ.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){var s=GZ.exec(n[2]);s&&(n[2]=s[1],n[3]=s[2],n[4]=s[3])}var i=x$(n[1]||Df,n[2]);return oE(e,i[1],i[0],n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},YZ=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ZZ=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,JZ=(t,e)=>{var r=YZ.exec(t);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var n=ZZ.exec(r[3]);n&&(r[1]=r[1]||"eval",r[3]=n[1],r[4]=n[2],r[5]="")}var s=r[3],i=r[1]||Df,a=x$(i,s);return oE(e,s=a[1],i=a[0],r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},cI=/\(error: (.*)\)/;class QZ{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,r){var n=pr(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?r.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var r=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?r+": "+e.message:r}isDOMException(e){return V_(e,"DOMException")}isDOMError(e){return V_(e,"DOMError")}}class XZ{match(e){return(function(r){switch({}.toString.call(r)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return ZF(r,Error)}})(e)}coerce(e,r){return{type:this.getType(e),value:this.getMessage(e,r),stack:this.getStack(e),cause:e.cause?r.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,r){var n=e.message;return String(n.error&&typeof n.error.message=="string"?n.error.message:n)}getStack(e){return e.stacktrace||e.stack||void 0}}class eJ{constructor(){}match(e){return!!V_(e,"ErrorEvent")&&(e.error!=null||this.fe(e))}coerce(e,r){var n;if(e.error!=null)return r.apply(e.error);var s=r.apply(e.message);return Ce({},s,{stack:(n=this.pe(e))!==null&&n!==void 0?n:s.stack,synthetic:!0})}fe(e){return pr(e.message)&&e.message.length>0}pe(e){var r=e;if(pr(r.filename)&&r.filename.length>0){var n,s,i=(n=r.lineno)!==null&&n!==void 0?n:0,a=(s=r.colno)!==null&&s!==void 0?s:0;return`Error
412    at `+r.filename+":"+i+":"+a}}}var tJ=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class rJ{match(e){return typeof e=="string"}coerce(e,r){var n,s=this.getInfos(e),i=s[0],a=s[1];return{type:i??"Error",value:a??e,stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}getInfos(e){var r="Error",n=e,s=e.match(tJ);return s&&(r=s[1],n=s[2]),[r,n]}}var nJ=["fatal","error","warning","log","info","debug"];function S$(t,e){e===void 0&&(e=40);var r=Object.keys(t);if(r.sort(),!r.length)return"[object has no keys]";for(var n=r.length;n>0;n--){var s=r.slice(0,n).join(", ");if(e>=s.length)return n===r.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class sJ{match(e){return typeof e=="object"&&e!==null}coerce(e,r){var n,s,i=this.getErrorPropertyFromObject(e);return i?r.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(n=this.getStack(e))!==null&&n!==void 0?n:(s=r.syntheticException)==null?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return DC(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var r="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(r+=" with message: '"+e.message+"'"),r}if("message"in e&&typeof e.message=="string")return e.message;var n=this.getObjectClassName(e);return(n&&n!=="Object"?"'"+n+"'":"Object")+" captured as exception with keys: "+S$(e)}isSeverityLevel(e){return pr(e)&&!rE(e)&&nJ.indexOf(e)>=0}getStack(e){try{return pr(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:pr(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(var r in e)if({}.hasOwnProperty.call(e,r)){var n=e[r];if(FZ(n))return n}}getObjectClassName(e){try{var r=Object.getPrototypeOf(e);return r?r.constructor.name:void 0}catch{return}}}class iJ{match(e){return DC(e)}coerce(e,r){var n,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+S$(e),stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}}class aJ{match(e){return YF(e)}coerce(e,r){var n;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}}class oJ{match(e){return V_(e,"PromiseRejectionEvent")||this.isCu
412stomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!DC(e))return!1;try{var r=e.detail;return r!=null&&typeof r=="object"&&"reason"in r}catch{return!1}}coerce(e,r){var n,s=this.getUnhandledRejectionReason(e);return YF(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}:r.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var Y_="$message",Z_="$timestamp",lJ=new Set([Y_,Z_]),qx={enabled:!0,max_bytes:32768};function J_(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:qx.enabled,max_bytes:uJ(t.max_bytes,qx.max_bytes)}:Ce({},qx)}class cJ{constructor(e){this.Ke=[],this.Je=0,this.Ne=J_(e)}setConfig(e){this.Ne=J_(e),this.Xe()}add(e){var r=(function(s){var i;try{i=WF(s)}catch{return}try{var a=JSON.parse(i);if(!Fr(a))return;var l=a,u=l[Y_],h=l[Z_];return!pr(u)||u.trim().length===0||!pr(h)&&!bn(h)?void 0:{step:l,json:i}}catch{return}})(e);if(r){var n=(function(s){if(typeof TextEncoder<"u")return new TextEncoder().encode(s).length;for(var i=encodeURIComponent(s),a=0,l=0;i.length>l;l++)i[l]==="%"?(a+=1,l+=2):a+=1;return a})(r.json);n>this.Ne.max_bytes||(this.Ke.push({step:r.step,bytes:n}),this.Je+=n,this.Xe())}}getAttachable(){return this.Ke.map((e=>e.step))}clear(){this.Ke=[],this.Je=0}size(){return this.Ke.length}Xe(){for(;this.Je>this.Ne.max_bytes&&this.Ke.length>0;){var e=this.Ke.shift();e&&(this.Je-=e.bytes)}}}function uJ(t,e){if(!bn(t)||t===1/0||t===-1/0)return e;var r=Math.floor(t);return 0>r?e:r}var k$=function(t,e){var r=(e===void 0?{}:e).debugEnabled,n={k(s){if(me&&(Er.DEBUG||me.POSTHOG_DEBUG||r)&&!Le(me.console)&&me.console){for(var i=("__rrweb_original__"in me.console[s])?me.console[s].__rrweb_original__:me.console[s],a=arguments.length,l=new Array(a>1?a-1:0),u=1;a>u;u++)l[u-1]=arguments[u];i(t,...l)}},debug(){for(var s=arguments.length,i=new Array(s),a=0;s>a;a++)i[a]=arguments[a];n.k("debug",...i)},info(){for(var s=arguments.length,i=new Array(s),a=0;s>a;a++)i[a]=arguments[a];n.k("log",...i)},warn(){for(var s=arguments.length,i=new Array(s),a=0;s>a;a++)i[a]=arguments[a];n.k("warn",...i)},error(){for(var s=arguments.length,i=new Array(s),a=0;s>a;a++)i[a]=arguments[a];n.k("error",...i)},critical(){for(var s=arguments.length,i=new Array(s),a=0;s>a;a++)i[a]=arguments[a];console.error(t,...i)},uninitializedWarning(s){n.error("You must initialize PostHog before calling "+s)},createLogger:(s,i)=>k$(t+" "+s,i)};return n},$e=k$("[PostHog.js]"),en=$e.createLogger,dJ=en("[ExternalScriptsLoader]"),Wx=(t,e,r)=>{if(t.config.disable_external_dependency_loading)return dJ.warn(e+" was requested but loading of external scripts is disabled."),r("Loading of external scripts is disabled");var n=Ue==null?void 0:Ue.querySelectorAll("script");if(n){for(var s,i=function(){if(n[a].src===e){var u=n[a];return u.__posthog_loading_callback_fired?{v:r()}:(u.addEventListener("load",(h=>{u.__posthog_loading_callback_fired=!0,r(void 0,h)})),u.onerror=h=>r(h),{v:void 0})}},a=0;n.length>a;a++)if(s=i())return s.v}var l=()=>{if(!Ue)return r("document not found");var u=Ue.createElement("script");if(u.type="text/javascript",u.crossOrigin="anonymous",u.src=e,u.onload=f=>{u.__posthog_loading_callback_fired=!0,r(void 0,f)},u.onerror=f=>r(f),t.config.prepare_external_dependency_script&&(u=t.config.prepare_external_dependency_script(u)),!u)return r("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")Ue.head.appendChild(u);else{var h,p=Ue.querySelectorAll("body > script");p.length>0?(h=p[0].parentNode)==null||h.insertBefore(u,p[0]):Ue.body.appendChild(u)}};Ue!=null&&Ue.body?l():Ue==null||Ue.addEventListener("DOMContentLoaded",l)};yt.__PosthogExtensions__=yt.__PosthogExtensions__||{},yt.__PosthogExtensions__.loadExternalDependency=(t,e,r)=>{if(e!=="remote-config"){var n;if(t.config.strict_script_versioning)n=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+t.version;if(e==="toolbar"){var i=3e5;
412s=s+"&t="+Math.floor(Date.now()/i)*i}n=t.requestRouter.endpointFor("assets",s)}Wx(t,n,r)}else{var a=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Wx(t,a,r)}},yt.__PosthogExtensions__.loadSiteApp=(t,e,r)=>{var n=t.requestRouter.endpointFor("api",e);Wx(t,n,r)};Er.DEBUG=!1,Er.LIB_VERSION="1.414.0",Er.LIB_NAME="web";var E$="$people_distinct_id",eg="$device_id",Gx="$device_model",bm="__alias",wm="__timers",lE="$autocapture_disabled_server_side",cE="$heatmaps_enabled_server_side",uE="$exception_capture_enabled_server_side",dE="$error_tracking_suppression_rules",hE="$error_tracking_capture_extension_exceptions",fE="$web_vitals_enabled_server_side",zC="$dead_clicks_enabled_server_side",UC="$product_tours_enabled_server_side",pE="$web_vitals_allowed_metrics",cd="$session_recording_remote_config",j$="$replay_sample_rate",C$="$replay_override_sampling",N$="$replay_override_linked_flag",P$="$replay_override_url_trigger",R$="$replay_override_event_trigger",Qh="$sesid",BC="$session_is_sampled",nd="$enabled_feature_flags",l_="$active_feature_flags",xm="$early_access_features",mE="$feature_flag_details",c_="$feature_flag_payloads",gE="$feature_flag_request_id",Q_="$minimal_flag_called_events",pl="$override_feature_flags",Hh="$override_feature_flag_payloads",Zu="$stored_person_properties",Ju="$stored_group_properties",vE="$surveys",X_="$surveys_loaded_at",yE="$surveys_activated",u_="$surveys_activated_session",d_="$surveys_activated_timestamps",Sm="ph_product_tours",Tm="$flag_call_reported",_E="$flag_call_reported_session_id",bE="$feature_flag_errors",tg="$feature_flag_evaluated_at",na="$user_state",wE="$client_session_props",xE="$capture_rate_limit",SE="$initial_campaign_params",kE="$initial_referrer_info",eb="$initial_person_info",tb="$epp",Sy="$posthog_cookieless",A$="$cookieless_mode",T$="$sdk_debug_extensions_init_method",I$="$sdk_debug_extensions_init_time_ms",D$="$sdk_debug_recording_script_not_loaded",VC="PostHog loadExternalDependency extension not found.",Qu="on_reject",Tl="always",Sh="anonymous",Mu="identified",EE="identified_only",rb="visibilitychange",nb="beforeunload",qh="$pageview",Kx="$pageleave",Yx="$identify",uI="$groupidentify";function ky(t,e){zt(t)&&t.forEach(e)}function Ir(t,e){if(!Wt(t))if(zt(t))t.forEach(e);else if(xZ(t))t.forEach(((n,s)=>e(n,s)));else for(var r in t)KF.call(t,r)&&e(t[r],r)}var Lr=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;e>n;n++)r[n-1]=arguments[n];for(var s of r)for(var i in s)s[i]!==void 0&&(t[i]=s[i]);return t};function h_(t){for(var e=Object.keys(t),r=e.length,n=new Array(r);r--;)n[r]=[e[r],t[e[r]]];return n}var dI=function(t){try{return t()}catch{return}},hJ=function(t){return function(){try{for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];return t.apply(this,r)}catch(s){$e.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),$e.critical(s)}}},HC=function(t){var e={};return Ir(t,(function(r,n){(pr(r)&&r.length>0||bn(r))&&(e[n]=r)})),e},fJ=["herokuapp.com","vercel.app","netlify.app"];function pJ(t){var e=t==null?void 0:t.hostname;if(!pr(e))return!1;var r=e.split(".").slice(-2).join(".");for(var n of fJ)if(r===n)return!1;return!0}function Jr(t,e,r,n){var s=n??{},i=s.capture,a=s.passive;t==null||t.addEventListener(e,r,{capture:i!==void 0&&i,passive:a===void 0||a})}function jE(t){return t.name==="ph_toolbar_internal"}var O$=t=>{if(Ue){try{for(var e=t+"=",r=Ue.cookie.split(";").filter((i=>i.length)),n=0;r.length>n;n++){for(var s=r[n];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return bn(t)&&isFinite(t)&&Math.floor(t)===t});class sb{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,r,n,s){if(!Number.isInteger(e)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(s)||0>e||0>r||0>n||0>s||e>0xffffffffffff||r>4095||n>1073741823||s>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=e/Math.pow(2,40),i[1]=e/Math.pow(2,32),i[2]=e/Math.pow(2,24),i[3]=e/Math.pow(2,16),i[4]=e/256,i[5]=e,i[6]=112|r>>>8,i[7]=r,i[8]=128|n>>>24,i[9]=n>>>16,i[10]=n>>>8,i[11]=n,i[12]=s>>>24,i[13]=s>>>16,i[14]=s>>>8,i[15]=s,new sb(i)}toString(){for(var e="",r=0;this.bytes.length>r;r++)e=e+(this.bytes[r]>>>4).toString(16)+(15&this.bytes[r]).toString(16),r!==3&&r!==5&&r!==7&&r!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new sb(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var r=0;16>r;r++){var n=this.bytes[r]-e.bytes[r];if(n!==0)return Math.sign(n)}return 0}}class mJ{generate(){var e=this.generateOrAbort();if(!Le(e))return e;this.S=0;var r=this.generateOrAbort();if(Le(r))throw new Error("Could not generate UUID after timestamp reset");return r}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.C();else{if(this.S>=e+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C())}return sb.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.A.nextUint32())}C(){this.I=1024*this.A.nextUint32()+(1023&this.A.nextUint32())}constructor(){this.S=0,this.I=0,this.A=new gJ}}var hI,M$=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};me&&!Le(me.crypto)&&crypto.getRandomValues&&(M$=t=>crypto.getRandomValues(t));class gJ{nextUint32(){return this.R.length>this.O||(M$(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var Sl=()=>
412vJ().toString(),vJ=()=>(hI||(hI=new mJ)).generate(),Yp="",yJ=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Il={N:()=>!!Ue,j(t){$e.error("cookieStore error: "+t)},P:O$,H(t){var e;try{e=JSON.parse(Il.P(t))||{}}catch{}return e},F(t,e,r,n,s){if(!Ue)return!1;try{var i="",a="",l=(function(p,f){if(f){var g=(function(_,x){if(x===void 0&&(x=Ue),Yp)return Yp;if(!x||["localhost","127.0.0.1"].includes(_))return"";for(var w=_.split("."),S=Math.min(w.length,8),k="dmn_chk_"+Sl();!Yp&&S--;){var j=w.slice(S).join("."),C=k+"=1;domain=."+j+";path=/";x.cookie=C+";max-age=3",x.cookie.includes(k)&&(x.cookie=C+";max-age=0",Yp=j)}return Yp})(p);if(!g){var v=(_=>{var x=_.match(yJ);return x?x[0]:""})(p);v!==g&&$e.info("Warning: cookie subdomain discovery mismatch",v,g),g=v}return g?"; domain=."+g:""}return""})(Ue.location.hostname,n);if(r){var u=new Date;u.setTime(u.getTime()+864e5*r),i="; expires="+u.toUTCString()}s&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+i+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&$e.warn("cookieStore warning: large cookie, len="+h.length),Ue.cookie=h,!0}catch{return!1}},q(t,e){if(Ue!=null&&Ue.cookie)try{Il.F(t,"",-1,e)}catch{return}}},Zx=null,Mr={N(){if(!Fs(Zx))return Zx;var t=!0;if(Le(me))t=!1;else try{var e="__mplssupport__";Mr.F(e,"xyz"),Mr.P(e)!=='"xyz"'&&(t=!1),Mr.q(e)}catch{t=!1}return t||$e.error("localStorage unsupported; falling back to cookie store"),Zx=t,t},j(t){$e.error("localStorage error: "+t)},P(t){try{return me==null?void 0:me.localStorage.getItem(t)}catch(e){Mr.j(e)}return null},H(t){try{return JSON.parse(Mr.P(t))||{}}catch{}return null},F(t,e){try{return me==null||me.localStorage.setItem(t,JSON.stringify(e)),!0}catch(r){Mr.j(r)}return!1},q(t){try{me==null||me.localStorage.removeItem(t)}catch(e){Mr.j(e)}}},_J=[eg,"distinct_id",Qh,BC,tb,eb,na],Ey={},bJ={N:()=>!0,j(t){$e.error("memoryStorage error: "+t)},P:t=>Ey[t]||null,H:t=>Ey[t]||null,F:(t,e)=>(Ey[t]=e,!0),q(t){delete Ey[t]}},Lu=null,sn={N(){if(!Fs(Lu))return Lu;if(Lu=!0,Le(me))Lu=!1;else try{var t="__support__";sn.F(t,"xyz"),sn.P(t)!=='"xyz"'&&(Lu=!1),sn.q(t)}catch{Lu=!1}return Lu},j(t){$e.error("sessionStorage error: ",t)},P(t){try{return me==null?void 0:me.sessionStorage.getItem(t)}catch(e){sn.j(e)}return null},H(t){try{return JSON.parse(sn.P(t))||null}catch{}return null},F(t,e){try{return me==null||me.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(r){sn.j(r)}return!1},q(t){try{me==null||me.sessionStorage.removeItem(t)}catch(e){sn.j(e)}}};class wJ{constructor(e){this._instance=e}get Ne(){return this._instance.config}get consent(){return this.ti()?0:this.ei}isOptedOut(){return this.Ne.cookieless_mode===Tl||this.isRejected()||this.consent===-1&&this.Ne.cookieless_mode===Qu}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Ne.opt_out_capturing_by_default}optInOut(e){this.ii.F(this.ri,e?1:0,this.Ne.cookie_expiration,this.Ne.cross_subdomain_cookie,this.Ne.secure_cookie)}reset(){this.ii.q(this.ri,this.Ne.cross_subdomain_cookie)}get ri(){var e=this._instance.config,r=e.token,n=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(n?n+r:"__ph_opt_in_out_"+r)}get ei(){var e=this.ii.P(this.ri);return Ux(e)?1:Lt(jZ,e)?0:-1}get ii(){var e=this.Ne.opt_out_capturing_persistence_type,r=e==="localStorage"?Mr:Il;if(!this.ni||this.ni!==r){this.ni=r;var n=e==="localStorage"?Il:Mr;n.P(this.ri)&&(this.ni.P(this.ri)||this.optInOut(Ux(n.P(this.ri))),n.q(this.ri,this.Ne.cross_subdomain_cookie))}return this.ni}ti(){return!!this.Ne.respect_dnt&&[Os==null?void 0:Os.doNotTrack,Os==null?void 0:Os.msDoNotTrack,yt.doNotTrack].some((e=>Ux(e)))}}function L$(t,e){var r,n=t==null||(r=t.config)==null?void 0:r.get_current_url;if(!Ni(n))return e;try{var s=n(e);return pr(s)&&s?s:e}catch(i){return $e.error("Error in get_current_url, falling back to window.location.href",i),e}}var F$="__POSTHOG_TOOLBAR__",xJ=1,SJ=3,kJ=11;function fI(t){return t instanceof Element&&(t.id===F$||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function ru(t){return!!t&&t.nodeType===xJ}function Ai(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function $$(t){return!!t&&t.nodeType===SJ}function z$(t){return!!t&&t.nodeType===kJ&&ru(t.host)}var U$=1e3;function qC(t){return t?rw(t).split(/\s+/):[]}function pI(t,e){var r=(function(n){var s,i=me==null||(s=me.location)==null?void 0:s.href;return Le(i)?void 0:L$(n,i)})(e);return!!(r&&t&&t.some((n=>r.match(n))))}function ib(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return qC(e)}function B$(t){return Wt(t)?null:rw(t).split(/(\s+)/).filter((e=>Im(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function rg(t){var e="";return NE(t)&&!W$(t)&&t.childNodes&&t.childNodes.length&&Ir(t.childNodes,(function(r){var n;$$(r)&&r.textContent&&(e+=(n=B$(r.textContent))!==null&&n!==void 0?n:"")})),rw(e)}function Jx(t){var e;return Le(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var WC=["a","button","form","input","select","textarea","label"];function CE(t,e){if(Le(e))return!0;var r,n=function(i){if(e.some((a=>(function(l,u){var h=l.matches||l.matchesSelector||l.msMatchesSelector||l.mozMatchesSelector||l.webkitMatchesSelector||l.oMatchesSelector;
412try{return!!h&&h.call(l,u)}catch{return!1}})(i,a))))return{v:!0}};for(var s of t)if(r=n(s))return r.v;return!1}function V$(t){var e=t.parentNode;return!(!e||!ru(e))&&e}var EJ=[".ph-no-autocapture","[data-ph-no-autocapture]"],H$=["next","previous","prev",">","<"],jJ=[...H$,"+","-","−","–"],mI=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,gI=[".ph-no-rageclick",".ph-no-capture"],CJ=["","text","search","email","password","url","tel","number"];function vI(t,e){if(!me||GC(t))return!1;var r,n,s,i,a;if(Wa(e)?(r=!!e&&gI,n=void 0,s=!1):(r=(i=e==null?void 0:e.css_selector_ignorelist)!==null&&i!==void 0?i:gI,n=e==null?void 0:e.content_ignorelist,s=(a=e==null?void 0:e.ignore_text_selection)!==null&&a!==void 0&&a),r===!1||s&&(function(u){return!(!u||!ru(u))&&(!!Ai(u,"textarea")||(Ai(u,"input")?Lt(CJ,(u.getAttribute("type")||"").toLowerCase()):(function(h){if(h.isContentEditable)return!0;var p=h.getAttribute==null?void 0:h.getAttribute("contenteditable");return p==="true"||p===""})(u)))})(t))return!1;var l=q$(t,!1).targetElementList;return!(function(u,h){if(u===!1||Le(u))return!1;var p;if(u===!0)p=H$;else{if(!zt(u))return!1;if(u.length>10)return $e.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;p=u.map((f=>f.toLowerCase()))}return h.some((f=>{var g=f.safeText,v=f.ariaLabel;return p.some((_=>mI(g,_)||mI(v,_)))}))})(n,l.map((u=>{var h;return{safeText:rg(u).toLowerCase(),ariaLabel:((h=u.getAttribute("aria-label"))==null?void 0:h.toLowerCase().trim())||""}})))&&!CE(l,r)}var GC=t=>!t||Ai(t,"html")||!ru(t),q$=(t,e)=>{if(!me||GC(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,n=[t],s=t;s.parentNode&&!Ai(s,"body");)if(z$(s.parentNode))n.push(s.parentNode.host),s=s.parentNode.host;else{var i=V$(s);if(!i)break;if(e||WC.indexOf(i.tagName.toLowerCase())>-1)r=!0;else try{var a=me.getComputedStyle(i);a&&a.getPropertyValue("cursor")==="pointer"&&(r=!0)}catch{}n.push(i),s=i}return{parentIsUsefulElement:r,targetElementList:n}};function NE(t){for(var e=new Set,r=0,n=t;n.parentNode&&!Ai(n,"body");n=n.parentNode){if(r++>=U$||e.has(n))return!1;e.add(n);var s=ib(n);if(Lt(s,"ph-sensitive")||Lt(s,"ph-no-capture"))return!1}if(Lt(ib(t),"ph-include"))return!0;var i=t.type||"";if(pr(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var a=t.name||t.id||"";return!pr(a)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,""))}function W$(t){return!!(Ai(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Ai(t,"select")||Ai(t,"textarea")||t.getAttribute("contenteditable")==="true")}var yI=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),_I=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,NJ=[16,15,14,13],PJ=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),bI=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),wI=/[0-9A-Za-z_]/;function RJ(t){for(var e=0,r=!1,n=t.length-1;n>=0;n--){var s=t.charCodeAt(n)-48;r&&(s*=2)>9&&(s-=9),e+=s,r=!r}return e%10==0}function Im(t,e){if(e===void 0&&(e=!0),Wt(t))return!1;if(pr(t)){t=rw(t);var r=e?yI.test((t||"").replace(/[- ]/g,"")):(function(s){var i;for(_I.lastIndex=0;i=_I.exec(s);){var a=i[2];if(a)for(var l=a.replace(/[- ]/g,""),u=0;l.length>u;u++)for(var h of NJ){var p=u+h;if(l.length>=p){var f=l.slice(u,p);if(yI.test(f)&&RJ(f))return!0}}}return!1})(t);if(r)return!1;var n=e?PJ.test(t):(function(s){var i;for(bI.lastIndex=0;i=bI.exec(s);){var a=i[1],l=i[3];if(!(a&&l&&wI.test(a)&&wI.test(l)))return!0}return!1})(t);if(n)return!1}return!0}function xI(t){var e=rg(t);return Im(e=(e+" "+G$(t)).trim())?e:""}function G$(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Ir(t.childNodes,(function(r){var n;if(r&&((n=r.tagName)==null?void 0:n.toLowerCase())==="span")try{var s=rg(r);e=(e+" "+s).trim(),r.childNodes&&r.childNodes.length&&(e=(e+" "+G$(r)).trim())}catch(i){$e.error("[AutoCapture]",i)}})),e}function SI(t){return t.replace(/"|\\"/g,'\\"')}function AJ(t){var e=t.attr__class;if(e)return zt(e)?e:qC(e)}var jy=en("[Dead Clicks]"),TJ=()=>!0,IJ=t=>{var e,r=!((e=t.instance.persistence)==null||!e.get_property(zC)),n=t.instance.config.capture_dead_clicks;return Wa(n)?n:!!Fr(n)||r};class kI{get lazyLoadedDeadClicksAutocapture(){return this.si}constructor(e,r,n){this.instance=e,this.isEnabled=r,this.onCapture=n,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var r=e.config;"captureDeadClicks"in r&&(this.instance.persistence&&this.instance.persistence.register({[zC]:r.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.ai((()=>{this.oi()})):this.stop()}ai(e){var r,n;(r=yt.__PosthogExtensions__)!=null&&r.initDeadClicksAutocapture?e():(n=yt.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",(s=>{s?jy.error("failed to load script",s):e()}))}oi(){var e;if(Ue){if(!this.si&&(e=yt.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var r=Fr(this.instance.config.capture_dead_clicks)?Ce({},this.instance.config.capture_dead_clicks):{};r.__onCapture=this.onCapture,this.onCapture&&(r.capture_dead_swipes=!1),this.si=yt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,r),this.si.start(Ue),jy.info("starting...")}}else jy.error("`document` not found. Cannot start.")}stop(){this.si&&(this.si.stop(),this.si=void 0,jy.info("stopping..."))}}var Qx=en("[SegmentIntegration]"),K$="posthog-js";function Y$(t,e){var r=e===void 0?{}:e,n=r.organization,s=r.projectId,i=r.prefix,a=r.severityAllowList,l=a===void 0?["error"]:a,u=r.sendExceptionsToPostHog,h=u===void 0||u;return p=>{var f,g,v,_,x;
412if(l!=="*"&&!l.includes(p.level)||!t.__loaded)return p;p.tags||(p.tags={});var w=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());p.tags["PostHog Person URL"]=w,t.sessionRecordingStarted()&&(p.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var S,k=((f=p.exception)==null?void 0:f.values)||[],j=k.map((R=>Ce({},R,{stacktrace:R.stacktrace?Ce({},R.stacktrace,{type:"raw",frames:(R.stacktrace.frames||[]).map((A=>Ce({},A,{platform:"web:javascript"})))}):void 0}))),C={$exception_message:((g=k[0])==null?void 0:g.value)||p.message,$exception_type:(v=k[0])==null?void 0:v.type,$exception_level:p.level,$exception_list:j,$sentry_event_id:p.event_id,$sentry_exception:p.exception,$sentry_exception_message:((_=k[0])==null?void 0:_.value)||p.message,$sentry_exception_type:(x=k[0])==null?void 0:x.type,$sentry_tags:p.tags};return n&&s&&(C.$sentry_url=(i||"https://sentry.io/organizations/")+n+"/issues/?project="+s+"&query="+p.event_id),h&&((S=t.exceptions)==null||S.sendExceptionEvent(C)),p}}class DJ{constructor(e,r,n,s,i,a){this.name=K$,this.setupOnce=function(l){l(Y$(e,{organization:r,projectId:n,prefix:s,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}}class EI{constructor(e){this.li=(r,n,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength||s.crossTabAdoption)&&($e.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:r,changeReason:s}),this.ui=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.hi()}hi(){var e;this.di=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.li)}destroy(){var e;(e=this.di)==null||e.call(this),this.di=void 0}doPageView(e,r){var n,s=this.vi(e,r);return this.ui={pathname:(n=me==null?void 0:me.location.pathname)!==null&&n!==void 0?n:"",pageViewId:r,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var r;return this.vi(e,(r=this.ui)==null?void 0:r.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.ui)==null?void 0:e.pageViewId}}vi(e,r){var n=this.ui;if(!n)return{$pageview_id:r};var s={$pageview_id:r,$prev_pageview_id:n.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var a=i.maxScrollHeight,l=i.lastScrollY,u=i.maxScrollY,h=i.maxContentHeight,p=i.lastContentY,f=i.maxContentY;if(!(Le(a)||Le(l)||Le(u)||Le(h)||Le(p)||Le(f))){a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h),p=Math.ceil(p),f=Math.ceil(f);var g=a>1?Ao(l/a,0,1,$e):1,v=a>1?Ao(u/a,0,1,$e):1,_=h>1?Ao(p/h,0,1,$e):1,x=h>1?Ao(f/h,0,1,$e):1;s=Lr(s,{$prev_pageview_last_scroll:l,$prev_pageview_last_scroll_percentage:g,$prev_pageview_max_scroll:u,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:p,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:f,$prev_pageview_max_content_percentage:x})}}return n.pathname&&(s.$prev_pageview_pathname=n.pathname),n.timestamp&&(s.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),s}}var Xx=["flags","surveys"],OJ={[E$]:{exposure:"hidden"},[bm]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[wm]:{exposure:"hidden"},[lE]:{exposure:"event"},[cE]:{exposure:"hidden"},[uE]:{exposure:"event"},[dE]:{exposure:"hidden"},[hE]:{exposure:"event"},[fE]:{exposure:"event"},[zC]:{exposure:"event"},[UC]:{exposure:"hidden"},[pE]:{exposure:"event"},[cd]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Qh]:{exposure:"hidden"},[BC]:{exposure:"event"},[j$]:{exposure:"event",shouldSkipFromEventProperties:t=>Fs(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[nd]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!Fr(t))return{};for(var e={},r=Object.keys(t),n=0;r.length>n;n++)e["$feature/"+r[n]]=t[r[n]];return e}},[l_]:{exposure:"event",storageGroup:"flags"},[xm]:{exposure:"hidden"}
412,[mE]:{exposure:"hidden",storageGroup:"flags"},[c_]:{exposure:"event",storageGroup:"flags"},[gE]:{exposure:"event",storageGroup:"flags",volatile:!0},[Q_]:{exposure:"hidden",storageGroup:"flags"},[pl]:{exposure:"event"},[Hh]:{exposure:"hidden"},[Zu]:{exposure:"hidden"},[Ju]:{exposure:"hidden"},[vE]:{exposure:"hidden",storageGroup:"surveys"},[X_]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[yE]:{exposure:"event"},[u_]:{exposure:"hidden"},[d_]:{exposure:"hidden"},[Sm]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Tm]:{exposure:"hidden"},[_E]:{exposure:"hidden"},[bE]:{exposure:"hidden"},[tg]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[na]:{exposure:"hidden"},[wE]:{exposure:"hidden"},[xE]:{exposure:"hidden"},[SE]:{exposure:"hidden"},[kE]:{exposure:"hidden"},[eb]:{exposure:"hidden"},[tb]:{exposure:"hidden"},[C$]:{exposure:"event"},[N$]:{exposure:"event"},[P$]:{exposure:"event"},[R$]:{exposure:"event"},[T$]:{exposure:"event"},[I$]:{exposure:"event"},[D$]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},MJ=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Fu=t=>{var e=OJ[t];if(e)return e;for(var r of MJ){var n=r[1];if(t.indexOf(r[0])===0)return n}},Xh=(t,e)=>{try{return JSON.stringify(t,((r,n)=>typeof n=="bigint"?n.toString():n),e)}catch{return WF(t)}},ab=t=>{var e=Ue==null?void 0:Ue.createElement("a");return Le(e)?null:(e.href=t,e)},Of=function(t,e){for(var r,n=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;n.length>s;s++){var i=n[s].split("=");if(i[0]===e){r=i;break}}if(!zt(r)||2>r.length)return"";var a=r[1];try{a=decodeURIComponent(a)}catch{$e.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},ng=function(t,e,r){if(!t||!e||!e.length)return t;for(var n=t.split("#"),s=n[1],i=(n[0]||"").split("?"),a=i[1],l=i[0],u=(a||"").split("&"),h=[],p=0;u.length>p;p++){var f=u[p].split("=");zt(f)&&(e.includes(f[0])?h.push(f[0]+"="+r):h.push(u[p]))}var g=l;return a!=null&&(g+="?"+h.join("&")),s!=null&&(g+="#"+s),g},ob=function(t,e){var r=t.match(new RegExp(e+"=([^&]*)"));return r?r[1]:null},Z$=(t,e)=>t>=e&&VF(),J$=(t,e,r,n)=>{if(t===0){if(VF()){var s=e+1;return s===r&&n(),s}return e}return 0},Cy="https?://(.*)",Mf=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],LJ=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Mf],sg="<masked>",FJ=["li_fat_id"];function Q$(t,e,r){if(!Ue)return{};var n,s=e?[...Mf,...r||[]]:[],i=X$(ng(Ue.URL,s,sg),t),a=(n={},Ir(FJ,(function(l){var u=O$(l);n[l]=u||null})),n);return Lr(a,i)}function X$(t,e){var r=LJ.concat(e||[]),n={};return Ir(r,(function(s){var i=Of(t,s);n[s]=i||null})),n}function ez(t){var e=(function(i){return i?i.search(Cy+"google.([^/?]*)")===0?"google":i.search(Cy+"bing.com")===0?"bing":i.search(Cy+"yahoo.com")===0?"yahoo":i.search(Cy+"duckduckgo.com")===0?"duckduckgo":null:null})(t),r=e!="yahoo"?"q":"p",n={};if(!Fs(e)){n.$search_engine=e;var s=Ue?Of(Ue.referrer,r):"";s.length&&(n.ph_keyword=s)}return n}function jI(){return navigator.language||navigator.userLanguage}var lb="$direct";function tz(){return(Ue==null?void 0:Ue.referrer)||lb}function rz(t,e,r){r===void 0&&(r=!1);var n=t?[...Mf,...e||[]]:[],s=r?tu(Zr==null?void 0:Zr.href):Zr==null?void 0:Zr.href,i=s==null?void 0:s.substring(0,1e3);return{r:tz().substring(0,1e3),u:i?ng(i,n,sg):void 0}}function nz(t,e){var r;e===void 0&&(e=!1);var n=t.r,s=t.u,i=e?tu(s):s,a={$referrer:n,$referring_domain:n==null?void 0:n==lb?lb:(r=ab(n))==null?void 0:r.host};
412if(i){a.$current_url=i;var l=ab(i);a.$host=l==null?void 0:l.host,a.$pathname=l==null?void 0:l.pathname;var u=X$(i);Lr(a,u)}if(n){var h=ez(n);Lr(a,h)}return a}function sz(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function $J(){try{return new Date().getTimezoneOffset()}catch{return}}var zJ={flags:tg,surveys:X_},UJ=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],kh="main";class eS{constructor(e,r,n){if(n===void 0&&(n=!0),this.ci={},this.fi=!1,this.pi=!1,this.Ne=e,this.gi=n,this.props={},this.mi=void 0,this.yi=(i=>{var a="";return i.token&&(a=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+a+"_posthog"})(e),this.ii=this.bi(e),this.pi=this.wi(e),this.load(),e.debug&&$e.info("Persistence loaded",e.persistence,Ce({},this.props)),this.update_config(e,e,r),this.save(),me){var s=()=>this.flush();Jr(me,"beforeunload",s,{capture:!1}),Jr(me,"pagehide",s,{capture:!1})}}ki(){var e,r=(e=this.Ne)==null?void 0:e.persistence_save_debounce_ms;return bn(r)&&r>0?r:0}isDisabled(){return!!this.xi}bi(e){UJ.indexOf(e.persistence.toLowerCase())===-1&&($e.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var r,n=(function(a,l){a===void 0&&(a=[]),l===void 0&&(l=!1);var u=[..._J,...a];return Ce({},Mr,{H(h){try{var p={};try{p=Il.H(h)||{}}catch{}var f,g=JSON.parse(Mr.P(h)||"{}");if(l){var v={};for(var _ in p){var x=p[_];Fs(x)||x===""||(v[_]=x)}f=Lr(g,v)}else f=Lr(p,g);return Mr.F(h,f),f}catch{}return null},F(h,p,f,g,v,_){var x=Mr.F(h,p,void 0,void 0,_);try{var w={};u.forEach((S=>{p[S]&&(w[S]=p[S])})),Object.keys(w).length&&Il.F(h,w,f,g,v,_)}catch(S){Mr.j(S)}return x},q(h,p){try{me==null||me.localStorage.removeItem(h),Il.q(h,p)}catch(f){Mr.j(f)}}})})(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),s=!1,i=e.persistence.toLowerCase();return i==="localstorage"&&Mr.N()?(r=Mr,s=!0):i==="localstorage+cookie"&&n.N()?(r=n,s=!0):i==="sessionstorage"&&sn.N()?r=sn:i==="memory"?r=bJ:i==="cookie"?r=Il:n.N()?(r=n,s=!0):r=Il,this.fi=s,r}Si(e){return this.yi+"__"+e}wi(e){return this.fi&&!!e.split_storage}Ci(e){var r=e??this.Ne.feature_flag_cache_ttl_ms;if(!r||0>=r)return!1;var n=this.props[tg];return!n||typeof n!="number"||Date.now()-n>r}properties(){var e={};return Ir(this.props,((r,n)=>{var s=Fu(n);if((s==null?void 0:s.exposure)==="derived"){if(s.shouldSkipFromEventProperties!=null&&s.shouldSkipFromEventProperties(r,n===nd?()=>this.Ci():()=>!1))return;s.transformToEventProperties&&Lr(e,s.transformToEventProperties(r))}else if(!s||s.exposure==="event"){if(s!=null&&s.shouldSkipFromEventProperties!=null&&s.shouldSkipFromEventProperties(r,(()=>!1)))return;e[n]=r}})),e}load(){if(!this.xi){var e=this.ii.H(this.yi);e&&(this.props=Lr({},e)),this.pi&&this.Mi()}}Mi(){for(var e of Xx){var r=Mr.H(this.Si(e));if(r&&!Ml(r)){var n=this.Ti(e);n.persisted=!0,this.Ei(e)||(n.fingerprint=this.Ii(r,e)),this.Pi(e,r)||Lr(this.props,r)}}}Ei(e){return Object.keys(this.props).some((r=>{var n;return((n=Fu(r))==null?void 0:n.storageGroup)===e}))}Pi(e,r){var n=zJ[e];if(!n)return!1;var s=r[n],i=this.props[n];return bn(s)&&bn(i)&&i>s}refreshKey(e){var r;if(!this.xi){var n=this.pi?(r=Fu(e))==null?void 0:r.storageGroup:void 0,s=n?Mr.H(this.Si(n)):this.ii.H(this.yi);if(s&&e in s)this.Ri(e,s[e]);else{if(n){var i=this.ii.H(this.yi);if(i&&e in i)return void this.Ri(e,i[e])}this.Ai(e)}}}save(){if(!this.xi){var e=this.ki();e>0?Le(this.Fi)&&(this.Fi=setTimeout((()=>{this.Fi=void 0,this.Li()}),e)):this.Li()}}flush(){Le(this.Fi)||(clearTimeout(this.Fi),this.Fi=void 0,this.Li())}Li(){this.xi||(this.pi?this.Oi():this.Di(this.ii,this.yi,this.props,kh))}Oi(){var e=this.$i(),r=e.main,n=e.groups;for(var s of(this.Di(this.ii,this.yi,r,kh),Xx)){var i,a=n[s];(!Ml(a)||(i=this.ci[s])!=null&&i.persisted)&&this.Di(Mr,this.Si(s),a,s)}}$i(){var e={},r={flags:{},surveys:{}};return Ir(this.props,((n,s)=>{var i,a=(i=Fu(s))==null?void 0:i.storageGroup;a?r[a][s]=n:e[s]=n})),{main:e,groups:r}}
412Ii(e,r){if(r===kh)return JSON.stringify(e)+"|"+this.Ni+"|"+this.qi+"|"+this.ji;var n={};return Ir(e,((s,i)=>{var a;n[i]=(a=Fu(i))!=null&&a.volatile?"__volatile__":s})),JSON.stringify(n)}Di(e,r,n,s){var i=this.Ti(s);if(s===kh||i.dirty||Le(i.fingerprint)){var a;try{if((a=this.Ii(n,s))===i.fingerprint)return void(i.dirty=!1)}catch{a=void 0}e.F(r,n,this.Ni,this.qi,this.ji,this.Ne.debug)?(i.dirty=!1,s!==kh&&(i.persisted=!0),Le(a)||(i.fingerprint=a)):this.Ne.debug&&$e.warn('failed to persist storage entry "'+r+'"; will retry on next save')}}remove(e){var r=(e===void 0?{}:e).keepGroupEntries,n=r!==void 0&&r;if(Le(this.Fi)||(clearTimeout(this.Fi),this.Fi=void 0),this.ii.q(this.yi,!1),this.ii.q(this.yi,!0),!n&&this.gi)for(var s of Xx)Mr.q(this.Si(s));n?delete this.ci[kh]:this.ci={}}clear(){this.remove(),this.props={}}register_once(e,r,n){if(Fr(e)){Le(r)&&(r="None"),this.Ni=Le(n)?this.Bi:n;var s=!1;if(Ir(e,((i,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==r||(this.Ri(a,i),s=!0)})),s)return this.save(),!0}return!1}register(e,r){if(Fr(e)){this.Ni=Le(r)?this.Bi:r;var n=!1;if(Ir(e,((s,i)=>{e.hasOwnProperty(i)&&(this.props[i]!==s||Fr(s)||zt(s))&&(this.Ri(i,s),n=!0)})),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Ai(e),this.save())}update_campaign_params(){var e=Ue==null?void 0:Ue.URL;if(e!==this.mi){var r=Q$(this.Ne.custom_campaign_params,this.Ne.mask_personal_data_properties,this.Ne.custom_personal_data_properties);Ml(HC(r))||this.register(r),this.mi=e}}update_search_keyword(){var e;this.register((e=Ue==null?void 0:Ue.referrer)?ez(e):{})}update_referrer_info(){var e;this.register_once({$referrer:tz(),$referring_domain:Ue!=null&&Ue.referrer&&((e=ab(Ue.referrer))==null?void 0:e.host)||lb},void 0)}set_initial_person_info(){this.props[SE]||this.props[kE]||this.register_once({[eb]:rz(this.Ne.mask_personal_data_properties,this.Ne.custom_personal_data_properties,this.Ne.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};Ir([kE,SE],(s=>{var i=this.props[s];i&&Ir(i,(function(a,l){e["$initial_"+tE(l)]=a}))}));var r=this.props[eb];
412if(r){var n=(function(s,i){i===void 0&&(i=!1);var a=nz(s,i),l={};return Ir(a,(function(u,h){l["$initial_"+tE(h)]=u})),l})(r,this.Ne.disable_capture_url_hashes);Lr(e,n)}return e}safe_merge(e){return Ir(this.props,(function(r,n){n in e||(e[n]=r)})),e}update_config(e,r,n){this.Bi=this.Ni=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var s=e.persistence!==r.persistence||!((u,h)=>{if(u.length!==h.length)return!1;var p=[...u].sort(),f=[...h].sort();return p.every(((g,v)=>g===f[v]))})(e.cookie_persisted_properties||[],r.cookie_persisted_properties||[]),i=s?this.bi(e):this.ii,a=this.wi(e);if(s||a!==this.pi){var l=this.props;this.clear(),this.ii=i,this.pi=a,this.props=l,this.save()}}set_disabled(e){this.xi=e,this.xi?this.remove():this.save()}set_cross_subdomain(e){e!==this.qi&&(this.qi=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.ji&&(this.ji=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,r){var n=this.props[wm]||{};n[e]=r,this.Ri(wm,n),this.save()}remove_event_timer(e){var r=this.props[wm]||{},n=r[e];return Le(n)||(delete r[e],this.Ri(wm,r),this.save()),n}get_property(e){return this.props[e]}set_property(e,r){this.Ri(e,r),this.save()}Ri(e,r){var n;this.props[e]=r,(n=Fu(e))!=null&&n.volatile||this.Hi(e)}Ai(e){delete this.props[e],this.Hi(e)}Hi(e){var r,n=(r=Fu(e))==null?void 0:r.storageGroup;n&&(this.Ti(n).dirty=!0)}Ti(e){return this.ci[e]||(this.ci[e]={})}}function Ny(t){var e=!0;return{dispose(){if(e){e=!1;var r=t();r&&Ni(r.then)&&r.then(void 0,(()=>{}))}}}}var Ts={GZipJS:"gzip-js",Base64:"base64"},Zp={Activation:"events",Cancellation:"cancelEvents"},tS={Popover:"popover",API:"api",Widget:"widget"},Dl={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},rS={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},PE={Popover:"popover",Inline:"inline"},BJ={SHOWN:"product tour shown"},CI={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},NI=en("[RateLimiter]");class VJ{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=r=>{var n=r.text;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach((s=>{NI.info((s||"events")+" is quota limited."),this.serverLimits[s]=new Date().getTime()+6e4}))}catch(s){return void NI.warn('could not rate limit - continuing. Error: "'+(s==null?void 0:s.message)+'"',{text:n})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var r,n,s;e===void 0&&(e=!1);var i=this.captureEventsBurstLimit,a=this.captureEventsPerSecond,l=new Date().getTime(),u=(r=(n=this.instance.persistence)==null?void 0:n.get_property(xE))!==null&&r!==void 0?r:{tokens:i,last:l};u.tokens+=(l-u.last)/1e3*a,u.last=l,u.tokens>i&&(u.tokens=i);var h=1>u.tokens;if(h||e||(u.tokens=Math.max(0,u.tokens-1)),h&&!e){var p=(bn(u.dropped)?u.dropped:0)+1;u.dropped=p,!this.lastEventRateLimited&&this.Ui(p)&&(u.dropped=0)}return this.lastEventRateLimited=h,(s=this.instance.persistence)==null||s.set_property(xE,u),{isRateLimited:h,remainingTokens:u.tokens}}zi(e){var r=this.instance.config.property_denylist;return!zt(r)||!r.includes(e)}Wi(){var e;if(this.zi("$current_url")&&this.zi("$pathname")&&Zr!=null&&Zr.pathname)return""+((e=Zr.origin)!==null&&e!==void 0?e:"")+Zr.pathname}Ui(e){var r,n,s=this.captureEventsBurstLimit,i=this.captureEventsPerSecond,a=this.Wi(),l=this.zi("$session_id")?(r=(n=this.instance).get_session_id)==null?void 0:r.call(n):void 0,u=[e+" event(s) dropped since the last warning",a?"triggered on "+a:void 0,l?"session "+l:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+u+". Config is set to "+i+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var r=this.serverLimits[e||"events"]||!1;return r!==!1&&new Date().getTime()<r}}var Sc=en("[RemoteConfig]");class iz{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=yt._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Vi(e){var r,n;(r=yt.__PosthogExtensions__)!=null&&r.loadExternalDependency?(n=yt.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}Zi(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:e})}load(){try{if(this.remoteConfig)return Sc.info("Using preloaded remote config",this.remoteConfig),this.Gi(this.remoteConfig),void this.Qi();if(this._instance.Ki())return void Sc.warn("Remote config is disabled. Falling back to local config.");this.Vi((e=>{if(!e)return Sc.info("No config found after loading remote JS config. Falling back to JSON."),void this.Zi((r=>{this.Gi(r.json,r),this.Qi()}));this.Gi(e),this.Qi()}))}catch(e){Sc.error("Error loading remote config",e),this.Gi()}}stop(){this.Ji&&(clearInterval(this.Ji),this.Ji=void 0)}refresh(){!this._instance.Ki()&&Ue&&Ue.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Qi(){var e;if(!this.Ji){var r=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;r!==0&&(this.Ji=setInterval((()=>{this.refresh()}),r))}}Gi(e,r){!e&&r&&(r.statusCode===0?r.error||Sc.warn("Failed to fetch remote config from PostHog."):Sc.error("Failed to fetch remote config from PostHog."));try{this._instance.Gi(e?{ok:!0,config:e}:{ok:!1})}catch(s){Sc.error("Error applying remote config",s)}if((e==null?void 0:e.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var n;(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded()}catch(s){Sc.error("Error loading feature flags",s)}}}var da=Uint8Array,ci=Uint16Array,Lf=Uint32Array,KC=new da([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),YC=new da([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),PI=new da([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),az=function(t,e){for(var r=new ci(31),n=0;31>n;++n)r[n]=e+=1<<t[n-1];var s=new Lf(r[30]);for(n=1;30>n;++n)for(var i=r[n];r[n+1]>i;++i)s[i]=i-r[n]<<5|n;return[r,s]},oz=az(KC,2),RE=oz[1];oz[0][28]=258,RE[258]=28;for(var RI=az(YC,0)[1],lz=new ci(32768),Qr=0;32768>Qr;++Qr){var Eh=(43690&Qr)>>>1|(21845&Qr)<<1;lz[Qr]=((65280&(Eh=(61680&(Eh=(52428&Eh)>>>2|(13107&Eh)<<2))>>>4|(3855&Eh)<<4))>>>8|(255&Eh)<<8)>>>1}var Dm=function(t,e,r){for(var n=t.length,s=0,i=new ci(e);n>s;++s)++i[t[s]-1];var a,l=new ci(e);for(s=0;e>s;++s)l[s]=l[s-1]+i[s-1]<<1;for(a=new ci(n),s=0;n>s;++s)a[s]=lz[l[t[s]-1]++]>>>15-t[s];return a},jd=new da(288);for(Qr=0;144>Qr;++Qr)jd[Qr]=8;for(Qr=144;256>Qr;++Qr)jd[Qr]=9;for(Qr=256;280>Qr;++Qr)jd[Qr]=7;for(Qr=280;288>Qr;++Qr)jd[Qr]=8;var cb=new da(32);for(Qr=0;32>Qr;++Qr)cb[Qr]=5;var HJ=Dm(jd,9),qJ=Dm(cb,5),cz=function(t){return(t/8>>
vendor: 4,524 bytes, line 412
4120)+(7&t&&1)},uz=function(t,e,r){(r==null||r>t.length)&&(r=t.length);var n=new(t instanceof ci?ci:t instanceof Lf?Lf:da)(r-e);return n.set(t.subarray(e,r)),n},ll=function(t,e,r){var n=e/8>>0;t[n]|=r<<=7&e,t[n+1]|=r>>>8},Jp=function(t,e,r){var n=e/8>>0;t[n]|=r<<=7&e,t[n+1]|=r>>>8,t[n+2]|=r>>>16},nS=function(t,e){for(var r=[],n=0;t.length>n;++n)t[n]&&r.push({s:n,f:t[n]});var s=r.length,i=r.slice();if(!s)return[new da(0),0];if(s==1){var a=new da(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort((function(R,A){return R.f-A.f})),r.push({s:-1,f:25001});var l=r[0],u=r[1],h=0,p=1,f=2;for(r[0]={s:-1,f:l.f+u.f,l,r:u};p!=s-1;)l=r[r[f].f>r[h].f?h++:f++],u=r[h!=p&&r[f].f>r[h].f?h++:f++],r[p++]={s:-1,f:l.f+u.f,l,r:u};var g=i[0].s;for(n=1;s>n;++n)i[n].s>g&&(g=i[n].s);var v=new ci(g+1),_=AE(r[p-1],v,0);if(_>e){n=0;var x=0,w=_-e,S=1<<w;for(i.sort((function(R,A){return v[A.s]-v[R.s]||R.f-A.f}));s>n;++n){var k=i[n].s;if(e>=v[k])break;x+=S-(1<<_-v[k]),v[k]=e}for(x>>>=w;x>0;){var j=i[n].s;e>v[j]?x-=1<<e-v[j]++-1:++n}for(;n>=0&&x;--n){var C=i[n].s;v[C]==e&&(--v[C],++x)}_=e}return[new da(v),_]},AE=function(t,e,r){return t.s==-1?Math.max(AE(t.l,e,r+1),AE(t.r,e,r+1)):e[t.s]=r},AI=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new ci(++e),n=0,s=t[0],i=1,a=function(u){r[n++]=u},l=1;e>=l;++l)if(t[l]==s&&l!=e)++i;else{if(!s&&i>2){for(;i>138;i-=138)a(32754);i>2&&(a(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(a(s),--i;i>6;i-=6)a(8304);i>2&&(a(i-3<<5|8208),i=0)}for(;i--;)a(s);i=1,s=t[l]}return[r.subarray(0,n),e]},Qp=function(t,e){for(var r=0,n=0;e.length>n;++n)r+=t[n]*e[n];return r},TE=function(t,e,r){var n=r.length,s=cz(e+2);t[s]=255&n,t[s+1]=n>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var i=0;n>i;++i)t[s+i+4]=r[i];return 8*(s+4+n)},TI=function(t,e,r,n,s,i,a,l,u,h,p){ll(e,p++,r),++s[256];for(var f=nS(s,15),g=f[0],v=f[1],_=nS(i,15),x=_[0],w=_[1],S=AI(g),k=S[0],j=S[1],C=AI(x),R=C[0],A=C[1],I=new ci(19),P=0;k.length>P;++P)I[31&k[P]]++;for(P=0;R.length>P;++P)I[31&R[P]]++;for(var T=nS(I,7),O=T[0],G=T[1],M=19;M>4&&!O[PI[M-1]];--M);var U,V,H,Y,B=h+5<<3,z=Qp(s,jd)+Qp(i,cb)+a,ee=Qp(s,g)+Qp(i,x)+a+14+3*M+Qp(I,O)+(2*I[16]+3*I[17]+7*I[18]);if(z>=B&&ee>=B)return TE(e,p,t.subarray(u,u+h));if(ll(e,p,1+(z>ee)),p+=2,z>ee){U=Dm(g,v),V=g,H=Dm(x,w),Y=x;var L=Dm(O,G);for(ll(e,p,j-257),ll(e,p+5,A-1),ll(e,p+10,M-4),p+=14,P=0;M>P;++P)ll(e,p+3*P,O[PI[P]]);p+=3*M;for(var $=[k,R],F=0;2>F;++F){var te=$[F];for(P=0;te.length>P;++P)ll(e,p,L[ue=31&te[P]]),p+=O[ue],ue>15&&(ll(e,p,te[P]>>>5&127),p+=te[P]>>>12)}}else U=HJ,V=jd,H=qJ,Y=cb;for(P=0;l>P;++P)if(n[P]>255){var ue;Jp(e,p,U[257+(ue=n[P]>>>18&31)]),p+=V[ue+257],ue>7&&(ll(e,p,n[P]>>>23&31),p+=KC[ue]);var re=31&n[P];Jp(e,p,H[re]),p+=Y[re],re>3&&(Jp(e,p,n[P]>>>5&8191),p+=YC[re])}else Jp(e,p,U[n[P]]),p+=V[n[P]];return Jp(e,p,U[256]),p+V[256]},WJ=new Lf([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),GJ=(function(){for(var t=new Lf(256),e=0;256>e;++e){for(var r=e,n=9;--n;)r=(1&r&&3988292384)^r>>>1;t[e]=r}return t})(),sS=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8};function KJ(t,e){e===void 0&&(e={});var r=(function(){var f=4294967295;return{p(g){for(var v=f,_=0;g.length>_;++_)v=GJ[255&v^g[_]]^v>>>8;f=v},d(){return 4294967295^f}}})(),n=t.length;r.p(t);var s,i,a,l,u,h=(l=10+((s=e).filename&&s.filename.length+1||0),u=8,(function(f,g,v,_,x,w){var S=f.length,k=new da(_+S+5*(1+Math.floor(S/7e3))+x),j=k.subarray(_,k.length-x),C=0;if(!g||8>S)for(var R=0;S>=R;R+=65535){var A=R+65535;S>A?C=TE(j,C,f.subarray(R,A)):(j[R]=!0,C=TE(j,C,f.subarray(R,S)))}else{for(var I=WJ[g-1],P=I>>>13,T=8191&I,O=(1<<v)-1,G=new ci(32768),M=new ci(O+1),U=Math.ceil(v/3),V=2*U,H=function(jt){return(f[jt]^f[jt+1]<<U^f[jt+2]<<V)&O},Y=new Lf(25e3),B=new ci(288),z=new ci(32),ee=0,L=0,$=(R=0,0),F=0,te=0;S>R;++R){var ue=H(R),re=32767&R,se=M[ue];if(G[re]=se,M[ue]=re,R>=F){var ye=S-R;if((ee>7e3||$>24576)&&ye>423){C=TI(f,j,0,Y,B,z,L,$,te,R-te,C),$=ee=L=0,te=R;for(var de=0;286>de;++de)B[de]=0;for(de=0;30>de;++de)z[de]=0}var pe=2,Ie=0,Ne=T,He=re-se&32767;if(ye>2&&ue==H(R-He))for(var We=Math.min(P,ye)-1,at=Math.min(32767,R),Xt=Math.min(258,ye);at>=He&&--Ne&&re!=se;){if(f[R+pe]==f[R+pe-He]){for(var Rt=0;Xt>Rt&&f[R+Rt]==f[R+Rt-He];++Rt);if(Rt>pe){if(pe=Rt,Ie=He,Rt>We)break;var Ee=Math.min(He,Rt-2),Et=0;for(de=0;Ee>de;++de){var Mt=R-He+de+32768&32767,ot=Mt-G[Mt]+32768&32767;ot>Et&&(Et=ot,se=Mt)}}}He+=(re=se)-(se=G[re])+32768&32767}if(Ie){Y[$++]=268435456|RE[pe]<<18|RI[Ie];var De=31&RE[pe],St=31&RI[Ie];L+=KC[De]+YC[St],++B[257+De],++z[St],F=R+pe,++ee}else Y[$++]=f[R],++B[f[R]]}}
412C=TI(f,j,!0,Y,B,z,L,$,te,R-te,C)}return uz(k,0,_+cz(C)+x)})(i=t,(a=e).level==null?6:a.level,a.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+a.mem,l,u)),p=h.length;return(function(f,g){var v=g.filename;if(f[0]=31,f[1]=139,f[2]=8,f[8]=2>g.level?4:g.level==9?2:0,f[9]=3,g.mtime!=0&&sS(f,4,Math.floor(new Date(g.mtime||Date.now())/1e3)),v){f[3]=8;for(var _=0;v.length>=_;++_)f[_+10]=v.charCodeAt(_)}})(h,e),sS(h,p-8,r.d()),sS(h,p-4,n),h}var YJ=!!Qk||!!IC,dz="text/plain",f_=!1,hz=(t,e)=>{var r=t.split("#"),n=r[1],s=r[0].split("?"),i=s[0],a=s[1];if(!a)return t;var l=a.split("&").filter((u=>u.split("=")[0]!==e)).join("&");return i+(l?"?"+l:"")+(n?"#"+n:"")},sw=function(t,e,r){var n;r===void 0&&(r=!0);var s=t.split("?"),i=s[0],a=s[1],l=Ce({},e),u=(n=a==null?void 0:a.split("&").map((p=>{var f,g=p.split("="),v=g[0],_=r&&(f=l[v])!==null&&f!==void 0?f:g[1];return delete l[v],v+"="+_})))!==null&&n!==void 0?n:[],h=(function(p,f){var g,v;f===void 0&&(f="&");var _=[];return Ir(p,(function(x,w){Le(x)||Le(w)||w==="undefined"||(g=encodeURIComponent((S=>S instanceof File)(x)?x.name:x.toString()),v=encodeURIComponent(w),_[_.length]=v+"="+g)})),_.join(f)})(l);return h&&u.push(h),u.length>0?i+"?"+u.join("&"):i},iS=t=>{if(t.Yi)return t.Yi;var e=t.data,r=t.compression;if(e){if(r===Ts.GZipJS){var n=KJ((function(l,u){var h=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var p=new da(l.length+(l.length>>>1)),f=0,g=function(w){p[f++]=w},v=0;h>v;++v){if(f+5>p.length){var _=new da(f+8+(h-v<<1));_.set(p),p=_}var x=l.charCodeAt(v);128>x?g(x):2048>x?(g(192|x>>>6),g(128|63&x)):x>55295&&57344>x?(g(240|(x=65536+(1047552&x)|1023&l.charCodeAt(++v))>>>18),g(128|x>>>12&63),g(128|x>>>6&63),g(128|63&x)):(g(224|x>>>12),g(128|x>>>6&63),g(128|63&x))}return uz(p,0,f)})(Xh(e)),{mtime:0});return{contentType:dz,body:n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength),estimatedSize:n.byteLength}}if(r===Ts.Base64){var s=(function(l){return l&&btoa(encodeURIComponent(l).replace(/%([0-9A-F]{2})/g,((u,h)=>String.fromCharCode(parseInt(h,16)))))})(Xh(e)),i=(l=>"data="+encodeURIComponent(typeof l=="string"?l:Xh(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}var a=Xh(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},fz=t=>{var e,r,n=()=>t.transport==="sendBeacon"?{url:sw(t.url,{compression:Ts.Base64}),encodedBody:iS(Ce({},t,{compression:Ts.Base64,Yi:void 0}))}:{url:hz(t.url,"compression"),encodedBody:iS(Ce({},t,{compression:void 0,Yi:void 0}))};try{e=iS(t)}catch(s){if(QT(t.compression,Of(t.url,"compression")))return $e.error("Failed to gzip request body, sending uncompressed payload",s),n();throw s}return e&&QT(t.compression,Of(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?Xk(new Uint8Array(r)):ArrayBuffer.isView(r)&&Xk(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(f_=!0,n()):{url:t.url,encodedBody:e}},pz=t=>{try{return fz(t)}catch(e){return $e.error(e),void(t.callback==null||t.callback({statusCode:0,error:e}))}},ZJ=(function(){var t=Hr((function*(e){var r=Xh(e.data),n=yield(function(i,a,l){return eE.apply(this,arguments)})(r,Er.DEBUG,{rethrow:!0});if(!n)return e;var s=yield n.arrayBuffer();return Ce({},e,{Yi:{contentType:dz,body:s,estimatedSize:s.byteLength}})}));return function(e){return t.apply(this,arguments)}})(),JJ=/Failed to fetch|NetworkError|Load failed/i,mz=t=>(t==null?void 0:t.name)==="TypeError"&&JJ.test((t==null?void 0:t.message)||""),gz=t=>{var e=pz(t);if(e){var r=e.url,n=e.encodedBody,s=n??{},i=s.contentType,a=s.body,l=s.estimatedSize,u=new Headers;Ir(t.headers,(function(_,x){u.append(x,_)})),i&&u.append("Content-Type",i);var h=null,p=!1;if(WT){var f=new WT;h={signal:f.signal,timeout:setTimeout((()=>{var _,x;p=!0,f.abort((_=t.timeout,(x=new Error("PostHog request timed out"+(_?" after "+_+"ms":""))).name="AbortError",x))}),t.timeout)}}var g=_=>{p&&(_==null?void 0:_.name)==="AbortError"||mz(_)?$e.warn(_):$e.error(_),t.callback==null||t.callback({statusCode:0,error:_})};try{var v;IC(r,Ce({method:(t==null?void 0:t.method)||"GET",headers:u,keepalive:t.method==="POST"&&!t.Xi&&52428.8>(l||0),body:a,signal:(v=h)==null?void 0:v.signal},t.fetchOptions)).then((_=>_.text().then((x=>{var w={statusCode:_.status,text:x};if(_.status===200)try{w.json=JSON.parse(x)}catch(S){$e.error(S)}t.callback==null||t.callback(w)}
412)))).catch(g).finally((()=>h?clearTimeout(h.timeout):null))}catch(_){h&&clearTimeout(h.timeout),g(_)}}},IE=t=>{try{var e,r=fz(t),n=r.url,s=r.encodedBody,i=s??{},a=i.body,l=i.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:i.contentType});if(Os.sendBeacon(n,u))return;var h=zt(t.data)?t.data:(e=t.data)==null?void 0:e.batch;if(zt(h)&&h.length>1&&(l??0)>16384){var p=Math.ceil(h.length/2),f=g=>zt(t.data)?g:Ce({},t.data,{batch:g});return IE(Ce({},t,{data:f(h.slice(0,p))})),void IE(Ce({},t,{data:f(h.slice(p))}))}$e.warn("Beacon of ~"+(l??0)+" bytes was rejected by the browser, falling back to fetch"),gz(Ce({},t,{Xi:!0}))}catch(g){$e.warn("Beacon send failed",g)}},II=(t,e,r,n)=>{var s=n==="query"?e==="POST"?"sent_at":"_":void 0;return sw(r===Ts.GZipJS?hz(t,"compression"):t,Ce({},s?{[s]:Date.now().toString()}:{},r===Ts.GZipJS?{}:{compression:r}))},p_=[];IC&&p_.push({transport:"fetch",method:gz}),Qk&&p_.push({transport:"XHR",method(t){var e=pz(t);if(e){var r=new Qk,n=e.encodedBody;r.open(t.method||"GET",e.url,!0);var s=n??{},i=s.contentType,a=s.body;Ir(t.headers,(function(l,u){r.setRequestHeader(u,l)})),i&&r.setRequestHeader("Content-Type",i),t.timeout&&(r.timeout=t.timeout),r.onreadystatechange=()=>{if(r.readyState===4){var l={statusCode:r.status,text:r.responseText};if(r.status===200)try{l.json=JSON.parse(r.responseText)}catch{}t.callback==null||t.callback(l)}},r.send(a)}}}),Os!=null&&Os.sendBeacon&&p_.push({transport:"sendBeacon",method:IE});var DE=3e3;class QJ{constructor(e,r){this.tr=!0,this.er=[],this.ir=Ao((r==null?void 0:r.flush_interval_ms)||DE,250,5e3,$e.createLogger("flush interval"),DE),this.rr=e}enqueue(e){this.er.push(e),this.nr||this.sr()}unload(){this.ar();var e=this.er.length>0?this.lr():{},r=Object.values(e);[...r.filter((n=>n.url.indexOf("/e")===0)),...r.filter((n=>n.url.indexOf("/e")!==0))].map((n=>{this.ur(Ce({},n,{transport:"sendBeacon"}))}))}enable(){this.tr=!1,this.sr()}sr(){var e=this;this.tr||(this.nr=setTimeout((()=>{if(this.ar(),this.er.length>0){var r=this.lr(),n=function(){var i=r[s],a=new Date().getTime();i.data&&zt(i.data)&&Ir(i.data,(l=>{l.offset=Math.abs(l.timestamp-a),delete l.timestamp})),e.ur(i)};for(var s in r)n()}}),this.ir))}ur(e){try{this.rr(e)}catch(r){$e.error(r)}}ar(){clearTimeout(this.nr),this.nr=void 0}lr(){var e={};return Ir(this.er,(r=>{var n,s=r,i=(s?s.batchKey:null)||s.url;Le(e[i])&&(e[i]=Ce({},s,{data:[]})),(n=e[i].data)==null||n.push(s.data)})),this.er=[],e}}var XJ=["retriesPerformedSoFar"];class eQ{constructor(e){this.hr=!1,this.dr=3e3,this.er=[],this._instance=e,this.er=[],this.vr=!0,!Le(me)&&"onLine"in me.navigator&&(this.vr=me.navigator.onLine,this.cr=()=>{this.vr=!0,this.pr()},this.gr=()=>{this.vr=!1},Jr(me,"online",this.cr),Jr(me,"offline",this.gr))}get length(){return this.er.length}retriableRequest(e){var r=e.retriesPerformedSoFar,n=HF(e,XJ);fl(r)&&(n.url=sw(n.url,{retry_count:r})),this._instance._send_request(Ce({},n,{callback:s=>{if(s.statusCode!==200&&(400>s.statusCode||s.statusCode>=500)){if((s.statusCode===0?3:10)>(r??0))return void this.At(Ce({retriesPerformedSoFar:r},n));s.statusCode===0&&$e.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(r??0)+" retries.")}n.callback==null||n.callback(s)}}))}At(e){var r=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=r+1;var n=(function(a){var l=3e3*Math.pow(2,a),u=l/2,h=Math.min(18e5,l),p=Math.random()-.5;return Math.ceil(h+p*(h-u))})(r),s=Date.now()+n;this.er.push({retryAt:s,requestOptions:e});var i="Enqueued failed request for retry in "+n;navigator.onLine||(i+=" (Browser is offline)"),$e.warn(i),this.hr||(this.hr=!0,this.mr())}mr(){if(this.yr&&clearTimeout(this.yr),this.er.length===0)return this.hr=!1,void(this.yr=void 0);this.yr=setTimeout((()=>{this.vr&&this.er.length>0&&this.pr(),this.mr()}),this.dr)}pr(){var e=Date.now(),r=[],n=this.er.filter((i=>e>i.retryAt||(r.push(i),!1)));if(this.er=r,n.length>0)for(var s of n)this.retriableRequest(s.requestOptions)}unload(){for(var e of(this.yr&&(clearTimeout(this.yr),this.yr=void 0),this.hr=!1,Le(me)||(this.cr&&(me.removeEventListener("online",this.cr),this.cr=void 0),this.gr&&(me.removeEventListener("offline",this.gr),this.gr=void 0)),this.er)){var r=e.requestOptions;try{this._instance._send_request(Ce({},r,{transport:"sendBeacon"}))}catch(n){$e.error(n)}}this.er=[]}}class tQ{constructor(e){this.br=()=>{var r,n,s,i;this._r||(this._r={});var a=this.scrollElement(),l=this.scrollY(),u=a?Math.max(0,a.scrollHeight-a.clientHeight):0,h=l+((a==null?void 0:a.clientHeight)||0),p=(a==null?void 0:a.scrollHeight)||0;this._r.lastScrollY=Math.ceil(l),this._r.maxScrollY=Math.max(l,(r=this._r.maxScrollY)!==null&&r!==void 0?r:0),this._r.maxScrollHeight=Math.max(u,(n=this._r.maxScrollHeight)!==null&&n!==void 0?n:0),this._r.last
412ContentY=h,this._r.maxContentY=Math.max(h,(s=this._r.maxContentY)!==null&&s!==void 0?s:0),this._r.maxContentHeight=Math.max(p,(i=this._r.maxContentHeight)!==null&&i!==void 0?i:0)},this._instance=e}get wr(){return this._instance.config.scroll_root_selector}getContext(){return this._r}resetContext(){var e=this._r;return setTimeout(this.br,0),e}startMeasuringScrollPosition(){Jr(me,"scroll",this.br,{capture:!0}),Jr(me,"scrollend",this.br,{capture:!0}),Jr(me,"resize",this.br)}scrollElement(){if(!this.wr)return me==null?void 0:me.document.documentElement;var e=zt(this.wr)?this.wr:[this.wr];for(var r of e){var n=me==null?void 0:me.document.querySelector(r);if(n)return n}}kr(e){var r=e==="y"?"scrollTop":"scrollLeft";if(this.wr){var n=this.scrollElement();return n&&n[r]||0}return me?e==="y"?me.scrollY||me.pageYOffset||me.document.documentElement.scrollTop||0:me.scrollX||me.pageXOffset||me.document.documentElement.scrollLeft||0:0}scrollY(){return this.kr("y")}scrollX(){return this.kr("x")}}var rQ=t=>rz(t==null?void 0:t.config.mask_personal_data_properties,t==null?void 0:t.config.custom_personal_data_properties,t==null?void 0:t.config.disable_capture_url_hashes);class DI{constructor(e,r,n,s){this.Sr=i=>{var a=this.Cr();if(!a||a.sessionId!==i){var l={sessionId:i,props:this.Mr(this._instance)};this.Tr.register({[wE]:l})}},this._instance=e,this.Er=r,this.Tr=n,this.Mr=s||rQ,this.Er.onSessionId(this.Sr)}Cr(){return this.Tr.props[wE]}getSetOnceProps(){var e,r=(e=this.Cr())==null?void 0:e.props;return r?"r"in r?nz(r,this._instance.config.disable_capture_url_hashes):{$referring_domain:r.referringDomain,$pathname:r.initialPathName,utm_source:r.utm_source,utm_campaign:r.utm_campaign,utm_medium:r.utm_medium,utm_content:r.utm_content,utm_term:r.utm_term}:{}}getSessionProps(){var e={};return Ir(HC(this.getSetOnceProps()),((r,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+tE(n)]=r})),e}}class ZC{on(e,r){return this.Ir[e]||(this.Ir[e]=[]),this.Ir[e].push(r),()=>{this.Ir[e]=this.Ir[e].filter((n=>n!==r))}}emit(e,r){for(var n of this.Ir[e]||[])n(r);for(var s of this.Ir["*"]||[])s(e,r)}constructor(){this.Ir={}}}var Xp=en("[SessionId]");class OI{on(e,r){return this.Pr.on(e,r)}constructor(e,r,n){var s;if(this.Rr=null,this.Ar=[],this.Fr=void 0,this.Lr=!1,this.Pr=new ZC,this.Or=(h,p)=>!(!fl(h)||!fl(p))&&Math.abs(h-p)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===Tl)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Ne=e.config,this.Tr=e.persistence,this.Dr=void 0,this.$r=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Nr=r||Sl,this.qr=n||Sl;var i=this.Ne.persistence_name||this.Ne.token;if(this._sessionTimeoutMs=1e3*Ao(this.Ne.session_idle_timeout_seconds||1800,60,36e3,Xp.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.jr(),this.Br="ph_"+i+"_window_id",this.Hr="ph_"+i+"_primary_window_exists",this.Ur()){var a=sn.H(this.Br),l=sn.H(this.Hr);a&&!l?this.Dr=a:sn.q(this.Br),sn.F(this.Hr,!0)}if((s=this.Ne.bootstrap)!=null&&s.sessionID)try{var u=(h=>{var p=this.Ne.bootstrap.sessionID.replace(/-/g,"");if(p.length!==32)throw new Error("Not a valid UUID");if(p[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(p.substring(0,12),16)})();this.zr(this.Ne.bootstrap.sessionID,new Date().getTime(),u)}catch(h){Xp.error("Invalid sessionID in bootstrap",h)}this.Wr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Le(this.Ar)&&(this.Ar=[]),this.Ar.push(e),this.$r&&e(this.$r,this.Dr),()=>{this.Ar=this.Ar.filter((r=>r!==e))}}Ur(){return this.Ne.persistence!=="memory"&&!this.Tr.xi&&sn.N()}Vr(e){e!==this.Dr&&(this.Dr=e,this.Ur()&&sn.F(this.Br,e))}Zr(){return this.Dr?this.Dr:this.Ur()?sn.H(this.Br):null}Gr(e){var r=this.Rr;return!Fs(r)&&!Fs(e)&&5e3>Math.abs(e-r)}zr(e,r,n){var s=r!==this._sessionActivityTimestamp,i=!(e!==this.$r||n!==this._sessionStartTimestamp);this._sessionStartTimestamp=n,this._sessionActivityTimestamp=r,this.$r=e,i&&!s||i&&this.Gr(r)||(this.Rr=r,this.Tr.register({[Qh]:[r,e,n]}))}Qr(){var e,r=(e=this.Ne)==null?void 0:e.persistence_save_debounce_ms;return fl(r)&&r>0}Kr(){this.Qr()?this.Tr.refreshKey(Qh):(this.Tr.flush(),this.Tr.load())}Jr(){var e;if(!Fs(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Rr){this.Kr();var r=this.Yr();r[1]===this.$r&&r[2]===this._sessionStartTimestamp&&(this.Rr=this._sessionActivityTimestamp,this.Tr.register({[Qh]:[this._sessionActivityTimestamp,(e=this.$r)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Tr.flush())}}Xr(){var e=this.Yr()[0],r=fl(e)?e:0,n=fl(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(r,n)}
412tn(e){return this.Kr(),this.Or(e,this.Xr())}Yr(){var e=this.Tr.props[Qh];return zt(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Rr=null,clearTimeout(this.en),this.en=void 0,this.zr(null,null,null)}destroy(){this.Lr=!0,this.Jr(),clearTimeout(this.en),this.en=void 0,this.Fr&&me&&(me.removeEventListener(nb,this.Fr,{capture:!1}),this.Fr=void 0),this.Ar=[]}Wr(){this.Fr=()=>{this.Jr(),this.Ur()&&sn.q(this.Hr)},Jr(me,nb,this.Fr,{capture:!1})}checkAndGetSessionAndWindowId(e,r){if(e===void 0&&(e=!1),r===void 0&&(r=null),this.Ne.cookieless_mode===Tl)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var n=r||new Date().getTime(),s=this.Yr(),i=s[1],a=s[2],l=this.Xr(),u=this.Zr(),h=fl(a)&&Math.abs(n-a)>864e5,p=!1,f=!1,g=!i,v=i,_=!g&&!e&&this.Or(n,l);if(_){(_=this.tn(n))||Xp.info("cross-tab refresh kept the session alive",{sessionId:i});var x=this.Yr();i=x[1],a=x[2]}g||_||h?(i=this.Nr(),u=this.qr(),Xp.info("new session ID generated",{sessionId:i,windowId:u,changeReason:{noSessionId:g,activityTimeout:_,sessionPastMaximumLength:h}}),a=n,p=!0):(u||(u=this.qr(),p=!0),(f=i!==v)&&(Xp.info("adopted cross-tab session id",{sessionId:i,windowId:u}),p=!0));var w=fl(l)&&e&&!h?l:n,S=fl(a)?a:new Date().getTime();this.Vr(u),this.zr(i,w,S),e||this.jr();var k={noSessionId:g,activityTimeout:_,sessionPastMaximumLength:h,crossTabAdoption:f};return p&&this.Ar.forEach((j=>j(i,u,k))),{sessionId:i,windowId:u,sessionStartTimestamp:S,changeReason:p?k:void 0,lastActivityTimestamp:l}}jr(){this.Lr||(clearTimeout(this.en),this.en=setTimeout((()=>{if(!this.Lr)if(this.tn(new Date().getTime())){var e=this.$r;this.resetSessionId(),this.Pr.emit("forcedIdleReset",{idleSessionId:e})}else this.jr()}),1.1*this.sessionTimeoutMs))}}var vz=function(t,e){if(!t)return!1;var r=t.userAgent;if(r&&eI(r,e))return!0;try{var n=t==null?void 0:t.userAgentData;if(n!=null&&n.brands&&n.brands.some((s=>eI(s==null?void 0:s.brand,e))))return!0}catch{}return!!t.webdriver};function yz(){return(yz=Hr((function*(){var t=Os==null?void 0:Os.userAgentData;if(t!=null&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),r=e==null?void 0:e.model;return pr(r)&&r.length>0?r:void 0}catch(n){return void $e.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",n)}}))).apply(this,arguments)}var ub=function(t,e){if(!(function(r){try{new RegExp(r)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function aS(t,e,r){return Xh({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:r})}var _z={exact:(t,e)=>e.some((r=>t.some((n=>r===n)))),is_not:(t,e)=>e.every((r=>t.every((n=>r!==n)))),regex:(t,e)=>e.some((r=>t.some((n=>ub(r,n))))),not_regex:(t,e)=>e.every((r=>t.every((n=>!ub(r,n))))),icontains:(t,e)=>e.map(Py).some((r=>t.map(Py).some((n=>r.includes(n))))),not_icontains:(t,e)=>e.map(Py).every((r=>t.map(Py).every((n=>!r.includes(n))))),gt:(t,e)=>e.some((r=>{var n=parseFloat(r);return!isNaN(n)&&t.some((s=>n>parseFloat(s)))})),lt:(t,e)=>e.some((r=>{var n=parseFloat(r);return!isNaN(n)&&t.some((s=>n<parseFloat(s)))}))},Py=t=>t.toLowerCase();function bz(t,e){return!t||Object.entries(t).every((r=>{var n=r[1],s=e==null?void 0:e[r[0]];if(Le(s)||Fs(s))return!1;var i=[String(s)],a=_z[n.operator];return!!a&&a(n.values,i)}))}var OE="custom",MI="i.posthog.com",nQ=/^\/static\//;class sQ{constructor(e){this.rn={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,r=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return r||(r=this.apiHost.replace("."+MI,".posthog.com")),r==="https://app.posthog.com"?"https://us.posthog.com":r}get region(){return this.rn[this.apiHost]||(this.rn[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":OE),this.rn[this.apiHost]}nn(e){if(nQ.test(e)){var r=this.instance.config.asset_host;if(typeof r=="string")return r.trim().replace(/\/$/,"")||void 0}}endpointFor(e,r){if(r===void 0&&(r=""),r&&(r=r[0]==="/"?r:"/"+r),e==="ui")return this.uiHost+r;if(e==="flags")return this.flagsApiHost+r;if(e==="assets"){var n=this.nn(r);if(n)return""+n+r}if(this.region===OE)return this.apiHost+r;var s=MI+r;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}function wz(t){var e;return!((e=t.conditions)==null||(e=e.events)==null||(e=e.values)==null||!e.length)}var kr=en("[Surveys]"),xz="seenSurvey_",Sz=t=>{try{var e=(r=>((n,s)=>""+xz+(function(i){return i.current_iteration&&i.current_iteration>0?i.id+"_"+i.current_iteration:i.id})(s))(0,r))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(r){kr.error("Failed to persist survey seen state",r)}},iQ=[tS.Popover,tS.Widget,tS.API],aQ={ignoreConditions:!1,ignoreDelay:!1,displayType:PE.Popover}
412,oQ=en("[PostHog ExternalIntegrations]"),lQ={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class cQ{constructor(e){this._instance=e}ai(e,r){var n;(n=yt.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(s=>{if(s)return oQ.error("failed to load script",s);r()}))}startIfEnabledOrStop(){var e=this,r=function(){var i,a,l,u=n[0],h=n[1];!h||(i=yt.__PosthogExtensions__)!=null&&(i=i.integrations)!=null&&i[u]||e.ai(lQ[u],(()=>{var p;(p=yt.__PosthogExtensions__)==null||(p=p.integrations)==null||(p=p[u])==null||p.start(e._instance)})),!h&&(a=yt.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[u]&&((l=yt.__PosthogExtensions__)==null||(l=l.integrations)==null||(l=l[u])==null||l.stop())};for(var n of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;r()}}}class uQ{constructor(e,r){this.rt=e,this.sn=r,this.an=new Map,this.ln=!1}add(e){var r=this;return Hr((function*(){if(r.ln)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(r.an.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');r.an.set(e.name,e);try{var n=e.setup(r.sn);n&&(yield n)}catch(i){var s=r.an.get(e.name)===e;s&&r.an.delete(e.name),r.rt.error('Failed to set up browser extension "'+e.name+'"',i),s&&r.un(e)}}))()}dispose(){if(!this.ln){this.ln=!0;var e=Array.from(this.an.values()).reverse();for(var r of(this.an.clear(),e))this.un(r)}}un(e){try{var r=e.dispose==null?void 0:e.dispose();r&&Ni(r.then)&&r.then(void 0,(n=>{this.rt.error('Failed to dispose browser extension "'+e.name+'"',n)}))}catch(n){this.rt.error('Failed to dispose browser extension "'+e.name+'"',n)}}}class dQ{constructor(e){this._instance=e}get(e){var r;return(r=this._instance.persistence)==null?void 0:r.get_property(e)}set(e,r){var n;(n=this._instance.persistence)==null||n.set_property(e,r)}remove(e){var r;(r=this._instance.persistence)==null||r.unregister(e)}}var LI="extensionsRemoteConfig";class hQ{constructor(e){this.ln=!1,this.instance=e,this.rt=$e.createLogger("[BrowserExtensions]"),this.hn=e.dn,this.kv=new dQ(e),this.onEvent=r=>Ny(this.instance.on("eventCaptured",(n=>{try{r({event:n.event,properties:n.properties})}catch(s){this.rt.error("Browser extension event listener failed",s)}}))),this.onRemoteConfig=r=>{if(this.ln)return Ny((()=>{}));var n=i=>{try{r(i)}catch(a){this.rt.error("Browser extension remote config listener failed",a)}},s=this.instance.vn.on(LI,n);return this.hn&&n(this.hn),Ny(s)},this.cn=new uQ(this.rt,this)}get logger(){return this.rt}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property(eg))!==null&&e!==void 0?e:this.distinctId}get groups(){return this.instance.getGroups()}get session(){try{var e,r,n,s,i=(e=this.instance.sessionManager)==null?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(r=i==null?void 0:i.sessionId)!==null&&r!==void 0?r:"",windowId:(n=i==null?void 0:i.windowId)!==null&&n!==void 0?n:"",sessionStartTimestamp:(s=i==null?void 0:i.sessionStartTimestamp)!==null&&s!==void 0?s:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(e){return this.cn.add(e)}capture(e,r,n){var s=this;return Hr((function*(){n?s.instance.capture(e,r,{timestamp:n.timestamp,uuid:n.uuid,$set:n.set,$set_once:n.setOnce}):s.instance.capture(e,r)}))()}registerDynamicEventProperties(e){return Ny(this.instance.fn(e))}handleRemoteConfig(e){this.ln||(this.hn=e,this.instance.vn.emit(LI,e))}sendRequest(e,r){var n=this;return Hr((function*(){var s;r===void 0&&(r={});var i=n.instance.requestRouter.endpointFor((s=r.target)!==null&&s!==void 0?s:"api",e),a={method:r.method,url:r.query?sw(i,r.query):i,data:r.body,headers:r.headers,timeout:r.timeoutMs,fireCallbackOnDrop:!0,transport:r.transport};return r.transport==="sendBeacon"?(n.instance._send_request(a),{statusCode:202}):new Promise((l=>{a.callback=l,n.instance._send_request(a)}))}))()}dispose(){this.ln||(this.ln=!0,this.cn.dispose())}}var Om={},oS=0,db=()=>{}
412,FI='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',em="Surveys module not available",$I="sanitize_properties is deprecated. Use before_send instead",kz="Invalid value for property_denylist config: ",fQ=["token","distinct_id",A$],Wh="posthog",Ez=!YJ&&(ri==null?void 0:ri.indexOf("MSIE"))===-1&&(ri==null?void 0:ri.indexOf("Mozilla"))===-1,lS=t=>{var e;return Ce({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:pJ(Ue==null?void 0:Ue.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:db,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Zr&&pr(Zr==null?void 0:Zr.search)&&Zr.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(me==null||(e=me.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(r){$e.error("Bad HTTP status: "+r.statusCode+" "+r.text)},get_device_id:r=>r,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:EE,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:DE},error_tracking:{},_onCapture:db},(r=>({rageclick:r&&r>="2026-05-30"?{content_ignorelist:jJ,ignore_text_selection:!0}
412:!r||"2025-11-30">r||{content_ignorelist:!0},capture_pageview:!r||"2025-05-24">r||"history_change",session_recording:r&&r>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:r&&r>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:r&&r>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:r&&r>="2026-01-30"?"head":"body",internal_or_test_user_hostname:r&&r>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:r&&r>="2026-05-30"?250:0,split_storage:!(!r||"2026-05-30">r),detect_google_search_app:!(!r||"2026-05-30">r),disable_capture_url_hashes:!(!r||"2026-06-25">r)}))(t))},pQ=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],zI=t=>{var e={};for(var r of pQ){var n=r[0],s=r[1];Le(t[n])||(e[s]=t[n])}var i=Lr({},e,t),a=t.__preview_external_dependency_versioned_paths;return Le(a)||(Le(t.strict_script_versioning)&&(i.strict_script_versioning=!!a),pr(a)&&Le(t.asset_host)&&(i.asset_host=a)),zt(t.property_blacklist)&&(Le(t.property_denylist)?i.property_denylist=t.property_blacklist:zt(t.property_denylist)?i.property_denylist=[...t.property_blacklist,...t.property_denylist]:$e.error(kz+t.property_denylist)),i};class mQ{constructor(){this.__forceAllowLocalhost=!1}get pn(){return this.__forceAllowLocalhost}set pn(e){$e.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class oa{gn(e,r){if(e){var n=this.an.indexOf(e);n!==-1&&this.an.splice(n,1)}return this.an.push(r),r.initialize==null||r.initialize(),r}mn(){return this.config.cookieless_mode===Tl||this.config.cookieless_mode===Qu&&this.consent.isRejected()}get decideEndpointWasHit(){var e,r;return(e=(r=this.featureFlags)==null?void 0:r.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,r;return(e=(r=this.featureFlags)==null?void 0:r.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new mQ,this.yn=!1,this.version=Er.LIB_VERSION,this.bn=new Set,this._n="",this.vn=new ZC,this.an=[],this.wn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=lS(),this.SentryIntegration=DJ,this.sentryIntegration=n=>(function(s,i){var a=Y$(s,i);return{name:K$,processEvent:l=>a(l)}})(this,n),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.kn=!1,this.xn=null,this.Sn=null,this.Cn=null,this.scrollManager=new tQ(this),this.pageViewManager=new EI(this),this.rateLimiter=new VJ(this),this.requestRouter=new sQ(this),this.consent=new wJ(this),this.externalIntegrations=new cQ(this);var r=(e=oa.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=r.featureFlags&&new r.featureFlags(this),this.toolbar=r.toolbar&&new r.toolbar(this),this.surveys=r.surveys&&new r.surveys(this),this.conversations=r.conversations&&new r.conversations(this),this.logs=r.logs&&new r.logs(this),this.metrics=r.metrics&&new r.metrics(this),this.experiments=r.experiments&&new r.experiments(this),this.exceptions=r.exceptions&&new r.exceptions(this),this.people={set:(n,s,i)=>{var a=pr(n)?{[n]:s}:n;this.setPersonProperties(a),i==null||i({})},set_once:(n,s,i)=>{var a=pr(n)?{[n]:s}:n;this.setPersonProperties(void 0,a),i==null||i({})}},this.on("eventCaptured",(n=>$e.info('send "'+(n==null?void 0:n.event)+'"',n)))}init(e,r,n){if(n&&n!==Wh){var s,i=(s=Om[n])!==null&&s!==void 0?s:new oa;return i._init(e,r,n),Om[n]=i,Om[Wh][n]=i,i}return this._init(e,r,n)}_init(e,r,n){var s,i;r===void 0&&(r={});var a,l=pr(e)?e.trim():"";if(!l)return $e.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return l!==((a=this.config)==null?void 0:a.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+l+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=lS(r.defaults),r.debug=this.Mn(r.debug),this.Tn=r,this.En=[],r.person_profiles?this.Sn=r.person_profiles:r.process_person&&(this.Sn=r.process_person);var u=lS(r.defaults),h=zI(r),p=Lr({},u,h,{name:n,token:l});Fr(u.rageclick)&&Fr(h.rageclick)&&(p.rageclick=Lr({},u.rageclick,h.rageclick)),Fr(u.session_recording)&&Fr(h.session_recording)&&(p.session_recording=Lr({},u.session_recording,h.session_recording)),this.set_config(p),this.config.on_xhr_error&&$e.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:Ts.GZipJS;var f=this.In();if(this.persistence=new eS(this.config,f),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new eS(Ce({},this.config,{persistence:"sessionStorage"}),f,!1),this._n="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!f&&sn.N()){var g=sn.H(this._n);zt(g)&&g.forEach((A=>{pr(A)&&this.bn.add(A)}))}else sn.q(this._n);var v=Ce({},this.persistence.props),_=Ce({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Pn=new QJ((A=>this.Rn(A)),this.config.request_queue_config),this.An=new eQ(this),this.__request_queue=[];var x=this.mn();if(x||(this.sessionManager=new OI(this),this.sessionPropsManager=new DI(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((A,I,P)=>{(P!=null&&P.activityTimeout||P!=null&&P.sessionPastMaximumLength||P!=null&&P.crossTabAdoption)&&this.Fn()}))),this.config.__preview_deferred_init_extensions?($e.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ln(x)}),0)):($e.info("Initializing extensions synchronously"),this.Ln(x)),Er.DEBUG=Er.DEBUG||this.config.debug,Er.DEBUG&&$e.info("Starting in debug mode",{this:this,config:r,thisC:Ce({},this.config),p:v,s:_}),!this.config.identity_distinct_id||(s=r.bootstrap)!=null&&s.distinctID||(r.bootstrap=Ce({},r.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((i=r.bootstrap)==null?void 0:i.distinctID)!==void 0){var w=r.bootstrap.distinctID,S=this.get_distinct_id(),k=this.persistence.get_property(na);if(r.bootstrap.isIdentifiedID&&S!=null&&S!==w&&k===Sh)this.identify(w);else if(r.bootstrap.isIdentifiedID&&S!=null&&S!==w&&k===Mu)$e.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var j=this.config.get_device_id(Sl()),C=r.bootstrap.isIdentifiedID?j:w;this.persistence.set_property(na,r.bootstrap.isIdentifiedID?Mu:Sh),this.register({distinct_id:w,$device_id:C})}}if(x)this.register_once({distinct_id:Sy,$device_id:null},"");else if(!this.get_distinct_id()){var R=this.config.get_device_id(Sl());this.register_once({distinct_id:R,$device_id:R},""),this.persistence.set_property(na,Sh)}return Jr(me,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),r.segment?(function(A,I){var P=A.config.segment;if(!P)return I();(function(T,O){var G=T.config.segment;if(!G)return O();var M=V=>{var H=()=>V.anonymousId()||Sl();T.config.get_device_id=H,V.id()&&(T.register({distinct_id:V.id(),$device_id:H()}),T.persistence.set_property(na,Mu)),O()},U=G.user();"then"in U&&Ni(U.then)?U.then(M):M(U)})(A,(()=>{P.register((T=>{typeof Promise<"u"&&Promise.resolve||Qx.warn("This browser does not have Promise support, and can not use the segment integration");var O=(G,M)=>{if(!M)return G;G.event.userId||G.event.anonymousId===T.get_distinct_id()||(Qx.info("No userId set, resetting PostHog"),T.reset()),G.event.userId&&G.event.userId!==T.get_distinct_id()&&(Qx.info("UserId set, identifying with PostHog"),T.identify(G.event.userId)
412);var U=T.calculateEventProperties(M,G.event.properties);return G.event.properties=Object.assign({},U,G.event.properties),G};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:G=>O(G,G.event.event),page:G=>O(G,qh),identify:G=>O(G,Yx),screen:G=>O(G,"$screen")}})(A)).then((()=>{I()}))}))})(this,(()=>this.On())):this.On(),Ni(this.config._onCapture)&&this.config._onCapture!==db&&($e.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(A=>this.config._onCapture(A.event,A)))),this.config.ip&&$e.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return yz.apply(this,arguments)})().then((A=>{A&&this.register({[Gx]:A})})).catch(db),this}Ln(e){var r,n,s,i,a,l,u,h,p=performance.now(),f=Ce({},oa.__defaultExtensionClasses,this.config.__extensionClasses),g=[];f.featureFlags&&this.an.push(this.featureFlags=(r=this.featureFlags)!==null&&r!==void 0?r:new f.featureFlags(this)),f.exceptions&&this.an.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new f.exceptions(this)),f.historyAutocapture&&this.an.push(this.historyAutocapture=new f.historyAutocapture(this)),f.tracingHeaders&&this.an.push(this.tracingHeaders=new f.tracingHeaders(this)),f.siteApps&&this.an.push(this.siteApps=new f.siteApps(this)),f.sessionRecording&&!e&&this.an.push(this.sessionRecording=new f.sessionRecording(this)),this.config.disable_scroll_properties||g.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),f.autocapture&&this.an.push(this.autocapture=new f.autocapture(this)),f.surveys&&this.an.push(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new f.surveys(this)),f.logs&&this.an.push(this.logs=(i=this.logs)!==null&&i!==void 0?i:new f.logs(this)),f.metrics&&this.an.push(this.metrics=(a=this.metrics)!==null&&a!==void 0?a:new f.metrics(this)),f.conversations&&this.an.push(this.conversations=(l=this.conversations)!==null&&l!==void 0?l:new f.conversations(this)),f.productTours&&this.an.push(this.productTours=new f.productTours(this)),f.heatmaps&&this.an.push(this.heatmaps=new f.heatmaps(this)),f.webVitalsAutocapture&&this.an.push(this.webVitalsAutocapture=new f.webVitalsAutocapture(this)),f.exceptionObserver&&this.an.push(this.exceptionObserver=new f.exceptionObserver(this)),f.deadClicksAutocapture&&this.an.push(this.deadClicksAutocapture=new f.deadClicksAutocapture(this,IJ)),f.toolbar&&this.an.push(this.toolbar=(u=this.toolbar)!==null&&u!==void 0?u:new f.toolbar(this)),f.experiments&&this.an.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new f.experiments(this)),this.an.forEach((v=>{v.initialize&&g.push((()=>{v.initialize==null||v.initialize()}))})),g.push((()=>{if(this.Dn){var v=this.Dn;this.Dn=void 0,this.an.forEach((_=>_.onRemoteConfig==null?void 0:_.onRemoteConfig(v)))}})),this.$n(g,p)}$n(e,r){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-r>=30&&e.length>0)return void setTimeout((()=>{this.$n(e,r)}),0);var n=e.shift();if(n)try{n()}catch(i){$e.error("Error initializing extension:",i)}}var s=Math.round(performance.now()-r);this.register_for_session({[T$]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[I$]:s}),this.config.__preview_deferred_init_extensions&&$e.info("PostHog extensions initialized ("+s+"ms)")}Gi(e){var r;if(!Ue||!Ue.body)return $e.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Gi(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this.Dn=e),this.dn=e,this.compression=void 0,e.ok){var n,s=e.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=Lt(s.supportedCompression,Ts.GZipJS)?Ts.GZipJS:Lt(s.supportedCompression,Ts.Base64)?Ts.Base64:void 0),(n=s.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.Sn?this.Sn:EE}),(r=this.Nn)==null||r.handleRemoteConfig(e),this.an.forEach((i=>i.onRemoteConfig==null?void 0:i.onRemoteConfig(e)))}On(){try{this.config.loaded(this)}catch(n){$e.critical("`loaded` function failed",n)}if(this.qn(),this.config.internal_or_test_user_hostname&&Zr!=null&&Zr.hostname){var e=Zr.hostname,r=this.config.internal_or_test_user_hostname;(typeof r=="string"?e===r:r.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.mn())&&this.jn()}),1),this.Bn=new iz(this),this.Bn.load()}qn(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Pn)==null||e.enable())}_dom_loaded(){this.is_capturing()&&ky(this.__request_queue,(e=>this.Rn(e))),this.__request_queue=[],this.qn()}_handle_unload(){var e,r,n,s,i;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(r=this.metrics)==null||r.flush("sendBeacon"),this.config.request_batching?(this.Hn()&&this.capture(Kx),(n=this.logs)==null||n.flushLogs("sendBeacon"),(s=this.Pn)==null||s.unload(),(i=this.An)==null||i.unload()):this.Hn()&&this.capture(Kx,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?Ez?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=Ce({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(Le(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,
412(r=>{var n,s,i,a=Ce({},r);a.timeout=a.timeout||6e4;var l,u,h,p,f,g=(n=a.transport)!==null&&n!==void 0?n:"fetch";g==="sendBeacon"&&Le(a.compression)&&a.data&&(a.compression=Ts.Base64),a.method==="POST"&&a.data&&(a.timestampMode==="capture-body"?a.data={api_key:(u=(f=(p=zt(l=a.data)?l:[l])[0])==null||(h=f.properties)==null?void 0:h.token)!==null&&u!==void 0?u:f==null?void 0:f.token,batch:p,sent_at:new Date().toISOString()}:a.timestampMode==="body"&&(a.data=(function(w,S){return S===void 0&&(S=new Date().toISOString()),zt(w)?w.map((k=>Ce({},k,{sent_at:S}))):Ce({},w,{sent_at:S})})(a.data))),a.url=II(a.url,a.method,a.compression,a.timestampMode);var v=p_.filter((w=>!a.disableTransport||!w.transport||!a.disableTransport.includes(w.transport))),_=(s=(i=(function(w,S){for(var k=0;w.length>k;k++)if(w[k].transport===g)return w[k]})(v))==null?void 0:i.method)!==null&&s!==void 0?s:v[0].method;if(!_)throw new Error("No available transport method");var x=w=>{try{_(w)}catch(S){mz(S)?$e.warn(S):$e.error(S),a.callback==null||a.callback({statusCode:0,error:S})}};g!=="sendBeacon"&&a.data&&a.compression===Ts.GZipJS&&gZ&&typeof Promise<"u"&&!f_?ZJ(a).then((w=>{x(w)})).catch((w=>{if(XT(w))return f_=!0,void x(Ce({},a,{compression:void 0,url:II(r.url,r.method,void 0,r.timestampMode)}));(S=>{if(!S||typeof S!="object")return!1;var k="name"in S?String(S.name):"";return XT(S)||k===qF})(w)&&(f_=!0),x(a)})):_(a)})(Ce({},e,{callback:r=>{var n,s;this.rateLimiter.checkForLimiting(r),400>r.statusCode||(n=(s=this.config).on_request_error)==null||n.call(s,r),e.callback==null||e.callback(r)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}Rn(e){this.An?this.An.retriableRequest(e):this._send_request(e)}_execute_array(e){oS++;try{var r,n=[],s=[],i=[];ky(e,(l=>{if(l)if(zt(r=l[0]))i.push(l);else if(Ni(l))try{l.call(this)}catch(u){$e.error("Error executing queued PostHog call",l,u)}else zt(l)&&r==="alias"?n.push(l):zt(l)&&r.indexOf("capture")!==-1&&Ni(this[r])?i.push(l):s.push(l)}));var a=function(l,u){ky(l,(function(h){try{if(zt(h[0])){var p=u;Ir(h,(function(f){p=p[f[0]].apply(p,f.slice(1))}))}else u[h[0]].apply(u,h.slice(1))}catch(f){$e.error("Error executing queued PostHog call",h,f)}}))};a(n,this),a(s,this),a(i,this)}finally{oS--}}push(e){if(oS>0&&zt(e)&&pr(e[0])){var r=oa.prototype[e[0]];Ni(r)&&r.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,r,n){var s,i,a,l,u,h,p;
412if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Pn){if(this.is_capturing())if(!Le(e)&&pr(e)){var f=!this.config.opt_out_useragent_filter&&this._is_bot();if(!f||this.config.__preview_capture_bot_pageviews){var g=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(g==null||!g.isRateLimited){if(this.wn.length>0){var v={};for(var _ of this.wn.slice())try{Lr(v,_())}catch(L){$e.error("Failed to produce browser extension event properties",L)}r=Ce({},v,r??{})}var x;(s=r)!=null&&s.$current_url&&!pr((i=r)==null?void 0:i.$current_url)&&($e.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),(x=r)==null||delete x.$current_url),e!=="$exception"||n!=null&&n.Un||$e.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var w=new Date,S=(n==null?void 0:n.timestamp)||w,k=sI(n==null?void 0:n.uuid,Sl),j={uuid:k,event:e,properties:this.calculateEventProperties(e,r||{},S,k)};e===qh&&this.config.__preview_capture_bot_pageviews&&f&&(j.event="$bot_pageview",j.properties.$browser_type="bot"),g&&(j.properties.$lib_rate_limit_remaining_tokens=g.remainingTokens);var C=e==="$feature_flag_called"&&j.properties.$feature_flag_has_experiment===!1&&this.get_property(Q_)===!0;n!=null&&n.$set&&!C&&(j.$set=n==null?void 0:n.$set);var R=n==null?void 0:n.$unset;R&&(j.$unset=R);var A,I,P,T=C?void 0:this.zn(n==null?void 0:n.$set_once,e!==uI,e===Yx);if(T&&(j.$set_once=T),n!=null&&n._noTruncate||(l=this.config.properties_string_max_length,u=j,h=L=>pr(L)?L.slice(0,l):L,p=new Set,j=(function L($,F){if($!==Object($))return h?h($):$;if(!p.has($)){var te;if(p.add($),zt($))te=[],ky($,(re=>{te.push(L(re))}));else{var ue={};Ir($,((re,se)=>{p.has(re)||(ue[se]=L(re))})),te=ue}return te}})(u)),j.timestamp=S,Le(n==null?void 0:n.timestamp)||(j.properties.$event_time_override_provided=!0,j.properties.$event_time_override_system_time=w),C&&(j.properties=(function(L,$){$===void 0&&($=[]);var F={},te=ue=>{L[ue]!==void 0&&(F[ue]=L[ue])};return vZ.forEach(te),$.forEach(te),F})(j.properties,fQ)),e===Dl.DISMISSED||e===Dl.SENT){var O,G,M=(O=r)==null?void 0:O[rS.SURVEY_ID],U=(G=r)==null?void 0:G[rS.SURVEY_ITERATION];Sz({id:M,current_iteration:U}),j.$set=Ce({},j.$set,{[(A={id:M,current_iteration:U},I=e===Dl.SENT?"responded":"dismissed",P="$survey_"+I+"/"+A.id,A.current_iteration&&A.current_iteration>0&&(P="$survey_"+I+"/"+A.id+"/"+A.current_iteration),P)]:!0})}else e===Dl.SHOWN&&(j.$set=Ce({},j.$set,{[rS.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===BJ.SHOWN){var V,H=(V=r)==null?void 0:V[CI.TOUR_TYPE];H&&(j.$set=Ce({},j.$set,{[CI.TOUR_LAST_SEEN_DATE+"/"+H]:new Date().toISOString()}))}var Y=Ce({},j.properties.$set,j.$set);if(Ml(Y)||this.setPersonPropertiesForFlags(Y),!Wt(this.config.before_send)){var B=this.Pt(j);if(!B)return;(j=B).uuid=sI(j.uuid,Sl)}this.vn.emit("eventCaptured",j);var z=(a=n==null?void 0:n._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),ee={method:"POST",url:z,data:j,compression:"best-available",timestampMode:(n==null?void 0:n._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(z)?"body":"capture-body",batchKey:n==null?void 0:n._batchKey,transport:n==null?void 0:n.transport};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.Rn(ee):this.Pn.enqueue(ee),j}$e.critical("This capture call is ignored due to client rate limiting.")}}else $e.error("No event name provided to posthog.capture")}else $e.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(r=>e(r.event,r)))}Wn(){var e;return(e=this.Nn)!==null&&e!==void 0?e:this.Nn=new hQ(this)}fn(e){this.wn.push(e);var r=!0;return()=>{if(r){r=!1;var n=this.wn.indexOf(e);n!==-1&&this.wn.splice(n,1)}}}calculateEventProperties(e,r,n,s,i){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return r;var a=i?void 0:this.persistence.remove_event_timer(e),l=Ce({},r);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.mn()&&(l[A$]=!0),e==="$snapshot"){var u=Ce({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!pr(l.distinct_id)&&!bn(l.distinct_id)||rE(l.distinct_id))&&$e.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var h,p=(function(j,C,R,A){var I,P,T,O;if(A===void 0&&(A=!1),!ri)return{};var G,M=j?[...Mf,...C||[]]:[],U=(function(We){for(var at=0;rI.length>at;at++){var Xt=rI[at],Rt=Xt[1],Ee=Xt[0].exec(We),Et=Ee&&(Ni(Rt)?Rt(Ee,We):Rt);if(Et)return Et}return["",""]})(ri),V=U[0],H=U[1],Y=(G=typeof navigator<"u"?navigator:void 0)!=null&&G.brave?{brave:!0}:{},B={};Le(R)||(B.detectGoogleSearchApp=R);var z={},ee=(I=navigator)==null||(I=I.userAgentData)==null?void 0:I.platform,L=(P=navigator)==null?void 0:P.maxTouchPoints,$=me==null||(T=me.screen)==null?void 0:T.width,F=me==null||(O=me.screen)==null?void 0:O.height,te=me==null?void 0:me.devicePixelRatio;Le(ee)||(z.userAgentDataPlatform=ee),Le(L)||(z.maxTouchPoints=L),Le($)||(z.screenWidth=$),Le(F)||(z.screenHeight=F),Le(te)||(z.devicePixelRatio=te);var ue,re,se,ye,de,pe,Ie,Ne,He=Lr(HC({$os:V,$os_version:H,$browser:g$(ri,navigator.vendor,Y,B),$device:nI(ri),$device_type:(re=ri,se=z,Ne=nI(re),Ne===QF||Ne===JF||Ne==="Kobo"||Ne==="Kindle Fire"||Ne===d$?Tf:Ne===Qm||Ne===cf||Ne===Xm||Ne===sE?"Console":Ne===e$?"Wearable":Ne?Oi:(se==null?void 0:se.userAgentDataPlatform)==="Android"&&((ye=se==null?void 0:se.maxTouchPoints)!==null&&ye!==void 0?ye:0)>0?600>Math.min((de=se==null?void 0:se.screenWidth)!==null&&de!==void 0?de:0,(pe=se==null?void 0:se.screenHeight)!==null&&pe!==void 0?pe:0)/((Ie=se==null?void 0:se.devicePixelRatio)!==null&&Ie!==void 0?Ie:1)?Oi:Tf:"Desktop"),$timezone:sz(),$timezone_offset:$J()}),{$current_url:ng(A?tu(Zr==null?void 0:Zr.href):Zr==null?void 0:Zr.href,M,sg),$host:Zr==null?void 0:Zr.host,$pathname:Zr==null?void 0:Zr.pathname,$raw_user_agent:ri.length>1e3?ri.substring(0,997)+"...":ri,$browser_version:MZ(ri,navigator.vendor,Y,B),$browser_language:jI(),$browser_language_prefix:(ue=jI(),typeof ue=="string"?ue.split("-")[0]:void 0),$screen_height:me==null?void 0:me.screen.height,$screen_width:me==null?void 0:me.screen.width,$viewport_height:me==null?void 0:me.innerHe
412ight,$viewport_width:me==null?void 0:me.innerWidth,$lib:Er.LIB_NAME,$lib_version:Er.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Er.SDK_DIST_CHANNEL&&(He.$sdk_dist_channel=Er.SDK_DIST_CHANNEL),He})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var f=this.sessionManager.checkAndGetSessionAndWindowId(i,n.getTime()),g=f.windowId;l.$session_id=f.sessionId,l.$window_id=g}this.sessionPropsManager&&Lr(l,this.sessionPropsManager.getSessionProps());try{var v;this.sessionRecording&&Lr(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=(v=this.An)==null?void 0:v.length}catch(j){l.$sdk_debug_error_capturing_properties=String(j)}if(this.requestRouter.region===OE&&(l.$lib_custom_api_host=this.config.api_host),h=e!==qh||i?e!==Kx||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,s),l=Lr(l,h),e===qh&&Ue&&(l.title=Ue.title),!Le(a)){var _=n.getTime()-a;l.$duration=parseFloat((_/1e3).toFixed(3))}ri&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var x=this.persistence.properties(),w=this.sessionPersistence.properties();Ir(["$referrer","$referring_domain"],(j=>{j in x&&delete w[j]})),(l=Lr({},p,x,w,l)).$is_identified=this._isIdentified(),zt(this.config.property_denylist)?Ir(this.config.property_denylist,(function(j){delete l[j]})):$e.error(kz+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var S=this.config.sanitize_properties;S&&($e.error($I),l=S(l,e));var k=this.Vn();return l.$process_person_profile=k,k&&!i&&this.Zn("_calculate_event_properties"),l}zn(e,r,n){var s;if(r===void 0&&(r=!0),n===void 0&&(n=!1),!this.persistence||!this.Vn()||this.yn&&!n)return e;var i=this.persistence.get_initial_props(),a=(s=this.sessionPropsManager)==null?void 0:s.getSetOnceProps(),l=Lr({},i,a||{},e||{}),u=this.config.sanitize_properties;return u&&($e.error($I),l=u(l,"$set_once")),r&&(this.yn=!0),Ml(l)?void 0:l}register(e,r){var n;(n=this.persistence)==null||n.register(e,r)}register_once(e,r,n){var s;(s=this.persistence)==null||s.register_once(e,r,n)}register_for_session(e){var r;(r=this.sessionPersistence)==null||r.register(e),Object.keys(e).forEach((n=>this.bn.add(n))),this.Gn()}unregister(e){var r;(r=this.persistence)==null||r.unregister(e)}unregister_for_session(e){var r;(r=this.sessionPersistence)==null||r.unregister(e),this.bn.delete(e),this.Gn()}Qn(e,r){this.register({[e]:r})}Fn(){this.bn.forEach((e=>{var r;(r=this.sessionPersistence)==null||r.unregister(e)})),this.bn.clear(),this.Gn()}Gn(){var e;if(this._n)if(this.config.persistence==="memory"||(e=this.sessionPersistence)!=null&&e.xi||!sn.N())sn.q(this._n);else{var r=[];this.bn.forEach((n=>r.push(n))),r.length>0?sn.F(this._n,r):sn.q(this._n)}}getFeatureFlag(e,r){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlag(e,r)}getFeatureFlagPayload(e){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagPayload(e)}getFeatureFlagResult(e,r){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagResult(e,r)}getAllFeatureFlags(){var e,r;return(e=(r=this.featureFlags)==null?void 0:r.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,r){var n,s;return(n=(s=this.featureFlags)==null?void 0:s.isFeatureEnabled(e,r))!==null&&n!==void 0?n:r==null?void 0:r.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,r,n){var s;(s=this.featureFlags)==null||s.updateFlags(e,r,n)}updateEarlyAccessFeatureEnrollment(e,r,n){var s;(s=this.featureFlags)==null||s.updateEarlyAccessFeatureEnrollment(e,r,n)}getEarlyAccessFeatures(e,r,n){var s;return r===void 0&&(r=!1),(s=this.featureFlags)==null?void 0:s.getEarlyAccessFeatures(e,r,n)}on(e,r){return this.vn.on(e,r)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:em}),()=>{})}onSessionId(e){var r,n;return(r=(n=this.sessionManager)==null?void 0:n.onSessionId(e))!==null&&r!==void 0?r:()=>{}}getSurveys(e,r){r===void 0&&(r=!1),this.surveys?this.surveys.getSurveys(e,r):e([],{isLoaded:!1,error:em})}getActiveMatchingSurveys(e,r){r===void 0&&(r=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,r):e([],{isLoaded:!1,error:em})}renderSurvey(e,r){var n;(n=this.surveys)==null||n.renderSurvey(e,r)}displaySurvey(e,r){var n;r===void 0&&(r=aQ),(n=this.surveys)==null||n.displaySurvey(e,r)}cancelPendingSurvey(e){var r;(r=this.surveys)==null||r.cancelPendingSurvey(e)}canRenderSurvey(e){var r,n;return(r=(n=this.surveys)==null?void 0:n.canRenderSurvey(e))!==null&&r!==void 0?r:{visible:!1,disabledReason:em}}canRenderSurveyAsync(e,r){var n,s;return r===void 0&&(r=!1),(n=(s=this.surveys)==null?void 0:s.canRenderSurveyAsync(e,r))!==null&&n!==void 0?n:Promise.resolve({visible:!1,disabledReason:em})}Kn(e){return!e||rE(e)?($e.critical("Unique user id has not been set in posthog.identify"),!1):e===Sy?($e.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||($e.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and n
412ot a hardcoded string.'),!1)}identify(e,r,n){if(!this.__loaded||!this.persistence)return $e.uninitializedWarning("posthog.identify");if(bn(e)&&(e=e.toString(),$e.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Kn(e)&&this.Zn("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(eg)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(bm)&&(this.unregister(bm),this.register({distinct_id:e}));var i,a=(this.persistence.get_property(na)||Sh)===Sh,l=e!==s,u=!l&&a;if(l&&a)this.persistence.set_property(na,Mu),this.setPersonPropertiesForFlags({$set:r||{},$set_once:n||{}},!1),this.capture(Yx,{distinct_id:e,$anon_distinct_id:s},{$set:r||{},$set_once:n||{}}),this.Cn=aS(e,r,n),(i=this.featureFlags)==null||i.setAnonymousDistinctId(s);else if(u){this.persistence.set_property(na,Mu);var h=r||{},p=n||{};this.setPersonPropertiesForFlags({$set:h,$set_once:p},!1),this.capture("$set",{$set:h,$set_once:p}),this.Cn=aS(e,r,n)}else(r||n)&&this.setPersonProperties(r,n);l?(this.reloadFeatureFlags(),this.unregister(Tm)):u&&(r||n)&&this.reloadFeatureFlags()}}setPersonProperties(e,r){if((e||r)&&this.Zn("posthog.setPersonProperties")){var n=aS(this.get_distinct_id(),e,r);this.Cn!==n?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:r||{}},!0),this.capture("$set",{$set:e||{},$set_once:r||{}}),this.Cn=n):$e.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var r,n=(zt(e)?e:[e]).filter((s=>pr(s)&&s.length>0));n.length!==0&&this.Zn("posthog.unsetPersonProperties")&&((r=this.featureFlags)==null||r.unsetPersonPropertiesForFlags(n,!0),this.capture("$set",{$unset:n}),this.Cn=null)}group(e,r,n){if(e&&r){var s=this.getGroups(),i=s[e]!==r;if(i&&this.resetGroupPropertiesForFlags(e),this.register({$groups:Ce({},s,{[e]:r})}),i||n){var a={$group_type:e,$group_key:r};n&&(a.$group_set=n),this.capture(uI,a)}n&&this.setGroupPropertiesForFlags({[e]:n}),i&&!n&&this.reloadFeatureFlags()}else $e.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,r){var n;r===void 0&&(r=!0),(n=this.featureFlags)==null||n.setPersonPropertiesForFlags(e,r)}resetPersonPropertiesForFlags(e){var r;e===void 0&&(e=!0),(r=this.featureFlags)==null||r.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,r){var n;r===void 0&&(r=!0),this.Zn("posthog.setGroupPropertiesForFlags")&&((n=this.featureFlags)==null||n.setGroupPropertiesForFlags(e,r))}resetGroupPropertiesForFlags(e){var r;(r=this.featureFlags)==null||r.resetGroupPropertiesForFlags(e)}reset(e){this.Jn(e)}Jn(e,r){var n,s,i,a,l,u,h,p,f,g;if(r===void 0&&(r=!1),$e.info("reset"),!this.__loaded)return $e.uninitializedWarning("posthog.reset");var v,_=this.get_property(eg),x=this.get_property(Gx),w=this.get_property(cd),S=this.is_capturing();if(this.consent.reset(),r||!S||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after."),(n=this.persistence)==null||n.clear(),(s=this.sessionPersistence)==null||s.clear(),this.bn.clear(),this.Gn(),Le(w)||(v=this.persistence)==null||v.register({[cd]:w}),(i=this.surveys)==null||i.reset(),(a=this.Bn)==null||a.stop(),(l=this.featureFlags)==null||l.reset(),(u=this.conversations)==null||u.reset(),(h=this.logs)==null||h.reset(),(p=this.metrics)==null||p.reset(),(f=this.persistence)==null||f.set_property(na,Sh),(g=this.sessionManager)==null||g.resetSessionId(),this.Cn=null,this.config.cookieless_mode===Tl)this.register_once({distinct_id:Sy,$device_id:null},"");else{var k=this.config.get_device_id(Sl());this.register_once({distinct_id:k,$device_id:e?k:_},""),e||Le(x)||this.register({[Gx]:x})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var r=this;return Hr((function*(){var n,s,i,a,l,u,h,p;r.__loaded?((n=r.Bn)==null||n.stop(),(s=r.Nn)==null||s.dispose(),(i=r.sessionRecording)==null||i.dispose(),(a=r.logs)==null||a.flushLogs("sendBeacon"),(l=r.metrics)==null||l.flush("sendBeacon"),(u=r.Pn)==null||u.unload(),(h=r.An)==null||h.unload(),(p=r.featureFlags)==null||p.destroy()):$e.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,r){var n;this.config.identity_distinct_id=e,this.config.identity_hash=r,this.alias(e),(n=this.conversations)==null||n.Yn()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.Xn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,r;return(e=(r=this.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var r=this.sessionManager.checkAndGetSessionAndWindowId(!0),n=r.sessionStartTimestamp,s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+r.sessionId);if(e!=null&&e.withTimestamp&&n){var i,a=(i=e.timestampLookBack)!==null&&i!==void 0?i:10;if(!n)return s;
412s+="?t="+Math.max(Math.floor((new Date().getTime()-n)/1e3)-a,0)}return s}alias(e,r){return e===this.get_property(E$)?($e.critical("Attempting to create alias for existing People user - aborting."),-2):this.Zn("posthog.alias")?(Le(r)&&(r=this.get_distinct_id()),e!==r?(this.Qn(bm,e),this.capture("$create_alias",{alias:e,distinct_id:r})):($e.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var r=Ce({},this.config);if(Fr(e)){var n,s,i,a,l,u,h,p,f,g,v;Lr(this.config,zI(e));var _=this.In();(n=this.persistence)==null||n.update_config(this.config,r,_),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new eS(Ce({},this.config,{persistence:"sessionStorage"}),_,!1);var x=this.Mn(this.config.debug);Wa(x)&&(this.config.debug=x),Wa(this.config.debug)&&(this.config.debug?(Er.DEBUG=!0,Mr.N()&&Mr.F("ph_debug",!0),$e.info("set_config",{config:e,oldConfig:r,newConfig:Ce({},this.config)})):(Er.DEBUG=!1,Mr.N()&&Mr.q("ph_debug"))),(s=this.exceptionObserver)==null||s.onConfigChange(),(i=this.exceptions)==null||i.onConfigChange(),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(l=this.tracingHeaders)==null||l.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(h=this.heatmaps)==null||h.startIfEnabled(),(p=this.exceptionObserver)==null||p.startIfEnabledOrStop(),(f=this.deadClicksAutocapture)==null||f.startIfEnabledOrStop(),(g=this.surveys)==null||g.loadIfEnabled(),this.ts(),(v=this.externalIntegrations)==null||v.startIfEnabledOrStop()}}_overrideSDKInfo(e,r){Er.LIB_NAME=e,Er.LIB_VERSION=r}startSessionRecording(e){var r,n,s,i,a,l=e===!0,u={sampling:l||!(e==null||!e.sampling),linked_flag:l||!(e==null||!e.linked_flag),url_trigger:l||!(e==null||!e.url_trigger),event_trigger:l||!(e==null||!e.event_trigger)};Object.values(u).some(Boolean)&&((r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),u.sampling&&((n=this.sessionRecording)==null||n.overrideSampling()),u.linked_flag&&((s=this.sessionRecording)==null||s.overrideLinkedFlag()),u.url_trigger&&((i=this.sessionRecording)==null||i.overrideTrigger("url")),u.event_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,r){if(this.exceptions){var n=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(Ce({},s,r))}}addExceptionStep(e,r){var n;(n=this.exceptions)==null||n.addExceptionStep(e,r)}captureLog(e){var r;(r=this.logs)==null||r.captureLog(e)}get logger(){var e,r;return(e=(r=this.logs)==null?void 0:r.logger)!==null&&e!==void 0?e:oa.es}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var r,n;return(r=(n=this.toolbar)==null?void 0:n.loadToolbar(e))!==null&&r!==void 0&&r}get_property(e){var r;return(r=this.persistence)==null?void 0:r.props[e]}getSessionProperty(e){var r;return(r=this.sessionPersistence)==null?void 0:r.props[e]}toString(){var e,r=(e=this.config.name)!==null&&e!==void 0?e:Wh;return r!==Wh&&(r=Wh+"."+r),r}_isIdentified(){var e,r;return((e=this.persistence)==null?void 0:e.get_property(na))===Mu||((r=this.sessionPersistence)==null?void 0:r.get_property(na))===Mu}Vn(){var e,r;return!(this.config.person_profiles==="never"||this.config.person_profiles===EE&&!this._isIdentified()&&Ml(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[bm])&&((r=this.persistence)==null||(r=r.props)==null||!r[tb]))}Hn(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Vn()||this.Zn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Zn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Zn(e){return this.config.person_profiles==="never"?($e.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Qn(tb,!0),!0)}In(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Qu)}ts(){var e,r,n,s,i=this.In();return((e=this.persistence)==null?void 0:e.xi)!==i&&((n=this.persistence)==null||n.set_disabled(i)),((r=this.sessionPersistence)==null?void 0:r.xi)!==i&&((s=this.sessionPersistence)==null||s.set_disabled(i)),i&&(this.bn.clear(),this.Gn()),i}opt_in_capturing(e){var r;if(this.config.cookieless_mode!==Tl){if(this.mn()){var n,s,i,a,l;this.Jn(!0,!0),(n=this.sessionManager)==null||n.destroy(),(s=this.pageViewM
412anager)==null||s.destroy(),this.sessionManager=new OI(this),this.pageViewManager=new EI(this),this.persistence&&(this.sessionPropsManager=new DI(this,this.sessionManager,this.persistence));var u,h=(i=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&i!==void 0?i:(l=oa.__defaultExtensionClasses)==null?void 0:l.sessionRecording;h&&(this.sessionRecording=this.gn(this.sessionRecording,new h(this)),this.dn&&((u=this.sessionRecording)==null||u.onRemoteConfig==null||u.onRemoteConfig(this.dn)))}var p,f;this.consent.optInOut(!0),this.ts(),this.qn(),(r=this.sessionRecording)==null||r.startIfEnabledOrStop(),this.config.cookieless_mode==Qu&&((p=this.surveys)==null||p.loadIfEnabled()),(Le(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((f=e==null?void 0:e.captureEventName)!==null&&f!==void 0?f:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.jn()}else $e.warn(FI)}opt_out_capturing(){var e,r,n;this.config.cookieless_mode!==Tl?(this.config.cookieless_mode===Qu&&this.consent.isOptedIn()&&this.Jn(!0,!0),this.consent.optInOut(!1),this.ts(),this.config.cookieless_mode===Qu&&(this.register({distinct_id:Sy,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(r=this.sessionManager)==null||r.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.jn(),this.qn())):$e.warn(FI)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Tl||(this.config.cookieless_mode===Qu?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.ts()}_is_bot(){return Os?vz(Os,this.config.custom_blocked_useragents):void 0}jn(){Ue&&(Ue.visibilityState==="visible"?this.kn||(this.kn=!0,this.capture(qh,{title:Ue.title},{send_instantly:!0}),this.xn&&(Ue.removeEventListener(rb,this.xn),this.xn=null)):this.xn||(this.xn=this.jn.bind(this),Jr(Ue,rb,this.xn)))}debug(e){e===!1?(me==null||me.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(me==null||me.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Ki(){var e=this.Tn||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?($e.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(r,n,s,i,a){var l=n in r&&!Wt(r[n]),u=s in r&&!Wt(r[s]);return l?r[n]:!!u&&(a&&a.warn("Config field '"+s+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),r[s])})(e,"advanced_disable_flags","advanced_disable_decide",0,$e)}Pt(e){var r;if(Wt(this.config.before_send))return e;var n=Object.keys((r=e.properties)!==null&&r!==void 0?r:{}).filter(kZ),s=zt(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var a of s){if(i=a(i),Wt(i)){var l="Event '"+e.event+"' was rejected in beforeSend function";return SZ(e.event)?$e.warn(l+". This can cause unexpected behavior."):$e.info(l),null}i.properties&&!Ml(i.properties)||$e.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var u of n)if(i.properties&&Wt(i.properties[u]))return $e.warn("Event '"+e.event+"' had its '"+u+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return i}getPageViewId(){var e;return(e=this.pageViewManager.ui)==null?void 0:e.pageViewId}captureTraceFeedback(e,r){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:r})}captureTraceMetric(e,r,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:r,$ai_metric_value:String(n)})}Mn(e){var r=Wa(e)&&!e,n=Mr.N()&&Mr.P("ph_debug")==="true";return!r&&(!!n||e)}}oa.__defaultExtensionClasses={},oa.es=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),(function(t,e){for(var r=0;e.length>r;r++)t.prototype[e[r]]=hJ(t.prototype[e[r]])})(oa,["identify"]);class UI{constructor(e){this.disabled=e===!1;var r=Fr(e)?e:{};this.thresholdPx=r.threshold_px||30,this.timeoutMs=r.timeout_ms||1e3,this.clickCount=r.click_count||3,this.clicks=[]}isRageClick(e,r,n){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(r-s.y)<this.thresholdPx&&this.timeoutMs>n-s.timestamp){if(this.clicks.push({x:e,y:r,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:r,timestamp:n}];return!1}}var cS="$copy_autocapture",uS=en("[AutoCapture]");function dS(t,e){return e.length>t?e.slice(0,t)+"...":e}function gQ(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!ru(e));return e}function vQ(t,e){var r,n,s=e.e,i=e.maskAllElementAttributes,a=e.maskAllText,l=e.elementAttributeIgnoreList,u=e.elementsC
412hainAsString,h=e.disableCaptureUrlHashes;if(!ru(t))return{props:{}};for(var p=[t],f=new Set([t]),g=t;g.parentNode&&!Ai(g,"body")&&U$>p.length;)if(z$(g.parentNode)){var v=g.parentNode.host;if(f.has(v))break;f.add(v),p.push(v),g=v}else{if(!ru(g.parentNode)||f.has(g.parentNode))break;f.add(g.parentNode),p.push(g.parentNode),g=g.parentNode}var _,x,w=[],S={},k=!1,j=!1;if(Ir(p,(P=>{var T=NE(P);if(Ai(P,"a")){var O=P.getAttribute("href");k=!!(T&&O&&Im(O))&&(h?tu(O):O)}Lt(ib(P),"ph-no-capture")&&(j=!0),w.push((function(M,U,V,H,Y){Y===void 0&&(Y=!1);var B=M.tagName.toLowerCase(),z={tag_name:B};WC.indexOf(B)>-1&&!V&&(z.$el_text=B.toLowerCase()==="a"||B.toLowerCase()==="button"?dS(1024,xI(M)):dS(1024,rg(M)));var ee=ib(M);ee.length>0&&(z.classes=ee.filter((function(te){return te!==""}))),Ir(M.attributes,(function(te){var ue;if((!W$(M)||["name","id","class","aria-label"].indexOf(te.name)!==-1)&&(H==null||!H.includes(te.name))&&!U&&Im(te.value)&&(!pr(ue=te.name)||ue.substring(0,10)!=="_ngcontent"&&ue.substring(0,7)!=="_nghost")){var re=te.value;te.name==="class"&&(re=qC(re).join(" ")),z["attr__"+te.name]=dS(1024,te.name==="href"&&Y?tu(re):re)}}));for(var L=1,$=1,F=M;F=gQ(F);)L++,F.tagName===M.tagName&&$++;return z.nth_child=L,z.nth_of_type=$,z})(P,i,a,l,h));var G=(function(M){if(!NE(M))return{};var U={};return Ir(M.attributes,(function(V){if(V.name&&V.name.indexOf("data-ph-capture-attribute")===0){var H=V.name.replace("data-ph-capture-attribute-",""),Y=V.value;H&&Y&&Im(Y)&&(U[H]=Y)}})),U})(P);Lr(S,G)})),j)return{props:{},explicitNoCapture:j};if(a||(w[0].$el_text=Ai(t,"a")||Ai(t,"button")?xI(t):rg(t)),k){var C,R;w[0].attr__href=k;var A=(C=ab(k))==null?void 0:C.host,I=me==null||(R=me.location)==null?void 0:R.host;A&&I&&A!==I&&(_=k)}return{props:Lr({$event_type:s.type,$ce_version:1},u?{}:{$elements:w},{$elements_chain:(x=w,(function(P){return P.map((T=>{var O,G,M="";if(T.tag_name&&(M+=T.tag_name),T.attr_class)for(var U of(T.attr_class.sort(),T.attr_class))M+="."+U.replace(/"/g,"");var V=Ce({},T.text?{text:T.text}:{},{"nth-child":(O=T.nth_child)!==null&&O!==void 0?O:0,"nth-of-type":(G=T.nth_of_type)!==null&&G!==void 0?G:0},T.href?{href:T.href}:{},T.attr_id?{attr_id:T.attr_id}:{},T.attributes),H={};return h_(V).sort(((Y,B)=>Y[0].localeCompare(B[0]))).forEach((Y=>{var B=Y[1];return H[SI(Y[0].toString())]=SI(B.toString())})),(M+=":")+h_(H).map((Y=>Y[0]+'="'+Y[1]+'"')).join("")})).join(";")})((function(P){return P.map((T=>{var O,G,M={text:(O=T.$el_text)==null?void 0:O.slice(0,400),tag_name:T.tag_name,href:(G=T.attr__href)==null?void 0:G.slice(0,2048),attr_class:AJ(T),attr_id:T.attr__id,nth_child:T.nth_child,nth_of_type:T.nth_of_type,attributes:{}};return h_(T).filter((U=>U[0].indexOf("attr__")===0)).forEach((U=>M.attributes[U[0]]=U[1])),M}))})(x)))},(r=w[0])!=null&&r.$el_text?{$el_text:(n=w[0])==null?void 0:n.$el_text}:{},_&&s.type==="click"?{$external_click_url:_}:{},S)}}var tm=en("[ExceptionAutocapture]"),BI=()=>{},yQ=en("[TracingHeaders]"),$u=en("[Web Vitals]"),VI=9e5,HI="disabled",qI="lazy_loading",rm="awaiting_config",Ry="missing_config";en("[SessionRecording]"),en("[SessionRecording]");var ME="[SessionRecording]",cl=en(ME),_Q=en("[Heatmaps]");function hS(t){return Fr(t)&&"clientX"in t&&"clientY"in t&&bn(t.clientX)&&bn(t.clientY)}var Ay=en("[Product Tours]"),fS=t=>{var e;return!t.config.disable_product_tours&&!((e=t.persistence)==null||!e.get_property(UC))},bQ=["$set_once","$set"],go=en("[SiteApps]"),WI="Error while initializing PostHog app with config id ";function jh(t,e,r){if(Wt(t))return!1;switch(r){case"exact":return t===e;case"contains":var n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(n,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}class wQ{constructor(e){this.rs=new ZC,this.ns=(r,n)=>this.ss(r,n)&&this.os(r,n)&&this.ls(r,n)&&this.us(r,n),this.ss=(r,n)=>n==null||!n.event||(r==null?void 0:r.event)===(n==null?void 0:n.event),this._instance=e,this.hs=new Set,this.ds=new Set}init(){var e,r;Le((e=this._instance)==null?void 0:e._addCaptureHook)||(r=this._instance)==null||r._addCaptureHook(((n,s)=>{this.on(n,s)}))}register(e){var r,n;if(!Le((r=this._instance)==null?void 0:r._addCaptureHook)&&(e.forEach((a=>{var l,u;(l=this.ds)==null||l.add(a),(u=a.steps)==null||u.forEach((h=>{var p;(p=this.hs)==null||p.add((h==null?void 0:h.event)||"")}))})),(n=this._instance)!=null&&n.autocapture)){var s,i=new Set;e.forEach((a=>{var l;
412(l=a.steps)==null||l.forEach((u=>{u!=null&&u.selector&&i.add(u==null?void 0:u.selector)}))})),(s=this._instance)==null||s.autocapture.setElementSelectors(i)}}on(e,r){var n;r!=null&&e.length!=0&&(this.hs.has(e)||this.hs.has(r.event))&&this.ds&&((n=this.ds)==null?void 0:n.size)>0&&this.ds.forEach((s=>{this.vs(r,s)&&this.rs.emit("actionCaptured",s.name)}))}cs(e){this.onAction("actionCaptured",(r=>e(r)))}vs(e,r){if((r==null?void 0:r.steps)==null)return!1;for(var n of r.steps)if(this.ns(e,n))return!0;return!1}onAction(e,r){return this.rs.on(e,r)}os(e,r){if(r!=null&&r.url){var n,s=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!s||typeof s!="string"||!jh(s,r.url,r.url_matching||"contains"))return!1}return!0}ls(e,r){return!!this.fs(e,r)&&!!this.ps(e,r)&&!!this.gs(e,r)}fs(e,r){var n;if(r==null||!r.href)return!0;var s=this.ys(e);if(s.length>0)return s.some((l=>jh(l.href,r.href,r.href_matching||"exact")));var i,a=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!a&&jh((i=a.match(/(?::|")href="(.*?)"/))?i[1]:"",r.href,r.href_matching||"exact")}ps(e,r){var n;if(r==null||!r.text)return!0;var s=this.ys(e);if(s.length>0)return s.some((h=>jh(h.text,r.text,r.text_matching||"exact")||jh(h.$el_text,r.text,r.text_matching||"exact")));var i,a,l,u=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!u&&(i=(function(h){for(var p,f=[],g=/(?::|")text="(.*?)"/g;!Wt(p=g.exec(h));)f.includes(p[1])||f.push(p[1]);return f})(u),a=r.text,l=r.text_matching||"exact",i.some((h=>jh(h,a,l))))}gs(e,r){var n,s;if(r==null||!r.selector)return!0;var i=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(i!=null&&i.includes(r.selector))return!0;var a=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";if(r.selector_regex&&a)try{return new RegExp(r.selector_regex).test(a)}catch{return!1}return!1}ys(e){var r;return(e==null||(r=e.properties)==null?void 0:r.$elements)==null?[]:e==null?void 0:e.properties.$elements}us(e,r){return r==null||!r.properties||r.properties.length===0||bz(r.properties.reduce(((n,s)=>{var i=zt(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return n[s.key]={values:i,operator:s.operator||"exact"},n}),{}),e==null?void 0:e.properties)}}class xQ{constructor(e){var r;this.bs=[],this._instance=e,this._s=new Map,this.ws=new Map,this.ks=new Map,(r=this._instance)==null||r.onSessionId==null||r.onSessionId((n=>this.xs(n)))}Ss(e){return!1}Cs(){return null}Ms(e){}Ts(){}Es(e,r){return!!e&&bz(e.propertyFilters,r==null?void 0:r.properties)}Is(e,r){var n=new Map;return e.forEach((s=>{var i;(i=s.conditions)==null||(i=i[r])==null||(i=i.values)==null||i.forEach((a=>{if(a!=null&&a.name){var l=n.get(a.name)||[];l.push(s.id),n.set(a.name,l)}}))})),n}Ps(e,r,n){var s=(n===Zp.Activation?this._s:this.ws).get(e),i=[];return this.Rs((a=>{i=a.filter((l=>s==null?void 0:s.includes(l.id)))})),i.filter((a=>{var l,u=(l=a.conditions)==null||(l=l[n])==null||(l=l.values)==null?void 0:l.find((h=>h.name===e));return this.Es(u,r)}))}register(e){var r;Le((r=this._instance)==null?void 0:r._addCaptureHook)||(this.As(e),this.Fs(e))}Fs(e){var r=e.filter((n=>{var s,i;return((s=n.conditions)==null?void 0:s.actions)&&((i=n.conditions)==null||(i=i.actions)==null||(i=i.values)==null?void 0:i.length)>0}));r.length!==0&&(this.Ls==null&&(this.Ls=new wQ(this._instance),this.Ls.init(),this.Ls.cs((n=>{this.onAction(n)}))),r.forEach((n=>{var s,i,a,l,u;n.conditions&&(s=n.conditions)!=null&&s.actions&&(i=n.conditions)!=null&&(i=i.actions)!=null&&i.values&&((a=n.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0&&((l=this.Ls)==null||l.register(n.conditions.actions.values),(u=n.conditions)==null||(u=u.actions)==null||(u=u.values)==null||u.forEach((h=>{if(h&&h.name){var p=this.ks.get(h.name);p&&p.push(n.id),this.ks.set(h.name,p||[n.id])}})))})))}
412As(e){var r,n=e.filter((i=>{var a,l;return((a=i.conditions)==null?void 0:a.events)&&((l=i.conditions)==null||(l=l.events)==null||(l=l.values)==null?void 0:l.length)>0})),s=e.filter((i=>{var a,l;return((a=i.conditions)==null?void 0:a.cancelEvents)&&((l=i.conditions)==null||(l=l.cancelEvents)==null||(l=l.values)==null?void 0:l.length)>0}));n.length===0&&s.length===0||((r=this._instance)==null||r._addCaptureHook(((i,a)=>{this.onEvent(i,a)})),this._s=this.Is(e,Zp.Activation),this.ws=this.Is(e,Zp.Cancellation))}onEvent(e,r){var n,s,i=this.Os(),a=(r==null||(n=r.properties)==null?void 0:n.$survey_id)||(r==null||(s=r.properties)==null?void 0:s.$product_tour_id);if(a&&this.getActivatedIds().includes(a)){var l=this.Ds(e,a);if(l==="consume")return i.info("event consumed activated item, removing it",{event:e,itemId:a}),void this.$s([a]);if(l==="persist")return i.info("shown item promoted to persisted activation",{event:e,itemId:a}),this.Ns(a),void this.qs([a])}if(this.ws.has(e)){var u=this.Ps(e,r,Zp.Cancellation);u.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:u.map((p=>p.id))}),this.$s(u.map((p=>p.id))),u.forEach((p=>this.js(p.id))))}if(this._s.has(e)){i.info("event name matched",{event:e,eventPayload:r,items:this._s.get(e)});var h=this.Ps(e,r,Zp.Activation);this.Bs(h.map((p=>p.id)))}}onAction(e){this.ks.has(e)&&this.Bs(this.ks.get(e)||[])}Bs(e){var r;if(e.length!==0){var n=!((r=this._instance)==null||r.get_session_id==null||!r.get_session_id()),s=[];for(var i of e)n&&this.Ss(i)?this.Ns(i)&&this.Hs(i):s.push(i);s.length>0&&(this.bs=[...new Set([...this.bs,...s])]),this.Os().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Ns(e){this.bs=this.bs.filter((n=>n!==e));var r=this.Us();return!r.includes(e)&&(this.zs([...r,e]),this.Ws(),!0)}$s(e){var r=new Set(e);this.bs=this.bs.filter((i=>!r.has(i)));var n=this.Vs(),s=n.filter((i=>!r.has(i)));s.length!==n.length&&(this.zs(s),s.length===0&&this.Zs()),this.qs(e)}Gs(){var e,r=this.Cs();if(!r)return{};var n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[r];return n&&typeof n=="object"?n:{}}Hs(e){if(this.Cs()){var r=this.Gs();this.Ms(Ce({},r,{[e]:Date.now()}))}}qs(e){if(this.Cs()){var r=this.Gs(),n={},s=!1;for(var i of Object.entries(r)){var a=i[0],l=i[1];e.includes(a)?s=!0:n[a]=l}s&&(Ml(n)?this.Ts():this.Ms(n))}}Qs(){this.Cs()&&this.Ts()}getActivationTimestamp(e){if(this.Us().includes(e)){var r=this.Gs()[e];return bn(r)?r:void 0}}Vs(){var e,r=this.Ks();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[r])||[]}Us(){var e,r,n=this.Vs();if(n.length===0)return[];var s=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this.Js()],i=(r=this._instance)==null||r.get_session_id==null?void 0:r.get_session_id();return i&&s===i?n:[]}Ws(){var e,r=(e=this._instance)==null||e.get_session_id==null?void 0:e.get_session_id();r&&this.Ys(r)}Zs(){this.Xs()}xs(e){var r,n=(r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[this.Js()];if(n&&n!==e){var s=this.Vs(),i=this.Gs();s.length>0&&(this.zs([]),s.filter((a=>bn(i[a]))).forEach((a=>this.js(a)))),this.Zs(),this.Qs()}}getActivatedIds(){return[...new Set([...this.Us(),...this.bs])].filter((e=>!this.ta(e)))}reset(){this.bs=[],this.Vs().length>0&&this.zs([]),this.Zs(),this.Qs()}getEventToItemsMap(){return this._s}ea(){return this.Ls}}class SQ extends xQ{constructor(e){super(e)}Ks(){return yE}Js(){return u_}Cs(){return d_}Ms(e){var r;(r=this._instance)==null||(r=r.persistence)==null||r.register({[d_]:e})}Ts(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(d_)}Ss(e){var r,n;this.Rs((i=>{n=i.find((a=>a.id===e))}));var s=(r=n)==null||(r=r.appearance)==null?void 0:r.surveyPopupDelaySeconds;return bn(s)&&s>0}ia(){return Dl.SHOWN}Rs(e){var r;(r=this._instance)==null||r.getSurveys(e)}js(e){var r;(r=this._instance)==null||r.cancelPendingSurvey(e)}Os(){return kr}zs(e){var r;(r=this._instance)==null||(r=r.persistence)==null||r.register({[yE]:e})}Ys(e){var r;(r=this._instance)==null||(r=r.persistence)==null||r.register({[u_]:e})}Xs(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(u_)}ta(){return!1}Ds(e,r){var n;this.Rs((i=>{n=i.find((a=>a.id===r))}));var s=!n||(function(i){var a;return wz(i)&&!((a=i.conditions)==null||(a=a.events)==null||!a.repeatedActivation)||i.schedule==="always"})(n);return s?e===Dl.SHOWN?"consume":"ignore":e===Dl.SHOWN?"persist":e===Dl.DISMISSED||e===Dl.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}
412getEventToSurveys(){return this.getEventToItemsMap()}}var Ty="SDK is not enabled or survey functionality is not yet loaded",GI="Disabled. Not loading surveys.",kQ=me!=null&&me.location?ob(me.location.hash,"__posthog")||ob(location.hash,"state"):null,KI="_postHogToolbarParams",YI=en("[Toolbar]"),In=en("[FeatureFlags]"),zu=en("[FeatureFlags]",{debugEnabled:!0}),pS=`" failed. Feature flags didn't load in time.`,ZI=t=>{for(var e={},r=0;t.length>r;r++)e[t[r]]=!0;return e},JI=t=>{var e={};for(var r of h_(t||{})){var n=r[1];n&&(e[r[0]]=n)}return e},vo=en("[Error tracking]"),QI="Refusing to render web experiment since the viewer is a likely bot",EQ={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>ub(e,t),not_regex:(t,e)=>!ub(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class ms{get Ne(){return this._instance.config}constructor(e){var r=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),r.getWebExperiments((s=>{ms.ra("retrieved web experiments from the server"),r.na=new Map,s.forEac
412h((i=>{if(i.feature_flag_key){var a;r.na&&(ms.ra("setting flag key ",i.feature_flag_key," to web experiment ",i),(a=r.na)==null||a.set(i.feature_flag_key,i));var l=r._instance.getFeatureFlag(i.feature_flag_key);pr(l)&&i.variants[l]&&r.sa(i.name,l,i.variants[l].transforms)}else if(i.variants)for(var u in i.variants){var h=i.variants[u];ms.aa(h,r._instance)&&r.sa(i.name,u,h.transforms)}}))}),n)},this._instance=e,this._instance.onFeatureFlags((n=>{this.onFeatureFlags(n)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())ms.ra(QI);else if(!this.Ne.disable_web_experiments){if(Wt(this.na))return this.na=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ms.ra("applying feature flags",e),e.forEach((r=>{var n;if(this.na&&(n=this.na)!=null&&n.has(r)){var s,i=this._instance.getFeatureFlag(r),a=(s=this.na)==null?void 0:s.get(r);i&&a!=null&&a.variants[i]&&this.sa(a.name,i,a.variants[i].transforms)}}))}}previewWebExperiment(){var e=ms.getWindowLocation();if(e!=null&&e.search){var r=Of(e==null?void 0:e.search,"__experiment_id"),n=Of(e==null?void 0:e.search,"__experiment_variant");r&&n&&(ms.ra("previewing web experiments "+r+" && "+n),this.getWebExperiments((s=>{this.oa(parseInt(r),n,s)}),!1,!0))}}loadIfEnabled(){this.Ne.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,r,n){if(this.Ne.disable_web_experiments&&!n)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!r)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Ne.token),method:"GET",timestampMode:"query",callback:i=>e(i.statusCode===200&&i.json&&i.json.experiments||[])})}oa(e,r,n){var s=n.filter((i=>i.id===e));s&&s.length>0&&(ms.ra("Previewing web experiment ["+s[0].name+"] with variant ["+r+"]"),this.sa(s[0].name,r,s[0].variants[r].transforms))}static aa(e,r){return!Wt(e.conditions)&&ms.la(e,r)&&ms.ua(e)}static la(e,r){var n;if(Wt(e.conditions)||Wt((n=e.conditions)==null?void 0:n.url))return!0;var s=ms.getWindowLocation();if(s){var i,a,l,u=L$(r,s.href);return(i=e.conditions)==null||!i.url||EQ[(a=(l=e.conditions)==null?void 0:l.urlMatchType)!==null&&a!==void 0?a:"icontains"](e.conditions.url,u)}return!1}
412static getWindowLocation(){return me==null?void 0:me.location}static ua(e){var r;if(Wt(e.conditions)||Wt((r=e.conditions)==null?void 0:r.utm))return!0;var n=Q$();if(n.utm_source){var s,i,a,l,u,h,p,f,g=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((i=e.conditions)==null||(i=i.utm)==null?void 0:i.utm_campaign)==n.utm_campaign,v=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_source)==n.utm_source,_=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_medium||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_medium)==n.utm_medium,x=(p=e.conditions)==null||(p=p.utm)==null||!p.utm_term||((f=e.conditions)==null||(f=f.utm)==null?void 0:f.utm_term)==n.utm_term;return g&&_&&x&&v}return!1}static ra(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;r>s;s++)n[s-1]=arguments[s];$e.info("[WebExperiments] "+e,n)}sa(e,r,n){this._is_bot()?ms.ra(QI):r!=="control"?n.forEach((s=>{if(s.selector){var i;ms.ra("applying transform of variant "+r+" for experiment "+e+" ",s);var a=(i=document)==null?void 0:i.querySelectorAll(s.selector);a==null||a.forEach((l=>{var u=l;s.html&&(u.innerHTML=s.html),s.css&&u.setAttribute("style",s.css)}))}})):ms.ra("Control variants leave the page unmodified.")}_is_bot(){return Os&&this._instance?vz(Os,this.Ne.custom_blocked_useragents):void 0}}var Xi=en("[Conversations]"),Uu="Conversations not available yet.",XI="console",jz="__posthogHandledLogsRequestError",mS=(t,e)=>{var r=t instanceof Error?t:new Error(e);return r[jz]=!0,r},eD=t=>!!t&&typeof t=="object"&&t[jz]===!0,iw={featureFlags:class{constructor(t){this.ha=!1,this.da=!1,this.va=!1,this.ca=!1,this.fa=!1,this.pa=!1,this.ga=!1,this.ma=!1,this.ya=0,this.ba=()=>{var e=this._a();this.ya=0,e&&this.reloadFeatureFlags()},this._instance=t,this.featureFlagEventHandlers=[],me&&Jr(me,"online",this.ba)}destroy(){me==null||me.removeEventListener("online",this.ba)}get Ne(){return this._instance.config}get Tr(){return this._instance.persistence}wa(t){return this._instance.get_property(t)}ka(){var t,e;return(t=(e=this.Tr)==null?void 0:e.Ci(this.Ne.feature_flag_cache_ttl_ms))!==null&&t!==void 0&&t}xa(){return!!this.ka()&&(this.ma||this.va||(this.ma=!0,In.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Sa(){var t,e=(t=this.Ne.evaluation_contexts)!==null&&t!==void 0?t:this.Ne.evaluation_environments;return!this.Ne.evaluation_environments||this.Ne.evaluation_contexts||this.ga||(In.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ga=!0),e!=null&&e.length?e.filter((r=>{var n=r&&typeof r=="string"&&r.trim().length>0;return n||In.error("Invalid evaluation context found:",r,"Expected non-empty string"),n})):[]}Ca(){return this.Sa().length>0}Ma(){var t=this.Ne.flag_keys;if(!Le(t)){if(zt(t))return t.filter((e=>{var r=e&&typeof e=="string"&&e.trim().length>0;return r||In.error("Invalid flag key found:",e,"Expected non-empty string"),r}));In.error("Invalid flag_keys found:",t,"Expected array of non-empty strings")}}initialize(){var t,e,r=this._instance.config,n=(t=(e=r.bootstrap)==null?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(n).length){var s,i,a=(s=(i=r.bootstrap)==null?void 0:i.featureFlagPayloads)!==null&&s!==void 0?s:{},l=Object.keys(n).filter((h=>!!n[h])).reduce(((h,p)=>(h[p]=n[p]||!1,h)),{}),u=Object.keys(a).filter((h=>l[h])).reduce(((h,p)=>(a[p]&&(h[p]=a[p]),h)),{});this.receivedFeatureFlags({featureFlags:l,featureFlagPayloads:u})}}updateFlags(t,e,r){var n,s,i=r!=null&&r.merge&&(n=this.wa(nd))!==null&&n!==void 0?n:{},a=r!=null&&r.merge&&(s=this.wa(c_))!==null&&s!==void 0?s:{},l=Ce({},i,t),u=Ce({},a,e),h={};for(var p of Object.entries(l)){var f=p[0],g=p[1];h[f]={key:f,enabled:YT(g),variant:ZT(g),reason:void 0,metadata:Le(u==null?void 0:u[f])?void 0:{id:0,version:void 0,description:void 0,payload:u[f]}}}this.receivedFeatureFlags({flags:h})}get hasLoadedFlags(){return this.da}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.wa(mE),e=this.wa(pl),r=this.wa(Hh);if(!r&&!e)return t||{};var n=Lr({},t||{}),s=[...new Set([...Object.keys(r||{}),...Object.keys(e||{})])];for(var i of s){var a,l,u=n[i],h=e==null?void 0:e[i],p=Le(h)?(a=u==null?void 0:u.enabled)!==null&&a!==void 0&&a:!!h,f=Le(h)?u.variant:typeof h=="string"?h:void 0,g=r==null?void 0:r[i],v=Ce({},u,{enabled:p,variant:p?f??(u==null?void 0:u.variant):void 0});p!==(u==null?void 0:u.enabled)&&(v.original_enabled=u==null?void 0:u.enabled),f!==(u==null?void 0:u.variant)&&(v.original_variant=u==null?void 0:u.variant),g&&(v.metadata=Ce({},u==null?void 0:u.metadata,{payload:g,original_payload:u==null||(l=u.metadata)==null?void 0:l.payload})),n[i]=v}return this.ha||(In.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:n}),this.ha=!0),n}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((r=>{var n=t[r];return{key:r,enabled:YT(n),variant:ZT(n),payload:KT(e[r])}}))}getFlagVariants(){var t=this.wa(nd),e=this.wa(pl);
412if(!e)return t||{};for(var r=Lr({},t),n=Object.keys(e),s=0;n.length>s;s++)r[n[s]]=e[n[s]];return this.ha||(In.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:r}),this.ha=!0),r}getFlagPayloads(){var t=this.wa(c_),e=this.wa(Hh);if(!e)return t||{};for(var r=Lr({},t||{}),n=Object.keys(e),s=0;n.length>s;s++)r[n[s]]=e[n[s]];return this.ha||(In.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:r}),this.ha=!0),r}reloadFeatureFlags(){this.ca||this.Ne.advanced_disable_feature_flags||this._a()||this.Ta||(this._instance.vn.emit("featureFlagsReloading",!0),this.Ta=setTimeout((()=>{this.Ea()}),5))}Ia(){clearTimeout(this.Ta),this.Ta=void 0}ensureFlagsLoaded(){this.da||this.va||this.Ta||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.ca=t}Ea(t){var e;if(this.Ia(),!this._instance.Ki()&&!this._a())if(this.va)this.fa=!0;else{var r=this.Ne.token,n=this.wa(eg),s={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:Ce({},((e=this.Tr)==null?void 0:e.get_initial_props())||{},this.wa(Zu)||{},{$lib:Er.LIB_NAME,$lib_version:Er.LIB_VERSION}),group_properties:this.wa(Ju),timezone:sz()};Fs(n)||Le(n)||(s.$device_id=n),(t!=null&&t.disableFlags||this.Ne.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.Ca()&&(s.evaluation_contexts=this.Sa());var i=this.Ma();Le(i)||(s.flag_keys=i);var a=!!this.Ne.advanced_only_evaluate_survey_feature_flags,l=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Ne.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.va=!0,this._instance._send_request({method:"POST",url:l,data:s,compression:this.Ne.disable_compression?void 0:Ts.Base64,timestampMode:"body",timeout:this.Ne.feature_flag_request_timeout_ms,callback:u=>{var h,p,f,g=!0;if(this.Pa(u.statusCode),u.statusCode===200&&(this.fa||(this.$anon_distinct_id=void 0),g=!1),this.va=!1,!s.disable_flags||this.fa){this.pa=!g;var v=[];u.error?u.error instanceof Error?v.push(u.error.name==="AbortError"?"timeout":"connection_error"):v.push("unknown_error"):u.statusCode!==200&&v.push("api_error_"+u.statusCode),(h=u.json)!=null&&h.errorsWhileComputingFlags&&v.push("errors_while_computing_flags");var _,x=!((p=u.json)==null||(p=p.quotaLimited)==null||!p.includes("feature_flags"));x&&v.push("quota_limited"),(f=this.Tr)==null||f.register({[bE]:v}),x?In.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset.  Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(s.disable_flags||this.receivedFeatureFlags((_=u.json)!==null&&_!==void 0?_:{},g,{partialResponse:a}),this.fa&&(this.fa=!1,this.Ea()))}}})}}_a(){return Z$(this.ya,3)}Pa(t){this.ya=J$(t,this.ya,3,(()=>In.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(t,e){var r;if(e===void 0&&(e={}),!e.fresh||this.pa)if(this.da||this.getFlags()&&this.getFlags().length>0){if(!this.xa()){var n=this.getFeatureFlagResult(t,e);return(r=n==null?void 0:n.variant)!==null&&r!==void 0?r:n==null?void 0:n.enabled}}else In.warn('getFeatureFlag for key "'+t+pS)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return e==null?void 0:e.payload}getFeatureFlagResult(t,e){if(e===void 0&&(e={}),!e.fresh||this.pa)if(this.da||this.getFlags()&&this.getFlags().length>0){if(!this.xa()){var r=this.getFlagVariants(),n=t in r,s=r[t],i=this.getFlagPayloads()[t],a=String(s),l=this.wa(gE)||void 0,u=this.wa(tg)||void 0,h=this.wa(Tm)||{};if(this.Ne.advanced_feature_flags_dedup_per_session){var p,f=this._instance.get_session_id(),g=this.wa(_E);f&&f!==g&&(h={},(p=this.Tr)==null||p.register({[Tm]:h,[_E]:f}))}if((e.send_event||!("send_event"in e))&&(!(t in h)||!h[t].includes(a))){var v,_,x,w,S,k,j,C,R,A,I;zt(h[t])?h[t].push(a):h[t]=[a],(v=this.Tr)==null||v.register({[Tm]:h});var P=this.getFeatureFlagDetails(t),T=[...(_=this.wa(bE))!==null&&_!==void 0?_:[]];Le(s)&&T.push("flag_missing");var O={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:i||null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:((x=this.Ne.bootstrap)==null||(x=x.featureFlags)==null?void 0:x[t])||null,$feature_flag_bootstrapped_payload:((w=this.Ne.bootstrap)==null||(w=w.featureFlagPayloads)==null?void 0:w[t])||null,$used_bootstrap_value:!this.pa};Le(P==null||(S=P.metadata)==null?void 0:S.has_experiment)||(O.$feature_flag_has_experiment=P.metadata.has_experiment),Le(P==null||(k=P.metadata)==null?void 0:k.version)||(O.$feature_flag_version=P.metadata.version);var G,M=(j=P==null||(C=P.reason)==null?void 0:C.description)!==null&&j!==void 0?j:P==null||(R=P.reason)==null?void 0:R.code;M&&(O.$feature_flag_reason=M),P!=null&&(A=P.metadata)!=null&&A.id&&(O.$feature_flag_id=P.metadata.id),Le(P==null?void 0:P.original_variant)&&Le(P==null?void 0:P.original_enabled)||(O.$feature_flag_original_response=Le(P.original_variant)?P.original_enabled:P.original_variant),P!=null&&(I=P.metadata)!=null&&I.original_payload&&(O.$feature_flag_original_payload=P==null||(G=P.metadata)==null?void 0:G.original_payload),T.length&&(O.$feature_flag_error=T.join(",")),this._instance.capture("$feature_flag_called",O)}if(n)return{key:t,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:KT(i)}}}else In.warn('getFeatureFlagResult for key "'+t+pS)}getRemoteConfigPayload(t,e){var r=this.Ne.token,n={distinct_id:this._instance.get_distinct_id(),token:r,person_properties:{$lib:Er.LIB_NAME,$lib_version:Er.
412LIB_VERSION}};this.Ca()&&(n.evaluation_contexts=this.Sa());var s=this.Ma();Le(s)||(n.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:n,compression:this.Ne.disable_compression?void 0:Ts.Base64,timestampMode:"body",timeout:this.Ne.feature_flag_request_timeout_ms,callback(i){var a,l=(a=i.json)==null?void 0:a.featureFlagPayloads;e((l==null?void 0:l[t])||void 0)}})}isFeatureEnabled(t,e){if(e===void 0&&(e={}),e.fresh&&!this.pa)return e.defaultValue;if(!(this.da||this.getFlags()&&this.getFlags().length>0))return In.warn('isFeatureEnabled for key "'+t+pS),e.defaultValue;var r=this.getFeatureFlag(t,e);return Le(r)?e.defaultValue:!!r}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,r){if(this.Tr){this.da=!0;var n=this.getFlagVariants(),s=this.getFlagPayloads(),i=this.getFlagsWithDetails();(function(a,l,u,h,p,f){u===void 0&&(u={}),h===void 0&&(h={}),p===void 0&&(p={});var g=(P=>{var T=P.flags;return T?(P.featureFlags=Object.fromEntries(Object.keys(T).map((O=>{var G;return[O,(G=T[O].variant)!==null&&G!==void 0?G:T[O].enabled]}))),P.featureFlagPayloads=Object.fromEntries(Object.keys(T).filter((O=>T[O].enabled)).filter((O=>{var G;return(G=T[O].metadata)==null?void 0:G.payload})).map((O=>{var G;return[O,(G=T[O].metadata)==null?void 0:G.payload]})))):P.featureFlags&&In.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),P})(a),v=g.flags,_=g.featureFlags,x=g.featureFlagPayloads;if(_){var w=a.requestId,S=a.evaluatedAt;if(zt(_)){In.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var k={};if(_)for(var j=0;_.length>j;j++)k[_[j]]=!0;l&&l.register({[l_]:_,[nd]:k,[Q_]:!1})}else{var C=_,R=x,A=v;if(f!=null&&f.partialResponse)C=Ce({},u,C),R=Ce({},h,R),A=Ce({},p,A);else if(a.errorsWhileComputingFlags)if(v){var I=new Set(Object.keys(v).filter((P=>{var T;return!((T=v[P])!=null&&T.failed)})));C=Ce({},u,Object.fromEntries(Object.entries(C).filter((P=>I.has(P[0]))))),R=Ce({},h,Object.fromEntries(Object.entries(R||{}).filter((P=>I.has(P[0]))))),A=Ce({},p,Object.fromEntries(Object.entries(A||{}).filter((P=>I.has(P[0])))))}else C=Ce({},u,C),R=Ce({},h,R),A=Ce({},p,A);l&&l.register(Ce({[l_]:Object.keys(JI(C)),[nd]:C||{},[c_]:R||{},[mE]:A||{},[Q_]:a.minimalFlagCalledEvents===!0},w?{[gE]:w}:{},S?{[tg]:S}:{}))}}})(t,this.Tr,n,s,i,r),e||(this.ma=!1),this.Ra(e)}}override(t,e){e===void 0&&(e=!1),In.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.Tr)return In.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.Tr.unregister(pl),this.Tr.unregister(Hh),this.Ra(),zu.info("All overrides cleared");if(zt(t)){var e=ZI(t);return this.Tr.register({[pl]:e}),this.Ra(),zu.info("Flag overrides set",{flags:t})}if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var r,n=t;if(this.ha=!!((r=n.suppressWarning)!==null&&r!==void 0&&r),"flags"in n){if(n.flags===!1)this.Tr.unregister(pl),zu.info("Flag overrides cleared");else if(n.flags){if(zt(n.flags)){var s=ZI(n.flags);this.Tr.register({[pl]:s})}else this.Tr.register({[pl]:n.flags});zu.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this.Tr.unregister(Hh),zu.info("Payload overrides cleared")):n.payloads&&(this.Tr.register({[Hh]:n.payloads}),zu.info("Payload overrides set",{payloads:n.payloads}))),void this.Ra()}if(t&&typeof t=="object")return this.Tr.register({[pl]:t}),this.Ra(),zu.info("Flag overrides set",{flags:t});In.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.da){var e=this.Aa(),r=e.flags,n=e.flagVariants;try{t(r,n)}catch(s){In.error("Error while running feature flags callback",s)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var n,s=(this.wa(xm)||[]).find((u=>u.flagKey===t)),i={["$feature_enrollment/"+t]:e},a={$feature_flag:t,$feature_enrollment:e,$set:i};s&&(a.$early_access_feature_name=s.name),r&&(a.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(i,!1);var l=Ce({},this.getFlagVariants(),{[t]:e});(n=this.Tr)==null||n.register({[l_]:Object.keys(JI(l)),[nd]:l}),this.Ra()}getEarlyAccessFeatures(t,e,r){e===void 0&&(e=!1);var n=this.wa(xm),s=r?"&"+r.map((i=>"stage="+i)).join("&"):"";if(n&&!e)return t(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Ne.token+s),method:"GET",timestampMode:"query",callback:i=>{var a,l;if(i.json){var u=i.json.earlyAccessFeatures;return(a=this.Tr)==null||a.unregister(xm),(l=this.Tr)==null||l.register({[xm]:u}),t(u)}}})}Aa(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((r=>e[r])),flagVariants:Object.keys(e).filter((r=>e[r])).reduce(((r,n)=>(r[n]=e[n],r)),{})}}Ra(t){var e=this.Aa(),r=e.flags,n=e.flagVariants;
412this.featureFlagEventHandlers.forEach((s=>{try{s(r,n,{errorsLoading:t})}catch(i){In.error("Error while running feature flags callback",i)}}))}setPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var r=this.wa(Zu)||{},n=(t==null?void 0:t.$set)||(t!=null&&t.$set_once?{}:t),s=t==null?void 0:t.$set_once,i={};if(s)for(var a in s)({}).hasOwnProperty.call(s,a)&&(a in r||(i[a]=s[a]));this._instance.register({[Zu]:Ce({},r,i,n)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var r=Ce({},this.wa(Zu)||{});t.forEach((n=>{delete r[n]})),this._instance.register({[Zu]:r}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){t===void 0&&(t=!0),this._instance.unregister(Zu),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){e===void 0&&(e=!0);var r=this.wa(Ju)||{};Object.keys(r).length!==0&&Object.keys(r).forEach((n=>{r[n]=Ce({},r[n],t[n]),delete t[n]})),this._instance.register({[Ju]:Ce({},r,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.wa(Ju)||{};this._instance.register({[Ju]:Ce({},e,{[t]:{}})})}else this._instance.unregister(Ju)}reset(){this.da=!1,this.va=!1,this.ca=!1,this.fa=!1,this.pa=!1,this.$anon_distinct_id=void 0,this.Ia(),this.ha=!1,this.ya=0}}},jQ={sessionRecording:class{get Ne(){return this._instance.config}get Tr(){return this._instance.persistence}get started(){var t;return!((t=this.Fa)==null||!t.isStarted)}get status(){var t,e;return this.La===rm||this.La===Ry?this.La:(t=(e=this.Fa)==null?void 0:e.status)!==null&&t!==void 0?t:this.La}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.La=HI,this.Oa=void 0,this.Da=!1,this.$a=(()=>{var e;if(Ue==null||!Ue.visibilityState||Ue.visibilityState==="visible")return!0;var r=me==null||(e=me.performance)==null||e.getEntriesByType==null?void 0:e.getEntriesByType("visibility-state");return!(r!=null&&r.length)||r.some((n=>n.name==="visible"))})(),this.Ie=()=>{var e;(Ue==null?void 0:Ue.visibilityState)==="visible"&&(this.$a=!0,(e=this.Fa)==null||e.setDocumentWasEverVisible==null||e.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw cl.error("started without valid sessionManager"),new Error(ME+" started without valid sessionManager. This is a bug.");if(this.Ne.cookieless_mode===Tl)throw new Error(ME+' cannot be used with cookieless_mode="always"');Ue!=null&&Ue.addEventListener&&Jr(Ue,"visibilitychange",this.Ie)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Da=!0,Ue==null||Ue.removeEventListener==null||Ue.removeEventListener("visibilitychange",this.Ie),this.stopRecording()}get Na(){var t,e=!((t=this._instance.get_property(cd))==null||!t.enabled),r=!this.Ne.disable_session_recording,n=this.Ne.disable_session_recording||this._instance.consent.isOptedOut();return me&&e&&r&&!n}startIfEnabledOrStop(t){var e;if(!(this.Da||this.Na&&(e=this.Fa)!=null&&e.isStarted)){var r=!Le(Object.assign)&&!Le(Array.from);this.Na&&r?(this.qa(t),cl.info("starting")):(this.La=HI,this.stopRecording())}}qa(t){var e,r,n;this.Na&&(this.La!==rm&&this.La!==Ry&&(this.La=qI),yt!=null&&(e=yt.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(r=yt.__PosthogExtensions__)!=null&&r.initSessionRecording?this.ja(t):(n=yt.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.Ba,(s=>{if(s)return cl.error("could not load recorder",s);this.ja(t)})))}stopRecording(){var t,e;(t=this.Oa)==null||t.call(this),this.Oa=void 0,(e=this.Fa)==null||e.stop()}Ha(){var t,e;(t=this.Oa)==null||t.call(this),this.Oa=void 0,(e=this.Fa)==null||e.discard()}Ua(){var t,e;(t=this.Tr)==null||t.unregister(BC),(e=this.Tr)==null||e.unregister(j$)}za(t,e){if(Wt(t))return null;var r,n=bn(t)?t:parseFloat(t);return typeof(r=n)!="number"||!Number.isFinite(r)||0>r||r>1?(cl.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):n}Wa(t){if(this.Tr){var e,r,n=this.Tr,s=()=>{var i,a=t.sessionRecording===!1?void 0:t.sessionRecording,l=this.za((i=this.Ne.session_recording)==null?void 0:i.sampleRate,"session_recording.sampleRate"),u=this.za(a==null?void 0:a.sampleRate,"remote config sampleRate"),h=l??u;Wt(h)&&this.Ua();var p=a==null?void 0:a.minimumDurationMilliseconds;n.register({[cd]:Ce({cache_timestamp:Date.now(),enabled:!!a},a,{networkPayloadCapture:Ce({capturePerformance:t.capturePerformance},a==null?void 0:a.networkPayloadCapture),canvasRecording:{enabled:a==null?void 0:a.recordCanvas,fps:a==null?void 0:a.canvasFps,quality:a==null?void 0:a.canvasQuality},sampleRate:h,minimumDurationMilliseconds:Le(p)?null:p,endpoint:a==null?void 0:a.endpoint,triggerMatchType:a==null?void 0:a.triggerMatchType,masking:a==null?void 0:a.masking,urlTriggers:a==null?void 0:a.urlTriggers,version:a==null?void 0:a.version,triggerGroups:a==null?void 0:a.triggerGroups})})};s(),(e=this.Oa)==null||e.call(this),this.Oa=(r=this._instance.sessionManager)==null?void 0:r.onSessionId(s)}}onRemoteConfig(t){var e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.Wa(e),void this.Ha()):(this.Wa(e),void this.startIfEnabledOrStop()):(this.La===rm&&(this.La=Ry,cl.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var r;e===void 0&&(e="log"),(r=this.Fa)!=null&&r.log?this.Fa.log(t,e):cl.warn("log called before recorder was ready")}get Ba(){var t,e,r=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(cd);return(r==null||(e=r.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}Va(){var t,e,r=this._instance.get_property(cd);if(!r)return!1;try{e=typeof r=="object"?r:JSON.parse(r)}catch(s){return cl.warn("persisted remote config for session recording is invali
412d and will be ignored",s),!1}var n=(t=e.cache_timestamp)!==null&&t!==void 0?t:Date.now();return 36e5>=Date.now()-n}ja(t){var e,r,n;if(!this.Da){if((e=yt.__PosthogExtensions__)==null||!e.initSessionRecording)return cl.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[D$]:!0});var s;if(this.Fa||(this.Fa=(s=yt.__PosthogExtensions__)==null?void 0:s.initSessionRecording(this._instance,this.$a),this.Fa._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Va())return this.La===Ry||this.La===rm?void 0:(this.La=rm,cl.info("persisted remote config is stale, requesting fresh config before starting"),void new iz(this._instance).load());this.La=qI,(r=(n=this.Fa).setDocumentWasEverVisible)==null||r.call(n,this.$a),this.Fa.start(t)}}onRRwebEmit(t){var e;(e=this.Fa)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.Fa||(e=this.Tr)==null||e.register({[N$]:!0}),(t=this.Fa)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Fa||(e=this.Tr)==null||e.register({[C$]:!0}),(t=this.Fa)==null||t.overrideSampling()}overrideTrigger(t){var e,r;this.Fa||(r=this.Tr)==null||r.register({[t==="url"?P$:R$]:!0}),(e=this.Fa)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.Fa)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var r;return!((r=this.Fa)==null||!r.tryAddCustomEvent(t,e))}}},CQ={autocapture:class{constructor(t){this.Za=!1,this.Ga=null,this.Qa=!1,this.Ka=!1,this.instance=t,this.rageclicks=new UI(t.config.rageclick),this.Ja=null}initialize(){this.startIfEnabled()}get Ne(){var t,e,r=Fr(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(t=r.url_allowlist)==null?void 0:t.map((n=>new RegExp(n))),r.url_ignorelist=(e=r.url_ignorelist)==null?void 0:e.map((n=>new RegExp(n))),r}Ya(){if(this.isBrowserSupported()){if(me&&Ue){var t=r=>{r=r||(me==null?void 0:me.event);try{this.Xa(r)}catch(n){uS.error("Failed to capture event",n)}};if(Jr(Ue,"submit",t,{capture:!0}),Jr(Ue,"change",t,{capture:!0}),Jr(Ue,"click",t,{capture:!0}),this.Ne.capture_copied_text){var e=r=>{r=r||(me==null?void 0:me.event);try{this.Xa(r,cS)}catch(n){uS.error("Failed to capture copy/cut event",n)}};Jr(Ue,"copy",e,{capture:!0}),Jr(Ue,"cut",e,{capture:!0})}}}else uS.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Za&&(this.Ya(),this.Za=!0)}onRemoteConfig(t){if(this.Qa=!0,t.ok){var e=t.config;e.elementsChainAsString&&(this.Ka=e.elementsChainAsString);var r=e.autocapture_opt_out;Wa(r)&&(this.instance.persistence&&this.instance.persistence.register({[lE]:r}),this.Ga=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.Ja=t}getElementSelectors(t){var e,r=[];return(e=this.Ja)==null||e.forEach((n=>{var s=Ue==null?void 0:Ue.querySelectorAll(n);s==null||s.forEach((i=>{t===i&&r.push(n)}))})),r}get isEnabled(){var t,e,r=(t=this.instance.persistence)==null?void 0:t.props[lE],n=this.Ga,s=this.instance.Ki()&&!this.Qa;if(Fs(n)&&!Wa(r)&&!s)return!1;var i=(e=this.Ga)!==null&&e!==void 0?e:!!r;return!!this.instance.config.autocapture&&!i}Xa(t,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var r,n=Jx(t);$$(n)&&(n=n.parentNode||null),e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&vI(n,this.instance.config.rageclick)&&this.Xa(t,"$rageclick");var s=e===cS;if(n&&(function(f,g,v,_,x,w){var S;if(!me||GC(f)||v!=null&&v.url_allowlist&&!pI(v.url_allowlist,w)||v!=null&&v.url_ignorelist&&pI(v.url_ignorelist,w))return!1;if(v!=null&&v.dom_event_allowlist){var k=v.dom_event_allowlist;if(k&&!k.some((P=>g.type===P)))return!1}var j=q$(f,_),C=j.parentIsUsefulElement,R=j.targetElementList;if(!(function(P,T){var O=T==null?void 0:T.element_allowlist;if(Le(O))return!0;var G,M=function(V){if(O.some((H=>V.tagName.toLowerCase()===H)))return{v:!0}};for(var U of P)if(G=M(U))return G.v;return!1})(R,v)||!CE(R,v==null?void 0:v.css_selector_allowlist)||CE(R,(S=v==null?void 0:v.css_selector_ignorelist)!==null&&S!==void 0?S:EJ))return!1;try{var A=me.getComputedStyle(f);if(A&&A.getPropertyValue("cursor")==="pointer"&&g.type==="click")return!0}catch{}var I=f.tagName.toLowerCase();switch(I){case"html":return!1;case"form":return(x||["submit"]).indexOf(g.type)>=0;case"input":case"select":case"textarea":return(x||["change","click"]).indexOf(g.type)>=0;default:return C?(x||["click"]).indexOf(g.type)>=0:(x||["click"]).indexOf(g.type)>=0&&(WC.indexOf(I)>-1||f.getAttribute("contenteditable")==="true")}})(n,t,this.Ne,s,s?["copy","cut"]:void 0,this.instance)){var i=vQ(n,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Ne.element_attribute_ignorelist,elementsC
412hainAsString:this.Ka,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),a=i.props;if(i.explicitNoCapture)return!1;var l=this.getElementSelectors(n);if(l&&l.length>0&&(a.$element_selectors=l),e===cS){var u,h=B$(me==null||(u=me.getSelection())==null?void 0:u.toString()),p=t.type||"clipboard";if(!h)return!1;a.$selected_content=h,a.$copy_type=p}return this.instance.capture(e,a),!0}}}isBrowserSupported(){return Ni(Ue==null?void 0:Ue.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.eo=(me==null||(e=me.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&($e.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.io&&this.io(),this.io=void 0,$e.info("History API monitoring stopped")}monitorHistoryChanges(){me&&me.history&&(this.ro("pushState"),this.ro("replaceState"),this.no())}ro(t){var e;if(me&&((e=me.history[t])==null||!e.__posthog_wrapped__)){var r=this;(function(n,s,i){try{if(!(s in n))return BI;var a={next:n[s]},l=i((function(){for(var u=arguments.length,h=new Array(u),p=0;u>p;p++)h[p]=arguments[p];return a.next.apply(this,h)}));return Ni(l)&&(l.prototype=l.prototype||{},Object.defineProperties(l,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:a}})),n[s]=l,()=>{if(n[s]!==l)for(var u=n[s];Ni(u)&&u.__posthog_layer__;){var h=u.__posthog_layer__;if(h.next===l)return void(h.next=a.next);u=h.next}else n[s]=a.next}}catch{return BI}})(me.history,t,(n=>
412function(s,i,a){n.call(this,s,i,a),r.so(t)}))}}so(t){try{var e,r=me==null||(e=me.location)==null?void 0:e.pathname;if(!r)return;r!==this.eo&&this.isEnabled&&this._instance.capture(qh,{navigation_type:t}),this.eo=r}catch(n){$e.error("Error capturing "+t+" pageview",n)}}no(){if(!this.io){var t=()=>{this.so("popstate")};Jr(me,"popstate",t),this.io=()=>{me&&me.removeEventListener("popstate",t)}}}},heatmaps:class{get Ne(){return this.instance.config}constructor(t){var e;this.ao=!1,this.Za=!1,this.oo=null,this.instance=t,this.ao=!((e=this.instance.persistence)==null||!e.props[cE]),this.rageclicks=new UI(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return Fr(this.Ne.capture_heatmaps)&&this.Ne.capture_heatmaps.flush_interval_milliseconds&&(t=this.Ne.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Wt(this.Ne.capture_heatmaps)?Wt(this.Ne.enable_heatmaps)?this.ao:this.Ne.enable_heatmaps:this.Ne.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Za)return;_Q.info("starting..."),this.lo(),this.Ie()}else{var t;clearInterval((t=this.oo)!==null&&t!==void 0?t:void 0),this.uo(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var e=t.config;if("heatmaps"in e){var r=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[cE]:r}),this.ao=r,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}ho(t){hS(t.originalEvent)&&this.ke(t.originalEvent,"deadclick")}Ie(){this.oo&&clearInterval(this.oo),this.oo=(Ue==null?void 0:Ue.visibilityState)==="visible"?setInterval(this.pr.bind(this),this.flushIntervalMilliseconds):null}lo(){me&&Ue&&(this.do=this.pr.bind(this),Jr(me,nb,this.do),this.vo=t=>this.ke(t||(me==null?void 0:me.event)),Jr(Ue,"click",this.vo,{capture:!0}),this.co=t=>this.fo(t||(me==null?void 0:me.event)),Jr(Ue,"mousemove",this.co,{capture:!0}),this.po=new kI(this.instance,TJ,this.ho.bind(this)),this.po.startIfEnabledOrStop(),this.mo=this.Ie.bind(this),Jr(Ue,rb,this.mo),this.Za=!0)}uo(){var t;me&&Ue&&(this.do&&me.removeEventListener(nb,this.do),this.vo&&Ue.removeEventListener("click",this.vo,{capture:!0}),this.co&&Ue.removeEventListener("mousemove",this.co,{capture:!0}),this.mo&&Ue.removeEventListener(rb,this.mo),clearTimeout(this.yo),(t=this.po)==null||t.stop(),this.Za=!1)}bo(t,e){var r=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),i=(function(a,l,u){for(var h=a;h&&ru(h)&&!Ai(h,"body");){if(h===u)return!1;var p=void 0;try{var f,g,v;p=(f=(g=(v=h.ownerDocument)==null?void 0:v.defaultView)!==null&&g!==void 0?g:me)==null?void 0:f.getComputedStyle(h).position}catch{return!1}if(Lt(l,p))return!0;h=V$(h)}return!1})(Jx(t),["fixed","sticky"],s);return{x:t.clientX+(i?0:n),y:t.clientY+(i?0:r),target_fixed:i,type:e}}ke(t,e){var r;if(e===void 0&&(e="click"),!fI(t.target)&&hS(t)){var n=this.bo(t,e);(r=this.rageclicks)!=null&&r.isRageClick(t.clientX,t.clientY,new Date().getTime())&&vI(Jx(t),this.instance.config.rageclick)&&this.Vt(Ce({},n,{type:"rageclick"})),this.Vt(n)}}fo(t){!fI(t.target)&&hS(t)&&(clearTimeout(this.yo),this.yo=setTimeout((()=>{this.Vt(this.bo(t,"mousemove"))}),500))}Vt(t){if(me){var e=this.Ne.disable_capture_url_hashes?tu(me.location.href):me.location.href,r=this.Ne.custom_personal_data_properties,n=this.Ne.mask_personal_data_properties?[...Mf,...r||[]]:[],s=ng(e,n,sg);this.R=this.R||{},this.R[s]||(this.R[s]=[]),this.R[s].push(t)}}pr(){this.R&&!Ml(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:kI,webVitalsAutocapture:class{constructor(t){var e;this.ao=!1,this.Za=!1,this.R={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this._o=()=>{clearTimeout(this.wo),this.wo=void 0,this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",Ce({$current_url:this.R.url},this.R.metrics.reduce(((r,n)=>Ce({},r,{["$web_vitals_"+n.name+"_event"]:Ce({},n),["$web_vitals_"+n.name+"_value"]:n.value})),{}))),this.R={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ko=r=>{var n;if(this.R=this.R||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Wt(r==null?void 0:r.name)||Wt(r==null?void 0:r.value))$u.error("Invalid metric received",r);
412else{var s=typeof r.navigationURL=="string"?r.navigationURL:void 0,i=this.xo(s);if(!Le(i)){var a=bn(r.navigationId)||typeof r.navigationId=="string"?"navigation:"+r.navigationId:"url:"+i;if(!this.So||this.So>r.value){this.R.navigationKey!==a&&(this._o(),this.wo=setTimeout(this._o,this.flushToCaptureTimeoutMs)),Le(this.R.navigationKey)&&(this.R.navigationKey=a,this.R.url=i),this.R.firstMetricTimestamp=Le(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0);var l=(n=this._instance.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0),u=Ce({},r,s?{navigationURL:i}:{},{$current_url:i,timestamp:Date.now()});Le(l)||(u.$session_id=l.sessionId,u.$window_id=l.windowId),this.R.metrics.push(u),this.R.metrics.length===this.allowedMetrics.length&&this._o()}else $u.error("Ignoring metric with value >= "+this.So,r)}}},this.Co=()=>{if(!this.Za){var r,n,s,i,a=yt.__PosthogExtensions__,l=a==null?void 0:a.postHogWebVitalsCallbacksByFlavor,u=(l==null?void 0:l[this.Mo])||(this.Mo==="web-vitals"&&Le(l)?a==null?void 0:a.postHogWebVitalsCallbacks:void 0);if(Le(u)||(r=u.onLCP,n=u.onCLS,s=u.onFCP,i=u.onINP),r&&n&&s&&i){var h={reportSoftNavs:this.useSoftNavs};this.allowedMetrics.indexOf("LCP")>-1&&r(this.ko.bind(this),h),this.allowedMetrics.indexOf("CLS")>-1&&n(this.ko.bind(this),h),this.allowedMetrics.indexOf("FCP")>-1&&s(this.ko.bind(this),h),this.allowedMetrics.indexOf("INP")>-1&&i(this.ko.bind(this),h),this.Za=!0}else $u.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.ao=!((e=this._instance.persistence)==null||!e.props[fE]),this.startIfEnabled()}get To(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,r=Fr(this.To)?(t=this.To)==null?void 0:t.web_vitals_allowed_metrics:void 0;return Wt(r)?((e=this._instance.persistence)==null?void 0:e.props[pE])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(Fr(this.To)?this.To.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=Fr(this.To)?this.To.web_vitals_attribution:void 0;return t!=null&&t}get useSoftNavs(){var t=Fr(this.To)?this.To.__preview_web_vitals_soft_navs:void 0;return t!=null&&t}get So(){var t=Fr(this.To)&&bn(this.To.__web_vitals_max_value)?this.To.__web_vitals_max_value:VI;return t>0&&6e4>=t?VI:t}get isEnabled(){var t=Zr==null?void 0:Zr.protocol;if(t!=="http:"&&t!=="https:")return $u.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=Fr(this.To)?this.To.web_vitals:Wa(this.To)?this.To:void 0;return Wa(e)?e:this.ao}startIfEnabled(){this.isEnabled&&!this.Za&&($u.info("enabled, starting..."),this.ai(this.Co))}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var r=Fr(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Fr(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[fE]:r}),this._instance.persistence.register({[pE]:n})),this.ao=r,this.startIfEnabled()}}}get Mo(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}ai(t){var e=yt.__PosthogExtensions__,r=this.Mo,n=e==null?void 0:e.postHogWebVitalsCallbacksByFlavor;n!=null&&n[r]||r==="web-vitals"&&Le(n)&&e!=null&&e.postHogWebVitalsCallbacks?t():e==null||e.loadExternalDependency==null||e.loadExternalDependency(this._instance,r,(s=>{s?$u.error("failed to load script",s):t()}))}xo(t){var e=t||(me==null?void 0:me.location.href);if(e){var r=this._instance.config.disable_capture_url_hashes?tu(e):e,n=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...Mf,...n||[]]:[];return ng(r,s,sg)}$u.error("Could not determine current URL")}}},NQ={exceptionObserver:class{constructor(t){var e;this.Co=()=>{var r;if(me&&this.isEnabled&&(r=yt.__PosthogExtensions__)!=null&&r.errorWrappingFunctions){var n=yt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=yt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=yt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Eo&&this.Ne.capture_unhandled_errors&&(this.Eo=n(this.captureException.bind(this))),!this.Io&&this.Ne.capture_unhandled_rejections&&(this.Io=s(this.captureException.bind(this))),!this.Po&&this.Ne.capture_console_errors&&(this.Po=i(this.captureException.bind(this)))}catch(a){tm.error("failed to start",a),this.Ro()}}},this._instance=t,this.Ao=!((e=this._instance.persistence)==null||!e.props[uE]),this.Fo=new CZ(Ce({},(function(r){var n,s,i,a;return r===void 0&&(r={}),{refillRate:(n=(s=r.exceptionRateLimiterRefillRate)!==null&&s!==void 0?s:r.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(i=(a=r.exceptionRateLimiterBucketSize)!==null&&a!==void 0?a:r.__exceptionRateLimiterBucketSize)!==null&&i!==void 0?i:10}})(this._instance.config.error_tracking),{refillInterval:1e4,rt:tm})),this.Ne=this.Lo(),this.startIfEnabledOrStop()}Lo(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Fr(t)?e=Ce({},e,t):(Le(t)?this.Ao:t)&&(e=Ce({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Ne.capture_console_errors||this.Ne.capture_unhandled_errors||this.Ne.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(tm.info("enabled"),this.Ro(),this.ai(this.Co)):this.Ro()}ai(t){var e,r;(e=yt.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?t():(r=yt.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"exception-autocapture",(n=>{if(n)return tm.error("failed to load script",n);t()}))}Ro(){var t,e,r;(t=this.Eo)==null||t.call(this),this.Eo=void 0,(e=this.Io)==null||e.call(this),this.Io=void 0,(r=this.Po)==null||r.call(this),this.Po=void 0}onRemoteConfig(t){if(t.ok){var e=t.config;"autocaptureExceptions"in e&&(this.Ao=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[uE]:this.Ao}),this.Ne=this.Lo(),this.startIfEnabledOrStop())}}onConfigChange(){this.Ne=this.Lo()}captureException(t){var e,r,n,s=(e=t==null||(r=t.$exception_list)==null||(r=r[0])==null?void 0:r.type)!==null&&e!==void 0?e:"Exception";this.Fo.consumeRateLimit(s)?tm.info("Skipping exception capture because of client rate limiting.",{exception:s}):(n=this._instance.exceptions)==null||n.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,r;this.Oo=[],this.Do=new HZ([new QZ,new oJ,new eJ,new XZ,new iJ,new sJ,new rJ,new aJ],(function(n){for(var s=arguments.length,i=new Array(s>1?s-1:0),a=1;s>a;a++)i[a-1]=arguments[a];return function(l,u){u===void 0&&(u=0);for(var h=[],p=l.split(`
413`),f=u;p.length>f;f++){var g=p[f];if(1024>=g.length){var v=cI.test(g)?g.replace(cI,"$1"):g;if(!v.match(/\S*Error: /)){for(var _ of i){var x=_(v,n);if(x){h.push(x);break}}if(h.length>=50)break}}}return(function(w){if(!w.length)return[];var S=Array.from(w);return S.reverse(),S.slice(0,50).map((k=>{return Ce({},k,{filename:k.filename||(j=S,j[j.length-1]||{}).filename,function:k.function||Df});var j}))})(h)}})("web:javascript",KZ,JZ)),this._instance=t,this.Oo=(e=(r=this._instance.persistence)==null?void 0:r.get_property(dE))!==null&&e!==void 0?e:[],this.$o=J_(this.No()),this.qo=new cJ(this.$o)}onConfigChange(){this.$o=J_(this.No()),this.qo.setConfig(this.$o)}onRemoteConfig(t){var e,r,n;if(t.ok){var s=t.config;if("errorTracking"in s){var i=(e=(r=s.errorTracking)==null?void 0:r.suppressionRules)!==null&&e!==void 0?e:[],a=(n=s.errorTracking)==null?void 0:n.captureExtensionExceptions;this.Oo=i,this._instance.persistence&&this._instance.persistence.register({[dE]:this.Oo,[hE]:a})}}}get jo(){var t,e=!!this._instance.get_property(hE),r=this._instance.config.error_tracking.captureExtensionExceptions;return(t=r??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.Do.buildFromUnknown(t,{syntheticException:e==null?void 0:e.syntheticException,mechanism:{handled:e==null?void 0:e.handled}})}addExceptionStep(t,e){if(this.$o.enabled)try{if(!pr(t)||t.trim().length===0)return void vo.warn("Ignoring exception step because message must be a non-empty string");var r=(function(i){if(!i)return{sanitizedProperties:{},droppedKeys:[]};var a=[];return{sanitizedProperties:Object.keys(i).reduce(((l,u)=>lJ.has(u)?(a.push(u),l):(l[u]=i[u],l)),{}),droppedKeys:a}})(this.Bo(e)),n=r.sanitizedProperties,s=r.droppedKeys;s.length>0&&vo.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.qo.add(Ce({[Y_]:t,[Z_]:new Date().toISOString()},n))}catch(i){vo.error("Failed to add exception step. Ignoring breadcrumb.",i)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.Ho(e)){if(this.Uo(e))return this.zo("Exception dropped: matched a suppression rule"),void vo.info("Skipping exception capture because a suppression rule matched");if(!this.jo&&this.Wo(e))return this.zo("Exception dropped: thrown by a browser extension"),void vo.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Vo(e))return this.zo("Exception dropped: thrown by the PostHog SDK"),void vo.info("Skipping exception capture because it was thrown by the PostHog SDK")}var r=this.$o.enabled&&Wt(t.$exception_steps)?this.Zo(t):t,n=typeof(i=globalThis._posthogReleaseId)=="string"&&i.length>0?i:void 0;n&&(r.$release_id=n);try{var s=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",Un:!0});return s&&this.qo.clear(),s}catch(a){return vo.error("Failed to capture exception event. Dropping this exception.",a),void this.qo.clear()}}catch(a){return void vo.error("Failed to process exception event. Ignoring this exception.",a)}var i}Zo(t){try{var e=this.qo.getAttachable();return e.length===0?t:Ce({},t,{$exception_steps:e})}catch(r){return vo.error("Failed to read buffered exception steps. Capturing exception without steps.",r),t}}zo(t){this.$o.enabled&&this.qo.add({[Y_]:t,[Z_]:new Date().toISOString()})}Bo(t){return Fr(t)?Ce({},t):{}}No(){var t,e;return(t=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}Uo(t){if(t.length===0)return!1;try{var e=t.reduce(((r,n)=>{var s=n.type,i=n.value;return pr(s)&&s.length>0&&r.$exception_types.push(s),pr(i)&&i.length>0&&r.$exception_values.push(i),r}),{$exception_types:[],$exception_values:[]});return this.Oo.some((r=>{var n=r.values.map((s=>{var i=_z[s.operator],a=e[s.key];if(!i||!a)return!1;var l=zt(s.value)?s.value:[s.value];return l.length>0&&i(l,a)}));return r.type==="OR"?n.some(Boolean):n.every(Boolean)}))}catch(r){return vo.warn("Failed to evaluate suppression rules. Capturing the exception.",r),!1}}Wo(t){return t.flatMap((e=>{var r,n;return(r=(n=e.stacktrace)==null?void 0:n.frames)!==null&&r!==void 0?r:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}Vo(t){if(t.length>0){var e,r,n,s,i=(e=(r=t[0].stacktrace)==null?void 0:r.frames)!==null&&e!==void 0?e:[],a=i[i.length-1];return(n=a==null||(s=a.filename)==null?void 0:s.includes("posthog.com/static"))!==null&&n!==void 0&&n}return!1}Ho(t){return!Wt(t)&&zt(t)}}},PQ=Ce({productTours:class{get Tr(){return this._instance.persistence}constructor(t){this.Go=null,this.Qo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var e=t.config;if("productTours"in e){var r,n;if(this.Tr&&this.Tr.register({[UC]:!!e.productTours}),!fS(this._instance))return!this.Go&&Wt((r=this.Tr)==null?void 0:r.props[Sm])||Ay.info("product tours disabled; stopping and clearing cached tours"),(n=this.Go)==null||n.stop(),this.Go=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Go&&fS(this._instance)&&this.ai((()=>this.Ko()))}ai(t){var e,r;(e=yt.__PosthogExtensions__)!=null&&e.generateProductTours?t():(r=yt.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"product-tours",(n=>{n?Ay.error("Could not load product tours script",n):t()}))}Ko(){var t;!this.Go&&(t=yt.__PosthogExtensions__)!=null&&t.generateProductTours&&(this.Go=yt.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(e===void 0&&(e=!1),!zt(this.Qo)||e){var r=this.Tr;if(r){var n=r.props[Sm];if(zt(n)&&!e)return this.Qo=n,void t(n,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:s=>{if(fS(this._instance)){var i=s.statusCode;if(i!==200||!s.json){var a="Product Tours API could not be loaded, status: "+i;return i===0?s.error||Ay.warn(a):Ay.error(a),void t([],{isLoaded:!1,error:a})}var l=zt(s.json.product_tours)?s.json.product_tours:[];this.Qo=l,r&&r.register({[Sm]:l}),t(l,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Qo,{isLoaded:!0})}getActiveProductTours(t){Wt(this.Go)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Go.getActiveProductTours(t)}showProductTour(t){var e;(e=this.Go)==null||e.showTourById(t)}previewTour(t){this.Go?this.Go.previewTour(t):this.ai((()=>{var e;this.Ko(),(e=this.Go)==null||e.previewTour(t)}))}dismissProductTour(){var t;(t=this.Go)==null||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.Go)==null||t.nextStep()}previousStep(){var t;(t=this.Go)==null||t.previousStep()}clearCache(){var t;this.Qo=null,(t=this.Tr)==null||t.unregister(Sm)}resetTour(t){var e;(e=this.Go)==null||e.resetTour(t)}resetAllTours(){var t;(t=this.Go)==null||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.Go)==null||e.cancelPendingTour(t)}}},iw),RQ={siteApps:class{constructor(t){this.Jo=0,this._instance=t,this.Yo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Xo(t,e){if(e){var r=this.globalsForEvent(e);this.Yo.push(r),this.Yo.length>1e3&&(this.Yo=this.Yo.slice(10))}}get siteAppLoaders(){var t;return(t=yt._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Xo.bind(this));this.tl=()=>{t(),this.Yo=[],this.tl=void 0}}}globalsForEvent(t){var e,r,n,s,i,a,l;if(!t)throw new Error("Event payload is required");var u={},h=this._instance.get_property("$groups")||[],p=this._instance.get_property("$stored_group_properties")||{};for(var f of Object.entries(p)){var g=f[0];u[g]={id:h[g],type:g,properties:f[1]}}var v=t.$set_once,_=t.$set;return{event:Ce({},HF(t,bQ),{properties:Ce({},t.properties,_?{$set:Ce({},(e=(r=t.properties)==null?void 0:r.$set)!==null&&e!==void 0?e:{},_)}:{},v?{$set_once:Ce({},(n=(s=t.properties)==null?void 0:s.$set_once)!==null&&n!==void 0?n:{},v)}:{}),elements_chain:(i=(a=t.properties)==null?void 0:a.$elements_chain)!==null&&i!==void 0?i:"",distinct_id:(l=t.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}el(t){var e,r=(e=t.tagName)==null?void 0:e.toLowerCase();return r==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(go.error("prepare_external_dependency_stylesheet returned null"),null):r==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(go.error("prepare_external_dependency_script returned null"),null):t}il(){var t,e,r,n,s,i,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var u=Ue==null?void 0:Ue.defaultView,h=u==null||(t=u.Node)==null?void 0:t.prototype;if(!u||!h)return()=>{};if(this.Jo++,this.rl)return this.nl();
413var p=[],f=this,g=new WeakSet,v=(w,S,k)=>{if(w!=null&&w[S]){var j=w[S];w[S]=k(j),p.push((()=>{w[S]=j}))}},_=w=>{if(g.has(w))return w;var S=f.el(w);return S&&g.add(S),S},x=w=>w.map((S=>typeof S=="string"?S:_(S))).filter((S=>!Fs(S)));return v(h,"appendChild",(w=>function(S){var k=_(S);return k?w.call(this,k):S})),v(h,"insertBefore",(w=>function(S,k){var j=_(S);return j?w.call(this,j,k):S})),v(h,"replaceChild",(w=>function(S,k){var j=_(S);return j?w.call(this,j,k):k})),[(e=u.Element)==null?void 0:e.prototype,(r=u.Document)==null?void 0:r.prototype,(n=u.DocumentFragment)==null?void 0:n.prototype].forEach((w=>{v(w,"append",(S=>function(){for(var k=arguments.length,j=new Array(k),C=0;k>C;C++)j[C]=arguments[C];return S.apply(this,x(j))})),v(w,"prepend",(S=>function(){for(var k=arguments.length,j=new Array(k),C=0;k>C;C++)j[C]=arguments[C];return S.apply(this,x(j))}))})),[(s=u.Element)==null?void 0:s.prototype,(i=u.CharacterData)==null?void 0:i.prototype,(a=u.DocumentType)==null?void 0:a.prototype].forEach((w=>{v(w,"before",(S=>function(){for(var k=arguments.length,j=new Array(k),C=0;k>C;C++)j[C]=arguments[C];return S.apply(this,x(j))})),v(w,"after",(S=>function(){for(var k=arguments.length,j=new Array(k),C=0;k>C;C++)j[C]=arguments[C];return S.apply(this,x(j))})),v(w,"replaceWith",(S=>function(){for(var k=arguments.length,j=new Array(k),C=0;k>C;C++)j[C]=arguments[C];var R=x(j);return j.length&&!R.length?void 0:S.apply(this,R)}))})),v((l=u.Element)==null?void 0:l.prototype,"insertAdjacentElement",(w=>function(S,k){var j=_(k);return j?w.call(this,S,j):null})),this.rl=()=>{p.forEach((w=>w())),this.rl=void 0},this.nl()}nl(){var t=!1;return()=>{var e;t||(t=!0,this.Jo--,this.Jo===0&&((e=this.rl)==null||e.call(this)))}}sl(t,e){e===void 0&&(e=!0);var r=this.il();try{var n=t(r);return e&&r(),n}catch(s){throw r(),s}}setupSiteApp(t){var e=this.apps[t.id],r=()=>{var a;!e.errored&&this.Yo.length&&(go.info("Processing "+this.Yo.length+" events for site app with id "+t.id),this.Yo.forEach((l=>this.sl((()=>e.processEvent==null?void 0:e.processEvent(l))))),e.processedBuffer=!0),Object.values(this.apps).every((l=>l.processedBuffer||l.errored))&&((a=this.tl)==null||a.call(this))},n=!1,s=a=>{e.errored=!a,e.loaded=!0,go.info("Site app with id "+t.id+" "+(a?"loaded":"errored")),n&&r()};try{var i=this.sl((a=>t.init({posthog:this._instance,callback(l){a(),s(l)}})),!1).processEvent;i&&(e.processEvent=i),n=!0}catch(a){go.error(WI+t.id,a),s(!1)}if(n&&e.loaded)try{r()}catch(a){go.error("Error while processing buffered events PostHog app with config id "+t.id,a),e.errored=!0}}al(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of t)this.setupSiteApp(r)}ol(t){var e=this;if(Object.keys(this.apps).length!==0){var r=this.globalsForEvent(t),n=function(i){try{e.sl((()=>i.processEvent==null?void 0:i.processEvent(r)))}catch(a){go.error("Error while processing event "+t.event+" for site app "+i.id,a)}};for(var s of Object.values(this.apps))n(s)}}onRemoteConfig(t){var e,r,n,s=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.al(),void this._instance.on("eventCaptured",(u=>this.ol(u)))):void go.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.tl)==null||r.call(this),t.ok){var i=t.config;if((n=i.siteApps)!=null&&n.length)if(this.isEnabled){var a=function(){var u,h=l.id,p=l.url;yt["__$$ph_site_app_"+h]=s._instance,(u=yt.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(s._instance,p,(f=>{if(f)return go.error(WI+h,f)}))};for(var l of i.siteApps)a()}else go.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},AQ={tracingHeaders:class{constructor(t){this.ll=void 0,this.ul=void 0,this.hl=void 0,this.Co=()=>{var e,r,n=this.dl();n?(Le(this.ll)&&(this.ll=(e=yt.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(n,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Le(this.ul)&&(this.ul=(r=yt.__PosthogExtensions__)==null||(r=r.tracingHeadersPatchFns)==null?void 0:r._patchFetch(n,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Ro()},this._instance=t}initialize(){this.startIfEnabledOrStop()}ai(t){var e,r;(e=yt.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?t():(r=yt.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"tracing-headers",(n=>{if(n)return yQ.error("failed to load script",n);t()}))}vl(){var t,e;return(t=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&t!==void 0?t:this._instance.config.__add_tracing_headers}dl(){var t=this.vl();return zt(t)?(zt(this.hl)?this.hl.splice(0,this.hl.length,...t):this.hl=[...t],t.length>0?this.hl:void 0):(zt(this.hl)&&this.hl.splice(0),this.hl=t||void 0,this.hl)}Ro(){var t,e;(t=this.ll)==null||t.call(this),(e=this.ul)==null||e.call(this),this.ll=void 0,this.ul=void 0}startIfEnabledOrStop(){this.dl()?this.ai(this.Co):this.Ro()}}},TQ=Ce({surveys:class{get Ne(){return this._instance.config}constructor(t){this.cl=void 0,this._surveyManager=null,this.fl=!1,this.pl=[],this.gl=null,this.ml=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Ne.disable_surveys){if(!t.ok)return kr.warn("Remote config unavailable. Not loading surveys.");var e=t.config.surveys;if(Wt(e))return kr.warn("Flags not loaded yet. Not loading surveys.");var r=zt(e);this.cl=r?e.length>0:e,kr.info("flags response received, isSurveysEnabled: "+this.cl),this.loadIfEnabled()}}reset(){try{var t;(t=this._surveyEventReceiver)==null||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],r=0;r<localStorage.length;r++){var n=localStorage.key(r);(n!=null&&n.startsWith(xz)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach((s=>localStorage.removeItem(s)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.fl)kr.info("Already initializing surveys, skipping...");else if(this.Ne.disable_surveys)kr.info(GI);else if(this.Ne.cookieless_mode&&this._instance.consent.isOptedOut())kr.info("Not loading surveys in cookieless mode without consent.");else{var t=yt==null?void 0:yt.__PosthogExtensions__;if(t){if(!Le(this.cl)||this.Ne.advanced_enable_surveys){var e=this.cl||this.Ne.advanced_enable_surveys;this.fl=!0;try{var r=t.generateSurveys;if(r)return void this.yl(r,e);var n=t.loadExternalDependency;if(!n)return void this.bl(VC);n(this._instance,"surveys",(s=>{s||!t.generateSurveys?this.bl("Could not load surveys script",s):this.yl(t.generateSurveys,e)}))}catch(s){throw this.bl("Error initializing surveys",s),s}finally{this.fl=!1}}}else kr.error("PostHog Extensions not found.")}}yl(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new SQ(this._instance),kr.info("Surveys loaded successfully"),this._l({isLoaded:!0})}bl(t,e){kr.error(t,e),this._l({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.pl.push(t),this._surveyManager&&this._l({isLoaded:!0}),()=>{this.pl=this.pl.filter((e=>e!==t))}}getSurveys(t,e){if(e===void 0&&(e=!1),this.Ne.disable_surveys)return kr.
413info(GI),t([]);var r,n=this._instance.get_property(vE);if(n&&!e)return t(n,{isLoaded:!0}),void(this.wl()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.gl?this.gl.then((s=>t(s.surveys,s.context))):(typeof Promise<"u"&&(this.gl=new Promise((s=>{r=s}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Ne.token),method:"GET",timestampMode:"query",timeout:this.Ne.surveys_request_timeout_ms,callback:s=>{var i;this.gl=null;var a=s.statusCode;if(a!==200||!s.json){var l="Surveys API could not be loaded, status: "+a;a!==0?kr.error(l):s.error||kr.warn(l),this.ml=Date.now();var u={isLoaded:!1,error:l};return t([],u),void(r==null||r({surveys:[],context:u}))}this.ml=null;var h,p=s.json.surveys||[],f=p.filter((v=>(function(_){return!(!_.start_date||_.end_date)})(v)&&(wz(v)||(function(_){var x;return!((x=_.conditions)==null||(x=x.actions)==null||(x=x.values)==null||!x.length)})(v))));f.length>0&&((h=this._surveyEventReceiver)==null||h.register(f)),(i=this._instance.persistence)==null||i.register({[vE]:p,[X_]:Date.now()});var g={isLoaded:!0};t(p,g),r==null||r({surveys:p,context:g})}}))}wl(){return this.kl()&&!this.gl&&!this.xl()}kl(){var t=this._instance.get_property(X_);return bn(t)&&Date.now()-t>3e5}xl(){return bn(this.ml)&&3e5>Date.now()-this.ml}markSurveyAsSeen(t,e){var r,n={id:t,current_iteration:(r=e==null?void 0:e.iteration)!==null&&r!==void 0?r:null};Sz(n);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}_l(t){for(var e of this.pl)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(r){kr.error("Error in survey callback",r)}}getActiveMatchingSurveys(t,e){if(e===void 0&&(e=!1),!Wt(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);kr.warn("init was not called")}Sl(t){var e=null;return this.getSurveys((r=>{var n;e=(n=r.find((s=>s.id===t)))!==null&&n!==void 0?n:null})),e}Cl(t){if(Wt(this._surveyManager))return{eligible:!1,reason:Ty};var e=typeof t=="string"?this.Sl(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Ml(t){if(Wt(this._surveyManager))return{eligible:!1,reason:Ty};var e=typeof t=="string"?this.Sl(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Wt(this._surveyManager))return kr.warn("init was not called"),{visible:!1,disabledReason:Ty};var e=this.Ml(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Wt(this._surveyManager)?(kr.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ty})):new Promise((r=>{this.getSurveys((n=>{var s,i=(s=n.find((l=>l.id===t)))!==null&&s!==void 0?s:null;if(i){var a=this.Ml(i);r({visible:a.eligible,disabledReason:a.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,r){var n;if(Wt(this._surveyManager))kr.warn("init was not called");else{var s=typeof t=="string"?this.Sl(t):t;if(s!=null&&s.id)if(iQ.includes(s.type)){var i=Ue==null?void 0:Ue.querySelector(e);if(i)return(n=s.appearance)!=null&&n.surveyPopupDelaySeconds?(kr.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,l;kr.info("Rendering survey "+s.id+" with delay of "+((a=s.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(l=this._surveyManager)==null||l.renderSurvey(s,i,r),kr.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,i,r);kr.warn("Survey element not found")}else kr.warn("Surveys of type "+s.type+" cannot be rendered in the app");else kr.warn("Survey not found")}}displaySurvey(t,e){var r;if(Wt(this._surveyManager))kr.warn("init was not called");else{var n=this.Sl(t);if(n){var s=n;if((r=n.appearance)!=null&&r.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=Ce({},n,{appearance:Ce({},n.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==PE.Popover&&e.initialResponses&&kr.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var i=this.Cl(n);if(!i.eligible)return void kr.warn("Survey is not eligible to be displayed: ",i.reason)}e.displayType!==PE.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}else kr.warn("Survey not found")}}cancelPendingSurvey(t){Wt(this._surveyManager)?kr.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload==null||t.handlePageUnload()}}},iw),IQ={toolbar:class{constructor(t){this.instance=t}Tl(t){yt.ph_toolbar_state=t}El(){var t;return(t=yt.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,r){if(t===void 0&&(t=void 0),e===void 0&&(e=void 0),r===void 0&&(r=void 0),jE(this.instance.config)||!me||!Ue)return!1;t=t??me.location,r=r??me.history;try{if(!e){try{me.localStorage.setItem("test","test"),me.localStorage.removeItem("test")}catch{return!1}e=me==null?void 0:me.localStorage}var n,s=kQ||ob(t.hash,"__posthog")||ob(t.hash,"state"),i=s?dI((()=>JSON.parse(atob(decodeURIComponent(s)))))||dI((()=>JSON.parse(decodeURIComponent(s)))):null;return i&&i.action==="ph_authorize"?((n=i).source="url",n&&Object.keys(n).length>0&&(i.desiredHash?t.hash=i.desiredHash:r?r.replaceState(r.state,"",t.pathname+t.search):t.hash="")):((n=JSON.parse(e.getItem(KI)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch{return!1}}Il(t){var e=yt.ph_load_toolbar||yt.ph_load_editor;!Wt(e)&&Ni(e)?e(t,this.instance):YI.warn("No toolbar load function found")}loadToolbar(t){var e=!(Ue==null||!Ue.getElementById(F$));if(!me||e)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,n=Ce({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(me.localStorage.setItem(KI,JSON.stringify(Ce({},n,{source:void 0}))),this.El()===2)this.Il(n);else if(this.El()===0){var s;this.Tl(1),(s=yt.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",(i=>{if(i)return YI.error("[Toolbar] Failed to load",i),void this.Tl(0);this.Tl(2),this.Il(n)})),Jr(me,"turbolinks:load",(()=>{this.Tl(0),this.loadToolbar(n)}))}return!0}Pl(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,r){return t===void 0&&(t=void 0),e===void 0&&(e=void 0),r===void 0&&(r=void 0),this.maybeLoadToolbar(t,e,r)}}},DQ=Ce({experiments:ms},iw),OQ={conversations:class{constructor(t){this.Rl=void 0,this._conversationsManager=null,this.Al=!1,this.Fl=null,this.Ll=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.Ol=t.ok,t.ok)){var e=t.config.conversations;Wt(e)||(Wa(e)?this.Rl=e:(this.Rl=e.enabled,this.Fl=e),this.loadIfEnabled())}}reset(){var t;(t=this._conversationsManager)==null||t.reset(),this._conversationsManager=null,this.Rl=void 0,this.Fl=null,this.Ol=void 0,this.Ll=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Al||this._instance.config.disable_conversations||jE(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=yt==null?void 0:yt.__PosthogExtensions__;if(t&&!Le(this.Rl)&&this.Rl)if(this.Fl&&this.Fl.token){this.Al=!0;try{var e=t.initConversations;if(e)return this.Dl(e),void(this.Al=!1);var r=t.loadExternalDependency;if(!r)return void this.$l(VC);r(this._instance,"conversations",(n=>{n||!t.initConversations?this.$l("Could not load conversations script",n):this.Dl(t.initConversations),this.Al=!1}))}catch(n){this.$l("Error initializing conversations",n),this.Al=!1}}else Xi.error("Conversations enabled but missing token in remote config.")}}Dl(t){if(this.Fl)try{this._conversationsManager=t(this.Fl,this._instance),this.Ll=!1,Xi.info("Conversations loaded successfully")}catch(e){this.$l("Error completing conversations initialization",e)}else Xi.error("Cannot complete initialization: remote config is null")}$l(t,e){Xi.error(t,e),this._conversationsManager=null,this.Al=!1,this.Ll=!0}show(){this._conversationsManager?this._conversationsManager.show():Xi.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Rl===!0&&!Fs(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":jE(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Ol===!1?"remote_config_failed":Le(this.Rl)?this.Ol?"disabled_in_project":"remote_config_pending":this.Rl?Wt(this.Fl)||!this.Fl.token?"missing_token":yt!=null&&yt.__PosthogExtensions__?this.Al?"initializing":this.Ll?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,r){var n=this;return Hr((function*(){return n._conversationsManager?n._conversationsManager.sendMessage(t,e,r):(Xi.warn(Uu),null)}))()}getMessages(t,e){var r=this;return Hr((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,e):(Xi.warn(Uu),null)}))()}markAsRead(t){var e=this;return Hr((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Xi.warn(Uu),null)}))()}getTickets(t){var e=this;return Hr((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Xi.warn(Uu),null)}))()}requestRestoreLink(t){var e=this;return Hr((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Xi.warn(Uu),null)}))()}restoreFromToken(t){var e=this;return Hr((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Xi.warn(Uu),null)}))()}restoreFromUrlToken(){var t=this;return Hr((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Xi.warn(Uu),null)}))()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}Yn(){var t;(t=this._conversationsManager)==null||t.setIdentity()}Xn(){var t;(t=this._conversationsManager)==null||t.clearIdentity()}}},MQ={logs:class{constructor(t){var e,r=this;this.Nl=!1,this.ql=!1,this.rt=en("[logs]"),this.jl=Ce({},this.rt,{error(){for(var n=arguments.length,s=new Array(n),i=0;n>i;i++)s[i]=arguments[i];s.some(eD)||r.rt.error(...s)}}),this.er=[],this.Bl=[],this.ya=0,this.Hl=()=>{var n,s;this.ya=0,(n=this.Ul)==null||n.onReconnect(),(s=this.zl)==null||s.onReconnect()},this._instance=t,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.Nl=!0),me&&Jr(me,"online",this.Hl)}Wl(t,e,r,n){var s,i=(function(a,l){var u,h,p,f,g,v,_,x=(u=a==null?void 0:a.flushIntervalMs)!==null&&u!==void 0?u:3e3,w=(h=a==null?void 0:a.maxBufferSize)!==null&&h!==void 0?h:100,S=l!=null&&l.consoleCapture?void 0:(p=a==null?void 0:a.maxLogsPerInterval)!==null&&p!==void 0?p:1e3,k=Le(S)?Math.max(w,2048):Math.max(w,S),j=a==null?void 0:a.resourceAttributes;return{serviceName:(f=(g=j==null?void 0:j["service.name"])!==null&&g!==void 0?g:a==null?void 0:a.serviceName)!==null&&f!==void 0?f:l==null?void 0:l.serviceNameDefault,serviceVersion:(v=j==null?void 0:j["service.version"])!==null&&v!==void 0?v:a==null?void 0:a.serviceVersion,environment:(_=j==null?void 0:j["deployment.environment"])!==null&&_!==void 0?_:a==null?void 0:a.environment,resourceAttributes:j,beforeSend:a==null?void 0:a.beforeSend,flushIntervalMs:x,maxBufferSize:w,maxQueueSize:k,maxBatchRecordsPerPost:100,rateCapWindowMs:x,maxLogsPerInterval:S,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((s=this._instance)==null||(s=s.config)==null?void 0:s.logs,r);return[new UZ(this.Vl(t,e),i,this.jl,(()=>this.Zl()),(a=>a()),void 0,n),i]}Gl(){var t,e=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;if(!this.Ul||this.Ql!==e){var r;(r=this.Ul)==null||r.reset(),this.Ql=e;var n=this.Wl((()=>this.er),(s=>{this.er=s}));this.Ul=n[0],this.Kl=n[1]}return this.Ul}Jl(){var t,e=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;if(!this.zl||this.Yl!==e){var r;(r=this.zl)==null||r.reset(),this.Yl=e;var n=this.Wl((()=>this.Bl),(s=>{this.Bl=s}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},XI);this.zl=n[0],this.Xl=n[1]}return this.zl}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e;if(t.ok){var r=(e=t.config.logs)==null?void 0:e.captureConsoleLogs;!Wt(r)&&r&&(this.Nl=!0,this.loadIfEnabled())}}reset(){var t,e;this.er=[],(t=this.Ul)==null||t.reset(),this.Bl=[],(e=this.zl)==null||e.reset(),this.ya=0}
413captureLog(t){this.Gl().captureLog(t)}he(t){this.Jl().captureLog(t)}get logger(){return this.tu||(this.tu={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.tu}flushLogs(t){t?this.eu(t):(this.Ul&&this.Ul.flush().catch((e=>this.iu(e))),this.zl&&this.zl.flush().catch((e=>this.iu(e))))}iu(t){eD(t)||this.rt.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Nl&&!this.ql){var t=yt==null?void 0:yt.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(r=>{var n;r||(n=t.logs)==null||!n.initializeLogs?this.rt.error("Could not load logs script",r):(t.logs.initializeLogs(this._instance),this.ql=!0)})):this.rt.error(VC)}else this.rt.error("PostHog Extensions not found.")}}Vl(t,e){var r=this._instance;return{get isDisabled(){return!1},get optedOut(){return!r.is_capturing()},getPersistedProperty:n=>n===wl.LogsQueue?t():void 0,setPersistedProperty(n,s){var i;n===wl.LogsQueue&&e((i=s)!==null&&i!==void 0?i:[])},Ot:n=>this.Ot(n),getLibraryId:()=>Er.LIB_NAME,getLibraryVersion:()=>Er.LIB_VERSION}}Ot(t){return new Promise((e=>{if(Z$(this.ya,3))e({kind:"fatal",error:mS(void 0,"logs endpoint is unreachable, dropping batch")});else{var r=!1,n=i=>{r||(r=!0,clearTimeout(s),e(i))},s=setTimeout((()=>{this.rt.warn("Logs request timed out before receiving a response"),n({kind:"retry-later",error:mS(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.ru(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:i=>{var a=i.statusCode;if(this.nu(a),a>=200&&300>a)n({kind:"ok"});else if(a===413)n({kind:"too-large"});else if(a!==0&&a!==429&&500>a)n({kind:"fatal",error:new Error("logs request failed with status "+a)});else{var l;a===0?(i.error||this.rt.warn("Logs request failed before receiving an HTTP response"),n({kind:"retry-later",error:mS(i.error,"logs request failed before receiving an HTTP response")})):n({kind:"retry-later",error:(l=i.error)!==null&&l!==void 0?l:new Error("logs request failed with status "+a)})}}})}}))}nu(t){(t!==0||this._instance.__loaded)&&(this.ya=J$(t,this.ya,3,(()=>this.rt.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}eu(t){this.er.length>0&&this.su(t,this.er,this.Kl,Er.LIB_NAME,(e=>{this.er=e})),this.Bl.length>0&&this.su(t,this.Bl,this.Xl,XI,(e=>{this.Bl=e}))}su(t,e,r,n,s){if(e.length!==0){var i=e.map((l=>l.record));s([]);var a=w$(i,b$(r,Er.LIB_NAME,Er.LIB_VERSION),n,Er.LIB_VERSION);this._instance._send_request({method:"POST",url:this.ru(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}ru(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Zl(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var r=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),n=r.windowId,s=r.sessionStartTimestamp,i=r.lastActivityTimestamp;e.sessionId=r.sessionId,e.windowId=n,Wt(s)||(e.sessionStartTimestamp=s),Wt(i)||(e.lastActivityTimestamp=i)}if(yt!=null&&(t=yt.location)!=null&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?tu(yt.location.href):yt.location.href),this._instance.featureFlags){var a=this._instance.featureFlags.getFlags();a&&a.length>0&&(e.activeFeatureFlags=a)}return e}}},LQ={metrics:class{constructor(t){this.rt=en("[metrics]"),this._instance=t}initialize(){}Gl(){var t,e,r=(t=this._instance)==null||(t=t.config)==null?void 0:t.metrics;return this.Ul&&this.Ql===r||((e=this.Ul)==null||e.reset(),this.Ql=r,this.Ul=new BZ(this.Vl(),(function(n){var s,i,a,l,u,h=n==null?void 0:n.resourceAttributes;return{serviceName:(s=h==null?void 0:h["service.name"])!==null&&s!==void 0?s:n==null?void 0:n.serviceName,serviceVersion:(i=h==null?void 0:h["service.version"])!==null&&i!==void 0?i:n==null?void 0:n.serviceVersion,environment:(a=h==null?void 0:h["deployment.environment"])!==null&&a!==void 0?a:n==null?void 0:n.environment,resourceAttributes:h,beforeSend:n==null?void 0:n.beforeSend,flushIntervalMs:(l=n==null?void 0:n.flushIntervalMs)!==null&&l!==void 0?l:1e4,maxSeriesPerFlush:(u=n==null?void 0:n.maxSeriesPerFlush)!==null&&u!==void 0?u:1e3}})(r),this.rt)),this.Ul}count(t,e,r){e===void 0&&(e=1),this.Gl().count(t,e,r)}gauge(t,e,r){this.Gl().gauge(t,e,r)}histogram(t,e,r){this.Gl().histogram(t,e,r)}flush(t){if(!this.Ul)return Promise.resolve();if(t){var e=this.Ul.drainWindow();return e&&this.Jt(e,t),Promise.resolve()}return this.Ul.flush().catch((r=>this.rt.error("PostHog metrics flush failed:",r)))}reset(){var t;(t=this.Ul)==null||t.reset()}Vl(){var t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Jt:r=>e.Jt(r),getLibraryId:()=>Er.LIB_NAME,getLibraryVersion:()=>Er.LIB_VERSION}}Jt(t,e){return new Promise((r=>{var n=!1,s=a=>{n||(n=!0,clearTimeout(i),r(a))},i=setTimeout((()=>s({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(Ce({method:"POST",url:this.au(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(a){var l=a.statusCode;if(l>=200&&300>l)s({kind:"ok"});else if(l===413)s({kind:"too-large"});else if(l!==0&&l!==429&&500>l)s({kind:"fatal",error:new Error("metrics request failed with status "+l)});else{var u;s({kind:"retry-later",error:(u=a.error)!==null&&u!==void 0?u:new Error("metrics request failed with status "+l)})}}}))}))}au(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},FQ=Ce({},iw,jQ,CQ,NQ,PQ,RQ,TQ,AQ,IQ,DQ,OQ,MQ,LQ);oa.__defaultExtensionClasses=Ce({},FQ);var $l=(function(){Er.SDK_DIST_CHANNEL="npm";var t=Om[Wh]=new oa;return(function(){function e(){e.done||(e.done=!0,Ez=!1,Ir(Om,(function(r){r._dom_loaded()})))}Ue!=null&&Ue.addEventListener?Ue.readyState==="complete"?e():Jr(Ue,"DOMContentLoaded",e,{capture:!1}):me&&$e.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),t})();const $Q=new Set(["external_user","core_team","system","internal_test"]),zQ=new Set(["viewer","contributor","auditor","administrator","unknown"]),UQ=new Set(["email","orcid","github","google","unknown"]),LE=(t,e,r)=>typeof t=="string"&&e.has(t)?t:r,Cz=t=>LE(t,UQ,"unknown"),BQ=(t,e)=>{const r=t?new Date(t):null;if(!r||Number.isNaN(r.getTime()))return"unknown";const n=Math.max(0,Math.floor((e.getTime()-r.getTime())/864e5));return n===0?"under_1_day":n<=7?"1_7_days":n<=30?"8_30_days":n<=90?"31_90_days":n<=365?"91_365_days":"over_365_days"},VQ=(t,e=new Date)=>{var r,n,s,i;return{set:{account_age_bucket:BQ(t.created_at,e),validation_state:t.email_confirmed_at?"validated":"unvalidated",internal_test:((r=t.app_metadata)==null?void 0:r.internal_test)===!0,permission_type:LE((n=t.app_metadata)==null?void 0:n.permission_type,zQ,"unknown")},setOnce:{authentication_method:Cz((s=t.app_metadata)==null?void 0:s.provider),actor_type:LE((i=t.app_metadata)==null?void 0:i.actor_type,$Q,"external_user")}}},HQ=({client:t,captureCanonical:e,deployment:r,hasConsent:n,now:s=()=>new Date})=>{const i=a=>
413{if(!n())return!1;const l=VQ(a,s());return t.identify(a.id,l.set,l.setOnce),t.register({actor_type:l.setOnce.actor_type,internal_test:l.set.internal_test}),!0};return{identify:i,signedIn(a){var l,u;return i(a)?e("account_signed_in",{account_id:a.id,provider:Cz((l=a.app_metadata)==null?void 0:l.provider),...((u=a.app_metadata)==null?void 0:u.internal_test)===!0?{internal_test:!0}:{}}):!1},signedOut(a,l=n(),u=!1){return l&&e("account_signed_out",{...a?{account_id:a}:{},...u?{internal_test:!0}:{}}),t.reset(),t.register(r),l}}},gS={events:{$pageview:{classification:"behavioral",description:"A consented visitor views a named application page.",funnels:["discovery_led_account","direct_account"],lifecycle:"active",owner:"accounts",producer:"browser",properties:{optional:["path","origin_surface","internal_test"],required:["page_name"]},taxonomy_version:"1.0.0"},account_created:{classification:"behavioral",description:"The account created outcome occurs.",funnels:["discovery_led_account","direct_account"],lifecycle:"active",owner:"accounts",producer:"backend",properties:{optional:["provider","internal_test","first_touch_source","first_touch_medium","first_touch_campaign","first_touch_referrer_domain","first_touch_route","last_touch_source","last_touch_medium","last_touch_campaign","last_touch_referrer_domain","last_touch_route"],required:["account_id","trace_id"]},taxonomy_version:"1.0.0"},account_signed_in:{classification:"behavioral",description:"The account signed in outcome occurs.",funnels:["discovery_led_account","direct_account"],lifecycle:"active",owner:"accounts",producer:"browser",properties:{optional:["account_id","trace_id","internal_test"],required:["provider"]},taxonomy_version:"1.0.0"},account_signed_out:{classification:"behavioral",description:"The account signed out outcome occurs.",funnels:["discovery_led_account","direct_account"],lifecycle:"active",owner:"accounts",producer:"browser",properties:{optional:["account_id","internal_test"],required:[]},taxonomy_version:"1.0.0"},account_signin_failed:{classification:"behavioral",description:"The account signin failed outcome occurs.",funnels:["discovery_led_account","direct_account"],lifecycle:"active",owner:"accounts",producer:"browser",properties:{optional:["provider","trace_id","internal_test"],required:["reason_code"]},taxonomy_version:"1.0.0"},account_signin_submitted:{classification:"behavioral",description:"The account signin submitted outcome occurs.",funnels:["discovery_led_account","direct_account"],lifecycle:"active",owner:"accounts",producer:"browser",properties:{optional:["origin_surface","trace_id","internal_test"],required:["provider"]},taxonomy_version:"1.0.0"},account_signup_failed:{classification:"behavioral",description:"The account signup failed outcome occurs.",funnels:["discovery_led_account","direct_account"],lifecycle:"active",owner:"accounts",producer:"browser",properties:{optional:["provider","stage","trace_id","internal_test","first_touch_source","first_touch_medium","first_touch_campaign","first_touch_referrer_domain","first_touch_route","last_touch_source","last_touch_medium","last_touch_campaign","last_touch_referrer_domain","last_touch_route"],required:["reason_code"]},taxonomy_version:"1.0.0"},account_signup_submitted:{classification:"behavioral",description:"The account signup submitted outcome occurs.",funnels:["discovery_led_account","direct_account"],lifecycle:"active",owner:"accounts",producer:"browser",properties:{optional:["origin_surface","trace_id","internal_test","first_touch_source","first_touch_medium","first_touch_campaign","first_touch_referrer_domain","first_touch_route","last_touch_source","last_touch_medium","last_touch_campaign","last_touch_referrer_domain","last_touch_route"],required:["provider"]},taxonomy_version:"1.0.0"},account_validated:{classification:"behavioral",description:"The account validated outcome occurs.",funnels:["discovery_led_account","direct_account"],lifecycle:"active",owner:"accounts",producer:"backend",properties:{optional:["provider","internal_test","first_touch_source","first_touch_medium","first_touch_campaign","first_touch_referrer_domain","first_touch_route","last_touch_source","last_touch_medium","last_touch_campaign","last_touch_referrer_domain","last_touch_route"],required:["account_id","trace_id"]},taxonomy_version:"1.0.0"}
413,account_validation_failed:{classification:"behavioral",description:"The account validation failed outcome occurs.",funnels:["discovery_led_account","direct_account"],lifecycle:"planned",owner:"accounts",producer:"backend",properties:{optional:["account_id","provider","trace_id","internal_test"],required:["reason_code"]},taxonomy_version:"1.0.0"},analytics_consent_granted:{classification:"behavioral",description:"The analytics consent granted outcome occurs.",funnels:["discovery_led_account","direct_account"],lifecycle:"active",owner:"accounts",producer:"browser",properties:{optional:["internal_test"],required:["consent_method"]},taxonomy_version:"1.0.0"},collection_dataset_opened:{classification:"behavioral",description:"The collection dataset opened outcome occurs.",funnels:["discovery_led_account","data_reuser_activation"],lifecycle:"planned",owner:"discovery",producer:"browser",properties:{optional:["origin_surface","viewer_context","internal_test"],required:["collection_id","dataset_id"]},taxonomy_version:"1.0.0"},collection_opened:{classification:"behavioral",description:"The collection opened outcome occurs.",funnels:["discovery_led_account","data_reuser_activation"],lifecycle:"planned",owner:"discovery",producer:"browser",properties:{optional:["internal_test"],required:["collection_id","origin_surface"]},taxonomy_version:"1.0.0"},contact_intent_expressed:{classification:"behavioral",description:"The contact intent expressed outcome occurs.",funnels:["account_engagement"],lifecycle:"planned",owner:"accounts",producer:"browser",properties:{optional:["origin_surface","internal_test"],required:["contact_source"]},taxonomy_version:"1.0.0"},dataset_access_rule_changed:{classification:"behavioral",description:"The dataset access rule changed outcome occurs.",funnels:["contributor_stewardship"],lifecycle:"planned",owner:"datasets",producer:"backend",properties:{optional:["account_id","trace_id","internal_test"],required:["dataset_id","access_rule"]},taxonomy_version:"1.0.0"},dataset_artifact_available:{classification:"operational",description:"The dataset artifact available outcome occurs.",funnels:["contributor_journey","contributor_value_realization"],lifecycle:"active",owner:"processing",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["dataset_id","processing_invocation_id","artifact_type","pipeline_version","workflow_revision","dataset_size_band"]},taxonomy_version:"1.0.0"},dataset_audit_aoi_removed:{classification:"operational",description:"The dataset audit aoi removed outcome occurs.",funnels:["core_team_operations"],lifecycle:"active",owner:"audit",producer:"backend",properties:{optional:["trace_id","internal_test","audit_aoi_kind"],required:["dataset_id","audit_id","actor_type","audit_status","review_status","audit_aoi_source"]},taxonomy_version:"1.0.0"},dataset_audit_aoi_saved:{classification:"operational",description:"The dataset audit aoi saved outcome occurs.",funnels:["core_team_operations"],lifecycle:"active",owner:"audit",producer:"backend",properties:{optional:["trace_id","internal_test","audit_aoi_kind"],required:["dataset_id","audit_id","actor_type","audit_status","review_status","audit_aoi_source"]},taxonomy_version:"1.0.0"},dataset_audit_draft_saved:{classification:"operational",description:"The dataset audit draft saved outcome occurs.",funnels:["core_team_operations"],lifecycle:"active",owner:"audit",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["dataset_id","audit_id","actor_type","audit_status","review_status","audit_duration_seconds"]},taxonomy_version:"1.0.0"},dataset_audit_metadata_updated:{classification:"operational",description:"The dataset audit metadata updated outcome occurs.",funnels:["core_team_operations"],lifecycle:"active",owner:"audit",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["dataset_id","audit_id","actor_type","changed_fields","audit_status","review_status"]},taxonomy_version:"1.0.0"},dataset_audit_opened:{classification:"behavioral",description:"The dataset audit opened outcome occurs.",funnels:["core_team_operations"],lifecycle:"active",owner:"audit",producer:"browser",properties:{optional:["audit_id","internal_test"],required:["dataset_id","actor_type"]},taxonomy_version:"1.0.0"},dataset_audit_operation_failed:{classification:"operational",description:"The dataset audit operation failed outcome occurs.",funnels:["core_team_operations"],lifecycle:"active",owner:"audit",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["dataset_id","audit_id","actor_type","reason_code","stage"]},taxonomy_version:"1.0.0"},dataset_audit_reopened:{classification:"operational",description:"The dataset audit reopened outcome occurs.",funnels:["core_team_operations"],lifecycle:"active",owner:"audit",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["dataset_id","audit_id","actor_type","audit_status","review_status","audit_duration_seconds","audit_reopen_reason"]},taxonomy_version:"1.0.0"},dataset_audit_reviewed:{classification:"operational",description:"The dataset audit reviewed outcome occurs.",funnels:["core_team_operations"],lifecycle:"active",owner:"audit",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["dataset_id","audit_id","actor_type","decision","audit_status","review_status","audit_duration_seconds"]},taxonomy_version:"1.0.0"},dataset_audit_skipped:{classification:"operational",description:"The dataset audit skipped outcome occurs.",funnels:["core_team_operations"],lifecycle:"active",owner:"audit",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["dataset_id","audit_id","actor_type","audit_status","review_status","audit_duration_seconds","audit_skip_reason"]},taxonomy_version:"1.0.0"},dataset_audit_started:{classification:"operational",description:"The dataset audit started outcome occurs.",funnels:["core_team_operations"],lifecycle:"active",owner:"audit",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["dataset_id","audit_id","actor_type","audit_status","review_status","audit_duration_seconds"]},taxonomy_version:"1.0.0"},dataset_audit_submitted:{classification:"operational",description:"The dataset audit submitted outcome occurs.",funnels:["core_team_operations"],lifecycle:"active",owner:"audit",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["dataset_id","audit_id","actor_type","audit_status","review_status","audit_duration_seconds"]},taxonomy_version:"1.0.0"},dataset_collection_assigned:{classification:"behavioral",description:"The dataset collection assigned outcome occurs.",funnels:["contributor_stewardship"],lifecycle:"active",owner:"datasets",producer:"backend",properties:{optional:["trace_id","actor_type","internal_test"],required:["dataset_id","collection_id"]},taxonomy_version:"1.0.0"},dataset_collection_removed:{classification:"behavioral",description:"The dataset collection removed outcome occurs.",funnels:["contributor_stewardship"],lifecycle:"active",owner:"datasets",producer:"backend",properties:{optional:["trace_id","actor_type","internal_test"],required:["dataset_id","collection_id"]},taxonomy_version:"1.0.0"},dataset_deleted:{classification:"behavioral",description:"The dataset deleted outcome occurs.",funnels:["contributor_stewardship"],lifecycle:"active",owner:"datasets",producer:"backend",properties:{optional:["account_id","trace_id","actor_type","internal_test"],required:["dataset_id"]},taxonomy_version:"1.0.0"},dataset_detail_opened:{classification:"behavioral",description:"The dataset detail opened outcome occurs.",funnels:["discovery_led_account","data_reuser_activation"],lifecycle:"active",owner:"discovery",producer:"browser",properties:{optional:["collection_id","internal_test"],required:["dataset_id","origin_surface"]},taxonomy_version:"1.0.0"},dataset_doi_generated:{classification:"behavioral",description:"The dataset doi generated outcome occurs.",funnels:["contributor_stewardship"],lifecycle:"planned",owner:"datasets",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["dataset_id","doi_provider"]},taxonomy_version:"1.0.0"},dataset_doi_generation_failed:{classification:"behavioral",description:"The dataset doi generation failed outcome occurs.",funnels:["contributor_stewardship"],lifecycle:"planned",owner:"datasets",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["dataset_id","doi_provider","reason_code"]},taxonomy_version:"1.0.0"},dataset_doi_opened:{classification:"behavioral",description:"The dataset doi opened outcome occurs.",funnels:["discovery_led_account","data_reuser_activation"],lifecycle:"planned",owner:"discovery",producer:"browser",properties:{optional:["doi_provider","origin_surface","internal_test"],required:["dataset_id"]},taxonomy_version:"1.0.0"},dataset_edit_failed:{classification:"behavioral",description:"The dataset edit failed outcome occurs.",funnels:["contributor_stewardship"],lifecycle:"active",owner:"datasets",producer:"backend",properties:{optional:["stage","trace_id","actor_type","internal_test"],required:["dataset_id","reason_code"]},taxonomy_version:"1.0.0"},dataset_edit_saved:{classification:"behavioral",description:"The dataset edit saved outcome occurs.",funnels:["contributor_stewardship"],lifecycle:"active",owner:"datasets",producer:"backend",properties:{optional:["account_id","trace_id","actor_type","internal_test"],required:["dataset_id","changed_fields"]},taxonomy_version:"1.0.0"},dataset_edit_started:{classification:"behavioral",description:"The dataset edit started outcome occurs.",funnels:["contributor_stewardship"],lifecycle:"active",owner:"datasets",producer:"browser",properties:{optional:["origin_surface","internal_test"],required:["dataset_id"]},taxonomy_version:"1.0.0"},dataset_filter_applied:{classification:"behavioral",description:"The dataset filter applied outcome occurs.",funnels:["discovery_led_account","data_reuser_activation"],lifecycle:"planned",owner:"discovery",producer:"browser",properties:{optional:["search_context","result_count","origin_surface","internal_test"],required:["filter_key"]},taxonomy_version:"1.0.0"},dataset_record_created:{classification:"operational",description:"The dataset record created outcome occurs.",funnels:["contributor_journey"],lifecycle:"active",owner:"ingestion",producer:"backend",properties:{optional:["account_id","trace_id","internal_test"],required:["dataset_id"]},taxonomy_version:"1.0.0"},dataset_search_performed:{classification:"behavioral",description:"The dataset search performed outcome occurs.",funnels:["discovery_led_account","data_reuser_activation"],lifecycle:"planned",owner:"discovery",producer:"browser",properties:{optional:["result_count","origin_surface","internal_test"],required:["search_context"]},taxonomy_version:"1.0.0"},dataset_supplementary_file_add_failed:{classification:"behavioral",description:"The dataset supplementary file add failed outcome occurs.",funnels:["contributor_stewardship"],lifecycle:"active",owner:"datasets",producer:"backend",properties:{optional:["trace_id","actor_type","internal_test"],required:["dataset_id","supplementary_file_type","reason_code"]},taxonomy_version:"1.0.0"},dataset_supplementary_file_added:{classification:"behavioral",description:"The dataset supplementary file added outcome occurs.",funnels:["contributor_stewardship"],lifecycle:"active",owner:"datasets",producer:"backend",properties:{optional:["file_size_bytes","trace_id","actor_type","internal_test"],required:["dataset_id","supplementary_file_type"]},taxonomy_version:"1.0.0"},dataset_supplementary_file_removed:{classification:"behavioral",description:"The dataset supplementary file removed outcome occurs.",funnels:["contributor_stewardship"],lifecycle:"active",owner:"datasets",producer:"backend",properties:{optional:["trace_id","actor_type","internal_test"],required:["dataset_id","supplementary_file_type"]},taxonomy_version:"1.0.0"},dataset_visibility_changed:{classification:"behavioral",description:"The dataset visibility changed outcome occurs.",funnels:["contributor_stewardship"],lifecycle:"active",owner:"datasets",producer:"backend",properties:{optional:["account_id","trace_id","actor_type","internal_test"],required:["dataset_id","visibility"]},taxonomy_version:"1.0.0"},download_access_blocked:{classification:"operational",description:"The download access blocked outcome occurs.",funnels:["data_reuser_activation","contributor_value_realization"],lifecycle:"active",owner:"downloads",producer:"backend",properties:{optional:["download_context","account_id","trace_id","internal_test"],required:["dataset_id","reason_code"]},taxonomy_version:"1.0.0"},download_configuration_submitted:{classification:"behavioral",description:"The download configuration submitted outcome occurs.",funnels:["data_reuser_activation","contributor_value_realization"],lifecycle:"active",owner:"downloads",producer:"browser",properties:{optional:["download_context","trace_id","internal_test"],required:["dataset_id"]},taxonomy_version:"1.0.0"},download_delivery_confirmed:{classification:"operational",description:"The download delivery confirmed outcome occurs.",funnels:["data_reuser_activation","contributor_value_realization"],lifecycle:"planned",owner:"downloads",producer:"backend",properties:{optional:["download_context","file_size_bytes","trace_id","internal_test"],required:["dataset_id","download_request_id","delivery_channel"]},taxonomy_version:"1.0.0"},download_intent_expressed:{classification:"behavioral",description:"The download intent expressed outcome occurs.",funnels:["data_reuser_activation","contributor_value_realization"],lifecycle:"active",owner:"downloads",producer:"browser",properties:{optional:["internal_test"],required:["dataset_id","origin_surface"]},taxonomy_version:"1.0.0"},download_link_delivered:{classification:"operational",description:"The download link delivered outcome occurs.",funnels:["data_reuser_activation","contributor_value_realization"],lifecycle:"active",owner:"downloads",producer:"backend",properties:{optional:["download_context","expiry_seconds","trace_id","internal_test"],required:["dataset_id","download_request_id","delivery_channel"]},taxonomy_version:"1.0.0"},download_link_delivery_failed:{classification:"operational",description:"The download link delivery failed outcome occurs.",funnels:["data_reuser_activation","contributor_value_realization"],lifecycle:"active",owner:"downloads",producer:"backend",properties:{optional:["download_context","trace_id","internal_test"],required:["dataset_id","download_request_id","delivery_channel","reason_code"]},taxonomy_version:"1.0.0"},download_link_expired:{classification:"operational",description:"The download link expired outcome occurs.",funnels:["data_reuser_activation","contributor_value_realization"],lifecycle:"active",owner:"downloads",producer:"backend",properties:{optional:["download_context","trace_id","internal_test"],required:["dataset_id","download_request_id"]},taxonomy_version:"1.0.0"},download_package_failed:{classification:"operational",description:"The download package failed outcome occurs.",funnels:["data_reuser_activation","contributor_value_realization"],lifecycle:"active",owner:"downloads",producer:"backend",properties:{optional:["download_context","stage","trace_id","internal_test"],required:["dataset_id","download_request_id","reason_code"]},taxonomy_version:"1.0.0"},download_package_ready:{classification:"operational",description:"The download package ready outcome occurs.",funnels:["data_reuser_activation","contributor_value_realization"],lifecycle:"active",owner:"downloads",producer:"backend",properties:{optional:["download_context","expiry_seconds","trace_id","internal_test"],required:["dataset_id","download_request_id"]},taxonomy_version:"1.0.0"},download_package_started:{classification:"operational",description:"The download package started outcome occurs.",funnels:["data_reuser_activation","contributor_value_realization"],lifecycle:"active",owner:"downloads",producer:"backend",properties:{optional:["download_context","trace_id","internal_test"],required:["dataset_id","download_request_id"]},taxonomy_version:"1.0.0"},download_request_created:{classification:"operational",description:"The download r
413equest created outcome occurs.",funnels:["data_reuser_activation","contributor_value_realization"],lifecycle:"active",owner:"downloads",producer:"backend",properties:{optional:["download_context","account_id","trace_id","internal_test"],required:["dataset_id","download_request_id"]},taxonomy_version:"1.0.0"},download_stalled_detected:{classification:"operational",description:"The download stalled detected outcome occurs.",funnels:["data_reuser_activation","contributor_value_realization"],lifecycle:"active",owner:"downloads",producer:"backend",properties:{optional:["download_context","trace_id","internal_test"],required:["dataset_id","download_request_id","stage"]},taxonomy_version:"1.0.0"},download_started:{classification:"operational",description:"The download started outcome occurs.",funnels:["data_reuser_activation","contributor_value_realization"],lifecycle:"active",owner:"downloads",producer:"backend",properties:{optional:["origin_surface","download_context","trace_id","internal_test"],required:["dataset_id","download_request_id"]},taxonomy_version:"1.0.0"},marketing_consent_updated:{classification:"behavioral",description:"The marketing consent updated outcome occurs.",funnels:["discovery_led_account","direct_account"],lifecycle:"active",owner:"accounts",producer:"backend",properties:{optional:["terms_context","trace_id","internal_test"],required:["account_id","marketing_consent"]},taxonomy_version:"1.0.0"},newsletter_signup_completed:{classification:"behavioral",description:"The newsletter signup completed outcome occurs.",funnels:["account_engagement"],lifecycle:"active",owner:"accounts",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["contact_source"]},taxonomy_version:"1.0.0"},newsletter_signup_failed:{classification:"behavioral",description:"The newsletter signup failed outcome occurs.",funnels:["account_engagement"],lifecycle:"active",owner:"accounts",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["contact_source","reason_code"]},taxonomy_version:"1.0.0"},newsletter_signup_submitted:{classification:"behavioral",description:"The newsletter signup submitted outcome occurs.",funnels:["account_engagement"],lifecycle:"active",owner:"accounts",producer:"browser",properties:{optional:["trace_id","internal_test"],required:["contact_source"]},taxonomy_version:"1.0.0"},orcid_connected:{classification:"behavioral",description:"The orcid connected outcome occurs.",funnels:["account_engagement"],lifecycle:"planned",owner:"accounts",producer:"backend",properties:{optional:["trace_id","actor_type","internal_test"],required:["account_id","provider"]},taxonomy_version:"1.0.0"},orcid_connection_failed:{classification:"behavioral",description:"The orcid connection failed outcome occurs.",funnels:["account_engagement"],lifecycle:"planned",owner:"accounts",producer:"backend",properties:{optional:["account_id","trace_id","actor_type","internal_test"],required:["reason_code","provider"]},taxonomy_version:"1.0.0"},orcid_connection_started:{classification:"behavioral",description:"The orcid connection started outcome occurs.",funnels:["account_engagement"],lifecycle:"planned",owner:"accounts",producer:"browser",properties:{optional:["trace_id","internal_test"],required:["provider"]},taxonomy_version:"1.0.0"},orcid_disconnected:{classification:"behavioral",description:"The orcid disconnected outcome occurs.",funnels:["account_engagement"],lifecycle:"planned",owner:"accounts",producer:"backend",properties:{optional:["trace_id","actor_type","internal_test"],required:["account_id","provider"]},taxonomy_version:"1.0.0"},outbound_resource_opened:{classification:"behavioral",description:"The outbound resource opened outcome occurs.",funnels:["account_engagement"],lifecycle:"planned",owner:"accounts",producer:"browser",properties:{optional:["origin_surface","internal_test"],required:["contact_source"]},taxonomy_version:"1.0.0"},password_reset_failed:{classification:"behavioral",description:"The password reset failed outcome occurs.",funnels:["discovery_led_account","direct_account"],lifecycle:"planned",owner:"accounts",producer:"browser",properties:{optional:["provider","trace_id","internal_test"],required:["reason_code"]},taxonomy_version:"1.0.0"},password_reset_requested:{classification:"behavioral",description:"The password reset requested outcome occurs.",funnels:["discovery_led_account","direct_account"],lifecycle:"planned",owner:"accounts",producer:"browser",properties:{optional:["trace_id","internal_test"],required:["provider"]},taxonomy_version:"1.0.0"},password_updated:{classification:"behavioral",description:"The password updated outcome occurs.",funnels:["discovery_led_account","direct_account"],lifecycle:"planned",owner:"accounts",producer:"backend",properties:{optional:["provider","trace_id","internal_test"],required:["account_id"]},taxonomy_version:"1.0.0"},processing_completed:{classification:"operational",description:"The processing completed outcome occurs.",funnels:["contributor_journey","contributor_value_realization"],lifecycle:"active",owner:"processing",producer:"backend",properties:{optional:["processing_latency_seconds","trace_id","internal_test"],required:["dataset_id","processing_invocation_id","pipeline_version","workflow_revision","dataset_size_band"]},taxonomy_version:"1.0.0"},processing_deferred:{classification:"operational",description:"The processing deferred outcome occurs.",funnels:["contributor_journey","contributor_value_realization"],lifecycle:"active",owner:"processing",producer:"backend",properties:{optional:["processing_invocation_id","stage","trace_id","internal_test"],required:["dataset_id","reason_code","pipeline_version","workflow_revision","dataset_size_band"]},taxonomy_version:"1.0.0"},processing_failed:{classification:"operational",description:"The processing failed outcome occurs.",funnels:["contributor_journey","contributor_value_realization"],lifecycle:"active",owner:"processing",producer:"backend",properties:{optional:["stage","trace_id","internal_test"],required:["dataset_id","processing_invocation_id","reason_code","pipeline_version","workflow_revision","dataset_size_band"]},taxonomy_version:"1.0.0"},processing_failure_notified:{classification:"operational",description:"The processing failure notified outcome occurs.",funnels:["contributor_journey","contributor_value_realization"],lifecycle:"active",owner:"processing",producer:"backend",properties:{optional:["reason_code","trace_id","internal_test"],required:["dataset_id","processing_invocation_id","delivery_channel","notification_state","pipeline_version","workflow_revision","dataset_size_band"]},taxonomy_version:"1.0.0"},processing_failure_resolved:{classification:"operational",description:"The processing failure resolved outcome occurs.",funnels:["contributor_journey","contributor_value_realization"],lifecycle:"active",owner:"processing",producer:"backend",properties:{optional:["reason_code","recovery_type","trace_id","internal_test"],required:["dataset_id","processing_invocation_id","recovery_state","pipeline_version","workflow_revision","dataset_size_band"]},taxonomy_version:"1.0.0"},processing_partially_completed:{classification:"operational",description:"The processing partially completed outcome occurs.",funnels:["contributor_journey","contributor_value_realization"],lifecycle:"active",owner:"processing",producer:"backend",properties:{optional:["stage","processing_latency_seconds","trace_id","internal_test"],required:["dataset_id","processing_invocation_id","pipeline_version","workflow_revision","dataset_size_band"]},taxonomy_version:"1.0.0"},processing_queued:{classification:"operational",description:"The processing queued outcome occurs.",funnels:["contributor_journey","contributor_value_realization"],lifecycle:"active",owner:"processing",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["dataset_id","processing_invocation_id","workflow","pipeline_version","workflow_revision","dataset_size_band"]},taxonomy_version:"1.0.0"},processing_resumed:{classification:"operational",description:"The processing resumed outcome occurs.",funnels:["contributor_journey","contributor_value_realization"],lifecycle:"active",owner:"processing",producer:"backend",properties:{optional:["stage","intervention_type","trace_id","internal_test"],required:["dataset_id","processing_invocation_id","stall_episode","pipeline_version","workflow_revision","dataset_size_band"]},taxonomy_version:"1.0.0"},processing_stage_completed:{classification:"operational",description:"The processing stage completed outcome occurs.",funnels:["contributor_journey","contributor_value_realization"],lifecycle:"active",owner:"processing",producer:"backend",properties:{optional:["stage_latency_seconds","trace_id","internal_test"],required:["dataset_id","processing_invocation_id","stage","pipeline_version","workflow_revision","dataset_size_band"]},taxonomy_version:"1.0.0"},processing_stage_failed:{classification:"operational",description:"The processing stage failed outcome occurs.",funnels:["contributor_journey","contributor_value_realization"],lifecycle:"active",owner:"processing",producer:"backend",properties:{optional:["stage_latency_seconds","trace_id","internal_test"],required:["dataset_id","processing_invocation_id","stage","reason_code","pipeline_version","workflow_revision","dataset_size_band"]},taxonomy_version:"1.0.0"},processing_stage_started:{classification:"operational",description:"The processing stage started outcome occurs.",funnels:["contributor_journey","contributor_value_realization"],lifecycle:"active",owner:"processing",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["dataset_id","processing_invocation_id","stage","pipeline_version","workflow_revision","dataset_size_band"]},taxonomy_version:"1.0.0"},processing_stalled_detected:{classification:"operational",description:"The processing stalled detected outcome occurs.",funnels:["contributor_journey","contributor_value_realization"],lifecycle:"active",owner:"processing",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["dataset_id","processing_invocation_id","stage","stall_episode","pipeline_version","workflow_revision","dataset_size_band"]},taxonomy_version:"1.0.0"},processing_started:{classification:"operational",description:"The processing started outcome occurs.",funnels:["contributor_journey","contributor_value_realization"],lifecycle:"active",owner:"processing",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["dataset_id","processing_invocation_id","pipeline_version","workflow_revision","dataset_size_band"]},taxonomy_version:"1.0.0"},profile_update_failed:{classification:"behavioral",description:"The profile update failed outcome occurs.",funnels:["account_engagement"],lifecycle:"planned",owner:"accounts",producer:"backend",properties:{optional:["trace_id","actor_type","internal_test"],required:["account_id","reason_code"]},taxonomy_version:"1.0.0"},profile_updated:{classification:"behavioral",description:"The profile updated outcome occurs.",funnels:["account_engagement"],lifecycle:"planned",owner:"accounts",producer:"backend",properties:{optional:["trace_id","actor_type","internal_test"],required:["account_id","changed_fields"]},taxonomy_version:"1.0.0"},shared_dataset_link_opened:{classification:"behavioral",description:"The shared dataset link opened outcome occurs.",funnels:["discovery_led_account","data_reuser_activation"],lifecycle:"planned",owner:"discovery",producer:"browser",properties:{optional:["origin_surface","internal_test"],required:["dataset_id"]},taxonomy_version:"1.0.0"},terms_accepted:{classification:"behavioral",description:"The terms accepted outcome occurs.",funnels:["discovery_led_account","direct_account"],lifecycle:"active",owner:"accounts",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["account_id","terms_version","terms_context"]},taxonomy_version:"1.0.0"},tool_activated:{classification:"behavioral",description:"The tool activated outcome occurs.",funnels:["contributor_value_realization"],lifecycle:"active",owner:"viewer",producer:"browser",properties:{optional:["origin_surface","viewer_context","internal_test"],required:["dataset_id","tool_key","outcome"]},taxonomy_version:"1.0.0"},tool_completed:{classification:"behavioral",description:"The tool completed outcome occurs.",funnels:["contributor_value_realization"],lifecycle:"active",owner:"viewer",producer:"browser",properties:{optional:["origin_surface","viewer_context","internal_test"],required:["dataset_id","tool_key","outcome"]},taxonomy_version:"1.0.0"},tool_failed:{classification:"behavioral",description:"The tool failed outcome occurs.",funnels:["contributor_value_realization"],lifecycle:"active",owner:"viewer",producer:"browser",properties:{optional:["stage","origin_surface","viewer_context","internal_test"],required:["dataset_id","tool_key","outcome","reason_code"]},taxonomy_version:"1.0.0"},upload_interface_opened:{classification:"behavioral",description:"The upload interface opened outcome occurs.",funnels:["contributor_journey"],lifecycle:"active",owner:"ingestion",producer:"browser",properties:{optional:["internal_test"],required:["origin_surface"]},taxonomy_version:"1.0.0"},upload_session_aborted:{classification:"operational",description:"The upload session aborted outcome occurs.",funnels:["contributor_journey"],lifecycle:"active",owner:"ingestion",producer:"backend",properties:{optional:["reason_code","trace_id","internal_test"],required:["dataset_id","upload_session_id"]},taxonomy_version:"1.0.0"},upload_session_created:{classification:"operational",description:"The upload session created outcome occurs.",funnels:["contributor_journey"],lifecycle:"active",owner:"ingestion",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["dataset_id","upload_session_id"]},taxonomy_version:"1.0.0"},upload_session_expired:{classification:"operational",description:"The upload session expired outcome occurs.",funnels:["contributor_journey"],lifecycle:"active",owner:"ingestion",producer:"backend",properties:{optional:["reason_code","stage","trace_id","internal_test"],required:["dataset_id","upload_session_id"]},taxonomy_version:"1.0.0"},upload_session_resumed:{classification:"behavioral",description:"The upload session resumed outcome occurs.",funnels:["contributor_journey"],lifecycle:"active",owner:"ingestion",producer:"browser",properties:{optional:["progress_milestone","trace_id","internal_test"],required:["dataset_id","upload_session_id"]},taxonomy_version:"1.0.0"},upload_submission_attempted:{classification:"behavioral",description:"The upload submission attempted outcome occurs.",funnels:["contributor_journey"],lifecycle:"active",owner:"ingestion",producer:"browser",properties:{optional:["file_type","file_size_bytes","trace_id","internal_test"],required:[]},taxonomy_version:"1.0.0"},upload_transfer_completed:{classification:"operational",description:"The upload transfer completed outcome occurs.",funnels:["contributor_journey"],lifecycle:"active",owner:"ingestion",producer:"backend",properties:{optional:["file_size_bytes","trace_id","internal_test"],required:["dataset_id","upload_session_id"]},taxonomy_version:"1.0.0"},upload_transfer_failed:{classification:"operational",description:"The upload transfer failed outcome occurs.",funnels:["contributor_journey"],lifecycle:"active",owner:"ingestion",producer:"backend",properties:{optional:["trace_id","internal_test"],required:["dataset_id","upload_session_id","reason_code","stage"]},taxonomy_version:"1.0.0"},upload_transfer_progressed:{classification:"behavioral",description:"The upload transfer progressed outcome occurs.",funnels:["contributor_journey"],lifecycle:"active",owner:"ingestion",producer:"browser",properties:{optional:["file_size_bytes","trace_id","internal_test"],required:["dataset_id","upload_session_id","progress_milestone"]},taxonomy_version:"1.0.0"},upload_transfer_started:{classification:"behavioral",description:"The upload transfer started outcome occurs.",funnels:["contributor_journey"],lifecycle:"active",owner:"ingestion",producer:"browser",properties:{optional:["file_type","file_size_bytes","trace_id","internal_test"],required:["dataset_id","upload_session_id"]},taxonomy_v
413ersion:"1.0.0"},upload_validation_failed:{classification:"behavioral",description:"The upload validation failed outcome occurs.",funnels:["contributor_journey"],lifecycle:"active",owner:"ingestion",producer:"browser",properties:{optional:["file_type","file_size_bytes","trace_id","internal_test"],required:["reason_code","stage"]},taxonomy_version:"1.0.0"},viewer_asset_missing:{classification:"behavioral",description:"The viewer asset missing outcome occurs.",funnels:["contributor_value_realization"],lifecycle:"active",owner:"viewer",producer:"browser",properties:{optional:["origin_surface","viewer_context","internal_test"],required:["dataset_id","artifact_type"]},taxonomy_version:"1.0.0"},viewer_load_failed:{classification:"behavioral",description:"The viewer load failed outcome occurs.",funnels:["contributor_value_realization"],lifecycle:"active",owner:"viewer",producer:"browser",properties:{optional:["stage","origin_surface","viewer_context","internal_test"],required:["dataset_id","reason_code"]},taxonomy_version:"1.0.0"},viewer_loaded:{classification:"behavioral",description:"The viewer loaded outcome occurs.",funnels:["contributor_value_realization"],lifecycle:"active",owner:"viewer",producer:"browser",properties:{optional:["origin_surface","viewer_context","internal_test"],required:["dataset_id","available_tool_keys"]},taxonomy_version:"1.0.0"},viewer_opened:{classification:"behavioral",description:"The viewer opened outcome occurs.",funnels:["contributor_value_realization"],lifecycle:"active",owner:"viewer",producer:"browser",properties:{optional:["internal_test"],required:["dataset_id","origin_surface","viewer_context"]},taxonomy_version:"1.0.0"}},prohibited_properties:["email","name","full_name","organization","research_focus","filename","file_name","signed_url","search_query","raw_error","error_message","audit_notes","audit_comments","aoi_geometry"],property_definitions:{access_rule:{allowed_values:["owner_only","authenticated","public","view_only"],privacy:"controlled_dimension",type:"string"},account_id:{privacy:"operational_identifier",type:"string"},actor_type:{allowed_values:["external_user","core_team","system","internal_test"],privacy:"controlled_dimension",type:"string"},artifact_type:{allowed_values:["standardized_point_cloud","overview","segmentation","point_cloud_viewer","three_d_tiles","processed_archive","metadata"],privacy:"controlled_dimension",type:"string"},audit_aoi_kind:{privacy:"technical_metadata",type:"string"},audit_aoi_source:{allowed_values:["drawn","full_extent","convex_hull"],privacy:"controlled_dimension",type:"string"},audit_duration_seconds:{privacy:"technical_metadata",type:"integer"},audit_id:{privacy:"operational_identifier",type:"string"},audit_reopen_reason:{allowed_values:["submitted_correction","accepted_reassessment","needs_changes_follow_up","skipped_reassessment"],privacy:"controlled_dimension",type:"string"},audit_skip_reason:{allowed_values:["no_visualization","too_sparse","wrong_data_type","processing_incomplete","broken_extent","other"],privacy:"controlled_dimension",type:"string"},audit_status:{allowed_values:["not_started","in_progress","submitted","skipped","needs_changes","accepted"],privacy:"controlled_dimension",type:"string"},available_tool_keys:{privacy:"controlled_dimension",type:"string_array"},changed_fields:{privacy:"controlled_dimension",type:"string_array"},collection_id:{privacy:"operational_identifier",type:"string"},consent_method:{allowed_values:["banner_accept","settings"],privacy:"controlled_dimension",type:"string"},contact_source:{allowed_values:["homepage","dataset_detail","footer","navigation","account"],privacy:"controlled_dimension",type:"string"},dataset_id:{privacy:"operational_identifier",type:"string"},dataset_size_band:{allowed_values:["small","medium","large","very_large","unknown"],privacy:"controlled_dimension",type:"string"},decision:{allowed_values:["accepted","needs_changes","skipped"],privacy:"controlled_dimension",type:"string"},delivery_channel:{allowed_values:["email","linear","tracked_redirect","storage_log"],privacy:"controlled_dimension",type:"string"},doi_provider:{allowed_values:["datacite"],privacy:"controlled_dimension",type:"string"},download_context:{allowed_values:["contributor_processed_result","dataset_reuse"],privacy:"controlled_dimension",type:"string"},download_request_id:{privacy:"operational_identifier",type:"string"},expiry_seconds:{privacy:"technical_metadata",type:"integer"},file_size_bytes:{privacy:"technical_metadata",type:"integer"},file_type:{allowed_values:["las","laz","zip","other"],privacy:"controlled_dimension",type:"string"},filter_key:{allowed_values:["data_type","country","year","species","visibility","license","collection"],privacy:"controlled_dimension",type:"string"},first_touch_campaign:{allowed_values:["none","q3-launch","july-update","town-hall","manuscript-outreach","other"],privacy:"controlled_dimension",type:"string"},first_touch_medium:{allowed_values:["direct","organic","social","email","referral","paid","other"],privacy:"controlled_dimension",type:"string"},first_touch_referrer_domain:{allowed_values:["none","linkedin.com","github.com","3dtrees.earth","google","other"],privacy:"controlled_dimension",type:"string"},first_touch_route:{allowed_values:["/","/map","/about","/legal/terms","/legal/privacy","/legal/impressum","/privacy-policy","/datenschutzerklaerung","/terms-of-service","/login","/sign-up","/auth/signup","/auth/error","/auth/confirm","/auth/verify-code","/forgot-password","/update-password","/logout","/protected","/account","/audit","/audit/:id","/datasets/:id","/unknown"],privacy:"controlled_dimension",type:"string"},first_touch_source:{allowed_values:["direct","google","bing","duckduckgo","linkedin","newsletter","github","doi","shared_link","referral","other"],privacy:"controlled_dimension",type:"string"},internal_test:{privacy:"controlled_dimension",type:"boolean"},intervention_type:{allowed_values:["manual_retry","automatic_retry","provider_recovery","operator_fix","unknown"],privacy:"controlled_dimension",type:"string"},last_touch_campaign:{allowed_values:["none","q3-launch","july-update","town-hall","manuscript-outreach","other"],privacy:"controlled_dimension",type:"string"},last_touch_medium:{allowed_values:["direct","organic","social","email","referral","paid","other"],privacy:"controlled_dimension",type:"string"},last_touch_referrer_domain:{allowed_values:["none","linkedin.com","github.com","3dtrees.earth","google","other"],privacy:"controlled_dimension",type:"string"},last_touch_route:{allowed_values:["/","/map","/about","/legal/terms","/legal/privacy","/legal/impressum","/terms-of-service","/login","/sign-up","/auth/signup","/auth/error","/auth/confirm","/auth/verify-code","/forgot-password","/update-password","/logout","/protected","/account","/audit","/audit/:id","/datasets/:id","/unknown"],privacy:"controlled_dimension",type:"string"},last_touch_source:{allowed_values:["direct","google","bing","duckduckgo","linkedin","newsletter","github","doi","shared_link","referral","other"],privacy:"controlled_dimension",type:"string"},marketing_consent:{privacy:"controlled_dimension",type:"boolean"},notification_state:{allowed_values:["sent"],privacy:"controlled_dimension",type:"string"},origin_surface:{allowed_values:["homepage","map","gallery","search","collection","shared_link","dataset_detail","account","unknown"],privacy:"controlled_dimension",type:"string"},outcome:{allowed_values:["activated","completed","failed"],privacy:"controlled_dimension",type:"string"},page_name:{privacy:"public_metadata",type:"string"},path:{privacy:"public_metadata",type:"string"},pipeline_version:{privacy:"technical_metadata",type:"string"},processing_invocation_id:{privacy:"operational_identifier",type:"string"},processing_latency_seconds:{privacy:"technical_metadata",type:"integer"},progress_milestone:{allowed_values:[25,50,75,90],privacy:"controlled_dimension",type:"integer"},provider:{allowed_values:["email","orcid","github","google","unknown"],privacy:"controlled_dimension",type:"string"}
413,reason_code:{allowed_values:["validation_failed","access_denied","authentication_required","not_found","conflict","rate_limited","network_error","storage_error","processing_error","delivery_error","expired","aborted","timeout","unsupported","configuration_error","provider_error","provider_wait","policy_limit","unknown"],privacy:"controlled_dimension",type:"string"},recovery_state:{allowed_values:["resolved"],privacy:"controlled_dimension",type:"string"},recovery_type:{allowed_values:["manual_reprocess","automatic_retry","provider_recovery","operator_fix","unknown"],privacy:"controlled_dimension",type:"string"},result_count:{privacy:"technical_metadata",type:"integer"},review_status:{allowed_values:["not_reviewed","needs_changes","accepted"],privacy:"controlled_dimension",type:"string"},search_context:{allowed_values:["homepage","map","gallery","collection"],privacy:"controlled_dimension",type:"string"},stage:{allowed_values:["validation","record_creation","session_creation","transfer","upload_intent","upload_transfer","queued","standardization","overview","segmentation","point_cloud_viewer","three_d_tiles","packaging","delivery","notification","verification","audit_save","aoi_save","aoi_remove","submit","skip","review","reopen","metadata_update","unknown"],privacy:"controlled_dimension",type:"string"},stage_latency_seconds:{privacy:"technical_metadata",type:"integer"},stall_episode:{privacy:"technical_metadata",type:"integer"},supplementary_file_type:{allowed_values:["metadata","documentation","derived_data","other"],privacy:"controlled_dimension",type:"string"},terms_context:{allowed_values:["signup","reconsent","settings","upload"],privacy:"controlled_dimension",type:"string"},terms_version:{privacy:"public_metadata",type:"string"},tool_key:{allowed_values:["transect","measurement","point_inspection","navigation"],privacy:"controlled_dimension",type:"string"},trace_id:{privacy:"operational_identifier",type:"string"},upload_session_id:{privacy:"operational_identifier",type:"string"},viewer_context:{allowed_values:["contributor_processed_result","dataset_reuse","internal_audit","unknown"],privacy:"controlled_dimension",type:"string"},visibility:{allowed_values:["public","view_only","private"],privacy:"controlled_dimension",type:"string"},workflow:{allowed_values:["account","discovery","upload","processing","viewer","download","dataset_management","profile","outreach","audit"],privacy:"controlled_dimension",type:"string"},workflow_revision:{privacy:"technical_metadata",type:"string"}}},qQ="1.0.0",WQ="3dtrees:analytics-delivery-failed",GQ="3dtrees:analytics-delivery-health",Nz={autocapture:{dom_event_allowlist:["click"],element_attribute_ignorelist:["value"]},rageclick:!0,capture_pageview:!1,capture_pageleave:!0,capture_heatmaps:!1,capture_performance:{network_timing:!1,web_vitals:!0,web_vitals_attribution:!1},capture_dead_clicks:{element_attribute_ignorelist:["value"]},disable_session_recording:!1,enable_recording_console_log:!1,session_recording:{maskAllInputs:!0,blockSelector:["a[download]",'a[href*="x-amz-" i]','a[href*="signature=" i]','a[href*="token=" i]','img[src^="blob:"]','img[src*="x-amz-" i]','img[src*="signature=" i]','img[src*="token=" i]'].join(", ")}},Pz=(t,e)=>{t.register(e),t.opt_in_capturing(),t.set_config(Nz),t.startSessionRecording()},KQ=new Set(["production","staging"]),tD=t=>{try{const e=new URL(t);return e.pathname=e.pathname.replace(/\/+$/,""),e}catch{return null}},Rz=t=>{if(typeof t!="string")return t;try{const e=new URL(t,"https://3dtrees.earth");return e.search="",e.hash="",t.startsWith("/")?e.pathname:e.toString().replace(/\/$/,"")}catch{return t.split(/[?#]/,1)[0]}},YQ=/(?:authorization|bearer|cookie|email|file_name|metadata|password|payload|query|request_body|response_body|secret|signed_url|token)/i,ZQ=new Set(["AbortError","CanceledError","CancelledError"]),JQ=t=>{if(!t||typeof t!="object")return t;const e=t,r={};for(const n of["type","module","function","lineno","colno","in_app"])n in e&&(r[n]=e[n]);return"filename"in e&&(r.filename=Rz(e.filename)),r},QQ=t=>Array.isArray(t)?t.map(e=>{if(!e||typeof e!="object")return e;const r=e,n=typeof r.type=="string"?r.type:"Exception",s={type:n,value:`${n}: unexpected application failure`};if(r.mechanism&&typeof r.mechanism=="object"){const i=r.mechanism;s.mechanism=Object.fromEntries(["handled","synthetic","type"].filter(a=>a in i).map(a=>[a,i[a]]))}if(r.stacktrace&&typeof r.stacktrace=="object"){const i=r.stacktrace;s.stacktrace={frames:Array.isArray(i.frames)?i.frames.map(JQ):[]}}return s}):t,XQ=t=>{const e=t.$exception_list;return Array.isArray(e)?e.some(r=>{if(!r||typeof r!="object")return!1;const n=r;return typeof n.type=="string"&&ZQ.has(n.type)?!0:typeof n.value=="string"&&(n.value==="ResizeObserver loop limit exceeded"||n.value==="ResizeObserver loop completed with undelivered notifications.")}):!1},eX=t=>{if(!(t!=null&&t.properties))return t;if(t.event==="$autocapture")return null;const e={...t.properties};if(t.event==="$exception"&&XQ(e))return null;for(const r of["$current_url","$pathname"])r in e&&(e[r]=Rz(e[r]));if(delete e.$referrer,delete e.$search_engine,delete e.search_query,t.event==="$rageclick"||t.event==="$dead_click")for(const r of Object.keys(e))(r.startsWith("$element")||r==="$el_text")&&delete e[r];if(t.event==="$exception"){for(const r of Object.keys(e))YQ.test(r)&&r!=="$exception_list"&&delete e[r];e.$exception_list=QQ(e.$exception_list)}return{...t,properties:e}},Lg=t=>{var u,h,p,f;if(t.VITE_PUBLIC_POSTHOG_ENABLED!=="true")return{enabled:!1,reason:"capture_not_enabled"};const e=t.VITE_PUBLIC_POSTHOG_ENVIRONMENT;if(!KQ.has(e))return{enabled:!1,reason:"environment_not_enabled"};const r=(u=t.VITE_PUBLIC_POSTHOG_KEY)==null?void 0:u.trim(),n=(h=t.VITE_PUBLIC_POSTHOG_HOST)==null?void 0:h.trim(),s=(p=t.VITE_PUBLIC_POSTHOG_UI_HOST)==null?void 0:p.trim(),i=(f=t.VITE_PUBLIC_POSTHOG_RELEASE)==null?void 0:f.trim();if(!r||!n||!s||!i)return{enabled:!1,reason:"configuration_incomplete"};const a=tD(n);if(!a||a.protocol!=="https:")return{enabled:!1,reason:"proxy_host_must_use_https"};if(!a.hostname.endsWith(".3dtrees.earth"))return{enabled:!1,reason:"proxy_host_is_not_first_party"};const l=tD(s);return!l||l.origin!=="https://eu.posthog.com"?{enabled:!1,reason:"ui_host_is_not_eu"}:{enabled:!0,environment:e,token:r,apiHost:a.origin,uiHost:"https://eu.posthog.com",release:i}},tX=t=>{var r;const e=globalThis;if(!(!e.dispatchEvent||!e.CustomEvent)){try{(r=e.sessionStorage)==null||r.setItem(GQ,JSON.stringify(t))}catch{}e.dispatchEvent(new e.CustomEvent(WQ,{detail:t}))}},rX=(t,e)=>{let r=0;const n=new URL(t.apiHost).hostname;return s=>{r+=1,e({kind:"analytics_delivery_failed",environment:t.environment,proxyHost:n,statusCode:s.statusCode,failureCountInPage:r})}},nX=(t,e,r=tX,n=!1)=>
413{if(!e.enabled)return!1;const s=rX(e,r);try{return t.init(e.token,{api_host:e.apiHost,ui_host:e.uiHost,person_profiles:"identified_only",persistence:"localStorage",...Nz,capture_exceptions:!1,opt_out_capturing_by_default:!0,opt_out_persistence_by_default:!0,loaded:n?i=>Pz(i,{environment:e.environment,release:e.release}):void 0,before_send:eX,on_request_error:s}),t.register({environment:e.environment,release:e.release}),!0}catch{return s({statusCode:0}),!1}},ef="3dtrees:analytics-attribution:v1",sX=720*60*60*1e3,iX=new Set(["direct","google","bing","duckduckgo","linkedin","newsletter","github","doi","shared_link","referral","other"]),aX=new Set(["direct","organic","social","email","referral","paid","other"]),oX=new Set(["none","q3-launch","july-update","town-hall","manuscript-outreach","other"]),Az=(t,e,r)=>{const n=(t==null?void 0:t.trim().toLowerCase().replace(/\s+/g,"_"))??"";return e.has(n)?n:r},lX=t=>{const e=(t==null?void 0:t.trim().toLowerCase())??"";return e?oX.has(e)?e:"other":"none"},hb=t=>{const e=t.split(/[?#]/,1)[0]||"/";if(/^\/datasets\/[^/]+\/?$/.test(e))return"/datasets/:id";if(/^\/audit\/[^/]+\/?$/.test(e))return"/audit/:id";const r=e.replace(/\/+$/,"")||"/";return new Set(["/","/map","/about","/legal/terms","/legal/privacy","/legal/impressum","/privacy-policy","/datenschutzerklaerung","/terms-of-service","/login","/sign-up","/auth/signup","/auth/error","/auth/confirm","/auth/verify-code","/forgot-password","/update-password","/logout","/protected","/account","/audit"]).has(r)?r:"/unknown"},Tz=t=>{if(!t)return"none";try{const e=new URL(t).hostname.toLowerCase().replace(/^www\./,"");return e==="linkedin.com"||e.endsWith(".linkedin.com")?"linkedin.com":e==="github.com"||e.endsWith(".github.com")?"github.com":e==="3dtrees.earth"||e.endsWith(".3dtrees.earth")?"3dtrees.earth":e==="google.com"||e.startsWith("google.")?"google":"other"}catch{return"none"}},cX=(t,e)=>{const r=t.searchParams.get("utm_source");if(r)return Az(r,iX,"other");const n=Tz(e);return n==="none"||n==="3dtrees.earth"?"direct":n==="google"?"google":n==="linkedin.com"?"linkedin":n==="github.com"?"github":"referral"},uX=(t,e)=>{const r=t.searchParams.get("utm_medium");return r?Az(r,aX,"other"):e==="direct"?"direct":e==="google"||e==="bing"||e==="duckduckgo"?"organic":e==="linkedin"?"social":e==="newsletter"?"email":"referral"},dX=t=>{try{const e=t.getItem(ef);return e?JSON.parse(e):null}catch{return null}},Iz=({storage:t,hasConsent:e,now:r=()=>new Date})=>{const n=()=>
413{if(!e())return null;const s=dX(t);return s?new Date(s.expiresAt).getTime()<=r().getTime()?(t.removeItem(ef),null):s:null};return{current:n,clear(){t.removeItem(ef)},recordVisit({url:s,referrer:i}){if(!e())return null;const a=new URL(s),l=r(),u=cX(a,i),h={source:u,medium:uX(a,u),campaign:lX(a.searchParams.get("utm_campaign")),referrerDomain:Tz(i),route:hb(a.pathname),occurredAt:l.toISOString()},p=n(),f=a.searchParams.has("utm_source")||a.searchParams.has("utm_medium")||a.searchParams.has("utm_campaign")||h.referrerDomain!=="none"&&h.referrerDomain!=="3dtrees.earth",g={firstTouch:(p==null?void 0:p.firstTouch)??h,lastMeaningfulTouch:p&&!f?p.lastMeaningfulTouch:h,expiresAt:(p==null?void 0:p.expiresAt)??new Date(l.getTime()+sX).toISOString()};return t.setItem(ef,JSON.stringify(g)),g},recordInteraction(s){const i=n();if(!i)return null;const a=hb(s);if(!new Set(["/","/map","/datasets/:id"]).has(a))return i;const l={...i,lastMeaningfulTouch:{...i.lastMeaningfulTouch,route:a,occurredAt:r().toISOString()}};return t.setItem(ef,JSON.stringify(l)),l}}},hX=t=>({first_touch_source:t.firstTouch.source,first_touch_medium:t.firstTouch.medium,first_touch_campaign:t.firstTouch.campaign,first_touch_referrer_domain:t.firstTouch.referrerDomain,first_touch_route:t.firstTouch.route,last_touch_source:t.lastMeaningfulTouch.source,last_touch_medium:t.lastMeaningfulTouch.medium,last_touch_campaign:t.lastMeaningfulTouch.campaign,last_touch_referrer_domain:t.lastMeaningfulTouch.referrerDomain,last_touch_route:t.lastMeaningfulTouch.route}),JC="/embed/datasets";function oSe(t,e,r){const n=new URL(`/datasets/${encodeURIComponent(t)}`,r);return n.searchParams.set("viewer",e),n.toString()}const fX=t=>t==="public"||t==="view_only",Dz=t=>Um(`${JC}/:id`,t)!==null,pX=t=>t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function lSe(t){try{const e=new URL(t),r=e.pathname.match(/^\/datasets\/(\d+)\/?$/);if(!r||!["https:","http:"].includes(e.protocol))return null;const n=new URL(`${JC}/${r[1]}`,e.origin),s=e.searchParams.get("viewer");return s&&n.searchParams.set("viewer",s),`<iframe src="${pX(n.toString())}" title="3Dtrees dataset viewer" width="100%" height="600" style="border:0" loading="lazy" allow="fullscreen; clipboard-write" allowfullscreen></iframe>`}catch{return null}}const ig="3dtrees:analytics-consent-changed",mX=365*24*60*60*1e3,gX=()=>typeof localStorage>"u"?null:localStorage,fb=(t=gX(),e=Date.now())=>{if(!t)return{decision:null,isCurrent:!1,consented:!1};const r=t.getItem("cookie-consent"),n=r==="accepted"||r==="rejected"?r:null,s=t.getItem("cookie-consent-date"),i=s&&/^\d+$/.test(s)?Number(s):Number.NaN,a=n!==null&&Number.isSafeInteger(i)&&i>0&&i<=e&&e-i<=mX;return{decision:n,isCurrent:a,consented:a&&n==="accepted"}},zo=()=>!(typeof window<"u"&&Dz(window.location.pathname))&&fb().consented,vX=()=>{typeof localStorage<"u"&&localStorage.removeItem(ef)},rD=()=>{typeof window<"u"&&window.dispatchEvent(new Event(ig))},uf=async(t,e)=>{var i,a;const{data:r}=await t.getSession(),n=(i=r.session)==null?void 0:i.user;if(!n)return!1;if(((a=n.user_metadata)==null?void 0:a.analytics_consent)===e)return!0;const{error:s}=await t.updateUser({data:{analytics_consent:e}});if(s)throw new Error("Analytics consent synchronization failed");return!0},yX={VITE_PUBLIC_POSTHOG_ENABLED:"true",VITE_PUBLIC_POSTHOG_ENVIRONMENT:"production",VITE_PUBLIC_POSTHOG_HOST:"https://canopy.3dtrees.earth",VITE_PUBLIC_POSTHOG_KEY:"phc_x6VTLIMGNNccCbnvkWLj8K2aAr9LiIUNadEECXqsZv1",VITE_PUBLIC_POSTHOG_RELEASE:"be93fd5adde5bee951c16bee082c50e2f7a7cdf3",VITE_PUBLIC_POSTHOG_UI_HOST:"https://eu.posthog.com"};class kc extends Error{constructor(e){super(e),this.name="AnalyticsContractError"}}const _X=new Set(["account_signin_submitted","account_signin_failed","account_signed_in","account_signed_out"]),bX=(t,e)=>e==="integer"?typeof t=="number"&&Number.isInteger(t):e==="string_array"?Array.isArray(t)&&t.every(r=>typeof r=="string"):typeof t===e,wX=(t,e)=>{const r=gS.events[t];if(!r)throw new kc(`Unknown canonical analytics event: ${t}`);if(r.producer!=="browser")throw new kc(`${t} is owned by the ${r.producer} producer`);if(r.lifecycle!=="active")throw new kc(`${t} is not active`);const n=new Set(gS.prohibited_properties),s=new Set(r.properties.required),i=new Set(r.properties.optional);for(const a of Object.keys(e)){if(n.has(a))throw new kc(`${a} is a prohibited analytics property`);
413if(!s.has(a)&&!i.has(a))throw new kc(`${a} is not allowed for ${t}`);const l=gS.property_definitions[a];if(!l||!bX(e[a],l.type))throw new kc(`${a} has an invalid property type`);if("allowed_values"in l&&!l.allowed_values.includes(e[a]))throw new kc(`${a} has an uncontrolled value`)}for(const a of s)if(!(a in e))throw new kc(`${a} is required for ${t}`);return r},xX=t=>({capture(e,r){const n=wX(e,r);if(!(t.environment==="production"||t.environment==="staging"&&t.stagingEnabled===!0)||n.classification==="behavioral"&&!t.consented)return!1;try{const i=_X.has(e)?{sendInstantly:!0}:void 0;return t.transport.capture(e,{...r,environment:t.environment,occurred_at:new Date().toISOString(),producer:"browser",release:t.release,taxonomy_version:qQ},i),!0}catch(i){return console.error("Canonical analytics delivery failed",i),!1}}}),es=(t,e)=>{const r=Lg(yX),n="be93fd5adde5bee951c16bee082c50e2f7a7cdf3".trim();if(!r.enabled||!n)return!1;const s=r.environment==="production"?"production":"staging";return xX({environment:s,release:n,consented:zo(),stagingEnabled:s==="staging",transport:{capture:(i,a,l)=>$l.capture(i,a,l!=null&&l.sendInstantly?{send_instantly:!0}:void 0)}}).capture(t,e)},SX=()=>{var t;try{return((t=$l.get_session_id)==null?void 0:t.call($l))||void 0}catch{return}},kX={VITE_PUBLIC_POSTHOG_ENABLED:"true",VITE_PUBLIC_POSTHOG_ENVIRONMENT:"production",VITE_PUBLIC_POSTHOG_HOST:"https://canopy.3dtrees.earth",VITE_PUBLIC_POSTHOG_KEY:"phc_x6VTLIMGNNccCbnvkWLj8K2aAr9LiIUNadEECXqsZv1",VITE_PUBLIC_POSTHOG_RELEASE:"be93fd5adde5bee951c16bee082c50e2f7a7cdf3",VITE_PUBLIC_POSTHOG_UI_HOST:"https://eu.posthog.com"},Oz=y.createContext(void 0),vS=Lg(kX),jn=vS.enabled?HQ({client:$l,captureCanonical:es,deployment:{environment:vS.environment,release:vS.release},hasConsent:zo}):null;function EX({children:t}){const[e,r]=y.useState(null),[n,s]=y.useState(!0),i=y.useRef(null);y.useEffect(()=>{(async()=>{try{const{data:{session:p}}=await Ye.auth.getSession(),f=(p==null?void 0:p.user)??null;if(i.current=f,r(f),f){const g=fb();g.decision&&uf(Ye.auth,g.consented).catch(()=>console.error("Failed to synchronize analytics consent")),jn==null||jn.identify(f)}else jn==null||jn.signedOut(void 0,!1)}catch(p){console.error("Failed to restore auth session:",p),i.current=null,r(null),jn==null||jn.signedOut(void 0,!1);try{await Ye.auth.signOut({scope:"local"})}catch(f){console.error("Failed to clear invalid auth session:",f)}}finally{s(!1)}})();const{data:{subscription:u}}=Ye.auth.onAuthStateChange((p,f)=>{var _;const g=(f==null?void 0:f.user)??null,v=i.current;if(i.current=g,r(g),s(!1),p==="SIGNED_IN"&&g){const x=fb();x.decision&&uf(Ye.auth,x.consented).catch(()=>console.error("Failed to synchronize analytics consent")),jn==null||jn.signedIn(g)}else p==="SIGNED_OUT"?jn==null||jn.signedOut(v==null?void 0:v.id,void 0,((_=v==null?void 0:v.app_metadata)==null?void 0:_.internal_test)===!0):p==="TOKEN_REFRESHED"&&g&&(jn==null||jn.identify(g))}),h=()=>{if(!i.current)return;const p=zo();uf(Ye.auth,p).catch(()=>console.error("Failed to update analytics consent state")),p&&(jn==null||jn.identify(i.current))};return window.addEventListener(ig,h),()=>{u.unsubscribe(),window.removeEventListener(ig,h)}},[]);const a=y.useMemo(()=>({user:e,loading:n}),[e,n]);return o.jsx(Oz.Provider,{value:a,children:t})}function Fg(){const t=y.useContext(Oz);if(!t)throw new Error("useAuthState must be used within an AuthProvider");return t}function Ql(){const{user:t,loading:e}=Fg(),r=Vo();return{user:t,loading:e,signOut:async()=>{try{await Ye.auth.signOut(),r("/login")}catch(s){console.error("Error signing out:",s)}}}}const Ht={auth:{session:["auth","session"]},datasets:{hasUploaded:t=>["datasets","has-uploaded",t??"anonymous"],mine:t=>["datasets","mine",t??"anonymous"],mineArchived:t=>["datasets","mine-archived",t??"anonymous"],coreTeam:t=>["datasets","core-team",t??"anonymous"],platformAdmin:t=>["datasets","platform-admin",t??"anonymous"],platformAdminArchived:t=>["datasets","platform-admin-archived",t??"anonymous"],adminEmails:(t,e)=>["datasets","admin-emails",t??"anonymous",...e],publicGallery:(t,e)=>["datasets","public","gallery",t??"anonymous",e],homepageMosaic:(t,e,r)=>["datasets","public","homepage-mosaic",t??"anonymous",r,...e],publicMap:t=>["datasets","public","map",t??"anonymous"],publicMapGeometries:t=>["datasets","public","map-geometries",t??"anonymous"],stats:t=>["datasets","stats",t??"anonymous"],details:t=>["datasets","details",t],embed:t=>["datasets","embed",t]},audit:{permissions:t=>["audit","permissions",t??"anonymous"],queue:t=>["audit","queue",t??"anonymous"],queueRow:t=>["audit","queue-row",t],detail:t=>["audit","detail",t],aoi:t=>["audit","aoi",t],aoiKinds:["audit","aoi-kinds"],tagOptions:["audit","tag-options"]},downloads:{mine:t=>["downloads","mine",t??"anonymous"],allowanceAll:t=>["downloads","allowance",t??"anonymous"],allowance:(t,e)=>["downloads","allowance",t??"anonymous",e]},ingestions:{capabilities:["ingestions","capabilities"]},collections:{mine:t=>["collections","mine",t??"anonymous"],allForCoreTeam:t=>["collections","all-core-team",t??"anonymous"],allForPlatformAdmin:t=>["collections","all-platform-admin",t??"anonymous"],datasetAssignments:t=>["collections","dataset-assignments",t??"anonymous"]},uploadTemplates:{mine:t=>["upload-templates","mine",t??"anonymous"]}},nD=()=>{var t;if(typeof((t=globalThis.crypto)==null?void 0:t.randomUUID)=="function")return globalThis.crypto.randomUUID();throw new Error("This browser cannot create a secure audit operation identifier.")};function qo(){return{operationId:nD(),traceId:nD()}}function cSe(t,e){return es("dataset_audit_opened",{actor_type:"core_team",dataset_id:String(t),...e?{audit_id:e}:{}})}
413class jX extends Error{constructor(r,n){super(`Audit operation failed (${r})`);En(this,"reasonCode");En(this,"stage");this.name="AuditDomainError",this.reasonCode=r,this.stage=n}}const CX=t=>{if(!t||typeof t!="object")return!1;const e=t;return e.ok===!1&&typeof e.reason_code=="string"&&typeof e.stage=="string"};async function QC(t,e,r=qo(),n){var u;const s=h=>({...h,p_operation_id:r.operationId,p_trace_id:r.traceId});let i=await Ye.rpc(t,s(e));((u=i.error)==null?void 0:u.code)==="PGRST202"&&n&&(i=await Ye.rpc(t,s(n)));const{data:a,error:l}=i;if(l)throw l;if(CX(a))throw new jX(a.reason_code,a.stage);if(!a||typeof a!="object"||a.ok!==!0)throw new Error("Audit operation returned an invalid response.");return a}async function aw(t,e,r,n=qo(),s){const i=await QC(t,e,n,s);if(!r)return;const a=i[r];if(a===void 0)throw new Error("Audit operation did not return its updated record.");return a}const sD={is_core_team:!1,can_view_all_datasets:!1,can_edit_dataset_metadata:!1,can_manage_dataset_lifecycle:!1,can_trigger_processing:!1,can_audit_datasets:!1,can_review_audits:!1},Da=t=>{if(t==null)return null;const e=t.trim();return e.length>0?e:null},Mz=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),Lz=t=>t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,""),yS=t=>t==null||!Number.isFinite(t)?0:Math.max(0,Math.min(100,Math.round(t))),Fz=t=>{const e={},r=(n,s)=>{s!==void 0&&(e[n]=s)};return r("expected_audit_revision",t.expectedAuditRevision),r("audit_status",t.auditStatus),r("review_status",t.reviewStatus),r("reviewer_user_id",t.reviewerUserId),r("final_grade",t.finalGrade),r("research_grade",t.researchGrade),r("canopy_occlusion_percent",t.canopyOcclusionPercent===void 0?void 0:yS(t.canopyOcclusionPercent)),r("understory_occlusion_percent",t.understoryOcclusionPercent===void 0?void 0:yS(t.understoryOcclusionPercent)),r("disturbance_percent",t.disturbancePercent===void 0?void 0:yS(t.disturbancePercent)),r("system_types",t.systemTypes),r("point_cloud_usability",t.pointCloudUsability===void 0?void 0:Da(t.pointCloudUsability)),r("canopy_coverage_quality",t.canopyCoverageQuality===void 0?void 0:Da(t.canopyCoverageQuality)),r("occlusion_notes",t.occlusionNotes===void 0?void 0:Da(t.occlusionNotes)),r("data_density_notes",t.dataDensityNotes===void 0?void 0:Da(t.dataDensityNotes)),r("registration_quality",t.registrationQuality===void 0?void 0:Da(t.registrationQuality)),r("metadata_completeness",t.metadataCompleteness===void 0?void 0:Da(t.metadataCompleteness)),r("system_type",t.systemType===void 0?void 0:Da(t.systemType)),r("management_level",t.managementLevel===void 0?void 0:Da(t.managementLevel)),r("characteristic_tags",t.characteristicTags),r("criteria",t.criteria),r("audit_notes",t.auditNotes===void 0?void 0:Da(t.auditNotes)),r("review_comment",t.reviewComment===void 0?void 0:Da(t.reviewComment)),r("aoi_status",t.aoiStatus),r("aoi_skip_reason",t.aoiSkipReason),r("aoi_skip_notes",t.aoiSkipNotes===void 0?void 0:Da(t.aoiSkipNotes)),r("audit_duration_seconds",t.auditDurationSeconds===void 0?void 0:Math.max(0,Math.round(t.auditDurationSeconds))),e};async function NX(){const{data:t,error:e}=await Ye.rpc("get_my_core_team_permissions");if(e)throw e;const r=Array.isArray(t)?t[0]:t;return r?{...sD,...r}:sD}function XC(t){return{queryKey:Ht.audit.permissions(t),enabled:!!t,queryFn:NX}}async function PX(){const{data:t,error:e}=await Ye.rpc("get_dataset_audit_queue");if(e)throw e;return t??[]}function uSe(t){return{queryKey:Ht.audit.queue(t),enabled:!!t,queryFn:PX}}async function RX(){const{data:t,error:e}=await Ye.from("dataset_audit_tag_options").select("*").eq("active",!0).order("label",{ascending:!0});if(e)throw e;return t??[]}function dSe(t){return{queryKey:Ht.audit.tagOptions,enabled:!!t,queryFn:RX}}async function hSe(t,e,r){const n=Lz(t);if(!n)throw new Error("Tag must include at least one letter or number.");const s=e.trim()||Mz(n),{data:i,error:a}=await Ye.from("dataset_audit_tag_options").upsert({slug:n,label:s,active:!0,created_by:r,updated_by:r},{onConflict:"slug"}).select("*").single();if(a)throw a;return i}async function e1(t,e){const r=Array.from(new Set((t??[]).map(Lz).filter(
413Boolean)));if(r.length===0)return;const{error:n}=await Ye.from("dataset_audit_tag_options").upsert(r.map(s=>({slug:s,label:Mz(s),active:!0,created_by:e,updated_by:e})),{onConflict:"slug",ignoreDuplicates:!0});if(n)throw n}async function fSe(t){const{data:e,error:r}=await Ye.rpc("get_dataset_audit_queue_row",{p_dataset_id:t});if(r)throw r;return(e??[])[0]??null}async function AX(t){const{data:e,error:r}=await Ye.from("dataset_audits").select("*").eq("dataset_id",t).maybeSingle();if(r)throw r;return e}function pSe(t){return{queryKey:Ht.audit.detail(t),queryFn:()=>AX(t)}}const $g="forest",iD=[{slug:$g,label:"Forest AOI",description:null,sort_order:10,active:!0}];async function TX(t){const{data:e,error:r}=await Ye.from("dataset_audit_aois").select("*").eq("dataset_id",t);if(r)throw r;return(e??[]).map(n=>({...n,aoi_kind:n.aoi_kind??$g}))}function mSe(t){return{queryKey:Ht.audit.aoi(t),queryFn:()=>TX(t)}}async function IX(){const{data:t,error:e}=await Ye.from("dataset_audit_aoi_kinds").select("slug, label, description, sort_order, active").eq("active",!0).order("sort_order",{ascending:!0});if((e==null?void 0:e.code)==="PGRST205"||(e==null?void 0:e.code)==="42P01")return iD;if(e)throw e;const r=t??[];return r.length>0?r:iD}function gSe(){return{queryKey:Ht.audit.aoiKinds,queryFn:IX,staleTime:1/0}}async function vSe(t,e=qo()){return await e1(t.characteristicTags,t.userId),aw("save_dataset_audit_with_analytics",{p_action:"save_draft",p_audit:Fz(t),p_dataset_id:t.datasetId},"audit",e)}async function ySe(t,e=qo()){return await e1(t.characteristicTags,t.userId),await $z(t,t.aoiStatus==="skipped"?"skip":"submit",void 0,e)}async function _Se(t,e=qo()){return await e1(t.characteristicTags,t.userId),$z(t,"review",t.decision,e)}async function $z(t,e,r,n=qo()){const s=Fz(t);return r!==void 0&&(s.decision=r),aw("save_dataset_audit_with_analytics",{p_action:e,p_audit:s,p_dataset_id:t.datasetId},"audit",n)}async function bSe(t,e,r=qo()){return aw("reopen_dataset_audit_with_analytics",{p_dataset_id:t,p_expected_audit_revision:e},"audit",r,{p_dataset_id:t})}async function wSe(t,e,r,n,s="drawn",i=null,a=qo(),l=$g){const u=await QC("save_dataset_audit_aoi_with_analytics",{p_aoi_kind:l,p_aoi_source:s,p_dataset_id:t,p_expected_audit_revision:r,p_exclusion_geometry:i,p_geometry:n},a,zz(l,{p_aoi_source:s,p_dataset_id:t,p_expected_audit_revision:r,p_exclusion_geometry:i,p_geometry:n}));if(!u.aoi)throw new Error("Audit AOI operation did not return its updated AOI.");return{aoi:u.aoi,audit:u.audit?u.audit:null}}async function xSe(t,e,r,n=qo(),s=$g){const i=await QC("remove_dataset_audit_aoi_with_analytics",{p_aoi_kind:s,p_dataset_id:t,p_expected_audit_revision:r},n,zz(s,{p_dataset_id:t,p_expected_audit_revision:r}));return i.audit?i.audit:null}function zz(t,e){return t===$g?e:void 0}async function SSe(t,e,r,n=qo()){const s=new Set(["title","description","acquisition_date","platform","sensor","scan_pattern","preprocessing_steps","coordinate_accuracy","coordinate_reference","point_attributes_description","visibility","license_id","rights_warranty_at"]),i=Object.fromEntries(Object.entries(e.updates).filter(([a])=>s.has(a)));return aw("update_dataset_metadata_for_audit_with_analytics",{p_dataset_id:t,p_authors:e.authors,p_funding:e.funding,p_replace_authors:!0,p_replace_funding:!0,p_reason:r,p_updates:i},"dataset",n)}function kSe(t,e){return{...t,audit_status:e.audit_status??t.audit_status,review_status:e.review_status??t.review_status,auditor_user_id:e.auditor_user_id??t.auditor_user_id,reviewer_user_id:e.reviewer_user_id??t.reviewer_user_id,final_grade:e.final_grade??t.final_grade,research_grade:e.research_grade??t.research_grade,aoi_status:e.aoi_status??t.aoi_status,aoi_skip_reason:e.aoi_skip_reason??t.aoi_skip_reason,audit_duration_seconds:e.audit_duration_seconds??t.audit_duration_seconds,audit_updated_at:e.updated_at??t.audit_updated_at,submitted_at:e.submitted_at??t.submitted_at,reviewed_at:e.reviewed_at??t.reviewed_at,accepted_at:e.accepted_at??t.accepted_at,checklist_version:e.checklist_version??t.checklist_version}}function ESe(t,e,r,n){t.setQueryData(Ht.audit.queue(e),s=>s&&s.map(i=>i.id!==r?i:{...i,audit_status:"not_started",review_status:"not_reviewed",auditor_user_id:null,reviewer_user_id:null,final_grade:null,research_grade:null,aoi_status:"required",aoi_skip_reason:null,audit_duration_seconds:0,audit_updated_at:null,submitted_at:null,reviewed_at:null,accepted_at:null}))}function DX(){var p,f,g;const{user:t,loading:e,signOut:r}=Ql(),n=Vo(),s=Hs(),i=fr(XC(t==null?void 0:t.id)),a=!!((p=i.data)!=null&&p.can_audit_datasets)||!!((f=i.data)!=null&&f.can_review_audits)||!!((g=i.data)!=null&&g.can_manage_dataset_lifecycle),l=()=>s.pathname==="/"?"home":s.pathname.startsWith("/map")?"map":s.pathname.startsWith("/audit")?"audit":s.pathname.startsWith("/account")?"account":s.pathname.startsWith("/about")?"about":"home",u=v=>{v==="home"?n("/"):v==="map"?n("/map"):v==="audit"?n("/audit"):v==="account"?n("/account"):v==="about"&&n("/about")},h=async()=>{t?await r():n("/login")};return o.jsx("header",{className:"sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:o.jsxs("div",{className:"container mx-auto px-2 sm:px-4 md:px-6 flex h-14 items-center",children:[o.jsx("div",{className:"mr-4 hidden md:flex",children:o.jsxs("div",{className:"mr-6 flex items-center space-x-2 cursor-pointer",onClick:()=>n("/"),children:[o.jsx("img",{src:"/images/3dtrees-logo-96.png",alt:"3Dtrees.earth logo",className:"h-8 w-auto"}),o.jsx("span",{className:"hidden font-bold sm:inline-block bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600 bg-clip-text text-transparent",children:"3Dtrees.earth"})]})}),o.jsxs("div",{className:"flex flex-1 items-center justify-between space-x-1 sm:space-x-2 md:justify-end",children:[o.jsx("div",{className:"w-full flex-1 md:w-auto md:flex-none",children:o.jsx("div",{className:"flex md:hidden",children:o.jsxs("div",{className:"flex items-center space-x-1.5 cursor-pointer",onClick:()=>n("/"),children:[o.jsx("img",{src:"/images/3dtrees-logo-96.png",alt:"3Dtrees.earth Logo",className:"h-7 w-auto"}),o.jsx("span",{className:"font-bold text-sm bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600 bg-clip-text text-transparent",children:"3Dtrees"})]})})}),o.jsxs("div",{className:"flex items-center space-x-1 sm:space-x-4",children:[o.jsx(Dg,{value:l(),onValueChange:u,children:o.jsxs(Og,{className:"h-8 sm:h-9",children:[o.jsx(Is,{value:"home",className:"text-xs sm:text-sm px-2 sm:px-3",children:"Home"}),o.jsx(Is,{value:"map",className:"text-xs sm:text-sm px-2 sm:px-3",children:"Map"}),a&&o.jsx(Is,{value:"audit",className:"text-xs sm:text-sm px-2 sm:px-3",children:"Audit"}),t&&o.jsx(Is,{value:"account",className:"text-xs sm:text-sm px-2 sm:px-3",children:"Account"}),o.jsx(Is,{value:"about",className:ke("text-xs sm:text-sm px-2 sm:px-3",t&&"hidden sm:inline-flex"),children:"About"})]})}),o.jsx(we,{asChild:!0,size:"sm",variant:"outline",className:"hidden sm:inline-flex",children:o.jsx("a",{href:"mailto:[email protected]","aria-label":"Contact support by email",children:"Contact"})}),o.jsx(we,{asChild:!0,size:"icon",variant:"ghost",className:"sm:hidden h-8 w-8",children:o.jsx("a",{href:"mailto:[email protected]","aria-label":"Contact support by email",children:o.jsx(L9,{className:"h-4 w-4"})})}),!e&&o.jsxs(o.Fragment,{children:[o.jsx(we,{onClick:h,size:"sm",variant:"outline",className:"hidden sm:inline-flex",children:t?"Log out":"Log in"}),o.jsx(we,{onClick:h,size:"icon",variant:"ghost",className:"sm:hidden h-8 w-8","aria-label":t?"Log out":"Log in",children:t?o.jsx(O9,{className:"h-4 w-4"}):o.jsx(I9,{className:"h-4 w-4"})})]})]})]})]})})}const Uz=y.createContext(void 0),t1=()=>{const t=y.useContext(Uz);if(!t)throw new Error("useUploadProgress must be used within an UploadProgressProvider");return t},OX=({children:t})=>{const[e,r]=y.useState({}),i={uploads:e,setUploadProgress:(a,l)=>{r(u=>({...u,[a]:l}))},removeUploadProgress:a=>{r(l=>{const u={...l};return delete u[a],u})}};return o.jsx(Uz.Provider,{value:i,children:t})},Bz=y.createContext(void 0);function MX({children:t}){const[e,r]=y.useState(null),n=()=>r(null);return o.jsx(Bz.Provider,{value:{viewport:e,setViewport:r,clearViewport:n},children:t})}function jSe(){const t=y.useContext(Bz);if(!t)throw new Error("useMapViewport must be used within MapViewportProvider");return t}function FE(t,e,r){let n=!0,s=!1;r==null||r(!1);const i=a=>{!n||s===a||(s=a,r==null||r(a),a&&e())};return t.on("system",{},a=>{a.extension==="postgres_changes"&&i(a.status==="ok")}).subscribe(a=>{a!=="SUBSCRIBED"&&i(!1)}),()=>{n&&(n=!1,t.unsubscribe())}}const LX="download_allowance_exhausted";
413class Vz extends Error{constructor(r,n,s){super(r);En(this,"limit");En(this,"resetsAt");this.name="DownloadAllowanceExhaustedError",this.limit=n,this.resetsAt=s}}class r1 extends Error{constructor(r,n){super(r instanceof Error?r.message:"Failed to fetch download links");En(this,"artifacts");En(this,"failure");this.name="PartialArtifactDownloadsError",this.artifacts=n,this.failure=r}}async function Bu(t,e){const n=(await t.json().catch(()=>({}))).detail;return t.status===429&&typeof n=="object"&&(n==null?void 0:n.code)===LX&&n.resets_at?new Vz(n.message||"You have reached today's download limit.",n.limit??0,n.resets_at):typeof n=="string"&&n?new Error(n):typeof n=="object"&&(n!=null&&n.message)?new Error(n.message):new Error(`${e} (${t.status})`)}class FX{constructor(e){En(this,"baseUrl");this.baseUrl=e||"https://api.3dtrees.earth"}async getSessionHeaders(){const{data:{session:e}}=await Ye.auth.getSession(),r=e==null?void 0:e.access_token;if(!r)throw new Error("Please sign in to download datasets.");return{Authorization:`Bearer ${r}`}}async getAuthHeaders(){return{"Content-Type":"application/json",...await this.get
413SessionHeaders()}}addAnalyticsHeaders(e,r){r&&(e["X-Trace-ID"]=r.traceId,r.posthogSessionId&&(e["X-Analytics-Consent"]="granted",e["X-PostHog-Session-ID"]=r.posthogSessionId))}async createDownloadRequest(e,r){const n=await this.getAuthHeaders();this.addAnalyticsHeaders(n,r);const s=await fetch(`${this.baseUrl}/downloads`,{method:"POST",headers:n,body:JSON.stringify(e)});if(!s.ok)throw await Bu(s,"Failed to create download request");return await s.json()}async getDatasetArtifacts(e,r){const n=await this.getSessionHeaders(),s=[],i=new Set;let a=0;for(;a!==null;){if(i.has(a))throw new Error("Download artifact pagination did not advance.");i.add(a);const l=new URL(`/downloads/datasets/${e}/artifacts`,this.baseUrl);l.searchParams.set("include_raw",String(r.includeRaw)),l.searchParams.set("include_segmentation",String(r.includeSegmentation)),r.bundleId&&l.searchParams.set("bundle_id",r.bundleId),l.searchParams.set("offset",String(a)),l.searchParams.set("limit","20");try{const u=await fetch(l.toString(),{headers:n});if(!u.ok)throw await Bu(u,"Failed to fetch download links");const h=await u.json();s.push(...h.artifacts),a=h.next_offset??null}catch(u){throw s.length>0?new r1(u,s):u}}return{dataset_id:e,artifacts:s,next_offset:null}}
413async getSupplementaryDownload(e){const r=await this.getSessionHeaders(),n=await fetch(`${this.baseUrl}/supplementary-data/${e}/download`,{headers:r});if(!n.ok)throw await Bu(n,"Failed to fetch supplementary download link");return await n.json()}async getDownloadAllowance(e){const r=await this.getSessionHeaders(),n=new URL("/downloads/allowance",this.baseUrl);typeof e=="number"&&n.searchParams.set("dataset_id",e.toString());const s=await fetch(n.toString(),{headers:r});if(!s.ok)throw await Bu(s,"Failed to load the daily download allowance");return await s.json()}async listDownloadRequests(e){const r=await this.getAuthHeaders(),n=new URL("/downloads",this.baseUrl);typeof e=="number"&&n.searchParams.set("dataset_id",e.toString());const s=await fetch(n.toString(),{method:"GET",headers:r});if(!s.ok)throw await Bu(s,"Failed to fetch download requests");return await s.json()}async getDownloadUrl(e){const r=await this.getAuthHeaders(),n=await fetch(`${this.baseUrl}/downloads/${e}/url`,{method:"GET",headers:r});if(!n.ok)throw await Bu(n,"Failed to open download archive");return await n.json()}async startDownload(e,r,n){const s=await this.getAuthHeaders();this.addAnalyticsHeaders(s,n);const i=await fetch(`${this.baseUrl}/downloads/${e}/start`,{method:"POST",headers:s,body:JSON.stringify({origin_surface:r})});if(!i.ok)throw await Bu(i,"Failed to start download");return await i.json()}}const ow=new FX;function $X(t){return[...t].sort((e,r)=>{const n=Date.parse(e.created_at||"");return Date.parse(r.created_at||"")-n})}function zX(t,e=Date.now()){const r=Date.parse(t)-e;return Number.isFinite(r)&&r>0?r+1e3:3e4}function CSe(t,e,r=!0){return{queryKey:Ht.downloads.allowance(t,e),enabled:!!t&&r,staleTime:3e4,refetchInterval:n=>n.state.data?zX(n.state.data.resets_at):!1,queryFn:()=>ow.getDownloadAllowance(e)}}function UX(t){return{queryKey:Ht.downloads.mine(t),enabled:!!t,queryFn:async()=>{const e=await ow.listDownloadRequests();return $X(e)}}}const BX=new Set(["pending","processing"]);function aD(t,e,r,n=!0){return`${t}|raw:${e?1:0}|seg:${r?1:0}|supp:${n?1:0}`}const Hz=y.createContext(void 0);function VX(){const t=y.useContext(Hz);if(!t)throw new Error("useDownloads must be used within a DownloadsProvider");return t}function HX({children:t}){const{user:e}=Fg(),r=(e==null?void 0:e.id)??null,n=lu(),[s,i]=y.useState({}),a=fr(UX(r)),l=y.useMemo(()=>r?a.data??[]:[],[a.data,r]),u=Aq({mutationFn:async({payload:v,analyticsContext:_})=>ow.createDownloadRequest(v,_),onSuccess:v=>{r&&n.setQueryData(Ht.downloads.mine(r),_=>[v,...(_??[]).filter(x=>x.id!==v.id)].sort((x,w)=>Date.parse(w.created_at||"")-Date.parse(x.created_at||"")))},onSettled:async()=>{r&&await n.invalidateQueries({queryKey:Ht.downloads.mine(r)})}}),h=y.useCallback(async()=>{r&&await n.invalidateQueries({queryKey:Ht.downloads.mine(r)})},[n,r]),p=y.useCallback(async(v,_)=>{const x=aD(v.dataset_id,v.include_raw,v.include_segmentation,v.include_supplementary??!0);i(w=>({...w,[x]:!0}));try{return await u.mutateAsync({payload:v,analyticsContext:_})}finally{i(w=>{const S={...w};return delete S[x],S})}},[u]),f=y.useCallback((v,_,x,w=!0)=>{const S=aD(v,_,x,w);return s[S]?!0:l.some(k=>k.dataset_id===v&&k.include_raw===_&&k.include_segmentation===x&&k.include_supplementary===w&&BX.has(k.status))},[s,l]);y.useEffect(()=>{if(!r)return;let v=!0;const _=Ye.channel(`download_requests_${r}`).on("postgres_changes",{event:"*",schema:"public",table:"download_requests",filter:`requested_by=eq.${r}`},()=>{v&&n.invalidateQueries({queryKey:Ht.downloads.mine(r)})}),x=FE(_,()=>{v&&n.invalidateQueries({queryKey:Ht.downloads.mine(r)})});return()=>{v=!1,x()}},[n,r]);const g=y.useMemo(()=>({requests:l,creating:s,refreshDownloads:h,createDownloadRequest:p,isIntentInFlight:f}),[l,s,h,p,f]);return o.jsx(Hz.Provider,{value:g,children:t})}function qX(){return o.jsx("footer",{className:"border-t bg-white",children:o.jsxs("div",{className:"container mx-auto px-4 md:px-6 py-1 flex flex-col md:flex-row items-center justify-between gap-4",children:[o.jsxs("div",{className:"text-sm text-gray-600",children:["© ",new Date().getFullYear()," 3Dtrees.earth · A GeoSense project"]}),o.jsxs("nav",{className:"flex max-w-full flex-wrap items-center justify-center gap-x-4 gap-y-1 text-sm",children:[o.jsx(Sr,{to:"/about",className:"text-gray-700 hover:text-gray-900 hover:underline",children:"About"}),o.jsx(Sr,{to:"/legal/terms",className:"text-gray-700 hover:text-gray-900 hover:underline",children:"Terms of Service"}),o.jsx(Sr,{to:"/legal/privacy",className:"text-gray-700 hover:text-gray-900 hover:underline",children:"Privacy Policy"}),o.jsx(Sr,{to:"/legal/impressum",className:"text-gray-700 hover:text-gray-900 hover:underline",children:"Impressum"}),o.jsx("a",{href:"mailto:[email protected]",className:"text-gray-700 hover:text-gray-900 hover:underline",children:"Delete my account"}),o.jsx("a",{href:"mailto:[email protected]",className:"text-blue-700 hover:text-blue-900 hover:underline",children:"Contact us"})]})]})})}var WX=Object.defineProperty,Qn=(t,e)=>WX(t,"name",{value:e,configurable:!0}),$E="dismissableLayer.update",GX="dismissableLayer.pointerDownOutside",KX="dism
413issableLayer.focusOutside",oD,qz=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),lw=y.forwardRef(Qn(function(e,r){const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:u,onDismiss:h,...p}=e,f=y.useContext(qz),[g,v]=y.useState(null),_=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=y.useState({}),w=Vt(r,v),S=Array.from(f.layers),[k]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),j=k?S.indexOf(k):-1,C=g?S.indexOf(g):-1,R=f.layersWithOutsidePointerEventsDisabled.size>0,A=C>=j,I=y.useRef(!1),P=Gz(M=>{a==null||a(M),u==null||u(M),M.defaultPrevented||h==null||h()},{ownerDocument:_,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:I,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:y.useCallback(M=>{if(!(M instanceof Node))return!1;const U=[...f.branches].some(V=>V.contains(M));return A&&!U},[f.branches,A])}),T=Kz(M=>{if(s&&I.current)return;const U=M.target;[...f.branches].some(H=>H.contains(U))||(l==null||l(M),u==null||u(M),M.defaultPrevented||h==null||h())},_),O=g?C===S.length-1:!1,G=Pn(M=>{M.key==="Escape"&&(i==null||i(M),!M.defaultPrevented&&h&&(M.preventDefault(),h()))});return y.useEffect(()=>{if(O)return _.addEventListener("keydown",G,{capture:!0}),()=>_.removeEventListener("keydown",G,{capture:!0})},[_,O,G]),y.useEffect(()=>{if(g)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(oD=_.body.style.pointerEvents,_.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(g)),f.layers.add(g),zE(),()=>{n&&(f.layersWithOutsidePointerEventsDisabled.delete(g),f.layersWithOutsidePointerEventsDisabled.size===0&&(_.body.style.pointerEvents=oD))}},[g,_,n,f]),y.useEffect(()=>()=>{g&&(f.layers.delete(g),f.layersWithOutsidePointerEventsDisabled.delete(g),zE())},[g,f]),y.useEffect(()=>{const M=Qn(()=>x({}),"handleUpdate");return document.addEventListener($E,M),()=>document.removeEventListener($E,M)},[]),o.jsx(it.div,{...p,ref:w,style:{pointerEvents:R?A?"auto":"none":void 0,...e.style},onFocusCapture:Xe(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Xe(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Xe(e.onPointerDownCapture,P.onPointerDownCapture)})},"DismissableLayer"));function Wz(){const t=y.useContext(qz),[e,r]=y.useState(null);return y.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),r}Qn(Wz,"useDismissableLayerSurface");var YX=Qn(()=>!0,"IS_TRUE");function Gz(t,e){const{ownerDocument:r=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:n=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i,shouldHandlePointerDownOutside:a=YX}=e,l=Pn(t),u=y.useRef(!1),h=y.useRef(!1),p=y.useRef(new Map),f=y.useRef(()=>{});return y.useEffect(()=>{function g(){h.current=!1,s.current=!1,p.current.clear()}Qn(g,"resetOutsideInteraction");function v(){return Array.from(p.current.values()).some(Boolean)}Qn(v,"isOutsideInteractionIntercepted");function _(j){if(!h.current)return;const C=j.target;C instanceof Node&&[...i].some(A=>A.contains(C))||p.current.set(j.type,!0),j.type==="click"&&window.setTimeout(()=>{h.current&&f.current()},0)}Qn(_,"handleInteractionCapture");function x(j){h.current&&p.current.set(j.type,!1)}Qn(x,"handleInteractionBubble");const w=Qn(j=>{if(j.target&&!u.current){let C=function(){r.removeEventListener("click",f.current);const A=v();g(),A||n1(GX,l,R,{discrete:!0})};if(Qn(C,"handleAndDispatchPointerDownOutsideEvent"),!a(j.target)){r.removeEventListener("click",f.current),g(),u.current=!1;return}const R={originalEvent:j};h.current=!0,s.current=n&&j.button===0,p.current.clear(),!n||j.button!==0?C():(r.removeEventListener("click",f.current),f.current=C,r.addEventListener("click",f.current,{once:!0}))}else r.removeEventListener("click",f.current),g();u.current=!1},"handlePointerDown"),S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const j of S)r.addEventListener(j,_,!0),r.addEventListener(j,x);const k=window.setTimeout(()=>{r.addEventListener("pointerdown",w)},0);return()=>{window.clearTimeout(k),r.removeEventListener("pointerdown",w),r.removeEventListener("click",f.current);for(const j of S)r.removeEventListener(j,_,!0),r.removeEventListener(j,x)}},[r,l,n,s,i,a]),{onPointerDownCapture:Qn(()=>u.current=!0,"onPointerDownCapture")}}Qn(Gz,"usePointerDownOutside");function Kz(t,e=globalThis==null?void 0:globalThis.document){const r=Pn(t),n=y.useRef(!1);return y.useEffect(()=>{const s=Qn(i=>{i.target&&!n.current&&n1(KX,r,{originalEvent:i},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,r]),{onFocusCapture:Qn(()=>n.current=!0,"onFocusCapture"),onBlurCapture:Qn(()=>n.current=!1,"onBlurCapture")}}Qn(Kz,"useFocusOutside");function zE(){const t=new CustomEvent($E);document.dispatchEvent(t)}Qn(zE,"dispatchUpdate");function n1(t,e,r,{discrete:n}){const s=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&s.addEventListener(t,e,{once:!0}),n?xC(s,i):s.dispatchEvent(i)}Qn(n1,"handleAndDispatchCustomEvent");var ZX=Object.defineProperty,Ms=(t,e)=>ZX(t,"name",{value:e,configurable:!0}),_S="focusScope.autoFocusOnMount",bS="focusScope.autoFocusOnUnmount",lD={bubbles:!1,cancelable:!0},cw=y.forwardRef(Ms(function(e,r){const{loop:n=!1,trapped:s=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...l}=e,[u,h]=y.useState(null),p=Pn(i),f=Pn(a),g=y.useRef(null),v=Vt(r,h),_=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(s){let w=function(C){if(_.paused||!u)return;const R=C.target;u.contains(R)?g.current=R:xl(g.current,{select:!0})},S=function(C){if(_.paused||!u)return;const R=C.relatedTarget;R!==null&&(u.contains(R)||xl(g.current,{select:!0}))},k=function(C){if(document.activeElement===document.body)for(const A of C)A.removedNodes.length>0&&xl(u)};Ms(w,"handleFocusIn"),Ms(S,"handleFocusOut"),Ms(k,"handleMutations"),document.addEventListener("focusin",w),document.addEventListener("focusout",S);const j=new MutationObserver(k);return u&&j.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",S),j.disconnect()}}},[s,u,_.paused]),y.useEffect(()=>{if(u){cD.add(_);const w=document.activeElement;if(!u.contains(w)){const k=new CustomEvent(_S,lD);u.addEventListener(_S,p),u.dispatchEvent(k),k.defaultPrevented||(Yz(e4(s1(u)),{select:!0}),document.activeElement===w&&xl(u))}return()=>{u.removeEventListener(_S,p),setTimeout(()=>{const k=new CustomEvent(bS,lD);u.addEventListener(bS,f),u.dispatchEvent(k),k.defaultPrevented||xl(w??document.body,{select:!0}),u.removeEventListener(bS,f),cD.remove(_)},0)}}},[u,p,f,_]);const x=y.useCallback(w=>{if(!n&&!s||_.paused)return;const S=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,k=document.activeElement;if(S&&k){const j=w.currentTarget,[C,R]=Zz(j);C&&R?!w.shiftKey&&k===R?(w.preventDefault(),n&&xl(C,{select:!0})):w.shiftKey&&k===C&&(w.preventDefault(),n&&xl(R,{select:!0})):k===j&&w.preventDefault()}},[n,s,_.paused]);return o.jsx(it.div,{tabIndex:-1,...l,ref:v,onKeyDown:x})},"FocusScope"));function Yz(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(xl(n,{select:e}),document.activeElement!==r)return}Ms(Yz,"focusFirst");function Zz(t){const e=s1(t),r=UE(e,t),n=UE(e.reverse(),t);return[r,n]}Ms(Zz,"getTabbableEdges");function s1(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:Ms(n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;r.nextNode();)e.push(r.currentNode);return e}Ms(s1,"getTabbableCandidates");function UE(t,e){const r=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const n of t)if(!(r?!n.checkVisibility({checkVisibilityCSS:!0}):Jz(n,{upTo:e})))return n}
413Ms(UE,"findVisible");function Jz(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}Ms(Jz,"isHidden");function Qz(t){return t instanceof HTMLInputElement&&"select"in t}Ms(Qz,"isSelectableInput");function xl(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&Qz(t)&&e&&t.select()}}Ms(xl,"focus");var cD=Xz();function Xz(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=BE(t,e),t.unshift(e)},remove(e){var r;t=BE(t,e),(r=t[0])==null||r.resume()}}}Ms(Xz,"createFocusScopesStack");function BE(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}Ms(BE,"arrayRemove");function e4(t){return t.filter(e=>e.tagName!=="A")}Ms(e4,"removeLinks");var JX=Object.defineProperty,QX=(t,e)=>JX(t,"name",{value:e,configurable:!0}),uw=y.forwardRef(QX(function(e,r){var u;const{container:n,...s}=e,[i,a]=y.useState(!1);Xr(()=>a(!0),[]);const l=n||i&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return l?ou.createPortal(o.jsx(it.div,{...s,ref:r}),l):null},"Portal")),XX=Object.defineProperty,i1=(t,e)=>XX(t,"name",{value:e,configurable:!0}),Iy=0,yo=null;function eee(t){return rp(),t.children}i1(eee,"FocusGuards");function rp(){y.useEffect(()=>{yo||(yo={start:VE(),end:VE()});const{start:t,end:e}=yo;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),Iy++,()=>{Iy===1&&(yo==null||yo.start.remove(),yo==null||yo.end.remove(),yo=null),Iy=Math.max(0,Iy-1)}},[])}i1(rp,"useFocusGuards");function VE(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}i1(VE,"createFocusGuard");var m_="right-scroll-bar-position",g_="width-before-scroll-bar",tee="with-scroll-bars-hidden",ree="--removed-body-scroll-bar-size";function wS(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function nee(t,e){var r=y.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=e,r.facade}var see=typeof window<"u"?y.useLayoutEffect:y.useEffect,uD=new WeakMap;function iee(t,e){var r=nee(null,function(n){return t.forEach(function(s){return wS(s,n)})});return see(function(){var n=uD.get(r);if(n){var s=new Set(n),i=new Set(t),a=r.current;s.forEach(function(l){i.has(l)||wS(l,null)}),i.forEach(function(l){s.has(l)||wS(l,a)})}uD.set(r,t)},[t]),r}function aee(t){return t}function oee(t,e){e===void 0&&(e=aee);var r=[],n=!1,s={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(i){var a=e(i,n);return r.push(a),function(){r=r.filter(function(l){return l!==a})}},assignSyncMedium:function(i){for(n=!0;r.length;){var a=r;r=[],a.forEach(i)}r={push:function(l){return i(l)},filter:function(){return r}}},assignMedium:function(i){n=!0;var a=[];if(r.length){var l=r;r=[],l.forEach(i),a=r}var u=function(){var p=a;a=[],p.forEach(i)},h=function(){return Promise.resolve().then(u)};h(),r={push:function(p){a.push(p),h()},filter:function(p){return a=a.filter(p),r}}}};return s}function lee(t){t===void 0&&(t={});var e=oee(null);return e.options=Ro({async:!0,ssr:!1},t),e}var t4=function(t){var e=t.sideCar,r=ep(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return y.createElement(n,Ro({},r))};t4.isSideCarExport=!0;function cee(t,e){return t.useMedium(e),t4}var r4=lee(),xS=function(){},dw=y.forwardRef(function(t,e){var r=y.useRef(null),n=y.useState({onScrollCapture:xS,onWheelCapture:xS,onTouchMoveCapture:xS}),s=n[0],i=n[1],a=t.forwardProps,l=t.children,u=t.className,h=t.removeScrollBar,p=t.enabled,f=t.shards,g=t.sideCar,v=t.no
vendor: 9,096 bytes, lines 413-453
413Relative,_=t.noIsolation,x=t.inert,w=t.allowPinchZoom,S=t.as,k=S===void 0?"div":S,j=t.gapMode,C=ep(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),R=g,A=iee([r,e]),I=Ro(Ro({},C),s);return y.createElement(y.Fragment,null,p&&y.createElement(R,{sideCar:r4,removeScrollBar:h,shards:f,noRelative:v,noIsolation:_,inert:x,setCallbacks:i,allowPinchZoom:!!w,lockRef:r,gapMode:j}),a?y.cloneElement(y.Children.only(l),Ro(Ro({},I),{ref:A})):y.createElement(k,Ro({},I,{className:u,ref:A}),l))});dw.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};dw.classNames={fullWidth:g_,zeroRight:m_};var uee=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function dee(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=uee();return e&&t.setAttribute("nonce",e),t}function hee(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function fee(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var pee=function(){var t=0,e=null;return{add:function(r){t==0&&(e=dee())&&(hee(e,r),fee(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},mee=function(){var t=pee();return function(e,r){y.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},n4=function(){var t=mee(),e=function(r){var n=r.styles,s=r.dynamic;return t(n,s),null};return e},gee={left:0,top:0,right:0,gap:0},SS=function(t){return parseInt(t||"",10)||0},vee=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],n=e[t==="padding"?"paddingTop":"marginTop"],s=e[t==="padding"?"paddingRight":"marginRight"];return[SS(r),SS(n),SS(s)]},yee=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return gee;var e=vee(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},_ee=n4(),df="data-scroll-locked",bee=function(t,e,r,n){var s=t.left,i=t.top,a=t.right,l=t.gap;return r===void 0&&(r="margin"),`
414  .`.concat(tee,` {
415   overflow: hidden `).concat(n,`;
416   padding-right: `).concat(l,"px ").concat(n,`;
417  }
418  body[`).concat(df,`] {
419    overflow: hidden `).concat(n,`;
420    overscroll-behavior: contain;
421    `).concat([e&&"position: relative ".concat(n,";"),r==="margin"&&`
422    padding-left: `.concat(s,`px;
423    padding-top: `).concat(i,`px;
424    padding-right: `).concat(a,`px;
425    margin-left:0;
426    margin-top:0;
427    margin-right: `).concat(l,"px ").concat(n,`;
428    `),r==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),`
429  }
430  
431  .`).concat(m_,` {
432    right: `).concat(l,"px ").concat(n,`;
433  }
434  
435  .`).concat(g_,` {
436    margin-right: `).concat(l,"px ").concat(n,`;
437  }
438  
439  .`).concat(m_," .").concat(m_,` {
440    right: 0 `).concat(n,`;
441  }
442  
443  .`).concat(g_," .").concat(g_,` {
444    margin-right: 0 `).concat(n,`;
445  }
446  
447  body[`).concat(df,`] {
448    `).concat(ree,": ").concat(l,`px;
449  }
450`)},dD=function(){var t=parseInt(document.body.getAttribute(df)||"0",10);return isFinite(t)?t:0},wee=function(){y.useEffect(function(){return document.body.setAttribute(df,(dD()+1).toString()),function(){var t=dD()-1;t<=0?document.body.removeAttribute(df):document.body.setAttribute(df,t.toString())}},[])},xee=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,s=n===void 0?"margin":n;wee();var i=y.useMemo(function(){return yee(s)},[s]);return y.createElement(_ee,{styles:bee(i,!e,s,r?"":"!important")})},HE=!1;if(typeof window<"u")try{var Dy=Object.defineProperty({},"passive",{get:function(){return HE=!0,!0}});window.addEventListener("test",Dy,Dy),window.removeEventListener("test",Dy,Dy)}catch{HE=!1}var Ch=HE?{passive:!1}:!1,See=function(t){return t.tagName==="TEXTAREA"},s4=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!See(t)&&r[e]==="visible")},kee=function(t){return s4(t,"overflowY")},Eee=function(t){return s4(t,"overflowX")},hD=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=i4(t,n);if(s){var i=a4(t,n),a=i[1],l=i[2];if(a>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},jee=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},Cee=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},i4=function(t,e){return t==="v"?kee(e):Eee(e)},a4=function(t,e){return t==="v"?jee(e):Cee(e)},Nee=function(t,e){return t==="h"&&e==="rtl"?-1:1},Pee=function(t,e,r,n,s){var i=Nee(t,window.getComputedStyle(e).direction),a=i*n,l=r.target,u=e.contains(l),h=!1,p=a>0,f=0,g=0;do{if(!l)break;var v=a4(t,l),_=v[0],x=v[1],w=v[2],S=x-w-i*_;(_||S)&&i4(t,l)&&(f+=S,g+=_);var k=l.parentNode;l=k&&k.nodeType===Node.DOCUMENT_FRAGMENT_NODE?k.host:k}while(!u&&l!==document.body||u&&(e.contains(l)||e===l));return(p&&Math.abs(f)<1||!p&&Math.abs(g)<1)&&(h=!0),h},Oy=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},fD=function(t){return[t.deltaX,t.deltaY]},pD=function(t){return t&&"current"in t?t.current:t},Ree=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Aee=function(t){return`
451  .block-interactivity-`.concat(t,` {pointer-events: none;}
452  .allow-interactivity-`).concat(t,` {pointer-events: all;}
453`)},Tee=0,Nh=[];function Iee(t){var e=y.useRef([]),r=y.useRef([0,0]),n=y.useRef(),s=y.useState(Tee++)[0],i=y.useState(n4)[0],a=y.useRef(t);y.useEffect(function(){a.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var x=l7([t.lockRef.current],(t.shards||[]).map(pD),!0).filter(Boolean);return x.forEach(function(w){return w.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),x.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var l=y.useCallback(function(x,w){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!a.current.allowPinchZoom;var S=Oy(x),k=r.current,j="deltaX"in x?x.deltaX:k[0]-S[0],C="deltaY"in x?x.deltaY:k[1]-S[1],R,A=x.target,I=Math.abs(j)>Math.abs(C)?"h":"v";if("touches"in x&&I==="h"&&A.type==="range")return!1;var P=window.getSelection(),T=P&&P.anchorNode,O=T?T===A||T.contains(A):!1;if(O)return!1;var G=hD(I,A);if(!G)return!0;if(G?R=I:(R=I==="v"?"h":"v",G=hD(I,A)),!G)return!1;if(!n.current&&"changedTouches"in x&&(j||C)&&(n.current=R),!R)return!0;var M=n.current||R;return Pee(M,w,x,M==="h"?j:C)},[]),u=y.useCallback(function(x){var w=x;if(!(!Nh.length||Nh[Nh.length-1]!==i)){var S="deltaY"in w?fD(w):Oy(w),k=e.current.filter(function(R){return R.name===w.type&&(R.target===w.target||w.target===R.shadowParent)&&Ree(R.delta,S)})[0];if(k&&k.should){w.cancelable&&w.preventDefault();return}if(!k){var j=(a.current.shards||[]).map(pD).filter(Boolean).filter(function(R){return R.contains(w.target)}),C=j.length>0?l(w,j[0]):!a.current.noIsolation;C&&w.cancelable&&w.preventDefault()}}},[]),h=y.useCallback(function(x,w,S,k){var j={name:x,delta:w,target:S,should:k,shadowParent:Dee(S)};e.current.push(j),setTimeout(function(){e.current=e.current.filter(function(C){return C!==j})},1)},[]),p=y.useCallback(function(x){r.current=Oy(x),n.current=void 0},[]),f=y.useCallback(function(x){h(x.type,fD(x),x.target,l(x,t.lockRef.current))},[]),g=y.useCallback(function(x){h(x.type,Oy(x),x.target,l(x,t.lockRef.current))},[]);y.useEffect(function(){return Nh.push(i),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Ch),document.addEventListener("touchmove",u,Ch),document.addEventListener("touchstart",p,Ch),function(){Nh=Nh.filter(function(x){return x!==i}),document.removeEventListener("wheel",u,Ch),document.removeEventListener("touchmove",u,Ch),document.removeEventListener("touchstart",p,Ch)}},[]);var v=t.removeScrollBar,_=t.inert;return y.createElement(y.Fragment,null,_?y.createElement(i,{styles:Aee(s)}):null,v?y.createElement(xee,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function Dee(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Oee=cee(r4,Iee);var zg=y.forwardRef(function(t,e){return y.createElement(dw,Ro({},t,{ref:e,sideCar:Oee}))});zg.classNames=dw.classNames;var Mee=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Ph=new WeakMap,My=new WeakMap,Ly={},kS=0,o4=function(t){return t&&(t.host||o4(t.parentNode))},Lee=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=o4(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},Fee=function(t,e,r,n){var s=Lee(e,Array.isArray(t)?t:[t]);Ly[r]||(Ly[r]=new WeakMap);var i=Ly[r],a=[],l=new Set,u=new Set(s),h=function(f){!f||l.has(f)||(l.add(f),h(f.parentNode))};
453s.forEach(h);var p=function(f){!f||u.has(f)||Array.prototype.forEach.call(f.children,function(g){if(l.has(g))p(g);else try{var v=g.getAttribute(n),_=v!==null&&v!=="false",x=(Ph.get(g)||0)+1,w=(i.get(g)||0)+1;Ph.set(g,x),i.set(g,w),a.push(g),x===1&&_&&My.set(g,!0),w===1&&g.setAttribute(r,"true"),_||g.setAttribute(n,"true")}catch(S){console.error("aria-hidden: cannot operate on ",g,S)}})};return p(e),l.clear(),kS++,function(){a.forEach(function(f){var g=Ph.get(f)-1,v=i.get(f)-1;Ph.set(f,g),i.set(f,v),g||(My.has(f)||f.removeAttribute(n),My.delete(f)),v||f.removeAttribute(r)}),kS--,kS||(Ph=new WeakMap,Ph=new WeakMap,My=new WeakMap,Ly={})}},hw=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),s=Mee(t);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live], script"))),Fee(n,s,r,"aria-hidden")):function(){return null}},$ee=Object.defineProperty,Bi=(t,e)=>$ee(t,"name",{value:e,configurable:!0}),a1="Dialog",[l4,NSe]=Vn(a1),[zee,eo]=l4(a1),c4=Bi(t=>{const{__scopeDialog:e,children:r,open:n,defaultOpen:s,onOpenChange:i,modal:a=!0}=t,l=y.useRef(null),u=y.useRef(null),[h,p]=$i({prop:n,defaultProp:s??!1,onChange:i,caller:a1}),[f,g]=y.useState(0),[v,_]=y.useState(0);return o.jsx(zee,{scope:e,triggerRef:l,contentRef:u,contentId:Bn(),titleId:Bn(),descriptionId:Bn(),titlePresent:f>0,descriptionPresent:v>0,setTitleCount:g,setDescriptionCount:_,open:h,onOpenChange:p,onOpenToggle:y.useCallback(()=>p(x=>!x),[p]),modal:a,children:r})},"Dialog"),Uee="DialogTrigger",u4=y.forwardRef(Bi(function(e,r){const{__scopeDialog:n,...s}=e,i=eo(Uee,n),a=Vt(r,i.triggerRef);return o.jsx(it.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":fw(i.open),...s,ref:a,onClick:Xe(e.onClick,i.onOpenToggle)})},"DialogTrigger")),d4="DialogPortal",[Bee,h4]=l4(d4,{forceMount:void 0}),f4=Bi(t=>{const{__scopeDialog:e,forceMount:r,children:n,container:s}=t,i=eo(d4,e);return o.jsx(Bee,{scope:e,forceMount:r,children:y.Children.map(n,a=>o.jsx(os,{present:r||i.open,children:o.jsx(uw,{asChild:!0,container:s,children:a})}))})},"DialogPortal"),qE="DialogOverlay",o1=y.forwardRef(Bi(function(e,r){const n=h4(qE,e.__scopeDialog),{forceMount:s=n.forceMount,...i}=e,a=eo(qE,e.__scopeDialog);return a.modal?o.jsx(os,{present:s||a.open,children:o.jsx(Hee,{...i,ref:r})}):null},"DialogOverlay")),Vee=Ga("DialogOverlay.RemoveScroll"),Hee=y.forwardRef(Bi(function(e,r){const{__scopeDialog:n,...s}=e,i=eo(qE,n),a=Wz(),l=Vt(r,a);return o.jsx(zg,{as:Vee,allowPinchZoom:!0,shards:[i.contentRef],children:o.jsx(it.div,{"data-state":fw(i.open),...s,ref:l,style:{pointerEvents:"auto",...s.style}})})},"DialogOverlayImpl")),ag="DialogContent",l1=y.forwardRef(Bi(function(e,r){const n=h4(ag,e.__scopeDialog),{forceMount:s=n.forceMount,...i}=e,a=eo(ag,e.__scopeDialog);return o.jsx(os,{present:s||a.open,children:a.modal?o.jsx(qee,{...i,ref:r}):o.jsx(Wee,{...i,ref:r})})},"DialogContent")),qee=y.forwardRef(Bi(function(e,r){const n=eo(ag,e.__scopeDialog),s=y.useRef(null),i=Vt(r,n.contentRef,s);return y.useEffect(()=>{const a=s.current;if(a)return hw(a)},[]),o.jsx(p4,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Xe(e.onCloseAutoFocus,a=>{var l;a.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Xe(e.onPointerDownOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0;(l.button===2||u)&&a.preventDefault()}),onFocusOutside:Xe(e.onFocusOutside,a=>a.preventDefault())})},"DialogContentModal")),Wee=y.forwardRef(Bi(function(e,r){const n=eo(ag,e.__scopeDialog),s=y.useRef(!1),i=y.useRef(!1);return o.jsx(p4,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,u;(l=e.onCloseAutoFocus)==null||l.call(e,a),a.defaultPrevented||(s.current||(u=n.triggerRef.current)==null||u.focus(),a.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:a=>{var h,p;(h=e.onInteractOutside)==null||h.call(e,a),a.defaultPrevented||(s.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=a.target;((p=n.triggerRef.current)==null?void 0:p.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})},"DialogContentNonModal")),p4=y.forwardRef(Bi(function(e,r){const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,...l}=e,u=eo(ag,n);return rp(),o.jsx(o.Fragment,{children:o.jsx(cw,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:a,children:o.jsx(lw,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionPresent?u.descriptionId:void 0,"aria-labelledby":u.titlePresent?u.titleId:void 0,"data-state":fw(u.open),...l,ref:r,deferPointerDownOutside:!0,onDismiss:()=>u.onOpenChange(!1)})})})},"DialogContentImpl")),Gee="DialogTitle",m4=y.forwardRef(Bi(function(e,r){const{__scopeDialog:n,...s}=e,i=eo(Gee,n),{setTitleCount:a}=i;return Xr(()=>(a(l=>l+1),()=>a(l=>l-1)),[a]),o.jsx(it.h2,{id:i.titleId,...s,ref:r})},"DialogTitle")),Kee="DialogDescription",g4=y.forwardRef(Bi(function(e,r){const{__scopeDialog:n,...s}=e,i=eo(Kee,n),{setDescriptionCount:a}=i;return Xr(()=>(a(l=>l+1),()=>a(l=>l-1)),[a]),o.jsx(it.p,{id:i.descriptionId,...s,ref:r})},"DialogDescription")),Yee="DialogClose",c1=y.forwardRef(Bi(function(e,r){const{__scopeDialog:n,...s}
453=e,i=eo(Yee,n);return o.jsx(it.button,{type:"button",...s,ref:r,onClick:Xe(e.onClick,()=>i.onOpenChange(!1))})},"DialogClose"));function fw(t){return t?"open":"closed"}Bi(fw,"getState");const hi=c4,Zee=y.forwardRef(({...t},e)=>o.jsx(u4,{ref:e,"data-slot":"dialog-trigger",...t}));Zee.displayName=u4.displayName;const Jee=f4,Qee=y.forwardRef(({...t},e)=>o.jsx(c1,{ref:e,"data-slot":"dialog-close",...t}));Qee.displayName=c1.displayName;const v4=y.forwardRef(({className:t,...e},r)=>o.jsx(o1,{ref:r,"data-slot":"dialog-overlay",className:ke("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e}));v4.displayName=o1.displayName;const $s=y.forwardRef(({className:t,children:e,showCloseButton:r=!0,...n},s)=>o.jsxs(Jee,{children:[o.jsx(v4,{}),o.jsxs(l1,{ref:s,"data-slot":"dialog-content",className:ke("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...n,children:[e,r&&o.jsxs(c1,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[o.jsx(cu,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));$s.displayName=l1.displayName;const zs=y.forwardRef(({className:t,...e},r)=>o.jsx("div",{ref:r,"data-slot":"dialog-header",className:ke("flex flex-col gap-2 text-center sm:text-left",t),...e}));zs.displayName="DialogHeader";const Mo=y.forwardRef(({className:t,...e},r)=>o.jsx("div",{ref:r,"data-slot":"dialog-footer",className:ke("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e}));Mo.displayName="DialogFooter";const Us=y.forwardRef(({className:t,...e},r)=>o.jsx(m4,{ref:r,"data-slot":"dialog-title",className:ke("text-lg leading-none font-semibold",t),...e}));Us.displayName=m4.displayName;const Mi=y.forwardRef(({className:t,...e},r)=>o.jsx(g4,{ref:r,"data-slot":"dialog-description",className:ke("text-muted-foreground text-sm",t),...e}));Mi.displayName=g4.displayName;const mD=["tos-reconsent","cookie-consent","milestone-celebration"],y4=y.createContext({claims:new Set,setClaim:()=>{}});function Xee({children:t}){const[e,r]=y.useState(()=>new Set),n=y.useCallback((i,a)=>{r(l=>{if(l.has(i)===a)return l;const u=new Set(l);return a?u.add(i):u.delete(i),u})},[]),s=y.useMemo(()=>({claims:e,setClaim:n}),[e,n]);return o.jsx(y4.Provider,{value:s,children:t})}function u1(t,e){const{claims:r,setClaim:n}=y.useContext(y4);y.useLayoutEffect(()=>(n(t,e),()=>n(t,!1)),[t,e,n]);const s=mD.indexOf(t),i=mD.some((a,l)=>l<s&&r.has(a));return e&&!i}function _4(t){try{return window.localStorage.getItem(t)==="true"}catch{return!1}}function b4(t){try{window.localStorage.setItem(t,"true")}catch{}}const d1={id:"2000-datasets",datasetCount:2e3,expiresAt:"2026-09-30T00:00:00.000Z"},w4=`3dtrees.milestone-celebration.${d1.id}.dismissed.v1`,ete=[/^\/login$/,/^\/logout$/,/^\/sign-up$/,/^\/auth\//,/^\/forgot-password$/,/^\/update-password$/,/^\/audit(\/|$)/];function tte(t){return Date.now()>=Date.parse(d1.expiresAt)||ete.some(e=>e.test(t))?!1:!_4(w4)}function rte(){b4(w4)}const nte=["#3b82f6","#8b5cf6","#ec4899","#10b981","#f59e0b","#f43f5e"],ste=900,ite=260,ate=740;function gD(t,e,r,n){if(!e)return;const s=e.getBoundingClientRect(),i=s.bottom/window.innerHeight,a={particleCount:r,startVelocity:n,spread:58,ticks:220,colors:nte,disableForReducedMotion:!0,scalar:.9};t({...a,angle:62,origin:{x:s.left/window.innerWidth,y:i}}),t({...a,angle:118,origin:{x:s.right/window.innerWidth,y:i}})}function ote(){const{pathname:t}=Hs(),[e,r]=y.useState(!1),n=y.useRef(null),s=y.useRef([]),i=y.useCallback(()=>{s.current.forEach(f=>window.clearTimeout(f)),s.current=[]},[]),a=y.useCallback((f,g)=>{s.current.push(window.setTimeout(f,g))},[]),l=u1("milestone-celebration",tte(t)),u=e&&l;y.useEffect(()=>{if(l)return a(()=>r(!0),ste),i},[l,i,a]),y.useEffect(()=>{if(!u)return;let f=!1;return Nn(async()=>{const{default:g}=await import("./confetti.module-BrSRgexL.js");return{default:g}},[]).then(({default:g})=>{f||(a(()=>gD(g,n.current,45,45),ite),a(()=>gD(g,n.current,18,55),ate))}),()=>{f=!0}},[u,a]);const h=y.useCallback(()=>{i(),r(!1),rte()}
453,[i]),p=d1.datasetCount.toLocaleString(void 0);return o.jsx(hi,{open:u,onOpenChange:f=>!f&&h(),children:o.jsxs($s,{ref:n,className:"max-h-[calc(100dvh-2rem)] gap-0 overflow-y-auto text-center sm:max-w-sm",children:[o.jsxs(zs,{className:"items-center gap-0 text-center sm:text-center",children:[o.jsxs("span",{className:"mb-4 inline-flex items-center rounded-full border border-gray-200 bg-white px-3 py-1 text-xs font-medium text-gray-700 shadow-sm",children:[o.jsx("span",{className:"mr-1.5",children:"🌲"})," Community milestone"]}),o.jsx("span",{className:"bg-gradient-to-r from-blue-500 via-purple-500 to-pink-500 bg-clip-text text-5xl font-extrabold tracking-tighter text-transparent tabular-nums sm:text-6xl",children:p}),o.jsx("span",{className:"mt-1 mb-4 text-xs font-semibold tracking-widest text-gray-500 uppercase",children:"open datasets"}),o.jsxs(Us,{className:"text-base font-bold text-gray-900 sm:text-lg",children:["Wow. We just passed ",p," datasets!"]}),o.jsxs(Mi,{className:"mt-2 text-sm text-gray-600",children:["Researchers around the world have now contributed over ",p," open 3D forest datasets. Thank you for being a part of this global community of researchers, practitioners, and enthusiasts."]})]}),o.jsx("div",{className:"mt-6",children:o.jsx(we,{asChild:!0,size:"lg",className:"w-full",onClick:h,children:o.jsx(Sr,{to:"/map",children:"Here’s to the next 1,000!"})})})]})})}var x4;function lte(t){x4=t}function WE(){return x4}var h1=y.createContext({get client(){return WE()},bootstrap:void 0});function S4(t,e,r){if(r===void 0&&(r=new WeakMap),t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(r.has(t)&&r.get(t)===e)return!0;r.set(t,e);var n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;for(var i=0,a=n;i<a.length;i++){var l=a[i];if(!s.includes(l)||!S4(t[l],e[l],r))return!1}return!0}function cte(t){var e,r,n=t.children,s=t.client,i=t.apiKey,a=t.options,l=y.useRef(null),u=y.useMemo(function(){if(s)return i&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),a&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),s;var h=WE();return i||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),h},[s,i,JSON.stringify(a)]);return y.useEffect(function(){if(!(s||!i)){var h=WE(),p=l.current;p?(i!==p.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),a&&!S4(a,p.options)&&h.set_config(a),l.current={apiKey:i,options:a??{}}):(h.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),h.init(i,a),l.current={apiKey:i,options:a??{}})}},[s,i,JSON.stringify(a)]),K.createElement(h1.Provider,{value:{client:u,bootstrap:(e=a==null?void 0:a.bootstrap)!==null&&e!==void 0?e:(r=s==null?void 0:s.config)===null||r===void 0?void 0:r.bootstrap}},n)}var ES=function(t){return typeof t=="function"},ute=function(){var t=y.useContext(h1).client;return t},GE=function(t,e){return GE=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},GE(t,e)};function dte(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");GE(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var hte={componentStack:null,exceptionEvent:null,error:null},fte={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(t){dte(e,t);function e(r){var n=t.call(this,r)||this;return n.state=hte,n}return e.prototype.componentDidCatch=function(r,n){var s=this.props.additionalProperties,i;ES(s)?i=s(r):typeof s=="object"&&(i=s);var a=this.context.client,l=a.captureException(r,i),u=n.componentStack;this.setState({error:r,componentStack:u??null,exceptionEvent:l})},e.prototype.render=function(){var r=this.props,n=r.children,s=r.fallback,i=this.state;if(i.componentStack==null)return ES(n)?n():n;var a=ES(s)?K.createElement(s,{error:i.error,componentStack:i.componentStack,exceptionEvent:i.exceptionEvent}):s;return K.isValidElement(a)?a:(console.warn(fte.INVALID_FALLBACK),K.createElement(K.Fragment,null))},e.contextType=h1,e})(K.Component);lte($l);function Vs({className:t,...e}){return o.jsx("div",{"data-slot":"card",className:ke("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...e})}function va({className:t,...e}){return o.jsx("div",{"data-slot":"card-header",className:ke("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...e})}function Ka({className:t,...e}){return o.jsx("div",{"data-slot":"card-title",className:ke("leading-none font-semibold",t),...e})}function nu({className:t,...e}){return o.jsx("div",{"data-slot":"card-description",className:ke("text-muted-foreground text-sm",t),...e})}function zi({className:t,...e}){return o.jsx("div",{"data-slot":"card-content",className:ke("px-6",t),...e})}function pte({className:t,...e}){return o.jsx("div",{"data-slot":"card-footer",className:ke("flex items-center px-6 [.border-t]:pt-6",t),...e})}const mte="cookie-consent",gte="cookie-consent-date",vte="cookie-consent-deferred",f1="cookie-consent-sync-pending";function yte(t,e){try{return window[t].getItem(e)}catch{return null}}function Mm(t,e,r){try{window[t].setItem(e,r)}catch{}}function vD(t){Mm("localStorage",mte,t),Mm("localStorage",gte,Date.now().toString()),Mm("localStorage",f1,"false")}function Rh(t){Mm("localStorage",f1,String(t))}function _te(){return yte("localStorage",f1)==="true"}function bte(){Mm("sessionStorage",vte,"true")}const wte={VITE_PUBLIC_POSTHOG_ENABLED:"true",VITE_PUBLIC_POSTHOG_ENVIRONMENT:"production",VITE_PUBLIC_POSTHOG_HOST:"https://canopy.3dtrees.earth",VITE_PUBLIC_POSTHOG_KEY:"phc_x6VTLIMGNNccCbnvkWLj8K2aAr9LiIUNadEECXqsZv1",VITE_PUBLIC_POSTHOG_RELEASE:"be93fd5adde5bee951c16bee082c50e2f7a7cdf3",VITE_PUBLIC_POSTHOG_UI_HOST:"https://eu.posthog.com"};function xte({className:t}){const[e,r]=y.useState(!1),[n,s]=y.useState(null),[i,a]=y.useState(!1),l=ute(),u=u1("cookie-consent",e),h=y.useCallback(()=>
453{if(!l)return;const _=Lg(wte);_.enabled&&Pz(l,{environment:_.environment,release:_.release})},[l]),p=y.useCallback(()=>{l&&(l.opt_out_capturing(),l.stopSessionRecording(),l.reset()),vX()},[l]);y.useEffect(()=>{const _=fb();if(_te()){p(),s({decision:"reject",message:"Analytics is disabled in this browser, but we could not update your account. Please try Essential Only again."}),r(!0);return}_.isCurrent?_.consented?h():p():(p(),Rh(!0),a(!0),uf(Ye.auth,!1).then(()=>Rh(!1)).catch(()=>{console.error("Failed to expire analytics consent"),Rh(!0),s({decision:"reject",message:"Analytics is disabled in this browser, but we could not update your account. Please try Essential Only again."})}).finally(()=>a(!1)),r(!0))},[p,h]);const f=async()=>{a(!0),s(null);try{await uf(Ye.auth,!0)}catch{console.error("Failed to synchronize analytics consent"),p(),s({decision:"accept",message:"Analytics remains disabled because we could not update your account. Please try accepting again."});return}finally{a(!1)}vD("accepted"),h(),r(!1),es("analytics_consent_granted",{consent_method:"banner_accept"}),rD()},g=async()=>{vD("rejected"),Rh(!0),p(),a(!0),s(null);try{await uf(Ye.auth,!1),Rh(!1)}catch{console.error("Failed to synchronize analytics consent"),Rh(!0),s({decision:"reject",message:"Analytics is disabled in this browser, but we could not update your account. Please try Essential Only again."});return}finally{a(!1)}r(!1),rD()},v=()=>{bte(),r(!1)};return u?o.jsx("div",{className:`fixed bottom-0 left-0 right-0 z-50 p-4 ${t||""}`,children:o.jsx(Vs,{className:"mx-auto max-w-4xl bg-white border border-gray-200 shadow-lg",children:o.jsx("div",{className:"p-6",children:o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{className:"flex-1",children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"🍪 We use cookies to improve your experience"}),o.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"We use analytics cookies to understand how you interact with our platform and improve your experience. This helps us optimize upload workflows, identify issues, and enhance our forest data management features. Your data is processed according to our privacy policy and GDPR requirements."}),n&&o.jsx("p",{className:"mb-4 text-sm text-red-700",role:"alert",children:n.message}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsx(we,{disabled:i,onClick:f,className:"bg-green-600 hover:bg-green-700 text-white",children:(n==null?void 0:n.decision)==="accept"?"Retry Accept Analytics":"Accept Analytics Cookies"}),o.jsx(we,{disabled:i,onClick:g,variant:"outline",className:"border-gray-300 text-gray-700 hover:bg-gray-50",children:(n==null?void 0:n.decision)==="reject"?"Retry Essential Only":"Essential Only"}),o.jsx(we,{disabled:i||n!==null,onClick:v,variant:"ghost",className:"text-gray-500 hover:text-gray-700",children:"Ask Later"})]})]}),o.jsx(we,{disabled:i||n!==null,onClick:v,variant:"ghost",size:"sm",className:"text-gray-400 hover:text-gray-600 p-1",children:o.jsx(cu,{className:"h-4 w-4"})})]})})})}):null}const pw="1.1";function Ste(t,e={tos:pw}){const r=((t==null?void 0:t.tosVersion)??null)!==e.tos;return{needsTos:r,needsReconsent:r}}function kte(t){return t.acceptedTos?null:"You must read and accept the Terms of Service to create an account."}function Ete(t){var r;const e={};for(const n of t){const s=e[n.document];(!s||n.accepted_at>s.accepted_at||n.accepted_at===s.accepted_at&&n.id>s.id)&&(e[n.document]=n)}return{tosVersion:((r=e.tos)==null?void 0:r.version)??null}}function jte(){return[{document:"tos",version:pw}]}function k4(t=new Date){const e=t.toISOString();return{tos_version_accepted:pw,tos_accepted_at:e}}async function Cte(t){const{data:e,error:r}=await Ye.from("user_consents").select("id, document, version, accepted_at").eq("user_id",t).order("accepted_at",{ascending:!1}).order("id",{ascending:!1});if(r)throw r;return Ete(e??[])}async function Nte(t,e=jte()){if(e.length===0)return;const{error:r}=await Ye.from("user_consents").insert(e.map(n=>({user_id:t,...n})));if(r)throw r}var Pte=Object.defineProperty,Rte=(t,e)=>Pte(t,"name",{value:e,configurable:!0});function mw(t){const[e,r]=y.useState(void 0);return Xr(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(s=>
453{if(!Array.isArray(s)||!s.length)return;const i=s[0];let a,l;if("borderBoxSize"in i){const u=i.borderBoxSize,h=Array.isArray(u)?u[0]:u;a=h.inlineSize,l=h.blockSize}else a=t.offsetWidth,l=t.offsetHeight;r({width:a,height:l})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}Rte(mw,"useSize");var Ate=Object.defineProperty,ql=(t,e)=>Ate(t,"name",{value:e,configurable:!0}),p1="Checkbox",[Tte,PSe]=Vn(p1),[Ite,m1]=Tte(p1);function E4(t){const{__scopeCheckbox:e,checked:r,children:n,defaultChecked:s,disabled:i,form:a,name:l,onCheckedChange:u,required:h,value:p="on",internal_do_not_use_render:f}=t,[g,v]=$i({prop:r,defaultProp:s??!1,onChange:u,caller:p1}),[_,x]=y.useState(null),[w,S]=y.useState(null),k=y.useRef(!1),[j,C]=y.useReducer(I=>I+1,0),R=_?!!a||!!_.closest("form"):!0,A={checked:g,disabled:i,setChecked:v,control:_,setControl:x,name:l,form:a,value:p,hasConsumerStoppedPropagationRef:k,userInteractionCount:j,onUserInteraction:C,required:h,defaultChecked:zl(s)?!1:s,isFormControl:R,bubbleInput:w,setBubbleInput:S};return o.jsx(Ite,{scope:e,...A,children:j4(f)?f(A):n})}ql(E4,"CheckboxProvider");var Dte="CheckboxTrigger",Ote=y.forwardRef(ql(function({__scopeCheckbox:e,onKeyDown:r,onClick:n,...s},i){const{control:a,value:l,disabled:u,checked:h,required:p,setControl:f,setChecked:g,hasConsumerStoppedPropagationRef:v,onUserInteraction:_,isFormControl:x,bubbleInput:w}=m1(Dte,e),S=Vt(i,f),k=y.useRef(h);return y.useEffect(()=>{const j=a==null?void 0:a.form;if(j){const C=ql(()=>g(k.current),"reset");return j.addEventListener("reset",C),()=>j.removeEventListener("reset",C)}},[a,g]),o.jsx(it.button,{type:"button",role:"checkbox","aria-checked":zl(h)?"mixed":h,"aria-required":p,"data-state":g1(h),"data-disabled":u?"":void 0,disabled:u,value:l,...s,ref:S,onKeyDown:Xe(r,j=>{j.key==="Enter"&&j.preventDefault()}),onClick:Xe(n,j=>{_(),g(C=>zl(C)?!0:!C),w&&x&&(v.current=j.isPropagationStopped(),v.current||j.stopPropagation())})})},"CheckboxTrigger")),Mte=y.forwardRef(ql(function(e,r){const{__scopeCheckbox:n,name:s,checked:i,defaultChecked:a,required:l,disabled:u,value:h,onCheckedChange:p,form:f,...g}=e;return o.jsx(E4,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:u,required:l,onCheckedChange:p,name:s,form:f,value:h,internal_do_not_use_render:({isFormControl:v})=>o.jsxs(o.Fragment,{children:[o.jsx(Ote,{...g,ref:r,__scopeCheckbox:n}),v&&o.jsx(zte,{__scopeCheckbox:n})]})})},"Checkbox")),Lte="CheckboxIndicator",Fte=y.forwardRef(ql(function(e,r){const{__scopeCheckbox:n,forceMount:s,...i}=e,a=m1(Lte,n);return o.jsx(os,{present:s||zl(a.checked)||a.checked===!0,children:o.jsx(it.span,{"data-state":g1(a.checked),"data-disabled":a.disabled?"":void 0,...i,ref:r,style:{pointerEvents:"none",...e.style}})})},"CheckboxIndicator")),$te="CheckboxBubbleInput",zte=y.forwardRef(ql(function({__scopeCheckbox:e,onClick:r,...n},s){const{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:u,defaultChecked:h,required:p,disabled:f,name:g,value:v,form:_,bubbleInput:x,setBubbleInput:w}=m1($te,e),S=Vt(s,w),k=mw(i),j=y.useRef(!1),C=y.useRef(u),R=y.useRef(l);y.useEffect(()=>{const I=x;if(!I)return;const P=window.HTMLInputElement.prototype,O=Object.getOwnPropertyDescriptor(P,"checked").set,G=l!==R.current;R.current=l;const M=C.current!==u;C.current=u;const U=!(G&&a.current);if(M&&O){j.current=!G;const V=new Event("click",{bubbles:U});I.indeterminate=zl(u),O.call(I,zl(u)?!1:u),I.dispatchEvent(V),j.current=!1}},[x,u,a,l]);const A=y.useRef(zl(u)?!1:u);return o.jsx(it.input,{type:"checkbox","aria-hidden":!0,defaultChecked:h??A.current,required:p,disabled:f,name:g,value:v,form:_,...n,tabIndex:-1,ref:S,onClick:Xe(r,I=>{j.current&&I.stopPropagation()}),style:{...n.style,...k,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function j4(t){return typeof t=="function"}ql(j4,"isFunction");function zl(t){return t==="indeterminate"}ql(zl,"isIndeterminate");function g1(t){return zl(t)?"indeterminate":t?"checked":"unchecked"}ql(g1,"getState");function ya({className:t,...e}){return o.jsx(Mte,{"data-slot":"checkbox",className:ke("peer group border-input data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground data-[state=indeterminate]:border-primary dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:o.jsxs(Fte,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:[o.jsx(Vl,{className:"size-3.5 group-data-[state=indeterminate]:hidden"}),o.jsx(V9,{className:"hidden size-3.5 group-data-[state=indeterminate]:block"})]})})}function C4({updated:t=!1,linkClassName:e="underline"}){return o.jsxs(o.Fragment,{children:["3Dtrees.earth processes your account and dataset data as described 
453in the"," ",t?"updated ":"",o.jsx("a",{href:"/legal/privacy",target:"_blank",rel:"noopener noreferrer",className:e,children:"Privacy Policy"}),"."]})}function Ute({open:t,summary:e,onAccept:r,onDecline:n}){const[s,i]=y.useState(!1),a=s,l=()=>{i(!1)},u=()=>{Promise.resolve(r()).finally(l)},h=()=>{l(),n()};return o.jsx(hi,{open:t,onOpenChange:p=>{p||h()},children:o.jsxs($s,{children:[o.jsxs(zs,{children:[o.jsx(Us,{children:"Updated Terms of Service"}),o.jsxs(Mi,{children:["We’ve updated our"," ",o.jsx("a",{href:"/legal/terms",target:"_blank",rel:"noopener noreferrer",className:"font-medium text-primary underline underline-offset-4 hover:no-underline",children:"Terms of Service"}),". ",e," Please review and accept below to continue uploading datasets, downloading processed outputs, or downloading datasets owned by other users. Without accepting, you can keep browsing and download raw or supplementary files from datasets you own."]})]}),o.jsxs("div",{className:"space-y-3 py-2 text-sm",children:[o.jsxs("label",{className:"flex items-start gap-2",children:[o.jsx(ya,{checked:s,onCheckedChange:p=>i(p===!0)}),o.jsxs("span",{children:["I have read and accept the updated"," ",o.jsx("a",{href:"/legal/terms",target:"_blank",rel:"noopener noreferrer",className:"font-medium text-primary underline underline-offset-4 hover:no-underline",children:"Terms of Service"}),"."]})]}),o.jsx("p",{className:"text-muted-foreground",children:o.jsx(C4,{updated:!0,linkClassName:"font-medium text-primary underline underline-offset-4 hover:no-underline"})})]}),o.jsxs(Mo,{children:[o.jsx(we,{variant:"outline",onClick:h,children:"Decline, keep browsing"}),o.jsx(we,{disabled:!a,onClick:u,children:"Accept and continue"})]})]})})}const N4=y.createContext({uploadBlocked:!1,openReconsent:()=>{}});function gw(){return y.useContext(N4)}function Bte({children:t}){const{user:e}=Fg(),r=lu(),n=Hs(),s=(e==null?void 0:e.id)??null,i=n.pathname.startsWith("/account"),a=n.pathname.startsWith("/legal"),[l,u]=y.useState(!1),[h,p]=y.useState(!1),{data:f}=fr({queryKey:["consent",s],enabled:!!s,queryFn:async()=>Cte(s)}),v=!!e&&f!==void 0?Ste(f).needsReconsent:!1;y.useEffect(()=>{v&&!h&&i&&u(!0)},[v,h,i]),y.useEffect(()=>{p(!1),u(!1)},[s]);const _=async()=>{e&&(await Nte(e.id),await Ye.auth.updateUser({data:k4()}),await r.invalidateQueries({queryKey:["consent",e.id]}),p(!0),u(!1))},x=()=>{p(!0),u(!1)},w=u1("tos-reconsent",l&&v&&!a);return o.jsxs(N4.Provider,{value:{uploadBlocked:v,openReconsent:()=>u(!0)},children:[t,o.jsx(Ute,{open:w,onAccept:_,onDecline:x},s??"anonymous")]})}const Vte=Jb("relative w-full rounded-md border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground border-border",destructive:"text-destructive border-destructive/50 dark:border-destructive [&>svg]:text-destructive bg-destructive/10",warning:"text-amber-900 border-amber-200 dark:border-amber-800 [&>svg]:text-amber-500 bg-amber-50 dark:bg-amber-950/30",success:"text-emerald-900 border-emerald-200 dark:border-emerald-800 [&>svg]:text-emerald-600 bg-emerald-50 dark:bg-emerald-950/30",info:"text-blue-900 border-blue-200 dark:border-blue-800 [&>svg]:text-blue-600 bg-blue-50 dark:bg-blue-950/30"}},defaultVariants:{variant:"default"}}),Bs=y.forwardRef(({className:t,variant:e,...r},n)=>o.jsx("div",{ref:n,role:"alert",className:ke(Vte({variant:e}),t),...r}));Bs.displayName="Alert";const ha=y.forwardRef(({className:t,...e},r)=>o.jsx("h5",{ref:r,className:ke("mb-1 font-medium leading-none tracking-tight",t),...e}));ha.displayName="AlertTitle";const fi=y.forwardRef(({className:t,...e},r)=>o.jsx("div",{ref:r,className:ke("text-muted-foreground text-sm",t),...e}));fi.displayName="AlertDescription";const Hte={warning:{icon:"text-amber-500",title:"text-amber-900",body:"text-muted-foreground",dismiss:"text-amber-800 hover:bg-amber-100 hover:text-amber-950"},success:{icon:"text-emerald-600",title:"text-emerald-950",body:"text-muted-foreground",dismiss:"text-emerald-800 hover:bg-emerald-100 hover:text-emerald-950"},destructive:{icon:"text-red-700 dark:text-red-300",title:"text-red-950 dark:text-red-100",body:"text-red-950 dark:text-red-100",dismiss:"text-red-900 hover:bg-destructive/10 hover:text-red-950 dark:text-red-100"}};function pb({title:t,children:e,action:r,icon:n=Oo,variant:s="warning",onDismiss:i,dismissLabel:a="Dismiss banner"}){const l=Hte[s];return o.jsx(Bs,{variant:s,className:"rounded-none border-x-0 border-t-0 p-0",children:o.jsxs("div",{className:ke("container mx-auto grid min-w-0 max-w-full items-start px-3 py-3 sm:px-4 md:px-6",i?"grid-cols-[1.75rem_minmax(0,1fr)_1.75rem]":"grid-cols-[minmax(0,1fr)]"),children:[o.jsxs("div",{className:ke("flex min-w-0 max-w-full items-start justify-center gap-3",i&&"col
453-start-2"),children:[o.jsx(n,{className:ke("mt-0.5 h-4 w-4 shrink-0",l.icon)}),o.jsxs("div",{className:"min-w-0 max-w-full break-words text-center text-sm leading-5 [overflow-wrap:anywhere]",children:[o.jsx("span",{className:ke("font-medium",l.title),children:t})," ",o.jsx("span",{className:l.body,children:e}),r&&o.jsxs("span",{className:"mt-1 block min-w-0 max-w-full break-words [overflow-wrap:anywhere] sm:mt-0 sm:inline",children:[o.jsx("span",{className:"hidden sm:inline",children:" "}),r]})]})]}),i&&o.jsx("button",{type:"button","aria-label":a,onClick:i,className:ke("col-start-3 row-start-1 -mt-1 inline-flex h-7 w-7 shrink-0","items-center justify-center justify-self-end rounded-md","transition-colors focus-visible:outline-none focus-visible:ring-2","focus-visible:ring-ring focus-visible:ring-offset-2",l.dismiss),children:o.jsx(cu,{className:"h-4 w-4"})})]})})}const qte="https://api.3dtrees.earth";async function Wte(){const t=await fetch(`${qte}/health/database`,{cache:"no-store"});if(!t.ok)throw new Error("Database health check failed");return await t.json()}const Gte=3e4,Kte=["health","database"];function Yte(){var e;return((e=fr({queryKey:Kte,queryFn:Wte,staleTime:1e4,refetchInterval:Gte,refetchIntervalInBackground:!0,retry:!1}).data)==null?void 0:e.outage_confirmed)!==!0?null:o.jsx(pb,{variant:"destructive",title:"Service disruption:",children:"The 3Dtrees.earth database is currently unavailable. Data access, uploads, and account features may not work until service is restored."})}const Zte=["sat","forestmamba","legacy_analysis"];function Jte(t){return!!(t&&Zte.some(e=>e in t.inputs))}const jS={native:!0,bundle:null};async function P4(t,e){if(t.read_route==="legacy")return null;if(t.read_route!=="native")throw new Error("Could not determine how this dataset is served.");const r=()=>e!=null&&e.native?e:jS;try{const{data:{session:n}}=await Ye.auth.getSession(),s=await fetch(`https://api.3dtrees.earth/datasets/${t.id}/serving-bundle`,{headers:n?{Authorization:`Bearer ${n.access_token}`}:{},cache:"no-store"});if(s.status>=500||s.status===429)return r();if(!s.ok)return jS;const i=await s.json();return i.native?i:jS}catch{return r()}}const vw=(t={})=>{const e=t.randomUUID??(()=>crypto.randomUUID()),r=t.consented??zo,n=t.posthogSessionId??SX,s=r(),i=s?n():void 0;return{traceId:e(),analyticsConsented:s,...i?{posthogSessionId:i}:{}}},Lm=(t={})=>{const{traceId:e,posthogSessionId:r}=vw(t);return{traceId:e,...r?{posthogSessionId:r}:{}}},Qte=t=>es("dataset_edit_started",{dataset_id:String(t),origin_surface:"account"}),Xte=t=>{const e=t==null?void 0:t.code;return e==="42501"||e==="PGRST301"?"access_denied":e==="P0002"||e==="PGRST116"?"not_found":e==="23505"||e==="409"?"conflict":t instanceof TypeError?"network_error":"unknown"};function yD(t,e){const r=t;return(r==null?void 0:r.code)==="23505"?"A template with this name already exists.":t instanceof Error?t.message:e}function _D(t,e){if(t instanceof Error)return t.message;const r=t==null?void 0:t.message;return typeof r=="string"?r:e}const ere=["id","uuid","uploaded_by_user_id","title","description","visibility","created_at","updated_at","acquisition_date","archived","collection_id","platform","sensor","scan_pattern","preprocessing_steps","coordinate_accuracy","coordinate_reference","point_attributes_description","item_count","file_names","bucket_paths","file_size_mb","point_count","status","progress","authors","funding","hide_location"].join(", "),tre="*";class R4{constructor(e){En(this,"supabase");this.supabase=e||Ye}async createAdditionalDatasetItem(e,r,n){try{const s={dataset_id:e,bucket_path:"",file_name:r,file_size_bytes:n},{data:i,error:a}=await this.supabase.from("dataset_items").insert(s).select().single();if(a)throw a;return{success:!0,data:{dataset_item_id:i.id}}}
453catch(s){return{success:!1,error:s instanceof Error?s.message:"Failed to create dataset item"}}}async getDatasetItemsForDataset(e){try{const{data:{user:r}}=await this.supabase.auth.getUser();if(!r)throw new Error("User not authenticated");const{data:n,error:s}=await this.supabase.from("datasets").select("id").eq("id",e).eq("archived",!1).single();if(s)throw s;if(!n)throw new Error("Dataset not found or access denied");const{data:i,error:a}=await this.supabase.from("dataset_items").select("id, dataset_id, bucket_path, file_name, file_size_bytes").eq("dataset_id",e).order("id");if(a)throw a;return{success:!0,data:i??[]}}catch(r){return{success:!1,error:r instanceof Error?r.message:"Failed to load dataset items"}}}async updateDatasetBucketPath(e,r,n){try{const{data:{user:s}}=await this.supabase.auth.getUser();if(!s)throw new Error("User not authenticated");const{error:i}=await this.supabase.from("dataset_items").update({bucket_path:n}).eq("id",r);if(i)throw i;const{data:a,error:l}=await this.supabase.from("datasets").select().eq("id",e).single();if(l)throw l;return await this.logOperation({level:"info",message:"Dataset finalized after successful upload",dataset_item_id:r,user_id:s.id,operation:"dataset_finalization",metadata:{bucket_path:n}}),{success:!0,data:a}}catch(s){return await this.logOperation({level:"error",message:"Failed to finalize dataset after upload",operation:"dataset_finalization",error_details:s instanceof Error?s.message:"Unknown error",metadata:{dataset_id:e,bucket_path:n}}),{success:!1,error:_D(s,"Failed to finalize dataset")}}}async createDatasetWithMetadata(e,r,n,s,i,a,l){try{const{data:{user:u}}=await this.supabase.auth.getUser();if(!u)throw new Error("User not authenticated");const h=(l==null?void 0:l.traceId)??crypto.randomUUID(),{data:p,error:f}=await this.supabase.rpc("create_upload_dataset_record",{p_dataset:e,p_metadata:r,p_authors:n,p_funding:s,p_file_name:i,p_file_size_bytes:a,p_trace_id:h,p_posthog_session_id:(l==null?void 0:l.posthogSessionId)??null});if(f)throw f;const g=p;if(!(g!=null&&g.dataset)||!g.dataset_item_id)throw new Error("Dataset creation returned no data");const v=g.dataset,_={id:g.dataset_item_id};return await this.logOperation({level:"info",message:"Dataset created successfully",dataset_item_id:_.id,user_id:u.id,operation:"dataset_creation",metadata:{file_name:i,platform:r.platform,authors_count:n.length,funding_count:s.length}}),{success:!0,data:{...v,dataset_item_id:_.id}}}catch(u){return await this.logOperation({level:"error",message:"Failed to create dataset",operation:"dataset_creation",error_details:u instanceof Error?u.message:"Unknown error",metadata:{attempted_data:e}}),{success:!1,error:_D(u,"Failed to create dataset")}}}async logOperation(e){}async updateDatasetMetadata(e,r,n=[],s=[],i,a,{replaceLists:l=!1}={}){const u=a??{traceId:crypto.randomUUID()};try{const{data:{user:h}}=await this.supabase.auth.getUser();if(!h)throw new Error("User not authenticated");const p=["acquisition_date","description","visibility","hide_location","title","platform","sensor","scan_pattern","preprocessing_steps","coordinate_accuracy","coordinate_reference","point_attributes_description","license_id","rights_warranty_at"],f={};Object.keys(r).forEach(_=>{if(p.includes(_)){const x=r[_];x!==void 0&&(f[_]=x)}});const{data:g,error:v}=await this.supabase.rpc("update_dataset_stewardship",{p_dataset_id:e,p_updates:f,p_authors:n,p_funding:s,p_replace_authors:l||n.length>0,p_replace_funding:l||s.length>0,p_reason:i||"Dataset metadata updated via web interface",p_trace_id:u.traceId,p_posthog_session_id:u.posthogSessionId??null});if(v)throw v;if(!g)throw new Error("Dataset update returned no data");return{success:!0,data:g}}catch(h){try{await this.supabase.rpc("record_dataset_stewardship_failure",{p_dataset_id:e,p_reason_code:Xte(h),p_trace_id:u.traceId,p_posthog_session_id:u.posthogSessionId??null})}catch{}return{success:!1,error:h instanceof Error?h.message:typeof(h==null?void 0:h.message)=="string"?String(h.message):"Unknown error"}}}async archiveDataset(e,r,n){const s=n??{traceId:crypto.randomUUID()};try{const{data:{user:i}}=await this.supabase.auth.getUser();if(!i)throw new Error("User not authenticated");const{data:a,error:l}=await this.supabase.rpc("archive_dataset_stewardship",{p_dataset_id:e,p_trace_id:s.traceId,p_posthog_session_id:s.posthogSessionId??null,p_reason:r??"Dataset archived via account page"});if(l)throw l;if(!a)throw new Error("Dataset archive returned no data");return{success:!0,data:a}}catch(i){return{success:!1,error:i instanceof Error?i.message:typeof(i==null?void 0:i.message)=="str
453ing"?String(i.message):"Unknown error"}}}async restoreDataset(e,r){try{const{data:{user:n}}=await this.supabase.auth.getUser();if(!n)throw new Error("User not authenticated");const{data:s,error:i}=await this.supabase.from("datasets").select("*").eq("id",e).eq("archived",!0).single();if(i)throw i;if(!s)throw new Error("Archived Dataset not found or access denied");const{data:a,error:l}=await this.supabase.from("datasets").update({archived:!1,updated_at:new Date().toISOString()}).eq("id",e).select().single();if(l)throw l;return await this.logOperation({level:"info",message:"Dataset restored successfully",user_id:n.id,operation:"dataset_restore",metadata:{dataset_id:e,reason:r}}),{success:!0,data:a}}catch(n){return await this.logOperation({level:"error",message:"Failed to restore dataset",operation:"dataset_restore",error_details:n instanceof Error?n.message:"Unknown error",metadata:{dataset_id:e}}),{success:!1,error:n instanceof Error?n.message:"Unknown error"}}}async getDatasetDOI(e){try{const{data:{user:r}}=await this.supabase.auth.getUser();if(!r)throw new Error("User not authenticated");const{data:n,error:s}=await this.supabase.from("datacite").select("*").eq("dataset_id",e);if(s)throw s;return{success:!0,data:n&&n.length>0?n[0]:null}}catch(r){return console.error("Get DOI error:",r),{success:!1,error:r instanceof Error?r.message:"Unknown database error"}}}async getDatasetLicenseInfo(e){try{const{data:{user:r}}=await this.supabase.auth.getUser();if(!r)throw new Error("User not authenticated");const{data:n,error:s}=await this.supabase.from("datasets").select("license_id, rights_warranty_at").eq("id",e).single();if(s)throw s;return{success:!0,data:{license_id:(n==null?void 0:n.license_id)??null,rights_warranty_at:(n==null?void 0:n.rights_warranty_at)??null}}}catch(r){return console.error("Get license info error:",r),{success:!1,error:r instanceof Error?r.message:"Unknown database error"}}}async createDatasetDOI(e){try{const{data:{user:r}}=await this.supabase.auth.getUser();if(!r)throw new Error("User not authenticated");const{data:n}=await this.supabase.from("datasets").select("id").eq("id",e.dataset_id).single();if(!n)throw new Error("Dataset not found or access denied");const{data:s,error:i}=await this.supabase.from("datacite").insert(e).select().single();if(i)throw i;return{success:!0,data:s}}catch(r){return console.error("Create DOI error:",r),{success:!1,error:r instanceof Error?r.message:"Unknown database error"}}}async updateDatasetDOI(e,r){try{const{data:{user:n}}=await this.supabase.auth.getUser();if(!n)throw new Error("User not authenticated");const{data:s}=await this.supabase.from("datasets").select("id").eq("id",e).single();if(!s)throw new Error("Dataset not found or access denied");const{data:i,error:a}=await this.supabase.from("datacite").update(r).eq("dataset_id",e).select().single();if(a)throw a;return{success:!0,data:i}}catch(n){return console.error("Update DOI error:",n),{success:!1,error:n instanceof Error?n.message:"Unknown database error"}}}async deleteDatasetDOI(e){try{const{data:{user:r}}=await this.supabase.auth.getUser();if(!r)throw new Error("User not authenticated");const{data:n}=await this.supabase.from("datasets").select("id").eq("id",e).single();if(!n)throw new Error("Dataset not found or access denied");const{error:s}=await this.supabase.from("datacite").delete().eq("dataset_id",e);if(s)throw s;return{success:!0,data:!0}}catch(r){return console.error("Delete DOI error:",r),{success:!1,error:r instanceof Error?r.message:"Unknown database error"}}}async upsertDatasetDOI(e,r){try{const n=await this.getDatasetDOI(e);return n.success?n.data?await this.updateDatasetDOI(e,{doi:r}):await this.createDatasetDOI({dataset_id:e,doi:r}):{success:!1,error:n.error}}catch(n){return console.error("Upsert DOI error:",n),{success:!1,error:n instanceof Error?n.message:"Unknown database error"}}}async getDatasets(e){try{let r=this.supabase.from("v_datasets").select(ere);e!=null&&e.uploaderUserId&&(r=r.eq("uploaded_by_user_id",e.uploaderUserId)),e!=null&&e.visibility&&e.visibility!=="all"&&(r=r.eq("visibility",e.visibility)),e!=null&&e.status&&e.status!=="all"&&(r=r.eq("status",e.status)),e!=null&&e.search&&(r=r.or(`title.ilike.%${e.search}%,description.ilike.%${e.search}%`)),e!=null&&e.limit&&(r=r.limit(e.limit)),r=r.order("created_at",{ascending:!1});const{data:n,error:s}=await r;if(s)throw s;return{success:!0,data:n??[]}}catch(r){return{success:!1,error:r instanceof Error?r.message:"Failed to fetch datasets"}}}async getDatasetDetails(e){try{const{data:r,error:n}=await this.supabase.from("v_datasets").select(tre).eq("id",e).maybeSingle();if(n)throw n;if(r)return{success:!0,data:r};throw new Error("Dataset not found")}catch(r){return{success:!1,error:r instanceof Error?r.message:"Failed to fetch dataset details"}}}async getActiveSupplementaryData(e){try{const{data:r,error:n}=await this.supabase.from("dataset_supplementary_data").select("id, uuid, dataset_id, uploaded_by, original_filename, storage_bucket, storage_key, upload_id, file_size_bytes, content_type, description, zip_entries, extension_summary, status, active, failure_reason, created_at, updated_at, completed_at, replaced_at").eq("dataset_id",e).eq("active",!0).eq("status","active").order("completed_at",{ascending:!1}).limit(1);if(n)throw n;return{success:!0,data:r&&r.length>0?r[0]:null}}catch(r){return{success:!1,error:r instanceof Error?r.message:"Failed to fetch supplementary data"}}}async getPublicDatasets(){return this.getDatasets({visibility:"public",status:"completed"})}async listUploadTemplates(e=200,r=0){try{const{data:{user:n}}=await this.supabase.auth.getUser();if(!n)throw new Error("User not authenticated");const{data:s,error:i}=await this.supabase.from("upload_templates").select("*").eq("owner_user_id",n.id).order("created_at",{ascending:!1}).range(r,r+Math.max(e,1)-1);if(i)throw i;return{success:!0,data:s??[]}}catch(n){return{success:!1,error:n instanceof Error?n.message:"Failed to list upload templates"}}}async createUploadTemplate(e,r){try{const{data:{user:n}}=await this.supabase.auth.getUser();if(!n)throw new Error("User not authenticated");const{data:s,error:i}=await this.supabase.from("upload_templates").insert({owner_user_id:n.id,name:e,defaults_jsonb:r}).select().single();if(i)throw i;return{success:!0,data:s}}catch(n){return{success:!1,error:yD(n,"Failed to create upload template")}}}async updateUploadTemplate(e,r){try{const{data:{user:n}}=await this.supabase.auth.getUser();if(!n)throw new Error("User not authenticated");const s={};if(typeof r.name=="string"&&(s.name=r.name),r.defaults_jsonb&&(s.defaults_jsonb=r.defaults_jsonb),Object.keys(s).length===0)throw new Error("No updates provided");const{data:i,error:a}=await this.supabase.from("upload_templates").update(s).eq("id",e).eq("owner_user_id",n.id).select().single();if(a)throw a;return{success:!0,data:i}}catch(n){return{success:!1,error:yD(n,"Failed to update upload template")}}}async deleteUploadTemplate(e){try{const{data:{user:r}}=await this.supabase.auth.getUser();if(!r)throw new Error("User not authenticated");const{error:n}=await this.supabase.from("upload_templates").delete().eq("id",e).eq("owner_user_id",r.id);if(n)throw n;return{success:!0,data:null}}catch(r){return{success:!1,error:r instanceof Error?r.message:"Failed to delete upload template"}}}}const Rs=new R4,rre={liphestream:{label:"LiPheStream",credit:{summary:"Sources:",links:[{label:"LiPheStream dataset",href:"https://doi.org/10.23729/cf81f7f3-faaa-4729-aa1c-aa4dd38951aa"},{label:"Scientific Data paper",href:"https://doi.org/10.1038/s41597-024-04143-w"},{label:"LiPheKit",href:"https://doi.org/10.5281/zenodo.13763734"}]}}},nre={liphestream:{groundIds:[0],groundLabel:"No species label",groundSecondaryLabel:"No species label",groundColor:"#262626",entries:[{id:1,name:"Pinus sylvestris",secondaryLabel:"Scots pine"},{id:2,name:"Picea abies",secondaryLabel:"Norway spruce"}
453,{id:3,name:"Betula pendula",secondaryLabel:"Silver birch"},{id:4,name:"Unidentified",secondaryLabel:"Unidentified species",color:"#808080"}]}},sre=[{id:"liphestream-species",names:["Species"],category:"species_attr",menu:"species",sidebarGroup:"extra",section:"liphestream",label:"Species Labels",description:"Reference species identifiers published with LiPheStream.",speciesMap:"liphestream",legendSource:"liphestream"},{id:"liphestream-trees",names:["Trees"],category:"instance_attr",menu:"segments",sidebarGroup:"extra",section:"liphestream",label:"Instance Labels",description:"Reference individual-tree identifiers published with LiPheStream.",excludeZero:!0,legendSource:"liphestream"}],ire={sources:rre,speciesMaps:nre,attributes:sre},are={treescanpl10k:{label:"TreeScanPL10K",credit:{summary:"Dataset:",links:[{label:"TreeScanPL10K",href:"https://doi.org/10.5281/zenodo.19127709"}]}}},ore={treescanpl10k:{groundIds:[0,255],groundLabel:"No species label",groundSecondaryLabel:"No species label",groundColor:"#262626",entries:[{id:1,name:"Pinus sylvestris",secondaryLabel:"Scots pine"},{id:2,name:"Pinus banksiana",secondaryLabel:"Jack pine"},{id:8,name:"Larix decidua",secondaryLabel:"European larch"},{id:11,name:"Picea abies",secondaryLabel:"Norway spruce"},{id:21,name:"Abies alba",secondaryLabel:"Silver fir"},{id:30,name:"Fagus sylvatica",secondaryLabel:"European beech"},{id:40,name:"Quercus sp.",secondaryLabel:"Oak (unspecified)"},{id:41,name:"Quercus robur",secondaryLabel:"English oak"},{id:43,name:"Quercus rubra",secondaryLabel:"Red oak"},{id:44,name:"Acer platanoides",secondaryLabel:"Norway maple"},{id:45,name:"Acer pseudoplatanus",secondaryLabel:"Sycamore maple"},{id:46,name:"Ulmus minor",secondaryLabel:"Field elm"},{id:48,name:"Fraxinus excelsior",secondaryLabel:"European ash"},{id:50,name:"Carpinus betulus",secondaryLabel:"Common hornbeam"},{id:60,name:"Betula pendula",secondaryLabel:"Silver birch"},{id:66,name:"Crataegus monogyna",secondaryLabel:"Common hawthorn"},{id:71,name:"Alnus glutinosa",secondaryLabel:"Black alder"},{id:72,name:"Alnus incana",secondaryLabel:"Grey alder"},{id:81,name:"Pyrus communis",secondaryLabel:"Common pear"},{id:82,name:"Prunus avium",secondaryLabel:"Wild cherry"},{id:84,name:"Malus sylvestris",secondaryLabel:"European crab apple"},{id:86,name:"Prunus padus",secondaryLabel:"Bird cherry"},{id:87,name:"Sorbus aucuparia",secondaryLabel:"Rowan"},{id:90,name:"Populus alba",secondaryLabel:"White poplar"},{id:91,name:"Populus tremula",secondaryLabel:"Aspen"},{id:95,name:"Tilia cordata",secondaryLabel:"Small-leaved lime"},{id:97,name:"Salix caprea",secondaryLabel:"Goat willow"},{id:98,name:"Prunus serotina",secondaryLabel:"Black cherry"},{id:99,name:"Populus berolinensis",secondaryLabel:"Berlin poplar"},{id:107,name:"Acer campestre",secondaryLabel:"Field maple"}]}},lre=[{id:"species-ids",names:["treeSP","Tree sp"],category:"species_attr",menu:"species",sidebarGroup:"extra",section:"treescanpl10k",label:"Species Labels",description:"Manually labelled TreeScanPL10K species identifiers.",speciesMap:"treescanpl10k",legendSource:"treescanpl10k"},{id:"tree-ids",names:["treeID"],category:"instance_attr",menu:"segments",sidebarGroup:"extra",section:"treescanpl10k",label:"Instance Labels",description:"Manually labelled TreeScanPL10K tree instances.",excludeZero:!1,legendSource:"treescanpl10k"}],cre={sources:are,speciesMaps:ore,attributes:lre},ure=1,dre={segmentanytree:{label:"SegmentAnyTree",credit:{summary:"Source:",links:[{label:"Wielgosz et al., 2024",href:"https://www.sciencedirect.com/science/article/pii/S0034425724003936"},{label:"Model code",href:"https://github.com/SmartForest-no/SegmentAnyTree"}]}},forestmamba:{label:"ForestMamba",credit:{summary:"Source:",links:[{label:"Trung et al., 2026",href:"https://arxiv.org/abs/2606.01549"},{label:"Model code",href:"https://github.com/thanhhff/ForestMamba"}]}},"detailview-sat":{label:"DetailView x SegmentAnyTree",credit:{summary:"Sources:",links:[{label:"Puliti et al., 2025",href:"https://doi.org/10.1111/2041-210X.14503"},{label:"DetailView model code",href:"https://github.com/JulFrey/DetailVie
453w"},{label:"Wielgosz et al., 2024",href:"https://www.sciencedirect.com/science/article/pii/S0034425724003936"},{label:"SegmentAnyTree model code",href:"https://github.com/SmartForest-no/SegmentAnyTree"}]}},"detailview-fm":{label:"DetailView x ForestMamba",credit:{summary:"Sources:",links:[{label:"Puliti et al., 2025",href:"https://doi.org/10.1111/2041-210X.14503"},{label:"DetailView model code",href:"https://github.com/JulFrey/DetailView"},{label:"Trung et al., 2026",href:"https://arxiv.org/abs/2606.01549"},{label:"ForestMamba model code",href:"https://github.com/thanhhff/ForestMamba"}]}}},hre={detailview:{groundIds:[0,255],groundLabel:"No species prediction",groundSecondaryLabel:"Keine Artvorhersage",groundColor:"#262626",entries:[{id:1,name:"Acer campestre",secondaryLabel:"Feldahorn",color:"#2e7d32"},{id:2,name:"Acer pseudoplatanus",secondaryLabel:"Bergahorn",color:"#ff8f00"},{id:3,name:"Acer saccharum",secondaryLabel:"Zuckerahorn",color:"#ef6c00"},{id:4,name:"Betula pendula",secondaryLabel:"Hängebirke",color:"#e65100"},{id:5,name:"Carpinus betulus",secondaryLabel:"Hainbuche",color:"#fdd835"},{id:6,name:"Corylus avellana",secondaryLabel:"Gemeine Hasel",color:"#827717"},{id:7,name:"Crataegus monogyna",secondaryLabel:"Eingriffliger Weißdorn",color:"#8d6e63"},{id:8,name:"Eucalyptus miniata",secondaryLabel:"Darwin-Eukalyptus",color:"#ec407a"},{id:9,name:"Euonymus europaeus",secondaryLabel:"Gewöhnliches Pfaffenhütchen",color:"#26a69a"},{id:10,name:"Fagus sylvatica",secondaryLabel:"Rotbuche",color:"#ab47bc"},{id:11,name:"Fraxinus angustifolia",secondaryLabel:"Schmalblättrige Esche",color:"#66bb6a"},{id:12,name:"Fraxinus excelsior",secondaryLabel:"Gemeine Esche",color:"#78909c"},{id:13,name:"Larix decidua",secondaryLabel:"Europäische Lärche",color:"#5c6bc0"},{id:14,name:"Picea abies",secondaryLabel:"Gemeine Fichte",color:"#aed581"},{id:15,name:"Picea glauca",secondaryLabel:"Weiß-Fichte",color:"#1b5e20"},{id:16,name:"Pinus contorta",secondaryLabel:"Küstenkiefer",color:"#004d40"},{id:17,name:"Pinus nigra",secondaryLabel:"Schwarzkiefer",color:"#006064"},{id:18,name:"Pinus pinaster",secondaryLabel:"Seekiefer",color:"#33691e"},{id:19,name:"Pinus radiata",secondaryLabel:"Monterey-Kiefer",color:"#558b2f"},{id:20,name:"Pinus resinosa",secondaryLabel:"Rotkiefer",color:"#43a047"},{id:21,name:"Pinus sylvestris",secondaryLabel:"Waldkiefer",color:"#00695c"},{id:22,name:"Populus deltoides",secondaryLabel:"Amerikanische Schwarzpappel",color:"#00796b"},{id:23,name:"Populus tremuloides",secondaryLabel:"Amerikanische Zitterpappel",color:"#ffa726"},{id:24,name:"Prunus avium",secondaryLabel:"Vogelkirsche",color:"#ffca28"},{id:25,name:"Pseudotsuga menziesii",secondaryLabel:"Douglasie",color:"#ef5350"},{id:26,name:"Quercus faginea",secondaryLabel:"Portugiesische Eiche",color:"#0277bd"},{id:27,name:"Quercus ilex",secondaryLabel:"Steineiche",color:"#a1887f"},{id:28,name:"Quercus petraea",secondaryLabel:"Traubeneiche",color:"#6d4c41"},{id:29,name:"Quercus robur",secondaryLabel:"Stieleiche",color:"#795548"},{id:30,name:"Quercus rubra",secondaryLabel:"Roteiche",color:"#bf360c"},{id:31,name:"Tilia cordata",secondaryLabel:"Winterlinde",color:"#d84315"},{id:32,name:"Ulmus laevis",secondaryLabel:"Flatterulme",color:"#7b1fa2"}]}},fre=[{id:"sat-instance",names:["PredInstance","PredInstance_SAT"],category:"instance_attr",menu:"segments",sidebarGroup:"products",section:"segmentanytree",label:"Instance Segmentation (SAT)",description:"Instance segmentation by SegmentAnyTree. Colors distinguish individual instances.",excludeZero:!0,legendSource:"segmentanytree",specialColoring:{attributeNames:["color_id","coloring_id","coloring_sat","coloring_id_sat"],palette:"candy"}},{id:"sat-semantic",names:["PredSemantic","PredSemantic_SAT"],category:"semantic_attr",menu:"segments",sidebarGroup:"products",section:"segmentanytree",label:"Semantic Segmentation (SAT)",description:"Semantic segmentation classes: Vegetation and Non-Vegetation.",legendSource:"segmentanytree",classes:[{id:1,label:"Vegetation",color:"#22c55e"},{id:0,label:"Non-Vegetation",color:"#3f3f46"}]},{id:"fm-instance",names:["PredInstance_FM"],category:"instance_attr",menu:"segments",sidebarGroup:"products",section:"forestmamba",label:"Instance Segmentation (FM)",description:"Instance segmentation by ForestMamba. Colors distinguish individual instances.",excludeZero:!0,legendSource:"forestmamba",specialColoring:{attributeNames:["coloring_foma","coloring_id_fm"],palette:"winter"}},{id:"fm-semantic",names:["PredSemantic_FM"],category:"semantic_attr",menu:"segments",sidebarGroup:"products",section:"forestmamba",label:"Semantic Segmentation (FM)",description:"Semantic segmentation classes: Leaf, Wood, and Ground.",legendSource:"forestmamba",classes:[{id:2,label:"Leaf",color:"#22c55e"},{id:1,label:"Wood",color:"#ef4444"},{id:0,label:"Ground",color:"#3f3f46"}]},{id:"fm-score",names:["PredScore_FM"],category:"instance_score_attr",menu:"segments",sidebarGroup:"products",section:"forestmamba",label:"Prediction Score (FM)",description:"ForestMamba prediction confidence from 0 to 1; unavailable predictions (-1) are dark grey.",legendSource:"forestmamba",colorScale:{min:0,max:1,sentinels:[{value:-1,label:"unavailable",color:"#262626"}]}},{id:"detailview-sat-class",names:["species_id","species_id_sat"],category:"species_attr",menu:"species",sidebarGroup:"products",section:"detailview-sat",label:"Species Classification (DV x SAT)",description:"Species classification by DetailVie
453w on SegmentAnyTree predictions.",speciesMap:"detailview",legendSource:"detailview-sat"},{id:"detailview-sat-probability",names:["species_prob","species_prob_sat"],category:"species_score_attr",menu:"species",sidebarGroup:"products",section:"detailview-sat",label:"Species Probability (DV x SAT)",description:"DetailView species probability on SegmentAnyTree predictions.",legendSource:"detailview-sat"},{id:"detailview-fm-class",names:["species_id_fm"],category:"species_attr",menu:"species",sidebarGroup:"products",section:"detailview-fm",label:"Species Classification (DV x FM)",description:"Species classification by DetailView on ForestMamba predictions.",speciesMap:"detailview",legendSource:"detailview-fm"},{id:"detailview-fm-probability",names:["species_prob_fm"],category:"species_score_attr",menu:"species",sidebarGroup:"products",section:"detailview-fm",label:"Species Probability (DV x FM)",description:"DetailView species probability on ForestMamba predictions.",legendSource:"detailview-fm"}],pre={version:ure,sources:dre,speciesMaps:hre,attributes:fre};var bD;function xe(t,e,r){function n(l,u){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(t))return;l._zod.traits.add(t),e(l,u);const h=a.prototype,p=Object.keys(h);for(let f=0;f<p.length;f++){const g=p[f];g in l||(l[g]=h[g].bind(l))}}const s=(r==null?void 0:r.Parent)??Object;class i extends s{}Object.defineProperty(i,"name",{value:t});function a(l){var u;const h=r!=null&&r.Parent?new i:this;n(h,l),(u=h._zod).deferred??(u.deferred=[]);for(const p of h._zod.deferred)p();return h}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>{var u,h;return r!=null&&r.Parent&&l instanceof r.Parent?!0:(h=(u=l==null?void 0:l._zod)==null?void 0:u.traits)==null?void 0:h.has(t)}}),Object.defineProperty(a,"name",{value:t}),a}class hf extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class A4 extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(bD=globalThis).__zod_globalConfig??(bD.__zod_globalConfig={});const v1=globalThis.__zod_globalConfig;function Wl(t){return v1}function T4(t){const e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,s])=>e.indexOf(+n)===-1).map(([n,s])=>s)}function KE(t,e){return typeof e=="bigint"?e.toString():e}function y1(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function _1(t){return t==null}function b1(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function mre(t,e){const r=t/e,n=Math.round(r),s=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<s?0:r-n}const wD=Symbol("evaluating");function Dr(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==wD)return n===void 0&&(n=wD,n=r()),n},set(s){Object.defineProperty(t,e,{value:s})},configurable:!0})}function Fd(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function hu(...t){const e={};for(const r of t){const n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function xD(t){return JSON.stringify(t)}function gre(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const I4="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function mb(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const vre=y1(()=>{var t;if(v1.jitless||typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)!=null&&t.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Ff(t){if(mb(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const r=e.prototype;return!(mb(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function D4(t){return Ff(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const yre=new Set(["string","number","symbol"]);function yw(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fu(t,e,r){const n=new t._zod.constr(e??t._zod.def);return(!e||r!=null&&r.parent)&&(n._zod.parent=t),n}function wt(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};
vendor: 43,563 bytes, lines 453-514
453if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function _re(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const bre={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function wre(t,e){const r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=hu(t._zod.def,{get shape(){const a={};for(const l in e){if(!(l in r.shape))throw new Error(`Unrecognized key: "${l}"`);e[l]&&(a[l]=r.shape[l])}return Fd(this,"shape",a),a},checks:[]});return fu(t,i)}function xre(t,e){const r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=hu(t._zod.def,{get shape(){const a={...t._zod.def.shape};for(const l in e){if(!(l in r.shape))throw new Error(`Unrecognized key: "${l}"`);e[l]&&delete a[l]}return Fd(this,"shape",a),a},checks:[]});return fu(t,i)}function Sre(t,e){if(!Ff(e))throw new Error("Invalid input to extend: expected a plain object");const r=t._zod.def.checks;if(r&&r.length>0){const i=t._zod.def.shape;for(const a in e)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=hu(t._zod.def,{get shape(){const i={...t._zod.def.shape,...e};return Fd(this,"shape",i),i}});return fu(t,s)}function kre(t,e){if(!Ff(e))throw new Error("Invalid input to safeExtend: expected a plain object");const r=hu(t._zod.def,{get shape(){const n={...t._zod.def.shape,...e};return Fd(this,"shape",n),n}});return fu(t,r)}function Ere(t,e){var n;if((n=t._zod.def.checks)!=null&&n.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const r=hu(t._zod.def,{get shape(){const s={...t._zod.def.shape,...e._zod.def.shape};return Fd(this,"shape",s),s},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return fu(t,r)}function jre(t,e,r){const s=e._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=hu(e._zod.def,{get shape(){const l=e._zod.def.shape,u={...l};if(r)for(const h in r){if(!(h in l))throw new Error(`Unrecognized key: "${h}"`);r[h]&&(u[h]=t?new t({type:"optional",innerType:l[h]}):l[h])}else for(const h in l)u[h]=t?new t({type:"optional",innerType:l[h]}):l[h];return Fd(this,"shape",u),u},checks:[]});return fu(e,a)}function Cre(t,e,r){const n=hu(e._zod.def,{get shape(){const s=e._zod.def.shape,i={...s};if(r)for(const a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new t({type:"nonoptional",innerType:s[a]}))}else for(const a in s)i[a]=new t({type:"nonoptional",innerType:s[a]});return Fd(this,"shape",i),i}});return fu(e,n)}function tf(t,e=0){var r;if(t.aborted===!0)return!0;for(let n=e;n<t.issues.length;n++)if(((r=t.issues[n])==null?void 0:r.continue)!==!0)return!0;return!1}function Nre(t,e=0){var r;if(t.aborted===!0)return!0;for(let n=e;n<t.issues.length;n++)if(((r=t.issues[n])==null?void 0:r.continue)===!1)return!0;return!1}function rf(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Fy(t){return typeof t=="string"?t:t==null?void 0:t.message}function Gl(t,e,r){var u,h,p,f,g,v;const n=t.message?t.message:Fy((p=(h=(u=t.inst)==null?void 0:u._zod.def)==null?void 0:h.error)==null?void 0:p.call(h,t))??Fy((f=e==null?void 0:e.error)==null?void 0:f.call(e,t))??Fy((g=r.customError)==null?void 0:g.call(r,t))??Fy((v=r.localeError)==null?void 0:v.call(r,t))??"Invalid input",{inst:s,continue:i,input:a,...l}=t;return l.path??(l.path=[]),l.message=n,e!=null&&e.reportInput&&(l.input=a),l}function w1(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function og(...t){const[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}const O4=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,KE,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},M4=xe("$ZodError",O4),L4=xe("$ZodError",O4,{Parent:Error});function Pre(t,e=r=>r.message){const r={},n=[];for(const s of t.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:r}}function Rre(t,e=r=>r.message){const r={_errors:[]},n=(s,i=[])=>{for(const a of s.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(l=>n({issues:l},[...i,...a.path]));else if(a.code==="invalid_key")n({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")n({issues:a.issues},[...i,...a.path]);else{const l=[...i,...a.path];if(l.length===0)r._errors.push(e(a));else{let u=r,h=0;for(;h<l.length;){const p=l[h];h===l.length-1?(u[p]=u[p]||{_errors:[]},u[p]._errors.push(e(a))):u[p]=u[p]||{_errors:[]},u=u[p],h++}}}};return n(t),r}const x1=t=>(e,r,n,s)=>{const i=n?{...n,async:!1}:{async:!1},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new hf;if(a.issues.length){const l=new((s==null?void 0:s.Err)??t)(a.issues.map(u=>Gl(u,i,Wl())));throw I4(l,s==null?void 0:s.callee),l}return a.value},S1=t=>async(e,r,n,s)=>{const i=n?{...n,async:!0}:{async:!0};let a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const l=new((s==null?void 0:s.Err)??t)(a.issues.map(u=>Gl(u,i,Wl())));throw I4(l,s==null?void 0:s.callee),l}return a.value},_w=t=>(e,r,n)=>{const s=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new hf;return i.issues.length?{success:!1,error:new(t??M4)(i.issues.map(a=>Gl(a,s,Wl())))}:{success:!0,data:i.value}},Are=_w(L4),bw=t=>async(e,r,n)=>{const s=n?{...n,async:!0}:{async:!0};let i=e._zod.run({value:r,issues:[]},s);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(a=>Gl(a,s,Wl())))}:{success:!0,data:i.value}},Tre=bw(L4),Ire=t=>(e,r,n)=>{const s=n?{...n,direction:"backward"}:{direction:"backward"};return x1(t)(e,r,s)},Dre=t=>(e,r,n)=>x1(t)(e,r,n),Ore=t=>async(e,r,n)=>{const s=n?{...n,direction:"backward"}:{direction:"backward"};return S1(t)(e,r,s)},Mre=t=>async(e,r,n)=>S1(t)(e,r,n),Lre=t=>(e,r,n)=>{const s=n?{...n,direction:"backward"}:{direction:"backward"};return _w(t)(e,r,s)},Fre=t=>(e,r,n)=>_w(t)(e,r,n),$re=t=>async(e,r,n)=>{const s=n?{...n,direction:"backward"}:{direction:"backward"};return bw(t)(e,r,s)},zre=t=>async(e,r,n)=>bw(t)(e,r,n),Ure=/^[cC][0-9a-z]{6,}$/,Bre=/^[0-9a-z]+$/,Vre=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Hre=/^[0-9a-vA-V]{20}$/,qre=/^[A-Za-z0-9]{27}$/,Wre=/^[a-zA-Z0-9_-]{21}$/,Gre=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Kre=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,SD=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Yre=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Zre="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Jre(){return new RegExp(Zre,"u")}const Qre=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xre=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ene=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,tne=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,rne=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,F4=/^[A-Za-z0-9_-]*$/,nne=/^https?$/,sne=/^\+[1-9]\d{6,14}$/,$4="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",ine=new RegExp(`^${$4}$`);function z4(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ane(t){return new RegExp(`^${z4(t)}$`)}function one(t){const e=z4({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${e}(?:${r.join("|")})`;return new RegExp(`^${$4}T(?:${n})$`)}const lne=t=>{const e=t?`[\\s\\S]{${(t==null?void 0:t.minimum)??0},${(t==null?void 0:t.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},cne=/^-?\d+$/,U4=/^-?\d+(?:\.\d+)?$/,une=/^(?:true|false)$/i,dne=/^[^A-Z]*$/,hne=/^[^a-z]*$/,gi=xe("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),B4={number:"number",bigint:"bigint",object:"date"},V4=xe("$ZodCheckLessThan",(t,e)=>{gi.init(t,e);const r=B4[typeof e.value];t._zod.onattach.push(n=>{const s=n._zod.bag,i=(e.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?s.maximum=e.value:s.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),H4=xe("$ZodCheckGreaterThan",(t,e)=>{gi.init(t,e);const r=B4[typeof e.value];t._zod.onattach.push(n=>{const s=n._zod.bag,i=(e.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?s.minimum=e.value:s.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),fne=xe("$ZodCheckMultipleOf",(t,e)=>{gi.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):mre(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),pne=xe("$ZodCheckNumberFormat",(t,e)=>{var a;gi.init(t,e),e.format=e.format||"float64";const r=(a=e.format)==null?void 0:a.includes("int"),n=r?"int":"number",[s,i]=bre[e.format];t._zod.onattach.push(l=>{const u=l._zod.bag;u.format=e.format,u.minimum=s,u.maximum=i,r&&(u.pattern=cne)}),t._zod.check=l=>{const u=l.value;if(r){if(!Number.isInteger(u)){l.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:u,inst:t});return}if(!Number.isSafeInteger(u)){u>0?l.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):l.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}u<s&&l.issues.push({origin:"number",input:u,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort}),u>i&&l.issues.push({origin:"number",input:u,code:"too_big",maximum:i,inclusive:!0,inst:t,continue:!e.abort})}}),mne=xe("$ZodCheckMaxLength",(t,e)=>{var r;gi.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!_1(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{const s=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<s&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{const s=n.value;if(s.length<=e.maximum)return;const a=w1(s);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),gne=xe("$ZodCheckMinLength",(t,e)=>{var r;gi.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!_1(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{const s=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>s&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{const s=n.value;if(s.length>=e.minimum)return;const a=w1(s);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),vne=xe("$ZodCheckLengthEquals",(t,e)=>{var r;gi.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!_1(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{const s=n._zod.bag;s.minimum=e.length,s.maximum=e.length,s.length=e.length}),t._zod.check=n=>{const s=n.value,i=s.length;if(i===e.length)return;const a=w1(s),l=i>e.length;n.issues.push({origin:a,...l?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),ww=xe("$ZodCheckStringFormat",(t,e)=>{var r,n;gi.init(t,e),t._zod.onattach.push(s=>{const i=s._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=s=>{e.pattern.lastIndex=0,!e.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:e.format,input:s.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),yne=xe("$ZodCheckRegex",(t,e)=>{ww.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),_ne=xe("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=dne),ww.init(t,e)}),bne=xe("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=hne),ww.init(t,e)}),wne=xe("$ZodCheckIncludes",(t,e)=>{gi.init(t,e);const r=yw(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=s=>{s.value.includes(e.includes,e.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:s.value,inst:t,continue:!e.abort})}}),xne=xe("$ZodCheckStartsWith",(t,e)=>{gi.init(t,e);const r=new RegExp(`^${yw(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),Sne=xe("$ZodCheckEndsWith",(t,e)=>{gi.init(t,e);const r=new RegExp(`.*${yw(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}}),kne=xe("$ZodCheckOverwrite",(t,e)=>{gi.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});class Ene{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const n=e.split(`
454`).filter(a=>a),s=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(s)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){const e=Function,r=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(i=>`  ${i}`)];return new e(...r,s.join(`
455`))}}const jne={major:4,minor:4,patch:3},dn=xe("$ZodType",(t,e)=>{var s;var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=jne;const n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(const i of n)for(const a of i._zod.onattach)a(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),(s=t._zod.deferred)==null||s.push(()=>{t._zod.run=t._zod.parse});else{const i=(l,u,h)=>{let p=tf(l),f;for(const g of u){if(g._zod.def.when){if(Nre(l)||!g._zod.def.when(l))continue}else if(p)continue;const v=l.issues.length,_=g._zod.check(l);if(_ instanceof Promise&&(h==null?void 0:h.async)===!1)throw new hf;if(f||_ instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await _,l.issues.length!==v&&(p||(p=tf(l,v)))});else{if(l.issues.length===v)continue;p||(p=tf(l,v))}}return f?f.then(()=>l):l},a=(l,u,h)=>{if(tf(l))return l.aborted=!0,l;const p=i(u,n,h);if(p instanceof Promise){if(h.async===!1)throw new hf;return p.then(f=>t._zod.parse(f,h))}return t._zod.parse(p,h)};t._zod.run=(l,u)=>{if(u.skipChecks)return t._zod.parse(l,u);if(u.direction==="backward"){const p=t._zod.parse({value:l.value,issues:[]},{...u,skipChecks:!0});return p instanceof Promise?p.then(f=>a(f,l,u)):a(p,l,u)}const h=t._zod.parse(l,u);if(h instanceof Promise){if(u.async===!1)throw new hf;return h.then(p=>i(p,n,u))}return i(h,n,u)}}Dr(t,"~standard",()=>({validate:i=>{var a;try{const l=Are(t,i);return l.success?{value:l.data}:{issues:(a=l.error)==null?void 0:a.issues}}catch{return Tre(t,i).then(u=>{var h;return u.success?{value:u.data}:{issues:(h=u.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}))}),k1=xe("$ZodString",(t,e)=>{var r;dn.init(t,e),t._zod.pattern=[...((r=t==null?void 0:t._zod.bag)==null?void 0:r.patterns)??[]].pop()??lne(t._zod.bag),t._zod.parse=(n,s)=>{if(e.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n}}),on=xe("$ZodStringFormat",(t,e)=>{ww.init(t,e),k1.init(t,e)}),Cne=xe("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Kre),on.init(t,e)}),Nne=xe("$ZodUUID",(t,e)=>{if(e.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=SD(n))}else e.pattern??(e.pattern=SD());on.init(t,e)}),Pne=xe("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Yre),on.init(t,e)}),Rne=xe("$ZodURL",(t,e)=>{on.init(t,e),t._zod.check=r=>{var n;try{const s=r.value.trim();if(!e.normalize&&((n=e.protocol)==null?void 0:n.source)===nne.source&&!/^https?:\/\//i.test(s)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:t,continue:!e.abort});return}const i=new URL(s);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=i.href:r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Ane=xe("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Jre()),on.init(t,e)}),Tne=xe("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Wre),on.init(t,e)}),Ine=xe("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Ure),on.init(t,e)}),Dne=xe("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Bre),on.init(t,e)}),One=xe("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Vre),on.init(t,e)}),Mne=xe("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Hre),on.init(t,e)}),Lne=xe("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=qre),on.init(t,e)}),Fne=xe("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=one(e)),on.init(t,e)}),$ne=xe("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=ine),on.init(t,e)}),zne=xe("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=ane(e)),on.init(t,e)}),Une=xe("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Gre),on.init(t,e)}),Bne=xe("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Qre),on.init(t,e),t._zod.bag.format="ipv4"}),Vne=xe("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Xre),on.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Hne=xe("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=ene),on.init(t,e)}),qne=xe("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=tne),on.init(t,e),t._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[s,i]=n;if(!i)throw new Error;const a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${s}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function q4(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const Wne=xe("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=rne),on.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{q4(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function Gne(t){if(!F4.test(t))return!1;const e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return q4(r)}const Kne=xe("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=F4),on.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{Gne(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Yne=xe("$ZodE164",(t,e)=>{e.pattern??(e.pattern=sne),on.init(t,e)});function Zne(t,e=null){try{const r=t.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const s=JSON.parse(atob(n));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&(!("alg"in s)||s.alg!==e))}catch{return!1}}const Jne=xe("$ZodJWT",(t,e)=>{on.init(t,e),t._zod.check=r=>{Zne(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),W4=xe("$ZodNumber",(t,e)=>{dn.init(t,e),t._zod.pattern=t._zod.bag.pattern??U4,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}const s=r.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;const i=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:t,...i?{received:i}:{}}),r}}),Qne=xe("$ZodNumberFormat",(t,e)=>{pne.init(t,e),W4.init(t,e)}),Xne=xe("$ZodBoolean",(t,e)=>{dn.init(t,e),t._zod.pattern=une,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}const s=r.value;return typeof s=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:t}),r}}),ese=xe("$ZodUnknown",(t,e)=>{dn.init(t,e),t._zod.parse=r=>r}),tse=xe("$ZodNever",(t,e)=>{dn.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),rse=xe("$ZodDate",(t,e)=>{dn.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}const s=r.value,i=s instanceof Date;return i&&!Number.isNaN(s.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:s,...i?{received:"Invalid Date"}:{},inst:t}),r}});function kD(t,e,r){t.issues.length&&e.issues.push(...rf(r,t.issues)),e.value[r]=t.value}const nse=xe("$ZodArray",(t,e)=>{dn.init(t,e),t._zod.parse=(r,n)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:t}),r;r.value=Array(s.length);const i=[];for(let a=0;a<s.length;a++){const l=s[a],u=e.element._zod.run({value:l,issues:[]},n);u instanceof Promise?i.push(u.then(h=>kD(h,r,a))):kD(u,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function gb(t,e,r,n,s,i){const a=r in n;if(t.issues.length){if(s&&i&&!a)return;e.issues.push(...rf(r,t.issues))}if(!a&&!s){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}t.value===void 0?a&&(e.value[r]=void 0):e.value[r]=t.value}function G4(t){var n,s,i,a;const e=Object.keys(t.shape);for(const l of e)if(!((a=(i=(s=(n=t.shape)==null?void 0:n[l])==null?void 0:s._zod)==null?void 0:i.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${l}": expected a Zod schema`);const r=_re(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function K4(t,e,r,n,s,i){const a=[],l=s.keySet,u=s.catchall._zod,h=u.def.type,p=u.optin==="optional",f=u.optout==="optional";for(const g in e){if(g==="__proto__"||l.has(g))continue;if(h==="never"){a.push(g);continue}const v=u.run({value:e[g],issues:[]},n);v instanceof Promise?t.push(v.then(_=>gb(_,r,g,e,p,f))):gb(v,r,g,e,p,f)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:i}),t.length?Promise.all(t).then(()=>r):r}const sse=xe("$ZodObject",(t,e)=>{dn.init(t,e);const r=Object.getOwnPropertyDescriptor(e,"shape");if(!(r!=null&&r.get)){const l=e.shape;Object.defineProperty(e,"shape",{get:()=>{const u={...l};return Object.defineProperty(e,"shape",{value:u}),u}})}const n=y1(()=>G4(e));Dr(t._zod,"propValues",()=>{const l=e.shape,u={};for(const h in l){const p=l[h]._zod;if(p.values){u[h]??(u[h]=new Set);for(const f of p.values)u[h].add(f)}}return u});const s=mb,i=e.catchall;let a;t._zod.parse=(l,u)=>{a??(a=n.value);const h=l.value;if(!s(h))return l.issues.push({expected:"object",code:"invalid_type",input:h,inst:t}),l;l.value={};const p=[],f=a.shape;for(const g of a.keys){const v=f[g],_=v._zod.optin==="optional",x=v._zod.optout==="optional",w=v._zod.run({value:h[g],issues:[]},u);w instanceof Promise?p.push(w.then(S=>gb(S,l,g,h,_,x))):gb(w,l,g,h,_,x)}return i?K4(p,h,l,u,n.value,t):p.length?Promise.all(p).then(()=>l):l}}),ise=xe("$ZodObjectJIT",(t,e)=>{sse.init(t,e);const r=t._zod.parse,n=y1(()=>G4(e)),s=g=>{var j,C;const v=new Ene(["shape","payload","ctx"]),_=n.value,x=R=>{const A=xD(R);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};v.write("const input = payload.value;");const w=Object.create(null);let S=0;for(const R of _.keys)w[R]=`key_${S++}`;v.write("const newResult = {};");for(const R of _.keys){const A=w[R],I=xD(R),P=g[R],T=((j=P==null?void 0:P._zod)==null?void 0:j.optin)==="optional",O=((C=P==null?void 0:P._zod)==null?void 0:C.optout)==="optional";v.write(`const ${A} = ${x(R)};`),T&&O?v.write(`
456        if (${A}.issues.length) {
457          if (${I} in input) {
458            payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
459              ...iss,
460              path: iss.path ? [${I}, ...iss.path] : [${I}]
461            })));
462          }
463        }
464        
465        if (${A}.value === undefined) {
466          if (${I} in input) {
467            newResult[${I}] = undefined;
468          }
469        } else {
470          newResult[${I}] = ${A}.value;
471        }
472        
473      `):T?v.write(`
474        if (${A}.issues.length) {
475          payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
476            ...iss,
477            path: iss.path ? [${I}, ...iss.path] : [${I}]
478          })));
479        }
480        
481        if (${A}.value === undefined) {
482          if (${I} in input) {
483            newResult[${I}] = undefined;
484          }
485        } else {
486          newResult[${I}] = ${A}.value;
487        }
488        
489      `):v.write(`
490        const ${A}_present = ${I} in input;
491        if (${A}.issues.length) {
492          payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
493            ...iss,
494            path: iss.path ? [${I}, ...iss.path] : [${I}]
495          })));
496        }
497        if (!${A}_present && !${A}.issues.length) {
498          payload.issues.push({
499            code: "invalid_type",
500            expected: "nonoptional",
501            input: undefined,
502            path: [${I}]
503          });
504        }
505
506        if (${A}_present) {
507          if (${A}.value === undefined) {
508            newResult[${I}] = undefined;
509          } else {
510            newResult[${I}] = ${A}.value;
511          }
512        }
513
514      `)}v.write("payload.value = newResult;"),v.write("return payload;");const k=v.compile();return(R,A)=>k(g,R,A)};let i;const a=mb,l=!v1.jitless,h=l&&vre.value,p=e.catchall;let f;t._zod.parse=(g,v)=>{f??(f=n.value);const _=g.value;return a(_)?l&&h&&(v==null?void 0:v.async)===!1&&v.jitless!==!0?(i||(i=s(e.shape)),g=i(g,v),p?K4([],_,g,v,f,t):g):r(g,v):(g.issues.push({expected:"object",code:"invalid_type",input:_,inst:t}),g)}});function ED(t,e,r,n){for(const i of t)if(i.issues.length===0)return e.value=i.value,e;const s=t.filter(i=>!tf(i));return s.length===1?(e.value=s[0].value,s[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(a=>Gl(a,n,Wl())))}),e)}const ase=xe("$ZodUnion",(t,e)=>{dn.init(t,e),Dr(t._zod,"optin",()=>e.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Dr(t._zod,"optout",()=>e.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Dr(t._zod,"values",()=>{if(e.options.every(n=>n._zod.values))return new Set(e.options.flatMap(n=>Array.from(n._zod.values)))}),Dr(t._zod,"pattern",()=>{if(e.options.every(n=>n._zod.pattern)){const n=e.options.map(s=>s._zod.pattern);return new RegExp(`^(${n.map(s=>b1(s.source)).join("|")})$`)}});const r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(n,s)=>{if(r)return r(n,s);let i=!1;const a=[];for(const l of e.options){const u=l._zod.run({value:n.value,issues:[]},s);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(l=>ED(l,n,t,s)):ED(a,n,t,s)}}),ose=xe("$ZodIntersection",(t,e)=>{dn.init(t,e),t._zod.parse=(r,n)=>{const s=r.value,i=e.left._zod.run({value:s,issues:[]},n),a=e.right._zod.run({value:s,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([u,h])=>jD(r,u,h)):jD(r,i,a)}});function YE(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Ff(t)&&Ff(e)){const r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),s={...t,...e};for(const i of n){const a=YE(t[i],e[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};s[i]=a.data}return{valid:!0,data:s}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<t.length;n++){const s=t[n],i=e[n],a=YE(s,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function jD(t,e,r){const n=new Map;let s;for(const l of e.issues)if(l.code==="unrecognized_keys"){s??(s=l);for(const u of l.keys)n.has(u)||n.set(u,{}),n.get(u).l=!0}else t.issues.push(l);for(const l of r.issues)if(l.code==="unrecognized_keys")for(const u of l.keys)n.has(u)||n.set(u,{}),n.get(u).r=!0;else t.issues.push(l);const i=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(i.length&&s&&t.issues.push({...s,keys:i}),tf(t))return t;const a=YE(e.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return t.value=a.data,t}const lse=xe("$ZodRecord",(t,e)=>{dn.init(t,e),t._zod.parse=(r,n)=>{const s=r.value;if(!Ff(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:t}),r;const i=[],a=e.keyType._zod.values;if(a){r.value={};const l=new Set;for(const h of a)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){l.add(typeof h=="number"?h.toString():h);const p=e.keyType._zod.run({value:h,issues:[]},n);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(v=>Gl(v,n,Wl())),input:h,path:[h],inst:t});continue}const f=p.value,g=e.valueType._zod.run({value:s[h],issues:[]},n);g instanceof Promise?i.push(g.then(v=>{v.issues.length&&r.issues.push(...rf(h,v.issues)),r.value[f]=v.value})):(g.issues.length&&r.issues.push(...rf(h,g.issues)),r.value[f]=g.value)}let u;for(const h in s)l.has(h)||(u=u??[],u.push(h));u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:t,keys:u})}else{r.value={};for(const l of Reflect.ownKeys(s)){if(l==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,l))continue;let u=e.keyType._zod.run({value:l,issues:[]},n);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&U4.test(l)&&u.issues.length){const f=e.keyType._zod.run({value:Number(l),issues:[]},n);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(u=f)}if(u.issues.length){e.mode==="loose"?r.value[l]=s[l]:r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(f=>Gl(f,n,Wl())),input:l,path:[l],inst:t});continue}const p=e.valueType._zod.run({value:s[l],issues:[]},n);p instanceof Promise?i.push(p.then(f=>{f.issues.length&&r.issues.push(...rf(l,f.issues)),r.value[u.value]=f.value})):(p.issues.length&&r.issues.push(...rf(l,p.issues)),r.value[u.value]=p.value)}}return i.length?Promise.all(i).then(()=>r):r}}),cse=xe("$ZodEnum",(t,e)=>{dn.init(t,e);const r=T4(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(s=>yre.has(typeof s)).map(s=>typeof s=="string"?yw(s):s.toString()).join("|")})$`),t._zod.parse=(s,i)=>{const a=s.value;return n.has(a)||s.issues.push({code:"invalid_value",values:r,input:a,inst:t}),s}}),use=xe("$ZodTransform",(t,e)=>{dn.init(t,e),t._zod.optin="optional",t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new A4(t.constructor.name);const s=e.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(a=>(r.value=a,r.fallback=!0,r));if(s instanceof Promise)throw new hf;return r.value=s,r.fallback=!0,r}});function CD(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}const Y4=xe("$ZodOptional",(t,e)=>{dn.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Dr(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Dr(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${b1(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){const s=r.value,i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>CD(a,s)):CD(i,s)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),dse=xe("$ZodExactOptional",(t,e)=>{Y4.init(t,e),Dr(t._zod,"values",()=>e.innerType._zod.values),Dr(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,n)=>e.innerType._zod.run(r,n)}),hse=xe("$ZodNullable",(t,e)=>{dn.init(t,e),Dr(t._zod,"optin",()=>e.innerType._zod.optin),Dr(t._zod,"optout",()=>e.innerType._zod.optout),Dr(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${b1(r.source)}|null)$`):void 0}),Dr(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),fse=xe("$ZodDefault",(t,e)=>{dn.init(t,e),t._zod.optin="optional",Dr(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;const s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>ND(i,e)):ND(s,e)}});function ND(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const pse=xe("$ZodPrefault",(t,e)=>{dn.init(t,e),t._zod.optin="optional",Dr(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),mse=xe("$ZodNonOptional",(t,e)=>{dn.init(t,e),Dr(t._zod,"values",()=>{const r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{const s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>PD(i,t)):PD(s,t)}});function PD(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const gse=xe("$ZodCatch",(t,e)=>{dn.init(t,e),t._zod.optin="optional",Dr(t._zod,"optout",()=>e.innerType._zod.optout),Dr(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);const s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(a=>Gl(a,n,Wl()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>Gl(i,n,Wl()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),vse=xe("$ZodPipe",(t,e)=>{dn.init(t,e),Dr(t._zod,"values",()=>e.in._zod.values),Dr(t._zod,"optin",()=>e.in._zod.optin),Dr(t._zod,"optout",()=>e.out._zod.optout),Dr(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){const i=e.out._zod.run(r,n);return i instanceof Promise?i.then(a=>$y(a,e.in,n)):$y(i,e.in,n)}const s=e.in._zod.run(r,n);return s instanceof Promise?s.then(i=>$y(i,e.out,n)):$y(s,e.out,n)}});function $y(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},r)}const yse=xe("$ZodReadonly",(t,e)=>{dn.init(t,e),Dr(t._zod,"propValues",()=>e.innerType._zod.propValues),Dr(t._zod,"values",()=>e.innerType._zod.values),Dr(t._zod,"optin",()=>{var r,n;return(n=(r=e.innerType)==null?void 0:r._zod)==null?void 0:n.optin}),Dr(t._zod,"optout",()=>{var r,n;return(n=(r=e.innerType)==null?void 0:r._zod)==null?void 0:n.optout}),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);const s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(RD):RD(s)}});function RD(t){return t.value=Object.freeze(t.value),t}const _se=xe("$ZodCustom",(t,e)=>{gi.init(t,e),dn.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{const n=r.value,s=e.fn(n);if(s instanceof Promise)return s.then(i=>AD(i,r,n,t));AD(s,r,n,t)}});function AD(t,e,r,n){if(!t){const s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),e.issues.push(og(s))}}var TD;class bse{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){const n=r[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){const r=e._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const s={...n,...this._map.get(e)};return Object.keys(s).length?s:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function wse(){return new bse}(TD=globalThis).__zod_globalRegistry??(TD.__zod_globalRegistry=wse());const km=globalThis.__zod_globalRegistry;function xse(t,e){return new t({type:"string",...wt(e)})}function Sse(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...wt(e)})}function ID(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...wt(e)})}function kse(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...wt(e)})}function Ese(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...wt(e)})}function jse(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...wt(e)})}function Cse(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...wt(e)})}function Nse(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...wt(e)})}function Pse(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...wt(e)})}function Rse(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...wt(e)})}function Ase(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...wt(e)})}function Tse(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...wt(e)})}function Ise(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...wt(e)})}function Dse(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...wt(e)})}function Ose(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...wt(e)})}function Mse(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...wt(e)})}function Lse(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...wt(e)})}function Fse(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...wt(e)})}function $se(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...wt(e)})}function zse(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...wt(e)})}function Use(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...wt(e)})}function Bse(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...wt(e)})}function Vse(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...wt(e)})}function Hse(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...wt(e)})}function qse(t,e){return new t({type:"string",format:"date",check:"string_format",...wt(e)})}function Wse(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...wt(e)})}function Gse(t,e){return new t({type:"string",format:"duration",check:"string_format",...wt(e)})}function Kse(t,e){return new t({type:"number",checks:[],...wt(e)})}function Yse(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...wt(e)})}function Zse(t,e){return new t({type:"boolean",...wt(e)})}function Jse(t){return new t({type:"unknown"})}function Qse(t,e){return new t({type:"never",...wt(e)})}function Xse(t,e){return new t({type:"date",...wt(e)})}function DD(t,e){return new V4({check:"less_than",...wt(e),value:t,inclusive:!1})}function v_(t,e){return new V4({check:"less_than",...wt(e),value:t,inclusive:!0})}function OD(t,e){return new H4({check:"greater_than",...wt(e),value:t,inclusive:!1})}function y_(t,e){return new H4({check:"greater_than",...wt(e),value:t,inclusive:!0})}function MD(t,e){return new fne({check:"multiple_of",...wt(e),value:t})}function Z4(t,e){return new mne({check:"max_length",...wt(e),maximum:t})}function vb(t,e){return new gne({check:"min_length",...wt(e),minimum:t})}function J4(t,e){return new vne({check:"length_equals",...wt(e),length:t})}function eie(t,e){return new yne({check:"string_format",format:"regex",...wt(e),pattern:t})}function tie(t){return new _ne({check:"string_format",format:"lowercase",...wt(t)})}function rie(t){return new bne({check:"string_format",format:"up
514percase",...wt(t)})}function nie(t,e){return new wne({check:"string_format",format:"includes",...wt(e),includes:t})}function sie(t,e){return new xne({check:"string_format",format:"starts_with",...wt(e),prefix:t})}function iie(t,e){return new Sne({check:"string_format",format:"ends_with",...wt(e),suffix:t})}function np(t){return new kne({check:"overwrite",tx:t})}function aie(t){return np(e=>e.normalize(t))}function oie(){return np(t=>t.trim())}function lie(){return np(t=>t.toLowerCase())}function cie(){return np(t=>t.toUpperCase())}function uie(){return np(t=>gre(t))}function die(t,e,r){return new t({type:"array",element:e,...wt(r)})}function hie(t,e,r){return new t({type:"custom",check:"custom",fn:e,...wt(r)})}function fie(t,e){const r=pie(n=>(n.addIssue=s=>{if(typeof s=="string")n.issues.push(og(s,n.value,r._zod.def));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(og(i))}},t(n.value,n)),e);return r}function pie(t,e){const r=new gi({check:"custom",...wt(e)});return r._zod.check=t,r}function Q4(t){let e=(t==null?void 0:t.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:(t==null?void 0:t.metadata)??km,target:e,unrepresentable:(t==null?void 0:t.unrepresentable)??"throw",override:(t==null?void 0:t.override)??(()=>{}),io:(t==null?void 0:t.io)??"output",counter:0,seen:new Map,cycles:(t==null?void 0:t.cycles)??"ref",reused:(t==null?void 0:t.reused)??"inline",external:(t==null?void 0:t.external)??void 0}}function Mn(t,e,r={path:[],schemaPath:[]}){var p,f;var n;const s=t._zod.def,i=e.seen.get(t);if(i)return i.count++,r.schemaPath.includes(t)&&(i.cycle=r.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,a);const l=(f=(p=t._zod).toJSONSchema)==null?void 0:f.call(p);if(l)a.schema=l;else{const g={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,a.schema,g);else{const _=a.schema,x=e.processors[s.type];if(!x)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);x(t,e,_,g)}const v=t._zod.parent;v&&(a.ref||(a.ref=v),Mn(v,e,g),e.seen.get(v).isParent=!0)}const u=e.metadataRegistry.get(t);return u&&Object.assign(a.schema,u),e.io==="input"&&js(t)&&(delete a.schema.examples,delete a.schema.default),e.io==="input"&&"_prefault"in a.schema&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,e.seen.get(t).schema}function X4(t,e){var a,l,u,h;const r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const p of t.seen.entries()){const f=(a=t.metadataRegistry.get(p[0]))==null?void 0:a.id;if(f){const g=n.get(f);if(g&&g!==p[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(f,p[0])}}const s=p=>{var x;const f=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const w=(x=t.external.registry.get(p[0]))==null?void 0:x.id,S=t.external.uri??(j=>j);if(w)return{ref:S(w)};const k=p[1].defId??p[1].schema.id??`schema${t.counter++}`;return p[1].defId=k,{defId:k,ref:`${S("__shared")}#/${f}/${k}`}}if(p[1]===r)return{ref:"#"};const v=`#/${f}/`,_=p[1].schema.id??`__schema${t.counter++}`;return{defId:_,ref:v+_}},i=p=>{if(p[1].schema.$ref)return;const f=p[1],{ref:g,defId:v}=s(p);f.def={...f.schema},v&&(f.defId=v);const _=f.schema;for(const x in _)delete _[x];_.$ref=g};if(t.cycles==="throw")for(const p of t.seen.entries()){const f=p[1];if(f.cycle)throw new Error(`Cycle detected: #/${(l=f.cycle)==null?void 0:l.join("/")}/<root>
515
516Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const p of t.seen.entries()){const f=p[1];if(e===p[0]){i(p);continue}if(t.external){const v=(u=t.external.registry.get(p[0]))==null?void 0:u.id;if(e!==p[0]&&v){i(p);continue}}if((h=t.metadataRegistry.get(p[0]))==null?void 0:h.id){i(p);continue}if(f.cycle){i(p);continue}if(f.count>1&&t.reused==="ref"){i(p);continue}}}function eU(t,e){var l,u,h,p;const r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=f=>{const g=t.seen.get(f);if(g.ref===null)return;const v=g.def??g.schema,_={...v},x=g.ref;if(g.ref=null,x){n(x);const S=t.seen.get(x),k=S.schema;if(k.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(v.allOf=v.allOf??[],v.allOf.push(k)):Object.assign(v,k),Object.assign(v,_),f._zod.parent===x)for(const C in v)C==="$ref"||C==="allOf"||C in _||delete v[C];if(k.$ref&&S.def)for(const C in v)C==="$ref"||C==="allOf"||C in S.def&&JSON.stringify(v[C])===JSON.stringify(S.def[C])&&delete v[C]}const w=f._zod.parent;if(w&&w!==x){n(w);const S=t.seen.get(w);if(S!=null&&S.schema.$ref&&(v.$ref=S.schema.$ref,S.def))for(const k in v)k==="$ref"||k==="allOf"||k in S.def&&JSON.stringify(v[k])===JSON.stringify(S.def[k])&&delete v[k]}t.override({zodSchema:f,jsonSchema:v,path:g.path??[]})};for(const f of[...t.seen.entries()].reverse())n(f[0]);const s={};
vendor: 5,481 bytes, line 516
516if(t.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":t.target,(l=t.external)!=null&&l.uri){const f=(u=t.external.registry.get(e))==null?void 0:u.id;if(!f)throw new Error("Schema is missing an `id` property");s.$id=t.external.uri(f)}Object.assign(s,r.def??r.schema);const i=(h=t.metadataRegistry.get(e))==null?void 0:h.id;i!==void 0&&s.id===i&&delete s.id;const a=((p=t.external)==null?void 0:p.defs)??{};for(const f of t.seen.entries()){const g=f[1];g.def&&g.defId&&(g.def.id===g.defId&&delete g.def.id,a[g.defId]=g.def)}t.external||Object.keys(a).length>0&&(t.target==="draft-2020-12"?s.$defs=a:s.definitions=a);try{const f=JSON.parse(JSON.stringify(s));return Object.defineProperty(f,"~standard",{value:{...e["~standard"],jsonSchema:{input:yb(e,"input",t.processors),output:yb(e,"output",t.processors)}},enumerable:!1,writable:!1}),f}catch{throw new Error("Error converting schema to JSON.")}}function js(t,e){const r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);const n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return js(n.element,r);if(n.type==="set")return js(n.valueType,r);if(n.type==="lazy")return js(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return js(n.innerType,r);if(n.type==="intersection")return js(n.left,r)||js(n.right,r);if(n.type==="record"||n.type==="map")return js(n.keyType,r)||js(n.valueType,r);if(n.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:js(n.in,r)||js(n.out,r);if(n.type==="object"){for(const s in n.shape)if(js(n.shape[s],r))return!0;return!1}if(n.type==="union"){for(const s of n.options)if(js(s,r))return!0;return!1}if(n.type==="tuple"){for(const s of n.items)if(js(s,r))return!0;return!!(n.rest&&js(n.rest,r))}return!1}const mie=(t,e={})=>r=>{const n=Q4({...r,processors:e});return Mn(t,n),X4(n,t),eU(n,t)},yb=(t,e,r={})=>n=>{const{libraryOptions:s,target:i}=n??{},a=Q4({...s??{},target:i,io:e,processors:r});return Mn(t,a),X4(a,t),eU(a,t)},gie={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},vie=(t,e,r,n)=>{const s=r;s.type="string";const{minimum:i,maximum:a,format:l,patterns:u,contentEncoding:h}=t._zod.bag;if(typeof i=="number"&&(s.minLength=i),typeof a=="number"&&(s.maxLength=a),l&&(s.format=gie[l]??l,s.format===""&&delete s.format,l==="time"&&delete s.format),h&&(s.contentEncoding=h),u&&u.size>0){const p=[...u];p.length===1?s.pattern=p[0].source:p.length>1&&(s.allOf=[...p.map(f=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},yie=(t,e,r,n)=>{const s=r,{minimum:i,maximum:a,format:l,multipleOf:u,exclusiveMaximum:h,exclusiveMinimum:p}=t._zod.bag;typeof l=="string"&&l.includes("int")?s.type="integer":s.type="number";const f=typeof p=="number"&&p>=(i??Number.NEGATIVE_INFINITY),g=typeof h=="number"&&h<=(a??Number.POSITIVE_INFINITY),v=e.target==="draft-04"||e.target==="openapi-3.0";f?v?(s.minimum=p,s.exclusiveMinimum=!0):s.exclusiveMinimum=p:typeof i=="number"&&(s.minimum=i),g?v?(s.maximum=h,s.exclusiveMaximum=!0):s.exclusiveMaximum=h:typeof a=="number"&&(s.maximum=a),typeof u=="number"&&(s.multipleOf=u)},_ie=(t,e,r,n)=>{r.type="boolean"},bie=(t,e,r,n)=>{r.not={}},wie=(t,e,r,n)=>{},xie=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Sie=(t,e,r,n)=>{const s=t._zod.def,i=T4(s.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},kie=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Eie=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},jie=(t,e,r,n)=>{const s=r,i=t._zod.def,{minimum:a,maximum:l}=t._zod.bag;typeof a=="number"&&(s.minItems=a),typeof l=="number"&&(s.maxItems=l),s.type="array",s.items=Mn(i.element,e,{...n,path:[...n.path,"items"]})},Cie=(t,e,r,n)=>{var h;const s=r,i=t._zod.def;s.type="object",s.properties={};const a=i.shape;for(const p in a)s.properties[p]=Mn(a[p],e,{...n,path:[...n.path,"properties",p]});const l=new Set(Object.keys(a)),u=new Set([...l].filter(p=>{const f=i.shape[p]._zod;return e.io==="input"?f.optin===void 0:f.optout===void 0}));u.size>0&&(s.required=Array.from(u)),((h=i.catchall)==null?void 0:h._zod.def.type)==="never"?s.additionalProperties=!1:i.catchall?i.catchall&&(s.additionalProperties=Mn(i.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(s.additionalProperties=!1)},Nie=(t,e,r,n)=>{const s=t._zod.def,i=s.inclusive===!1,a=s.options.map((l,u)=>Mn(l,e,{...n,path:[...n.path,i?"oneOf":"anyOf",u]}));i?r.oneOf=a:r.anyOf=a},Pie=(t,e,r,n)=>{const s=t._zod.def,i=Mn(s.left,e,{...n,path:[...n.path,"allOf",0]}),a=Mn(s.right,e,{...n,path:[...n.path,"allOf",1]}),l=h=>"allOf"in h&&Object.keys(h).length===1,u=[...l(i)?i.allOf:[i],...l(a)?a.allOf:[a]];r.allOf=u},Rie=(t,e,r,n)=>{const s=r,i=t._zod.def;s.type="object";const a=i.keyType,l=a._zod.bag,u=l==null?void 0:l.patterns;if(i.mode==="loose"&&u&&u.size>0){const p=Mn(i.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});s.patternProperties={};for(const f of u)s.patternProperties[f.source]=p}
vendor: 5,560 bytes, line 516
516else(e.target==="draft-07"||e.target==="draft-2020-12")&&(s.propertyNames=Mn(i.keyType,e,{...n,path:[...n.path,"propertyNames"]})),s.additionalProperties=Mn(i.valueType,e,{...n,path:[...n.path,"additionalProperties"]});const h=a._zod.values;if(h){const p=[...h].filter(f=>typeof f=="string"||typeof f=="number");p.length>0&&(s.required=p)}},Aie=(t,e,r,n)=>{const s=t._zod.def,i=Mn(s.innerType,e,n),a=e.seen.get(t);e.target==="openapi-3.0"?(a.ref=s.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Tie=(t,e,r,n)=>{const s=t._zod.def;Mn(s.innerType,e,n);const i=e.seen.get(t);i.ref=s.innerType},Iie=(t,e,r,n)=>{const s=t._zod.def;Mn(s.innerType,e,n);const i=e.seen.get(t);i.ref=s.innerType,r.default=JSON.parse(JSON.stringify(s.defaultValue))},Die=(t,e,r,n)=>{const s=t._zod.def;Mn(s.innerType,e,n);const i=e.seen.get(t);i.ref=s.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},Oie=(t,e,r,n)=>{const s=t._zod.def;Mn(s.innerType,e,n);const i=e.seen.get(t);i.ref=s.innerType;let a;try{a=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},Mie=(t,e,r,n)=>{const s=t._zod.def,i=s.in._zod.traits.has("$ZodTransform"),a=e.io==="input"?i?s.out:s.in:s.out;Mn(a,e,n);const l=e.seen.get(t);l.ref=a},Lie=(t,e,r,n)=>{const s=t._zod.def;Mn(s.innerType,e,n);const i=e.seen.get(t);i.ref=s.innerType,r.readOnly=!0},tU=(t,e,r,n)=>{const s=t._zod.def;Mn(s.innerType,e,n);const i=e.seen.get(t);i.ref=s.innerType},Fie=xe("ZodISODateTime",(t,e)=>{Fne.init(t,e),fn.init(t,e)});function $ie(t){return Hse(Fie,t)}const zie=xe("ZodISODate",(t,e)=>{$ne.init(t,e),fn.init(t,e)});function Uie(t){return qse(zie,t)}const Bie=xe("ZodISOTime",(t,e)=>{zne.init(t,e),fn.init(t,e)});function Vie(t){return Wse(Bie,t)}const Hie=xe("ZodISODuration",(t,e)=>{Une.init(t,e),fn.init(t,e)});function qie(t){return Gse(Hie,t)}const Wie=(t,e)=>{M4.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Rre(t,r)},flatten:{value:r=>Pre(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,KE,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,KE,2)}},isEmpty:{get(){return t.issues.length===0}}})},wa=xe("ZodError",Wie,{Parent:Error}),Gie=x1(wa),Kie=S1(wa),Yie=_w(wa),Zie=bw(wa),Jie=Ire(wa),Qie=Dre(wa),Xie=Ore(wa),eae=Mre(wa),tae=Lre(wa),rae=Fre(wa),nae=$re(wa),sae=zre(wa),LD=new WeakMap;function Ug(t,e,r){const n=Object.getPrototypeOf(t);let s=LD.get(n);if(s||(s=new Set,LD.set(n,s)),!s.has(e)){s.add(e);for(const i in r){const a=r[i];Object.defineProperty(n,i,{configurable:!0,enumerable:!1,get(){const l=a.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:l}),l},set(l){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:l})}})}}}const hn=xe("ZodType",(t,e)=>(dn.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:yb(t,"input"),output:yb(t,"output")}}),t.toJSONSchema=mie(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(r,n)=>Gie(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Yie(t,r,n),t.parseAsync=async(r,n)=>Kie(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Zie(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>Jie(t,r,n),t.decode=(r,n)=>Qie(t,r,n),t.encodeAsync=async(r,n)=>Xie(t,r,n),t.decodeAsync=async(r,n)=>eae(t,r,n),t.safeEncode=(r,n)=>tae(t,r,n),t.safeDecode=(r,n)=>rae(t,r,n),t.safeEncodeAsync=async(r,n)=>nae(t,r,n),t.safeDecodeAsync=async(r,n)=>sae(t,r,n),Ug(t,"ZodType",{check(...r){const n=this.def;return this.clone(hu(n,{checks:[...n.checks??[],...r.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return fu(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(Yae(r,n))},superRefine(r,n){return this.check(Zae(r,n))},overwrite(r){return this.check(np(r))},optional(){return UD(this)},exactOptional(){return Lae(this)},nullable(){return BD(this)},nullish(){return UD(BD(this))},nonoptional(r){return Vae(this,r)},array(){return as(this)},or(r){return iU([this,r])},and(r){return Iae(this,r)},transform(r){return VD(this,Oae(r))},default(r){return zae(this,r)},prefault(r){return Bae(this,r)},catch(r){return qae(this,r)},pipe(r){return VD(this,r)},readonly(){return Kae(this)},describe(r){const n=this.clone();return km.add(n,{description:r}),n},meta(...r){if(r.length===0)return km.get(this);const n=this.clone();return km.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(t,"description",{get(){var r;return(r=km.get(t))==null?void 0:r.description},configurable:!0}),t)),rU=xe("_ZodString",(t,e)=>{k1.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(n,s,i)=>vie(t,n,s);const r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,Ug(t,"_ZodString",{regex(...n){return this.check(eie(...n))},includes(...n){return this.check(nie(...n))},startsWith(...n){return this.check(sie(...n))},endsWith(...n){return this.check(iie(...n))},min(...n){return this.check(vb(...n))},max(...n){return this.check(Z4(...n))},length(...n){return this.check(J4(...n))},nonempty(...n){return this.check(vb(1,...n))},lowercase(n){return this.check(tie(n))},uppercase(n){return this.check(rie(n))},trim(){return this.check(oie())},normalize(...n){return this.check(aie(...n))},toLowerCase(){return this.check(lie())}
516,toUpperCase(){return this.check(cie())},slugify(){return this.check(uie())}})}),iae=xe("ZodString",(t,e)=>{k1.init(t,e),rU.init(t,e),t.email=r=>t.check(Sse(aae,r)),t.url=r=>t.check(Nse(oae,r)),t.jwt=r=>t.check(Vse(xae,r)),t.emoji=r=>t.check(Pse(lae,r)),t.guid=r=>t.check(ID(FD,r)),t.uuid=r=>t.check(kse(zy,r)),t.uuidv4=r=>t.check(Ese(zy,r)),t.uuidv6=r=>t.check(jse(zy,r)),t.uuidv7=r=>t.check(Cse(zy,r)),t.nanoid=r=>t.check(Rse(cae,r)),t.guid=r=>t.check(ID(FD,r)),t.cuid=r=>t.check(Ase(uae,r)),t.cuid2=r=>t.check(Tse(dae,r)),t.ulid=r=>t.check(Ise(hae,r)),t.base64=r=>t.check(zse(_ae,r)),t.base64url=r=>t.check(Use(bae,r)),t.xid=r=>t.check(Dse(fae,r)),t.ksuid=r=>t.check(Ose(pae,r)),t.ipv4=r=>t.check(Mse(mae,r)),t.ipv6=r=>t.check(Lse(gae,r)),t.cidrv4=r=>t.check(Fse(vae,r)),t.cidrv6=r=>t.check($se(yae,r)),t.e164=r=>t.check(Bse(wae,r)),t.datetime=r=>t.check($ie(r)),t.date=r=>t.check(Uie(r)),t.time=r=>t.check(Vie(r)),t.duration=r=>t.check(qie(r))});function ht(t){return xse(iae,t)}const fn=xe("ZodStringFormat",(t,e)=>{on.init(t,e),rU.init(t,e)}),aae=xe("ZodEmail",(t,e)=>{Pne.init(t,e),fn.init(t,e)}),FD=xe("ZodGUID",(t,e)=>{Cne.init(t,e),fn.init(t,e)}),zy=xe("ZodUUID",(t,e)=>{Nne.init(t,e),fn.init(t,e)}),oae=xe("ZodURL",(t,e)=>{Rne.init(t,e),fn.init(t,e)}),lae=xe("ZodEmoji",(t,e)=>{Ane.init(t,e),fn.init(t,e)}),cae=xe("ZodNanoID",(t,e)=>{Tne.init(t,e),fn.init(t,e)}),uae=xe("ZodCUID",(t,e)=>{Ine.init(t,e),fn.init(t,e)}),dae=xe("ZodCUID2",(t,e)=>{Dne.init(t,e),fn.init(t,e)}),hae=xe("ZodULID",(t,e)=>{One.init(t,e),fn.init(t,e)}),fae=xe("ZodXID",(t,e)=>{Mne.init(t,e),fn.init(t,e)}),pae=xe("ZodKSUID",(t,e)=>{Lne.init(t,e),fn.init(t,e)}),mae=xe("ZodIPv4",(t,e)=>{Bne.init(t,e),fn.init(t,e)}),gae=xe("ZodIPv6",(t,e)=>{Vne.init(t,e),fn.init(t,e)}),vae=xe("ZodCIDRv4",(t,e)=>{Hne.init(t,e),fn.init(t,e)}),yae=xe("ZodCIDRv6",(t,e)=>{qne.init(t,e),fn.init(t,e)}),_ae=xe("ZodBase64",(t,e)=>{Wne.init(t,e),fn.init(t,e)}),bae=xe("ZodBase64URL",(t,e)=>{Kne.init(t,e),fn.init(t,e)}),wae=xe("ZodE164",(t,e)=>{Yne.init(t,e),fn.init(t,e)}),xae=xe("ZodJWT",(t,e)=>{Jne.init(t,e),fn.init(t,e)}),nU=xe("ZodNumber",(t,e)=>{W4.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(n,s,i)=>yie(t,n,s),Ug(t,"ZodNumber",{gt(n,s){return this.check(OD(n,s))},gte(n,s){return this.check(y_(n,s))},min(n,s){return this.check(y_(n,s))},lt(n,s){return this.check(DD(n,s))},lte(n,s){return this.check(v_(n,s))},max(n,s){return this.check(v_(n,s))},int(n){return this.check($D(n))},safe(n){return this.check($D(n))},positive(n){return this.check(OD(0,n))},nonnegative(n){return this.check(y_(0,n))},negative(n){return this.check(DD(0,n))},nonpositive(n){return this.check(v_(0,n))},multipleOf(n,s){return this.check(MD(n,s))},step(n,s){return this.check(MD(n,s))},finite(){return this}});const r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function fa(t){return Kse(nU,t)}const Sae=xe("ZodNumberFormat",(t,e)=>{Qne.init(t,e),nU.init(t,e)});function $D(t){return Yse(Sae,t)}const kae=xe("ZodBoolean",(t,e)=>{Xne.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>_ie(t,r,n)});function Gc(t){return Zse(kae,t)}const Eae=xe("ZodUnknown",(t,e)=>{ese.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>wie()});function _b(){return Jse(Eae)}const jae=xe("ZodNever",(t,e)=>{tse.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>bie(t,r,n)});function Cae(t){return Qse(jae,t)}const Nae=xe("ZodDate",(t,e)=>{rse.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(n,s,i)=>xie(t,n),t.min=(n,s)=>t.check(y_(n,s)),t.max=(n,s)=>t.check(v_(n,s));const r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function sU(t){return Xse(Nae,t)}const Pae=xe("ZodArray",(t,e)=>{nse.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>jie(t,r,n,s),t.element=e.element,Ug(t,"ZodArray",{min(r,n){return this.check(vb(r,n))},nonempty(r){return this.check(vb(1,r))},max(r,n){return this.check(Z4(r,n))},length(r,n){return this.check(J4(r,n))},unwrap(){return this.element}})});function as(t,e){return die(Pae,t,e)}const Rae=xe("ZodObject",(t,e)=>{ise.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Cie(t,r,n,s),Dr(t,"shape",()=>e.shape),Ug(t,"ZodObject",{keyof(){return li(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:_b()})},loose(){return this.clone({...this._zod.def,catchall:_b()})},strict(){return this.clone({...this._zod.def,catchall:Cae()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return Sre(this,r)},safeExtend(r){return kre(this,r)},merge(r){return Ere(this,r)},pick(r){return wre(this,r)},omit(r){return xre(this,r)},partial(...r){return jre(aU,this,r[0])}
vendor: 4,464 bytes, line 516
516,required(...r){return Cre(oU,this,r[0])}})});function Rn(t,e){const r={type:"object",shape:t??{},...wt(e)};return new Rae(r)}const Aae=xe("ZodUnion",(t,e)=>{ase.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Nie(t,r,n,s),t.options=e.options});function iU(t,e){return new Aae({type:"union",options:t,...wt(e)})}const Tae=xe("ZodIntersection",(t,e)=>{ose.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Pie(t,r,n,s)});function Iae(t,e){return new Tae({type:"intersection",left:t,right:e})}const zD=xe("ZodRecord",(t,e)=>{lse.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Rie(t,r,n,s),t.keyType=e.keyType,t.valueType=e.valueType});function lg(t,e,r){return!e||!e._zod?new zD({type:"record",keyType:ht(),valueType:t,...wt(e)}):new zD({type:"record",keyType:t,valueType:e,...wt(r)})}const ZE=xe("ZodEnum",(t,e)=>{cse.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(n,s,i)=>Sie(t,n,s),t.enum=e.entries,t.options=Object.values(e.entries);const r=new Set(Object.keys(e.entries));t.extract=(n,s)=>{const i={};for(const a of n)if(r.has(a))i[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ZE({...e,checks:[],...wt(s),entries:i})},t.exclude=(n,s)=>{const i={...e.entries};for(const a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new ZE({...e,checks:[],...wt(s),entries:i})}});function li(t,e){const r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new ZE({type:"enum",entries:r,...wt(e)})}const Dae=xe("ZodTransform",(t,e)=>{use.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Eie(t,r),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new A4(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(og(i,r.value,e));else{const a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),r.issues.push(og(a))}};const s=e.transform(r.value,r);return s instanceof Promise?s.then(i=>(r.value=i,r.fallback=!0,r)):(r.value=s,r.fallback=!0,r)}});function Oae(t){return new Dae({type:"transform",transform:t})}const aU=xe("ZodOptional",(t,e)=>{Y4.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>tU(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});function UD(t){return new aU({type:"optional",innerType:t})}const Mae=xe("ZodExactOptional",(t,e)=>{dse.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>tU(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});function Lae(t){return new Mae({type:"optional",innerType:t})}const Fae=xe("ZodNullable",(t,e)=>{hse.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Aie(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});function BD(t){return new Fae({type:"nullable",innerType:t})}const $ae=xe("ZodDefault",(t,e)=>{fse.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Iie(t,r,n,s),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function zae(t,e){return new $ae({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():D4(e)}})}const Uae=xe("ZodPrefault",(t,e)=>{pse.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Die(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});function Bae(t,e){return new Uae({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():D4(e)}})}const oU=xe("ZodNonOptional",(t,e)=>{mse.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Tie(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});function Vae(t,e){return new oU({type:"nonoptional",innerType:t,...wt(e)})}const Hae=xe("ZodCatch",(t,e)=>{gse.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Oie(t,r,n,s),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function qae(t,e){return new Hae({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const Wae=xe("ZodPipe",(t,e)=>{vse.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Mie(t,r,n,s),t.in=e.in,t.out=e.out});function VD(t,e){return new Wae({type:"pipe",in:t,out:e})}const Gae=xe("ZodReadonly",(t,e)=>{yse.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Lie(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});function Kae(t){return new Gae({type:"readonly",innerType:t})}const lU=xe("ZodCustom",(t,e)=>{_se.init(t,e),hn.init(t,e),t._zod.processJSONSchema=(r,n,s)=>kie(t,r)});function Yae(t,e={}){return hie(lU,t,e)}function Zae(t,e){return fie(t,e)}function CS(t,e={}){const r=new lU({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...wt(e)});return r._zod.bag.Class=t,r._zod.check=n=>
516{n.value instanceof t||n.issues.push({code:"invalid_type",expected:t.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}const Ah={custom:"custom"},HD=t=>t.toLowerCase().replace(/[^a-z0-9]/g,""),Jae=["instance_attr","semantic_attr","species_attr","instance_score_attr","semantic_score_attr","species_score_attr"],Bg=ht().regex(/^#[0-9a-f]{6}$/i),Qae=li(Jae),Xae=li(["segments","species"]),eoe=li(["products","extra"]),toe=Rn({summary:ht(),links:as(Rn({label:ht().min(1),href:ht().min(1)}).strict())}).strict(),cU=Rn({label:ht().min(1),credit:toe.optional()}).strict(),roe=cU.partial(),noe=Rn({id:fa().int(),name:ht().min(1),secondaryLabel:ht().optional(),color:Bg.optional()}).strict(),uU=Rn({groundIds:as(fa().int()).min(1),groundLabel:ht().min(1),groundSecondaryLabel:ht().optional(),groundColor:Bg,entries:as(noe)}).strict(),soe=uU.partial(),ioe=Rn({id:fa().int(),label:ht().min(1),color:Bg}).strict(),aoe=Rn({value:fa(),label:ht().min(1),color:Bg}).strict(),ooe=Rn({min:fa(),max:fa(),sentinels:as(aoe).optional()}).strict(),loe=Rn({attributeNames:as(ht().min(1)).min(1),palette:ht().min(1).optional(),idColors:lg(ht(),Bg).optional()}).strict(),Cs={id:ht().min(1),names:as(ht().min(1)).min(1),category:Qae,menu:Xae,sidebarGroup:eoe.optional(),section:ht().min(1),label:ht().min(1),description:ht().optional(),excludeZero:Gc().optional(),legendSource:ht().min(1).nullable().optional(),speciesMap:ht().min(1).optional(),classes:as(ioe).optional(),colorScale:ooe.optional(),specialColoring:loe.optional()},dU=(t,e)=>{if(!t.category||!t.menu)return;const r=t.category==="species_attr"||t.category==="species_score_attr"?"species":"segments";t.menu!==r&&e.addIssue({code:"custom",path:["menu"],message:`${t.category} attributes must use the ${r} menu`})},coe=Rn(Cs).strict().superRefine(dU),uoe=Rn({id:Cs.id,names:Cs.names.optional(),category:Cs.category.optional(),menu:Cs.menu.optional(),sidebarGroup:Cs.sidebarGroup,section:Cs.section.optional(),label:Cs.label.optional(),description:Cs.description,excludeZero:Cs.excludeZero,legendSource:Cs.legendSource,speciesMap:Cs.speciesMap,classes:Cs.classes,colorScale:Cs.colorScale,specialColoring:Cs.specialColoring}).strict().superRefine(dU),doe=Rn({version:_b().optional(),sources:lg(ht(),roe).optional(),speciesMaps:lg(ht(),soe).optional(),attributes:as(uoe).optional()}).strict(),hoe=Rn({version:_b().optional(),sources:lg(ht(),cU),speciesMaps:lg(ht(),uU),attributes:as(coe)}).strict().superRefine((t,e)=>{Object.entries(t.speciesMaps).forEach(([n,s])=>{const i=new Set;s.groundIds.forEach((a,l)=>{i.has(a)&&e.addIssue({code:"custom",path:["speciesMaps",n,"groundIds",l],message:`Duplicate no-prediction id: ${a}`}),i.add(a)}),s.entries.forEach((a,l)=>{i.has(a.id)&&e.addIssue({code:"custom",path:["speciesMaps",n,"entries",l,"id"],message:`Duplicate species id: ${a.id}`}),i.add(a.id)})});const r=new Set;t.attributes.forEach((n,s)=>{var i,a;if(r.has(n.id)&&e.addIssue({code:"custom",path:["attributes",s,"id"],message:`Duplicate attribute definition id: ${n.id}`}),r.add(n.id),t.sources[n.section]||e.addIssue({code:"custom",path:["attributes",s,"section"],message:`Unknown source section: ${n.section}`}),n.legendSource&&!t.sources[n.legendSource]&&e.addIssue({code:"custom",path:["attributes",s,"legendSource"],message:`Unknown legend source: ${n.legendSource}`}),n.speciesMap&&!t.speciesMaps[n.speciesMap]&&e.addIssue({code:"custom",path:["attributes",s,"speciesMap"],message:`Unknown species map: ${n.speciesMap}`}),n.category==="species_attr"&&!n.speciesMap&&e.addIssue({code:"custom",path:["attributes",s,"speciesMap"],message:"Species classification attributes require a species map"}),n.category==="semantic_attr"){const l=new Set;(i=n.classes)!=null&&i.length||e.addIssue({code:"custom",path:["attributes",s,"classes"],message:"Semantic attributes require at least one class"}),(a=n.classes)==null||a.forEach((u,h)=>{l.has(u.id)&&e.addIssue({code:"custom",path:["attributes",s,"classes",h,"id"],message:`Duplicate semantic class id: ${u.id}`}),l.add(u.id)})}})}),foe=Object.assign({}),poe=Object.assign({"/src/config/potree-attributes/collections/95.json":ire,"/src/config/potree-attributes/collections/96.json":cre}),qD=(t,e)=>e?Object.fromEntries([...new Set([...Object.keys(t),...Object.keys(e)])].map(r=>[r,{...t[r]??{},...e[r]??{}}])):t,WD=(t,e)=>{if(!e)return t;
516const r=new Map((e.attributes??[]).map(l=>[l.id,l])),n=t.attributes.map(l=>{const u=r.get(l.id);return u?(r.delete(l.id),{...l,...u,colorScale:u.colorScale?{...l.colorScale,...u.colorScale}:l.colorScale,specialColoring:u.specialColoring?{...l.specialColoring,...u.specialColoring}:l.specialColoring}):l});for(const l of r.values())Array.isArray(l.names)&&l.category&&l.menu&&l.section&&l.label&&n.push(l);const s=qD(t.speciesMaps,e.speciesMaps);for(const[l,u]of Object.entries(e.speciesMaps??{}))u.entries&&(s[l].entries=u.entries),u.groundIds&&(s[l].groundIds=u.groundIds);const i={version:1,sources:qD(t.sources,e.sources),speciesMaps:s,attributes:n},a=hU(i);return a||(console.warn("Ignoring invalid Potree attribute manifest override."),t)},hU=t=>{const e=hoe.safeParse(t);return e.success?{version:1,sources:e.data.sources,speciesMaps:e.data.speciesMaps,attributes:e.data.attributes}:null},JE=t=>{const e=doe.safeParse(t);if(!e.success)return null;const r={};return e.data.sources&&(r.sources=e.data.sources),e.data.speciesMaps&&(r.speciesMaps=e.data.speciesMaps),e.data.attributes&&(r.attributes=e.data.attributes),r},fU=hU(pre);if(!fU)throw new Error("The default Potree attribute manifest is invalid.");const ls=fU,moe=t=>`/src/config/potree-attributes/datasets/${t}.json`,goe=t=>`/src/config/potree-attributes/collections/${t}.json`,RSe=(t,e)=>{const r=e==null?null:poe[goe(e)],n=JE(r),s=WD(ls,n);if(t==null)return s;const i=JE(foe[moe(t)]);return WD(s,i)},voe=(t,e)=>{const r=new URL(t);return r.pathname=`${r.pathname.slice(0,r.pathname.lastIndexOf("/")+1)}${e}`,r.search="",r.hash="",r.href},ASe=async(t,e)=>{for(const r of["point_cloud_attributes.json","attribute_manifest.json"])try{const n=await fetch(voe(t,r),{signal:e});if(!n.ok)continue;const s=JE(await n.json());if(s)return s}catch{if(e!=null&&e.aborted)return null}return null},to=(t,e)=>{const r=HD(e??"");return r?t.attributes.find(n=>n.names.some(s=>HD(s)===r))??null:null},TSe=(t,e)=>{var r;return e?((r=t.sources[e.section])==null?void 0:r.label)??e.section:null},ISe=(t,e)=>{var r;if(e!=null&&e.legendSource)return(r=t.sources[e.legendSource])==null?void 0:r.credit},DSe=(t,e)=>{const r=to(t,e);return r!=null&&r.speciesMap?t.speciesMaps[r.speciesMap]??null:e?null:t.speciesMaps.detailview??null},OSe=(t,e)=>{var r;return((r=to(t,e))==null?void 0:r.colorScale)??null},MSe=(t,e)=>{var r;return((r=to(t,e))==null?void 0:r.classes)??[]},mi=t=>t.toLowerCase().replace(/[^a-z0-9]/g,""),xw=ls.attributes,yoe=new Map(xw.filter(({category:t})=>["instance_attr","semantic_attr","instance_score_attr","semantic_score_attr"].includes(t)).flatMap(t=>t.names.map(e=>[mi(e),t.label]))),LSe=new Map([["predinstance","PredInstance"],["predsemantic","PredSemantic"],["predinstancesat","PredInstance_SAT"],["predsemanticsat","PredSemantic_SAT"],["predinstancefm","PredInstance_FM"],["predsemanticfm","PredSemantic_FM"],["predscorefm","PredScore_FM"]]),_oe=new Map(xw.flatMap(t=>{var r;const e=(r=ls.sources[t.section])==null?void 0:r.label;return t.names.map(n=>[mi(n),e])}));new Set(xw.flatMap(t=>t.names.map(mi)));const E1="classification",GD=2.05,pU=new Map([["rgb","RGB"],["rgba","RGB"],["intensity","Intensity"],["returnnumber","Return Number"],["numberofreturns","Number Of Returns"],["classification","Classification"],["scananglerank","Scan Angle Rank"],["userdata","User Data"],["pointsourceid","Point Source ID"],["gpstime","GPS time"],["gps-time","GPS time"],["edgeofflightline","Edge Of Flight Line"],["scandirectionflag","Scan Direction Flag"],["scannerchannel","Scanner Channel"],["nir","Near Infrared"]]),boe=new Set([...pU.keys(),"r","red","g","green","b","blue","x","y","z","position","positioncartesian"]),woe=new Map([["intensity","Returned pulse strength recorded by the laser scanner."],["returnnumber","Return index for this pulse, starting at 1."],["numberofreturns","Total number of returns detected for the emitted pulse."],["classification","LAS classification code, for example ground or vegetation."],["scananglerank","Scanner angle relative to nadir at acquisition time."],["userdata","Generic LAS user data byte supplied by the source file."],["pointsourceid","Source flight line, scan strip, or file identifier."],["gpstime","GPS timestamp associated with the point measurement."],["edgeofflightline","Flag for points near the edge of a flight line."],["scandirectionflag","Flag describing the scanner mirror travel direction."],["scannerchannel","Scanner channel index for multi-channel sensors."],["rgb","Red, green, and blue color channels stored with the point."],["rgba","Red, green, blue, and alpha color channels stored with the point."],["nir","Near-infrared channel stored in compatible LAS point formats."]]),xoe=new Map(xw.flatMap(t=>t.names.map(e=>[mi(e),t.description]))),Sw=(t,e,r=ls)=>{var n;return((n=to(r,t))==null?void 0:n.category)===e},FSe=(t,e=ls)=>Sw(t,"instance_attr",e),$Se=(t,e=ls)=>Sw(t,"semantic_attr",e),zSe=(t,e=ls)=>{var n;const r=(n=to(e,t))==null?void 0:n.category;return r==="instance_score_attr"||r==="semantic_score_attr"},USe=(t,e=ls)=>
516Sw(t,"species_attr",e),BSe=(t,e=ls)=>{var r;return((r=to(e,t))==null?void 0:r.speciesMap)==="treescanpl10k"},VSe=(t,e=ls)=>Sw(t,"species_score_attr",e),HSe=(t,e=ls)=>!!to(e,t),qSe=t=>mi(t??"")===E1,WSe=t=>mi(t??"")==="returnnumber",GSe=(t,e=ls)=>{const r=mi(t??"");return e.attributes.some(n=>{var s;return(s=n.specialColoring)==null?void 0:s.attributeNames.some(i=>mi(i)===r)})||r==="colorid"},Soe=new Set([E1,"predinstance","predsemantic","predinstancesat","predsemanticsat","predinstancefm","predsemanticfm","speciesid","speciesidsat","speciesidfm","returnnumber","numberofreturns","scandirectionflag","edgeofflightline","userdata","pointsourceid","scannerchannel","classificationflags","syntheticflag","keypointflag","withheldflag","colorid","coloringid","coloringsat","coloringidsat","coloringfoma","coloringidfm"]),koe=t=>{const e=mi(t??"");return!!e&&!Soe.has(e)},j1=t=>!!(t&&Number.isFinite(t[0])&&Number.isFinite(t[1])&&t[0]===t[1]),Eoe=t=>!!(t&&Number.isFinite(t[0])&&Number.isFinite(t[1])&&t[0]===0&&t[1]===0),joe=t=>t.replace(/[_-]+/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/\b\w/g,e=>e.toUpperCase()),Coe=(t,e=ls)=>{var l;const r=t.toLowerCase(),n=mi(t),s=(l=to(e,t))==null?void 0:l.label;if(s)return s;const i=yoe.get(n);if(i)return i;if(n==="speciesid")return"Species Classification (DV x SAT)";if(n==="speciesprob")return"Species Probability (DV x SAT)";if(n==="speciesidsat")return"Species Classification (DV x SAT)";if(n==="speciesprobsat")return"Species Probability (DV x SAT)";if(n==="speciesidfm")return"Species Classification (DV x FM)";if(n==="speciesprobfm")return"Species Probability (DV x FM)";if(n===E1)return"Classification";if(r==="rgba"||r==="rgb")return"RGB";if(n==="gpstime")return"GPS time";const a=pU.get(n);return a||(n==="coloringid"||n==="colorid"||n==="coloringsat"||n==="coloringidsat"||n==="coloringfoma"||n==="coloringidfm"?"Special coloring":joe(t))},Noe=(t,e=ls)=>Coe(t,e),KD=t=>{const e=mi(t??"");return boe.has(e)},Poe=(t,e=ls)=>{var n;const r=mi(t??"");return((n=to(e,t))==null?void 0:n.description)??xoe.get(r)??woe.get(r)??null},KSe=t=>{if(!Array.isArray(t)||t.length!==2)return null;const e=Number(t[0]),r=Number(t[1]);return!Number.isFinite(e)||!Number.isFinite(r)?null:r>e?[e,r]:[e-.5,r+.5]},YSe=t=>{if(!Array.isArray(t)||t.length!==2)return null;const e=t.flatMap(i=>Array.isArray(i)?i.map(Number):[Number(i)]),r=e.filter(Number.isFinite);if(r.length!==e.length||r.length===0)return null;const n=Math.min(...r),s=Math.max(...r);return n<=s?[n,s]:[s,n]},Th=t=>{const e=typeof t=="number"?t:typeof t=="string"?Number(t):NaN;return Number.isFinite(e)?String(Math.trunc(e)):null},Roe=t=>{if(!t||typeof t!="object")return null;const e=t,r=e.version??e.las_version??e.lasVersion??e.Version??e.LASVersion;if(typeof r=="string"&&r.trim()){const i=r.trim().replace(/^LAS\s*/i,"");return i?`LAS ${i}`:null}const n=Th(e.VersionMajor)??Th(e.version_major)??Th(e.major_version),s=Th(e.VersionMinor)??Th(e.version_minor)??Th(e.minor_version);return n&&s?`LAS ${n}.${s}`:null},mU=t=>{if(!t||typeof t!="object")return null;const e=t,r=Number(e.minimum??e.min),n=Number(e.maximum??e.max);return!Number.isFinite(r)||!Number.isFinite(n)?null:r<=n?[r,n]:[n,r]},Uy=(t,e)=>{for(const r of e){const n=t[r],s=Array.isArray(n)?n[0]:n,i=typeof s=="number"?s:typeof s=="string"?Number(s):NaN;if(Number.isFinite(i))return i}return null},By=(t,e,r)=>Math.min(r,Math.max(e,t)),Aoe=t=>{if(!t||typeof t!="object")return null;const e=t,r=Array.isArray(e.name)?e.name[0]:e.name;if(!koe(typeof r=="string"?r:null))return null;const s=mU(t);if(!s||j1(s))return null;const[i,a]=s,l=Uy(e,["q02","q2","p02","p2","percentile_02","percentile_2"]),u=Uy(e,["q98","p98","percentile_98"]);if(l!==null&&u!==null&&u>l)return[By(l,i,a),By(u,i,a)];const h=Uy(e,["median"]),p=Uy(e,["stddev","sd"]);if(h===null||p===null||p<=0)return null;const f=By(h-GD*p,i,a),g=By(h+GD*p,i,a);return!Number.isFinite(f)||!Number.isFinite(g)||g<=f?null:[f,g]},Toe=(t,e,r=ls)=>{const n=to(r,t);return(n==null?void 0:n.menu)==="segments"?{menuGroup:"segmentation-products",sidebarGroup:n.sidebarGroup??"products"}:(n==null?void 0:n.menu)==="species"?{menuGroup:"species-products",sidebarGroup:n.sidebarGroup??"products"}:j1(e)?{menuGroup:"static",sidebarGroup:KD(t)?"standard":"extra"}:KD(t)?{menuGroup:"standard",sidebarGroup:"standard"}:{menuGroup:"extra",sidebarGroup:"extra"}},Ioe=(t,e,r=null,n=ls)=>{var h;const s=Toe(t,e,n),i=mi(t),a=to(n,t),l=a?((h=n.sources[a.section])==null?void 0:h.label)??a.section:_oe.get(i),u=Eoe(e);return{name:t,label:Noe(t,n),range:e,colorRange:r,...s,isEmpty:u,isStatic:j1(e),sourceComment:l,standardDescription:Poe(t,n)??void 0}},ZSe=t=>t?t[0]===t[1]?NS(t[0]):`${NS(t[0])}-${NS(t[1])}`:"n/a",NS=t=>{if(!Number.isFinite(t))return"n/a";const e=Math.abs(t);return e>=1e6?YD(t/1e6,"M"):e>
516=1e3?YD(t/1e3,"k"):t.toLocaleString(void 0,{maximumFractionDigits:e>=10?0:2})},YD=(t,e)=>`${t.toFixed(1).replace(/\.0$/,"")}${e}`,Doe={2056:"+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs +type=crs",2154:"+proj=lcc +lat_0=46.5 +lon_0=3 +lat_1=49 +lat_2=44 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs",2180:"+proj=tmerc +lat_0=0 +lon_0=19 +k=0.9993 +x_0=500000 +y_0=-5300000 +ellps=GRS80 +units=m +no_defs +type=crs",2193:"+proj=tmerc +lat_0=0 +lon_0=173 +k=0.9996 +x_0=1600000 +y_0=10000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs",2955:"+proj=utm +zone=11 +ellps=GRS80 +units=m +no_defs +type=crs",2972:"+proj=utm +zone=22 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs",3067:"+proj=utm +zone=35 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs",3157:"+proj=utm +zone=10 +ellps=GRS80 +units=m +no_defs +type=crs",3844:"+proj=sterea +lat_0=46 +lon_0=25 +k=0.99975 +x_0=500000 +y_0=500000 +ellps=krass +units=m +no_defs +type=crs",21037:"+proj=utm +zone=37 +south +a=6378249.145 +rf=293.465 +towgs84=-160,-6,-302,0,0,0,0 +units=m +no_defs +type=crs",26915:"+proj=utm +zone=15 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs",27700:"+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +units=m +no_defs +type=crs",28351:"+proj=utm +zone=51 +south +ellps=GRS80 +units=m +no_defs +type=crs",28992:"+proj=sterea +lat_0=52.1561605555556 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +no_defs +type=crs",31287:"+proj=lcc +lat_0=47.5 +lon_0=13.3333333333333 +lat_1=49 +lat_2=46 +x_0=400000 +y_0=400000 +ellps=bessel +towgs84=577.326,90.129,463.919,5.137,1.474,5.297,2.4232 +units=m +no_defs +type=crs"},Ooe=t=>{const e=t%100;return e<1||e>60?null:t>=25801&&t<=25860?`+proj=utm +zone=${e} +ellps=GRS80 +units=m +no_defs +type=crs`:t>=32601&&t<=32660?`+proj=utm +zone=${e} +datum=WGS84 +units=m +no_defs +type=crs`:t>=32701&&t<=32760?`+proj=utm +zone=${e} +south +datum=WGS84 +units=m +no_defs +type=crs`:null},Moe=()=>typeof window>"u"?null:window.proj4??null,Loe=t=>Number.isInteger(t)?Doe[Number(t)]??Ooe(Number(t)):null,Foe=(t,e)=>{if(!(t!=null&&t.defs)||!Number.isInteger(e))return!1;const r=`EPSG:${Number(e)}`,n=Loe(Number(e));return n?(t.defs(r,n),!0):!1},$oe=(t,e,r=Moe())=>{if(!r||!Number.isInteger(e))return null;if(Number(e)===4326)return t;const n=`EPSG:${Number(e)}`;if(!Foe(r,Number(e)))return null;try{const s=r("EPSG:4326",n,t),i=Number(s==null?void 0:s[0]),a=Number(s==null?void 0:s[1]);return Number.isFinite(i)&&Number.isFinite(a)?[i,a]:null}catch{return null}},ZD=t=>Array.isArray(t)&&t.length>=2&&typeof t[0]=="number"&&typeof t[1]=="number"&&Number.isFinite(t[0])&&Number.isFinite(t[1]),Vy=t=>{if(t.length<2)return t;const e=t[0],r=t[t.length-1];return e[0]===r[0]&&e[1]===r[1]?t.slice(0,-1):t};function gU(t){if(!t||typeof t!="object")return null;const e=t;return e.type==="Feature"?gU(e.geometry):e}function bb(t){const e=gU(t);if(!e)return[];if(e.type==="FeatureCollection")return(Array.isArray(e.features)?e.features:[]).flatMap(bb);if(e.type==="GeometryCollection")return(Array.isArray(e.geometries)?e.geometries:[]).flatMap(bb);if(e.type==="Polygon"&&Array.isArray(e.coordinates)){const r=e.coordinates[0];if(!Array.isArray(r))return[];const n=r.filter(ZD);return Vy(n).length>=3?[Vy(n)]:[]}return e.type==="MultiPolygon"&&Array.isArray(e.coordinates)?e.coordinates.flatMap(r=>{if(!Array.isArray(r))return[];const n=r[0];if(!Array.isArray(n))return[];const s=n.filter(ZD);return Vy(s).length>=3?[Vy(s)]:[]}):[]}function zoe(t){const e=t.flat();return C1(e)}function C1(t){if(t.length<3)return null;const e=t.map(l=>l[0]),r=t.map(l=>l[1]),n=Math.min(...e),s=Math.max(...e),i=Math.min(...r),a=Math.max(...r);return!Number.isFinite(n)||!Number.isFinite(s)||!Number.isFinite(i)||!Number.isFinite(a)?null:{minX:n,maxX:s,minY:i,maxY:a}}function Uoe(t){return{x:(t.minX+t.maxX)/2,y:(t.minY+t.maxY)/2}}function JD(t){return t.length>0?[...t,t[0]]:t}function QD(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function Boe(t){const e=new Set;return t.filter(r=>{const n=`${r[0]},${r[1]}`;return e.has(n)?!1:(e.add(n),!0)})}function vU(t){const e=Boe(t).sort((s,i)=>s[0]===i[0]?s[1]-i[1]:s[0]-i[0]);if(e.length<3)return[];const r=[];for(const s of e){for(;r.length>=2&&QD(r[r.length-2],r[r.length-1],s)<=0;)r.pop();r.push(s)}const n=[];for(const s of[...e].reverse()){for(;n.length>=2&&QD(n[n.length-2],n[n.length-1],s)<=0;)n.pop();n.push(s)}return[...r.slice(0,-1),...n.slice(0,-1)]}function Voe(t){return t.minX>=-180&&t.maxX<=180&&t.minY>=-90&&t.maxY<=90}function Hoe(t,e,r,n){if(!Voe(e))return null;const s=t.map(i=>n(i,r));return s.some(i=>i==null)?null:s}function qoe(t){return{minX:t.min.x,maxX:t.max.x,minY:t.min.y,maxY:t.max.y}}function XD(t,e){const r=C1(t);if(!r)return!1;const n=qoe(e),s=r.maxX-r.minX,i=r.maxY-r.minY,a=n.maxX-n.minX,l=n.maxY-n.minY;if(s<=0||i<=0||a<=0||l<=0)return!1;const u=Math.max(0,Math.min(r.maxX,n.maxX)-Math.max(r.minX,n.minX)),h=Math.max(0,Math.min(r.maxY,n.maxY)-Math.max(r.minY,n.minY)),p=u/Math.min(s,a),f=h/Math.min(i,l),g=s/a,v=i/l;return p>=.5&&f>=.5&&g>=.01&&v>=.01&&g<=3&&v<=3}function Woe(t,e,r,n){return t.map(([s,i])=>
516[e.x+(s-e.x)*r,e.y+(i-e.y)*r,n])}function JSe(t,e,r,n,s={}){var i;return((i=Goe(t,e,r,n,s))==null?void 0:i.geometry)??null}function Goe(t,e,r,n,s={}){const i=bb(t),a=vU(i.flat()),l=zoe([a]);if(!l)return null;const u=l.maxX-l.minX,h=l.maxY-l.minY,p=e.max.x-e.min.x,f=e.max.y-e.min.y,g=Math.max(1,e.max.z-e.min.z);if(p<=0||f<=0)return null;const v=Number.isFinite(n)?Number(n):e.min.z+Math.max(.05,g*.002),_=(e.min.x+e.max.x)/2,x=(e.min.y+e.max.y)/2,w=1-Math.max(0,Math.min(90,r))/100,S=Hoe(a,l,s.targetEpsg,s.projectLonLat??$oe),k=XD(a,e)?a:null,j=S&&XD(S,e)?S:null,C=k??j;if(C){const A=C1(C);if(!A)return null;const I=Woe(C,Uoe(A),w,v);return I.length>0?{geometry:{type:"MultiPolygon",coordinates:[[JD(I)]]},mode:k?"direct":"projected"}:null}const R=a.map(([A,I])=>{const P=u>0?(A-l.minX)/u:.5,T=h>0?(I-l.minY)/h:.5,O=e.min.x+P*p,G=e.min.y+T*f;return[_+(O-_)*w,x+(G-x)*w,v]});return R.length>0?{geometry:{type:"MultiPolygon",coordinates:[[JD(R)]]},mode:"approximate"}:null}const Koe=t=>{if(!t||typeof t!="object")return!1;const e=t,r=e.x??e.X,n=e.y??e.Y;return Number.isFinite(Number(r))&&Number.isFinite(Number(n))},eO=t=>Array.isArray(t)&&t.length>=2&&Number.isFinite(Number(t[0]))&&Number.isFinite(Number(t[1])),QE=t=>{if(!t||typeof t!="object")return[];const e=t;if(e.type==="Feature")return QE(e.geometry);if(e.type==="FeatureCollection"&&Array.isArray(e.features))return e.features.flatMap(r=>QE(r));if(e.type==="Polygon"&&Array.isArray(e.coordinates)){const r=e.coordinates[0];return Array.isArray(r)?[r.filter(eO).map(([n,s])=>[Number(n),Number(s)])]:[]}return e.type==="MultiPolygon"&&Array.isArray(e.coordinates)?e.coordinates.flatMap(r=>{const n=Array.isArray(r)?r[0]:null;return Array.isArray(n)?[n.filter(eO).map(([s,i])=>[Number(s),Number(i)])]:[]}):[]},Yoe=t=>{const e=t.flat();return e.length>0&&e.every(([r,n])=>Math.abs(r)<=180&&Math.abs(n)<=90)},Oc=t=>{if(typeof t=="number"&&Number.isFinite(t))return Math.round(t);if(Array.isArray(t))return t.map(Oc).find(n=>n!=null)??null;if(t&&typeof t=="object"){const n=t;return Oc(n.epsg??n.code??n.srid??null)}if(typeof t!="string")return null;const e=t.trim(),r=e.match(/EPSG[:\s]*([0-9]+)/i)??e.match(/^([0-9]{4,6})$/);return r?Number(r[1]):null},Zoe=t=>{if(typeof t!="string")return!1;const e=t.trim().toLowerCase();return!e||e.startsWith("{")||e.startsWith("[")?!1:!["0","none","null","undefined","unknown","local","local_or_unknown","local or unknown","n/a","na"].includes(e)},Ha=t=>Oc(t)!=null||Zoe(t),Joe=(t,e,r)=>{const n=r>=25801&&r<=25860?r-25800:r>=32601&&r<=32660?r-32600:r>=32701&&r<=32760?r-32700:null;if(!n)return null;const s=r>=32701&&r<=32760,i=6378137,a=1/298.257223563,l=.9996,u=a*(2-a),h=u/(1-u),p=((n-1)*6-180+3)*Math.PI/180,f=e*Math.PI/180,g=t*Math.PI/180,v=Math.sin(f),_=Math.cos(f),x=Math.tan(f),w=i/Math.sqrt(1-u*v*v),S=x*x,k=h*_*_,j=_*(g-p),C=i*((1-u/4-3*u*u/64-5*u**3/256)*f-(3*u/8+3*u*u/32+45*u**3/1024)*Math.sin(2*f)+(15*u*u/256+45*u**3/1024)*Math.sin(4*f)-35*u**3/3072*Math.sin(6*f)),R=l*w*(j+(1-S+k)*j**3/6+(5-18*S+S*S+72*k-58*h)*j**5/120)+5e5;let A=l*(C+w*x*(j*j/2+(5-S+9*k+4*k*k)*j**4/24+(61-58*S+S*S+600*k-330*h)*j**6/720));return s&&(A+=1e7),Number.isFinite(R)&&Number.isFinite(A)?[R,A]:null},Qoe=(t,e)=>{const r=e*3600,n=t*3600,s=(r-169028.66)/1e4,i=(n-26782.5)/1e4,a=260007237e-2+211455.93*i-10938.51*i*s-.36*i*s**2-44.54*i**3,l=120014707e-2+308807.95*s+3745.25*i**2+76.63*s**2-194.56*i**2*s+119.79*s**3;return Number.isFinite(a)&&Number.isFinite(l)?[a,l]:null},Xoe=(t,e,r)=>r===2056?Qoe(t,e):Joe(t,e,r),Ol=t=>{if(t&&typeof t=="object")return t;if(typeof t!="string")return null;try{const e=JSON.parse(t);return e&&typeof e=="object"?e:null}catch{return null}},ele=(t,e)=>{var n,s;return[Ol(t.collection_summary),Ol((n=t.collection_summary)==null?void 0:n.collection),Ol(e==null?void 0:e.collection_summary),Ol((s=e==null?void 0:e.collection_summary)==null?void 0:s.collection),Ol(e==null?void 0:e.collection)].filter(i=>!!i)},bd=(t,e)=>t.map(r=>r[e]).find(r=>r!=null),tle=(t,e)=>!!(Ha(t.epsg)||Ha(t.coordinate_reference)||Ha(bd(e,"epsg"))||Ha(bd(e,"multipolygon_crs"))||Ha(bd(e,"crs_epsg_values"))),rle=(t,e)=>{const r=Ol(t.crs),n=r==null?void 0:r.input,s=r==null?void 0:r.wkt,i=t.concave_hull_crs;return!!(Ha(e.epsg)||Ha(e.multipolygon_crs)||Ha(e.crs_epsg_values)||Ha(n)||Ha(s)||Ha(i))},tO=(t,e)=>{const n=(Array.isArray(t.attribute_stats)?t.attribute_stats:Array.isArray(t.global_attribute_stats)?t.global_attribute_stats:[]).map(Ol).find(a=>String((a==null?void 0:a.name)??"").toLowerCase()===e.toLowerCase()),s=Number(n==null?void 0:n.minimum),i=Number(n==null?void 0:n.maximum);return Number.isFinite(s)&&Number.isFinite(i)&&i>s?[s,i]:null},nle=t=>{const e=tO(t,"X"),r=tO(t,"Y");if(!e||!r)return null;const[n,s]=e,[i,a]=r;return[{x:n,y:i},{x:s,y:i},{x:s,y:a},{x:n,y:a},{x:n,y:i}]},sle=t=>{const e=Number(t.bbox_xmin),r=Number(t.bbox_ymin),n=Number(t.bbox_xmax),s=Number(t.bbox_ymax);return![e,r,n,s].every(Number.isFinite)||n<=e||s<=r?null:[{x:e,y:r},{x:n,y:r},{x:n,y:s},{x:e,y:s},{x:e,y:r}]},yU=(t=null)=>({rings:[],kind:"none",unavailableReason:t}),ile=t=>{const e=[];let r=!1,n=!1;return t.forEach(s=>{const i=Ol(s.files);
516i&&Object.values(i).forEach(a=>{const l=Ol(a);if(!l)return;const u=l.concave_hull,h=Array.isArray(u)?u.filter(Koe).map(f=>{const g=f;return{x:Number(g.x??g.X),y:Number(g.y??g.Y)}}):[];if(h.length>=3&&rle(l,s)){e.push(h);return}h.length>=3&&(n=!0);const p=nle(l);p&&(e.push(p),r=!0)})}),e.length===0?yU(n?"missing-crs":"missing-geometry"):r?{rings:e,kind:"bbox",unavailableReason:n?"missing-crs":"missing-geometry"}:{rings:e,kind:"hull",unavailableReason:null}},ale=(t,e,r)=>{const n=Oc(e.epsg)??Oc(e.coordinate_reference)??Oc(bd(r,"epsg"))??Oc(bd(r,"multipolygon_crs"))??Oc(bd(r,"crs_epsg_values"));if(n){const s=t.map(i=>i.map(([a,l])=>Xoe(a,l,n)).filter(a=>!!a).map(([a,l])=>({x:a,y:l}))).filter(i=>i.length>=3);if(s.length>0)return s}return[]},ole=(t,e)=>{const r=ele(t,e),n=tle(t,r),s=(l="missing-crs")=>{const u=ile(r);if(u.rings.length>0)return u;const h=sle(t);return h?{rings:[h],kind:"bbox",unavailableReason:n?"missing-geometry":"missing-crs"}:yU(u.unavailableReason==="missing-crs"?"missing-crs":l)},i=bd(r,"convex_hull")??(e==null?void 0:e.convex_hull)??t.convex_hull,a=QE(i).filter(l=>l.length>=3);if(a.length>0){if(Yoe(a)){const u=ale(a,t,r);return u.length>0?{rings:u,kind:"hull",unavailableReason:null}:s("missing-crs")}const l=a.map(u=>u.map(([h,p])=>({x:h,y:p}))).filter(u=>u.length>=3);return l.length>0&&n?{rings:l,kind:"hull",unavailableReason:null}:s(n?"missing-geometry":"missing-crs")}return s("missing-geometry")};function rO(t){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){const e=t.trim().replace(",","."),r=Number(e);if(Number.isFinite(r))return r}return null}function wb(t,e){return Number.isFinite(t)&&Number.isFinite(e)&&t>=-90&&t<=90&&e>=-180&&e<=180}function lle(t,e){const r=t.trim(),n=e.trim();if(!r&&!n)return{status:"empty"};if(!r||!n)return{status:"incomplete"};const s=Number(r.replace(",",".")),i=Number(n.replace(",","."));return wb(s,i)?{status:"valid",lat:s,lon:i,roundedLat:Number(s.toFixed(6)),roundedLon:Number(i.toFixed(6))}:{status:"invalid"}}function cle(t,e){return wb(t,e)?{lat:t,lon:e}:wb(e,t)?{lat:e,lon:t}:null}function ule(t){const e=(t.match(/-?\d+(?:[.,]\d+)?/g)||[]).map(n=>Number(n.replace(",","."))).filter(n=>Number.isFinite(n));if(e.length<2)return null;const r=cle(e[0],e[1]);return r?{type:"approx_point",lat:r.lat,lon:r.lon,source:"legacy_text",raw_query:t,version:1}:null}function dle(t){if(!t||typeof t!="object")return null;const e=t;if(e.type!=="approx_point")return null;const r=rO(e.lat),n=rO(e.lon);return r===null||n===null||!wb(r,n)?null:{type:"approx_point",lat:r,lon:n,source:e.source||"unknown",raw_query:typeof e.raw_query=="string"?e.raw_query:void 0,version:1}}function _U(t){if(!t||t.trim()==="")return{};const e=t.trim();try{const r=JSON.parse(e),n=dle(r);return n?{point:n}:{rawText:e}}catch{const r=ule(e);return r?{point:r,rawText:e}:{rawText:e}}}function bU(t){return JSON.stringify({type:"approx_point",lat:t.lat,lon:t.lon,source:t.source,raw_query:t.raw_query,version:1})}const QSe=t=>t==="footprint"||t==="approx",XE=t=>Array.isArray(t)&&t.length>=2&&typeof t[0]=="number"&&Number.isFinite(t[0])&&typeof t[1]=="number"&&Number.isFinite(t[1])&&Math.abs(t[0])<=180&&Math.abs(t[1])<=90,nO=t=>{if(!t||typeof t!="object")return null;const r=t.centroid;if(!r||typeof r!="object"||Array.isArray(r))return null;const n=r;if(n.available!==!0||n.crs!=="EPSG:4326")return null;const s=n.longitude,i=n.latitude;return typeof s!="number"||typeof i!="number"?null:XE([s,i])?[s,i]:null},hle=t=>{var e,r;return t?t.type==="FeatureCollection"?((r=(e=t.features)==null?void 0:e[0])==null?void 0:r.geometry)??null:t.type==="Polygon"||t.type==="MultiPolygon"||t.type==="Point"?t:null:null},wU=t=>Array.isArray(t)&&t.length>=2&&typeof t[0]=="number"&&Number.isFinite(t[0])&&typeof t[1]=="number"&&Number.isFinite(t[1]),xU=(t,e)=>{if(wU(t)){e.push(t);return}if(Array.isArray(t))for(const r of t)xU(r,e)},fle=(t,e,r)=>(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0]),Hy=([t,e])=>`${t}:${e}`,ple=t=>{var _;if(!Array.isArray(t)||t.length<2)return null;const e=[],r=new Map,n=new Map;for(const x of t){if(!Array.isArray(x)||x.length!==1||!Array.isArray(x[0]))return null;const w=Array.from(new Map(x[0].filter(wU).map(C=>[Hy(C),C])).values());if(w.length!==3)return null;
516w.forEach(C=>n.set(Hy(C),C));const S=[[w[0],w[1]],[w[1],w[2]],[w[2],w[0]]],k=new Set,j=e.length;for(const[C,R]of S){const A=[Hy(C),Hy(R)].sort(),I=A.join("|");k.add(I);const P=r.get(I)??{triangles:[],vertices:A};P.triangles.push(j),r.set(I,P)}e.push(k)}const s=new Set([0]),i=[0];for(;i.length>0;){const x=i.pop();for(const w of e[x])for(const S of((_=r.get(w))==null?void 0:_.triangles)??[])s.has(S)||(s.add(S),i.push(S))}if(s.size!==e.length)return null;const a=Array.from(r.values()).filter(x=>x.triangles.length===1);if(a.length<3)return null;const l=new Map;for(const{vertices:[x,w]}of a)l.set(x,[...l.get(x)??[],w]),l.set(w,[...l.get(w)??[],x]);if(Array.from(l.values()).some(x=>x.length!==2))return null;const u=Array.from(l.keys()).sort()[0],h=[u];let p=null,f=u;for(;h.length<=a.length;){const x=l.get(f),w=x[0]===p?x[1]:x[0];if(w===u)break;if(h.includes(w))return null;h.push(w),p=f,f=w}if(h.length!==a.length)return null;const g=h.map(x=>n.get(x));let v=0;for(let x=0;x<g.length;x+=1){const w=fle(g[x],g[(x+1)%g.length],g[(x+2)%g.length]);if(Math.abs(w)<=Number.EPSILON)continue;const S=Math.sign(w);if(v!==0&&S!==v)return null;v=S}return v===0?null:[...g,g[0]]},mle=t=>{if(t.type!=="MultiPolygon")return t;const e=ple(t.coordinates);return e?{type:"Polygon",coordinates:[e]}:t},gle=t=>{const e=[];if(xU(t.coordinates,e),e.length===0)return null;let r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const[a,l]of e)r=Math.min(r,a),n=Math.min(n,l),s=Math.max(s,a),i=Math.max(i,l);return[r,n,s,i].every(Number.isFinite)?{minX:r,minY:n,maxX:s,maxY:i}:null},vle=t=>{const e=gle(t);if(!e||e.minX<-180||e.maxX>180||e.minY<-90||e.maxY>90)return!1;const r=e.maxX-e.minX,n=e.maxY-e.minY;return r<=10&&n<=10},XSe=({coordinateAccuracy:t,coordinateReference:e,convexHull:r,preferredCentroid:n,locationHidden:s=!1})=>{if(s)return{mode:"hidden",geometry:null,approxPoint:null};const i=hle(r),a=_U(e),l=a.point?[a.point.lon,a.point.lat]:null;if(t==="local"){const u=l??(n&&XE(n)?n:null);return u?{mode:"approx",geometry:null,approxPoint:u}:{mode:"none",geometry:null,approxPoint:null}}return i&&vle(i)?{mode:"footprint",geometry:mle(i),approxPoint:l}:n&&XE(n)?{mode:"footprint",geometry:{type:"Point",coordinates:n},approxPoint:l}:l?{mode:"approx",geometry:null,approxPoint:l}:{mode:"none",geometry:null,approxPoint:null}},yle="funder_name, funder_identifier, award_number, award_title";async function _le(t,e,r=Ye){try{const{data:n,error:s}=await r.from("dataset_funding").select(yle).eq("dataset_id",t).order("id",{ascending:!0});if(s)console.warn(`Structured funding lookup failed for dataset ${t}; using embedded funding data.`,s);else if(Array.isArray(n))return n}catch(n){console.warn(`Structured funding lookup failed for dataset ${t}; using embedded funding data.`,n)}return e}const ej=new R4,sO="https://s3.bwsfs.uni-freiburg.de/frct-3dtrees-products",Em="https://s3.bwsfs.uni-freiburg.de/frct-3dtrees-visualization",iO="https://s3.bwsfs.uni-freiburg.de/frct-3dtrees-products-dev/overviews",ble=t=>t,aO=500;async function wle(t){const e=Array.from(new Set(t)),r=new Map,n=[];for(let a=0;a<e.length;a+=aO)n.push(e.slice(a,a+aO));const s=await Promise.all(n.map(a=>Ye.from("datasets").select("id, coordinate_accuracy").in("id",a)));for(const{data:a,error:l}of s){if(l)throw l;for(const u of a??[])r.set(u.id,u.coordinate_accuracy??null)}const i=e.filter(a=>!r.has(a));if(i.length>0)throw new Error(`Coordinate accuracy is unavailable for ${i.length} map datasets`);return r}const PS=t=>t&&typeof t=="object"?t:null;function tj(t){return t?Array.isArray(t)?t.filter(e=>typeof e=="string"):typeof t=="object"?Object.values(t).flat().filter(e=>typeof e=="string"):[]:[]}const xle=t=>t?t.split("/").find(Boolean)??null:null,Sle=t=>{if(!t)return[];const e=xle(t),r=[`${Em}/${t}overviews/top_view_00.png`,`${Em}/${t}overviews/top_view_01.png`,`${Em}/${t}overviews/top_view_00.png.png`,`${Em}/${t}overviews/top_view_01.png.png`];return e&&r.push(`${iO}/${e}/top_view_00.png`,`${iO}/${e}/top_view_01.png`),Array.from(new Set(r))},kle=t=>{const e=Sle(t);return{primary:e[0]??null,fallback:e[1]??null,candidates:e}};async function oO(){const{data:t,error:e}=await Ye.rpc("get_account_dataset_index",{p_scope:"mine"});if(e)throw e;return t??[]}async function Ele(){const{data:t,error:e}=await Ye.rpc("has_uploaded_dataset_v1");if(e)throw e;return t===!0}async function jle(){const{data:t,error:e}=await Ye.rpc("get_account_dataset_index",{p_scope:"mine_archived"});if(e)throw e;return t??[]}async function Cle(){const{data:t,error:e}=await Ye.rpc("get_account_dataset_index",{p_scope:"platform_admin"});if(e)throw e;return t??[]}async function Nle(){const{data:t,error:e}=await Ye.rpc("get_account_dataset_index",{p_scope:"platform_admin_archived"});if(e)throw e;return t??[]}const lO=2.05,qy=t=>{const e=typeof t=="number"?t:typeof t=="string"?Number(t):NaN;return Number.isFinite(e)?e:null},SU=t=>{if(!Array.isArray(t))return null;const e=t.find(s=>
516!s||typeof s!="object"?!1:s.name==="Z");if(!e)return null;const r=qy(e.minimum),n=qy(e.maximum);return r===null||n===null||n<=r?null:{min:r,max:n,median:qy(e.median),stddev:qy(e.stddev)}},kU=t=>{const{min:e,max:r,median:n,stddev:s}=t;if(n===null||s===null||s<=0)return{min:e,max:r,rawMin:e,rawMax:r};const i=Math.max(e,n-lO*s),a=Math.min(r,n+lO*s);return!Number.isFinite(i)||!Number.isFinite(a)||a<=i?{min:e,max:r,rawMin:e,rawMax:r}:{min:i,max:a,rawMin:e,rawMax:r}},cO=t=>{if(!t||typeof t!="object")return null;const e=t.files;if(!e||typeof e!="object")return null;let r=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const a of Object.values(e)){const l=SU(a==null?void 0:a.attribute_stats),u=l?kU(l):null;u&&(r=Math.min(r,u.min),n=Math.max(n,u.max),s=Math.min(s,u.rawMin),i=Math.max(i,u.rawMax))}return!Number.isFinite(r)||!Number.isFinite(n)||n<=r||!Number.isFinite(s)||!Number.isFinite(i)||i<=s?null:{min:r,max:n,rawMin:s,rawMax:i}},uO=t=>{if(!t||typeof t!="object")return null;const e=SU(t.dimensions);return e?kU(e):null},$f=t=>{const e=typeof t=="number"?t:typeof t=="string"?Number(t):NaN;return Number.isInteger(e)&&e>0?e:null},Ple=t=>{var s,i,a;if(typeof t!="string")return null;const e=t.match(/AUTHORITY\["EPSG"\s*,\s*"?(?<code>\d{3,6})"?\]/i),r=t.match(/ID\["EPSG"\s*,\s*(?<code>\d{3,6})\]/i),n=t.match(/EPSG(?::|["\s,]+)(?<code>\d{3,6})/i);return $f(((s=e==null?void 0:e.groups)==null?void 0:s.code)??((i=r==null?void 0:r.groups)==null?void 0:i.code)??((a=n==null?void 0:n.groups)==null?void 0:a.code))},rj=t=>$f(t)!==null||Ple(t)!==null?!0:Array.isArray(t)?t.some(rj):!t||typeof t!="object"?!1:Object.entries(t).some(([e,r])=>{const n=e.toLowerCase();return["epsg","crs","srs","wkt","input"].some(s=>n.includes(s))?rj(r):!1}),Rle=t=>{if(t.length<3)return 0;let e=0;for(let r=0;r<t.length;r+=1){const n=t[r],s=t[(r+1)%t.length];e+=n[0]*s[1]-s[0]*n[1]}return Math.abs(e)/2},Ale=t=>{const e=bb(t),r=vU(e.flat());if(r.length<3)return!1;const n=r.map(h=>h[0]),s=r.map(h=>h[1]),i=Math.min(...n),a=Math.max(...n),l=Math.min(...s),u=Math.max(...s);return!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(l)||!Number.isFinite(u)||a<=i||u<=l?!1:Rle(r)>0},Tle=({dataset:t,collectionSummary:e,standardLasInfo:r,convexHull:n})=>{const s=e&&typeof e=="object"?e:null,i=$f(s==null?void 0:s.epsg)!==null||$f(t.epsg)!==null||rj(r);return Ale(n)?(s==null?void 0:s.homogeneous_crs)===!1||t.homogeneous_crs===!1?{disabledReason:"Convex hull AOI preview requires a homogeneous CRS across the standardized point cloud files.",warning:null}:{disabledReason:null,warning:i?null:"Hull is based on local/approximate coordinates; verify before using."}:{disabledReason:"Convex hull AOI preview requires finite, non-degenerate hull geometry.",warning:null}},nj=(t,e,r)=>{const n=Array.isArray(r)?r[0]:r;if(typeof n!="string")return;const s=n.trim(),i=s.toLowerCase();!s||e.has(i)||(e.add(i),t.push(s))},dO=(t,e,r)=>{if(Array.isArray(r))for(const n of r)!n||typeof n!="object"||nj(t,e,n.name)},Ile=(t,e)=>{const r=[],n=new Set;if(t&&typeof t=="object"){const s=t;if(Array.isArray(s.all_attribute_names))for(const i of s.all_attribute_names)nj(r,n,i);if(Array.isArray(s.common_attribute_names))for(const i of s.common_attribute_names)nj(r,n,i);dO(r,n,s.global_attribute_stats)}return e&&typeof e=="object"&&dO(r,n,e.dimensions),r},sj=(t,e,r=null,n=null)=>{const s=Array.isArray(e)?e[0]:e;if(typeof s!="string")return;const i=s.trim(),a=mi(i);if(!a)return;const l=t.get(a),u=r??(l==null?void 0:l.range)??null,h=n??(l==null?void 0:l.colorRange)??null;t.set(a,Ioe((l==null?void 0:l.name)??i,u,h))},hO=(t,e)=>{if(Array.isArray(e))for(const r of e)!r||typeof r!="object"||sj(t,r.name,mU(r),Aoe(r))},Dle=(t,e)=>{const r=new Map;if(t&&typeof t=="object"){const n=t;if(Array.isArray(n.all_attribute_names))for(const s of n.all_attribute_names)sj(r,s);if(Array.isArray(n.common_attribute_names))for(const s of n.common_attribute_names)sj(r,s);hO(r,n.global_attribute_stats)}return e&&typeof e=="object"&&hO(r,e.dimensions),Array.from(r.values())};function EU(t,e=null){var j,C;const r=t.outputs,n=tj(r==null?void 0:r.potree).find(R=>R.endsWith("metadata.json")),s=e!=null&&e.native?e.bundle?`https://api.3dtrees.earth${e.bundle.metadata_path}`:null:n?ble(`${Em}/${n}`):null,i=PS(r==null?void 0:r.metadata)??void 0,a=PS(i==null?void 0:i.collection_summary),l=PS(a==null?void 0:a.collection),u=cO(a)??cO(t.collection_summary)??uO(i==null?void 0:i.standard_las_info)??uO(t.standard_las_info),h=l??a??t.collection_summary,p=nO
516(a)??nO(t.collection_summary),f=(h==null?void 0:h.convex_hull)??(i==null?void 0:i.convex_hull)??t.convex_hull??null,g=$f(h==null?void 0:h.epsg)??$f(t.epsg),v=(i==null?void 0:i.standard_las_info)??t.standard_las_info,_=Tle({dataset:t,collectionSummary:h,standardLasInfo:v,convexHull:f}),x=Ile(h,v),w=Dle(h,v),S=Roe(v),k=ole(t,i);return{dataset:e!=null&&e.bundle?{...t,point_count:e.bundle.points}:t,nativeServing:e,servingBundleId:((j=e==null?void 0:e.bundle)==null?void 0:j.generation_id)??null,potreeMetadataKey:e!=null&&e.bundle?`native:${e.bundle.generation_id}`:null,viewerTicketExpiresAt:((C=e==null?void 0:e.bundle)==null?void 0:C.expires_at)??null,potreeMetadataUrl:s,heightBounds:u,footprintRings:k.rings,footprintKind:k.kind,footprintUnavailableReason:k.unavailableReason,potreeDimensions:x,potreeAttributeSummaries:w,standardLasVersion:S,convexHull:f,collectionCentroid:p,convexHullTargetEpsg:g,convexHullAoiDisabledReason:_.disabledReason,convexHullAoiWarning:_.warning}}async function Ole(t,e){const r=await ej.getDatasetDetails(t);if(!r.success||!r.data)throw new Error("Dataset not found");const n=r.data,s=_le(n.id,n.funding),i=n.outputs,a={standard:tj(i==null?void 0:i.standard),segmentation:tj(i==null?void 0:i.segmentation)},l=a.standard.find(S=>S.endsWith(".laz")),u=l?`${sO}/${l}`:"",h=a.segmentation.find(S=>S.endsWith(".laz")),p=h?`${sO}/${h}`:null,f=await P4(n,e),g=f!=null&&f.native?Jte(f.bundle):!!p;let v=null;try{const{data:S,error:k}=await Ye.from("datacite").select("doi, updated_at").eq("dataset_id",n.id).order("updated_at",{ascending:!1}).limit(1);if(!k&&Array.isArray(S)&&S.length>0){const j=S[0];v=(j==null?void 0:j.doi)??null}}catch{}let _=null;try{const S=await ej.getActiveSupplementaryData(n.id);S.success&&(_=S.data??null)}catch{}const x=await s;let w=null;try{const{data:S}=await Ye.from("datasets").select("license:licenses(name, url, spdx_id)").eq("id",n.id).single(),k=S==null?void 0:S.license;k&&(w={name:k.name,url:k.url,spdxId:k.spdx_id})}catch{}return{...EU(n,f),funding:x,doi:v,license:w,supplementaryData:_,downloadUrl:u,segmentationDownloadUrl:p,hasSegmentation:g}}function Mle(t,e=[],r=30){return{queryKey:Ht.datasets.homepageMosaic(t,e,r),queryFn:async({signal:n})=>{const{data:s,error:i}=await Ye.rpc("get_homepage_mosaic",{p_featured_ids:Array.from(e),p_limit:r}).abortSignal(n);if(i)throw i;return(s??[]).map((l,u)=>{const h=kle(l.s3_base_path);return{id:l.id,title:l.title||"Untitled dataset",date:l.acquisition_date,author:l.primary_author,imageUrl:h.primary,imageFallbackUrl:h.fallback,imageUrls:h.candidates,mosaicSource:l.mosaic_source??"recent_unique_author",mosaicRank:l.mosaic_rank??u+1}})}}}function Lle(t){return{queryKey:Ht.datasets.stats(t),queryFn:async({signal:e})=>{const{data:r,error:n}=await Ye.rpc("get_homepage_stats").abortSignal(e);if(n)throw n;const s=Array.isArray(r)?r[0]:r;return{publicDatasets:Number((s==null?void 0:s.public_datasets)??0),privateDatasets:Number((s==null?void 0:s.private_datasets)??0),totalAreaHa:Number((s==null?void 0:s.total_area_ha)??0),uniqueAuthors:Number((s==null?void 0:s.unique_authors)??0)}}}}const jU=5*6e4;function eke(t){return{queryKey:Ht.datasets.publicMap(t),staleTime:jU,queryFn:async()=>{const{data:e,error:r}=await Ye.rpc("get_map_dataset_sidebar_index");if(r)throw r;let n=e??[];if(n.some(a=>a.coordinate_accuracy===void 0)){const a=await wle(n.map(l=>l.id));n=n.map(l=>({...l,coordinate_accuracy:a.get(l.id)??null}))}const i=Object.fromEntries(n.filter(a=>a.primary_author).map(a=>[a.id,a.primary_author]));return{rows:n,authorByDataset:i}}}}function tke(t,e=!0){return{queryKey:Ht.datasets.publicMapGeometries(t),enabled:e,staleTime:jU,queryFn:async()=>{const{data:r,error:n}=await Ye.rpc("get_map_dataset_geometries");if(n)throw n;return r??[]}}}function Fle(t,e=Date.now()){return t?Math.max(15e3,t*1e3-e-$le):!1}const $le=10*6e4;function zle(t){return{queryKey:Ht.datasets.details(t),queryFn:async({client:e,queryKey:r})=>{var n;return Ole(t,(n=e.getQueryData(r))==null?void 0:n.nativeServing)},refetchOnMount:e=>{var r;return((r=e.state.data)==null?void 0:r.dataset.read_route)==="native"?"always":!0},refetchInterval:e=>{var r;return((r=e.state.data)==null?void 0:r.dataset.read_route)==="native"?Fle(e.state.data.viewerTicketExpiresAt)||3e4:!1}
516,refetchIntervalInBackground:!0}}function Ule(t){return{queryKey:Ht.datasets.embed(t),queryFn:async({client:e,queryKey:r})=>{var i;const n=await ej.getDatasetDetails(t);if(!n.success||!n.data||!fX(n.data.visibility))throw new Error("Dataset is not available for embedding");const s=(i=e.getQueryData(r))==null?void 0:i.nativeServing;return EU(n.data,await P4(n.data,s))},staleTime:3e4,refetchOnMount:e=>{var r;return(r=e.state.data)!=null&&r.viewerTicketExpiresAt?"always":!0},refetchInterval:3e4,retry:!1}}const xb=57,Sb=29,N1="--app-header-height",P1="--app-footer-height",R1="--app-site-banner-height",rke=`calc(100dvh - var(${N1}, ${xb}px) - var(${P1}, ${Sb}px) - var(${R1}, 0px))`,CU=`calc(100vh - var(${N1}, ${xb}px) - var(${P1}, ${Sb}px) - var(${R1}, 0px))`,Ble=t=>t==="/"?"homepage":t==="/datasets/:id"?"dataset_detail":t.slice(1).replace(/[:/-]+/g,"_")||"homepage",Vle=t=>{const e=new URL(t,"https://3dtrees.earth"),r=hb(e.pathname);return{path:r,pageName:Ble(r)}},Hle=({pathname:t,originSurface:e="unknown",internalTest:r})=>{const{path:n,pageName:s}=Vle(t),i=[{name:"$pageview",properties:{page_name:s,path:n,origin_surface:e,...r===void 0?{}:{internal_test:r}}}],a=t.split(/[?#]/,1)[0].match(/^\/datasets\/([^/]+)\/?$/);return a&&/^[1-9]\d*$/.test(a[1])&&i.push({name:"dataset_detail_opened",properties:{dataset_id:a[1],origin_surface:e,...r===void 0?{}:{internal_test:r}}}),i},qle=(t,e)=>{if(t==="/")return"homepage";if(t==="/map")return"map";if(t==="/account")return"account";if(t==="/datasets/:id")return"dataset_detail";const r=e==null?void 0:e.lastMeaningfulTouch.source;return r==="shared_link"||r==="doi"?"shared_link":"unknown"};function Wle(){const t=Hs(),{user:e,loading:r}=Fg(),n=y.useRef(),s=y.useRef(),i=y.useRef(!1),[a,l]=y.useState(0);return y.useEffect(()=>{const u=()=>l(h=>h+1);return window.addEventListener(ig,u),()=>window.removeEventListener(ig,u)},[]),y.useEffect(()=>{var v,_;if(r||!zo()||((v=s.current)==null?void 0:v.consentRevision)===a&&s.current.pathname===t.pathname)return;const u=hb(t.pathname),h=Iz({storage:window.localStorage,hasConsent:zo});let p=h.current();i.current||(p=h.recordVisit({url:window.location.href,referrer:document.referrer}),i.current=!0),p=h.recordInteraction(t.pathname)??p;const f=qle(n.current,p),g=((_=e==null?void 0:e.app_metadata)==null?void 0:_.internal_test)===!0?!0:void 0;for(const x of Hle({pathname:t.pathname,originSurface:f,internalTest:g}))x.name==="$pageview"?es("$pageview",x.properties):es("dataset_detail_opened",x.properties);n.current=u,s.current={consentRevision:a,pathname:t.pathname}},[a,r,t.pathname,e]),null}const Gle="https://forms.gle/zQeFEXCuxQnXZEpv6",Kle=45,NU={upload:"3dtrees.manuscript-banner.upload.dismissed.v1",contributor:"3dtrees.manuscript-banner.contributor.dismissed.v1"};function fO(t){return _4(NU[t])}function Yle(t){b4(NU[t])}function Zle(){const{uploadBlocked:t,openReconsent:e}=gw();return t?o.jsx(pb,{title:"Read-only mode:",action:o.jsx("button",{type:"button",onClick:e,className:"cursor-pointer font-medium text-amber-900 underline underline-offset-4 hover:no-underline",children:"Review and accept"}),children:"You can browse and edit your own datasets, but uploading new datasets and downloading datasets you don’t own are disabled until you accept the updated terms."}):null}function Jle(){var C;const t=y.useRef(null),e=y.useRef(null),r=y.useRef(null),[n,s]=y.useState({banner:0,header:xb,footer:Sb}),[i,a]=y.useState(()=>({upload:fO("upload"),contributor:fO("contributor")})),{user:l,loading:u}=Ql(),h=(l==null?void 0:l.id)??null,p=!!h,f=fr({queryKey:Ht.datasets.hasUploaded(h),queryFn:Ele,enabled:p&&!u,staleTime:6e4}),g=fr(XC(h)),v=p&&f.data===!0,_=!!((C=g.data)!=null&&C.is_core_team),x=p&&(f.isPending||!g.isSuccess),w=v?"contributor":"upload",S=!u&&!_&&!x&&!i[w],k=()=>{Yle(w),a(R=>({...R,[w]:!0}))};y.useEffect(()=>{const R=()=>{var P,T,O;const I={banner:Math.ceil(((P=t.current)==null?void 0:P.getBoundingClientRect().height)??(S?Kle:0)),header:Math.ceil(((T=e.current)==null?void 0:T.getBoundingClientRect().height)??xb),footer:Math.ceil(((O=r.current)==null?void 0:O.getBoundingClientRect().height)??Sb)};s(G=>G.banner===I.banner&&G.header===I.header&&G.footer===I.footer?G:I)};if(R(),typeof ResizeObserver>"u")return window.addEventListener("resize",R),()=>window.removeEventListener("resize",R);const A=new ResizeObserver(R);for(const I of[t.current,e.current,r.current])I&&A.observe(I);return window.addEventListener("resize",R),()=>{A.disconnect(),window.removeEventListener("resize",R)}},[S]);const j={[R1]:`${n.banner}px`,[N1]:`${n.header}px`,[P1]:`${n.footer}px`};return o.jsx(OX,{children:o.jsx(HX,{children:o.jsx(MX,{children:o.jsx(Xee,{children:o.jsxs(Bte,{children:[o.jsx(Wle,{}),o.jsxs("div",{className:"min-h-screen overflow-x-clip bg-background flex flex-col",style:j,children:[o.jsxs("div",{ref:t,children:[o.jsx(Yte,{}),S&&(v?o.jsx(pb,{variant:"success",icon:yL,title:"Help shape the upcoming 3Dtrees.earth manuscript.",onDismiss:k,dismissLabel:"Dismiss manuscript banner",action:o.jsx("a",{href:Gle,target:"_blank",rel:"noreferrer",className:"max-w-full break-words font-medium text-emerald-800 underline underline-offset-4 hover:text-emerald-950",children:"Complete the contributor form"}),children:"Nominate yourself or a colleague to be considered for co-authorship."}):o.jsx(pb,{variant:"success",icon:l9,title:"Upload a dataset to be considered for co-authorship.",onDismiss:k,dismissLabel:"Dismiss manuscript banner",action:o.jsx(Sr,{to:"/account",className:"max-w-full break-words font-medium text-emerald-800 underline underline-offset-4 hover:text-emerald-950",children:"Upload a dataset"}),children:"Help shape the upcoming 3Dtrees.earth manuscript."})),o.jsx(Zle,{})]}),o.jsx("div",{ref:e,className:"sticky top-0 z-50",children:o.jsx(DX,{})}),o.jsx("main",{className:"flex-1",children:o.jsx(GM,{})}),o.jsx("div",{ref:r,children:o.jsx(qX,{})}),o.jsx(xte,{}),o.jsx(ote,{})]})]})})})})})}
516function Qle(){return o.jsxs("main",{className:"relative h-dvh w-full overflow-hidden bg-background",children:[o.jsx(GM,{}),o.jsxs("a",{href:"/",target:"_blank",rel:"noopener noreferrer","aria-label":"3Dtrees homepage",className:"absolute bottom-3 left-3 z-20 flex items-center gap-2",children:[o.jsx("img",{src:"/images/3dtrees-logo-96.png",alt:"3Dtrees.earth logo",className:"h-8 w-auto"}),o.jsxs("span",{className:"relative whitespace-nowrap text-lg font-extrabold leading-none",children:[o.jsx("span",{"aria-hidden":"true",className:"absolute inset-0 text-white",style:{WebkitTextStroke:"4px white",textShadow:"0 0 1px rgba(255, 255, 255, 0.2)"},children:"3Dtrees.earth"}),o.jsx("span",{className:"relative bg-gradient-to-r from-blue-700 via-purple-700 to-pink-700 bg-clip-text text-transparent",children:"3Dtrees.earth"})]})]})]})}function Xu({className:t,...e}){return o.jsx("div",{className:ke("animate-pulse rounded-md bg-muted",t),...e})}const Xle=4e3,Oa=48,ece=24,tce=2.35,rce=12,Vu=t=>JSON.stringify([t.id,t.imageUrls]);function nce(t,e){if(t[e+3]<24)return!1;const n=t[e],s=t[e+1],i=t[e+2],a=Math.max(n,s,i),l=Math.min(n,s,i);return(a===0?0:(a-l)/a)>.08&&a<252}function sce(t){if(!t.naturalWidth||!t.naturalHeight)return!1;const e=document.createElement("canvas");e.width=Oa,e.height=Oa;const r=e.getContext("2d",{willReadFrequently:!0});if(!r)return!0;r.drawImage(t,0,0,Oa,Oa);let n;try{n=r.getImageData(0,0,Oa,Oa)}catch{return!0}let s=Oa,i=Oa,a=-1,l=-1,u=0;for(let g=0;g<Oa;g+=1)for(let v=0;v<Oa;v+=1){const _=(g*Oa+v)*4;nce(n.data,_)&&(s=Math.min(s,v),i=Math.min(i,g),a=Math.max(a,v),l=Math.max(l,g),u+=1)}if(u<ece)return!1;const h=a-s+1,p=l-i+1;return Math.max(h/p,p/h)<=tce}function ice(t,e){return new Promise((r,n)=>{if(e.aborted){n(new DOMException("Image preload aborted","AbortError"));return}const s=new Image;let i=null;const a=()=>{s.onload=null,s.onerror=null,e.removeEventListener("abort",l),i!==null&&window.clearTimeout(i)},l=()=>{a(),s.removeAttribute("src"),n(new DOMException("Image preload aborted","AbortError"))};s.decoding="async",s.onload=()=>{a(),r(s)},s.onerror=()=>{a(),n(new Error(`Unable to load mosaic image: ${t}`))},i=window.setTimeout(()=>{a(),s.removeAttribute("src"),n(new Error(`Timed out loading mosaic image: ${t}`))},Xle),e.addEventListener("abort",l),s.src=t})}async function ace(t,e){let r=!1;for(const n of t.imageUrls){if(e.aborted)return null;try{const s=await ice(n,e);if(sce(s))return{status:"ready",url:n}}catch(s){if(s instanceof DOMException&&s.name==="AbortError")return null;r=!0}}return{status:r?"failed":"unfit"}}async function oce(t,e,r){let n=0;const s=Array.from({length:Math.min(rce,t.length)},async()=>{for(;!e.aborted&&n<t.length;){const i=n;n+=1;const a=await ace(t[i],e);!e.aborted&&a&&r(t[i],a)}});await Promise.all(s)}function lce(t){const e=y.useRef(new Map),[r,n]=y.useState(e.current),[s,i]=y.useState(0);y.useEffect(()=>{const h=new AbortController;let p=null;const f=new Set(t.map(Vu)),g=new Map([...e.current].filter(([v,_])=>f.has(v)&&_.status!=="failed"));return e.current=g,n(g),oce(t.filter(v=>!g.has(Vu(v))),h.signal,(v,_)=>{e.current=new Map(e.current).set(Vu(v),_),p===null&&(p=window.requestAnimationFrame(()=>{p=null,h.signal.aborted||n(e.current)}))}),()=>{h.abort(),p!==null&&window.cancelAnimationFrame(p)}},[t,s]);const a=y.useCallback(h=>{const p=t.find(g=>g.id===h);if(!p)return;const f=new Map(e.current).set(Vu(p),{status:"failed"});e.current=f,n(f)},[t]),l=y.useCallback(()=>i(h=>h+1),[]);return{visibleTiles:y.useMemo(()=>{const h=new Map(t.map(p=>[Vu(p),p]));return[...r].flatMap(([p,f])=>{const g=h.get(p);return g&&f.status==="ready"?[{...g,imageUrls:[f.url]}]:[]})},[t,r]),isResolving:t.some(h=>!r.has(Vu(h))),failedCount:t.filter(h=>{var p;return((p=r.get(Vu(h)))==null?void 0:p.status)==="failed"}).length,markImageExhausted:a,retryImages:l}}const cce=90,uce=[0,1,2],ij=1,dce=[1386,571,1487,527,1587,818,1202,1472,1590,1694,1479,400,1340,95,559,251,493,1692,1476,1368,1344,645,579,754,1501,1384,1371,1370,746,816];function hce(t){const e=t*7%5;return e===0?"tall":e===1?"wide":"normal"}function fce(t){switch(t){case"tall":return"row-span-2";case"wide":return"col-span-2";default:return""}}function pO(t){const e=t.querySelectorAll("[data-mosaic-copy]"),r=e[0],n=e[ij];if(!r||!n)return null;const s=n.offsetLeft-r.offsetLeft;return s<=0?null:{middleStart:n.offsetLeft,segmentWidth:s}}function pce({tile:t,size:e,priority:r,tabIndex:n,onImageExhausted:s}){const i=Vo(),[a,l]=y.useState(0),[u,h]=y.useState(!1),p=t.imageUrls[a]??null,f=a>=t.imageUrls.length,g=y.useCallback(()=>{h(!1),l(_=>Math.min(_+1,t.imageUrls.length))},[t.imageUrls.length]);y.useEffect(()=>{f&&s(t.id)},[f,s,t.id]);const v=y.useCallback(()=>{i(`/datasets/${t.id}`)},[i,t.id]);return f?null:o.jsxs("button",{type:"button","aria-label":`Open dataset ${t.title}`,tabIndex:n,onClick:v,className:ke("group relative overflow-hidden rounded-xl cursor-pointer border-0 p-0 text-left","bg-white shadow-md hover:shadow-xl","transition-all duration-300 hover:-translate-y-0.5",fce(e)),children:[(!p||!u)&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-slate-100 text-slate-400",children:o.jsx(N9,{className:"h-5 w-5"})}),p&&o.jsx("img",{src:p,alt:t.title,className:ke("absolute inset-0 w-full h-full object-cover","transition-all duration-500 group-hover:scale-105",u?"opacity-100":"opacity-0"),loading:r?"eager":"lazy",decoding:"async",onLoad:()=>h(!0),onError:g}),o.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:"linear-gradient(to top, rgba(15, 23, 42, 0.34) 0%, rgba(15, 23, 42, 0.12) 26%, rgba(15, 23, 42, 0) 56%)"}}),o.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-2.5",children:[o.jsx("p",{className:"text-white text-xs font-medium leading-tight truncate drop-shadow-md",children:t.title}),t.author&&o.jsx("p",{className:"text-white/75 text-[10px] truncate drop-shadow-md mt-0.5",children:t.author})]})]})}function PU({children:t}){return o.jsx("div",{className:"h-[280px] sm:h-[360px] lg:h-[420px] rounded-xl bg-gray-50 flex items-center justify-center text-center text-sm text-gray-600 p-6",children:t})}function mce(){const{user:t,loading:e}=Ql();return e?o.jsx(PU,{children:o.jsx("p",{role:"status",children:"Loading dataset previews…"})}):o.jsx(gce,{userId:t==null?void 0:t.id},(t==null?void 0:t.id)??"anonymous")}function gce({userId:t}){const e=fr(Mle(t,dce,cce)),r=y.useRef(null),n=y.useRef(null),s=y.useRef(null),i=y.useMemo(()=>(e.data??[]).map(w=>({id:w.id,title:w.title,author:w.author,imageUrls:w.imageUrls})),[e.data]),{visibleTiles:a,isResolving:l,failedCount:u,markImageExhausted:h,retryImages:p}=lce(i),f=()=>{p(),e.refetch()},g=o.jsx(we,{variant:"outline",size:"sm",onClick:f,disabled:e.isFetching,children:"Retry dataset previews"}),v=y.useCallback(()=>{const w=r.current;if(!w)return;const S=pO(w);if(!S)return;const k=S.middleStart-S.segmentWidth/2,j=S.middleStart+S.segmentWidth/2;w.scrollLeft<k?w.scrollLeft+=S.segmentWidth:w.scrollLeft>j&&(w.scrollLeft-=S.segmentWidth)},[]),_=y.useCallback(()=>{n.current===null&&(n.current=window.requestAnimationFrame(()=>{n.current=null,v()}))},[v]);y.useLayoutEffect(()=>{const w=r.current;if(!w||a.length===0){s.current=null;return}const S=()=>{const j=pO(w);j&&(w.scrollLeft+=j.middleStart-(s.current??0),s.current=j.middleStart)};S();const k=new ResizeObserver(S);return k.observe(w),()=>k.disconnect()},[a]),y.useEffect(()=>()=>{n.current!==null&&window.cancelAnimationFrame(n.current)},[]);const x=y.useCallback(w=>{var S;(S=r.current)==null||S.scrollBy({left:w==="left"?-400:400,behavior:"smooth"})},[]);return a.length===0?o.jsx(PU,{children:e.isPending||e.isFetching||l?o.jsx("p",{role:"status",children:"Loading dataset previews…"}):e.isError||u>0?o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{role:"alert",children:"Dataset previews could not be loaded."}),g]}):o.jsx("p",{role:"status",children:"No dataset previews are available yet."})}):o.jsxs("div",{children:[o.jsxs("div",{className:"relative group/mosaic",children:[o.jsx("div",{className:"absolute inset-y-0 left-0 w-12 bg-gradient-to-r from-white to-transparent z-10 pointer-events-none"}),o.jsx("div",{className:"absolute inset-y-0 right-0 w-12 bg-gradient-to-l from-white to-transparent z-10 pointer-events-none"}),o.jsx("button",{onClick:()=>x("left"),className:"absolute left-2 top-1/2 -translate-y-1/2 z-20 bg-white/90 hover:bg-white shadow-lg rounded-full p-2 opacity-0 group-hover/mosaic:opacity-100 transition-opacity","aria-label":"Scroll left",children:o.jsx(gL,{className:"h-5 w-5 text-gray-700"})}),o.jsx("button",{onClick:()=>x("right"),className:"absolute right-2 top-1/2 -translate-y-1/2 z-20 bg-white/90 hover:bg-white shadow-lg rounded-full p-2 opacity-0 group-hover/mosaic:opacity-100 transition-opacity","aria-label":"Scroll right",children:o.jsx(hC,{className:"h-5 w-5 text-gray-700"})}),o.jsx("div",{ref:r,"data-testid":"hero-mosaic-scroller",onScroll:_,className:ke("overflow-x-auto overflow-y-hidden scrollbar-hide","h-[280px] sm:h-[360px] lg:h-[420px]"),style:{scrollbarWidth:"none",msOverflowStyle:"none",containerType:"inline-size"},children:o.jsx("div",{className:"flex h-full w-max gap-3 px-6",children:uce.map(w=>o.jsx("div",{"data-mosaic-copy":"",className:"grid grid-flow-col auto-cols-[140px] sm:auto-cols-[170px] lg:auto-cols-[200px] grid-rows-3 gap-3 h-full",style:{gridAutoFlow:"column dense",minWidth:"100cqw"},children:a.map((S,k)=>o.jsx(pce,{tile:S,size:hce(S.id),priority:w===ij&&k<6,tabIndex:w===ij?void 0:-1,onImageExhausted:h},`${w}-${S.id}`))},w))})})]}),o.jsxs("div",{className:"text-center text-sm text-gray-600 mt-3 space-y-2",children:[l&&o.jsx("p",{role:"status",children:"Loading more dataset previews…"}),!l&&!e.isFetching&&(e.isError||u>0)&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{role:"alert",children:e.isError?"Dataset previews could not be refreshed. Showing the last loaded previews.":"Some dataset previews could not be loaded."}),g]})]})]})}const mO=t=>
516t.toLocaleString(void 0),vce=t=>Math.round(t).toLocaleString(void 0);function yce(){const{user:t,loading:e}=Ql(),r=fr({...Lle(t==null?void 0:t.id),enabled:!e}),n=r.data??null,s=n?"Statistics could not be refreshed. Showing the last loaded values.":"Statistics could not be loaded.",i=r.isError&&!r.isFetching&&o.jsxs("div",{className:"text-sm text-gray-600 space-y-2",children:[o.jsx("p",{role:"alert",children:s}),o.jsx(we,{variant:"outline",size:"sm",onClick:()=>void r.refetch(),children:"Retry statistics"})]});return e||!n?i||o.jsx("p",{role:"status",className:"text-sm text-gray-600",children:"Loading statistics…"}):o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-3 gap-y-1 text-sm text-gray-500",children:[o.jsxs("span",{className:"inline-flex items-baseline gap-1.5",children:[o.jsx("span",{className:"text-base font-bold text-blue-600",children:mO(n.publicDatasets)}),"datasets"]}),o.jsx("span",{className:"text-gray-200",children:"|"}),o.jsxs("span",{className:"inline-flex items-baseline gap-1.5",children:[o.jsx("span",{className:"text-base font-bold text-emerald-600",children:mO(n.uniqueAuthors)}),"contributors"]}),o.jsx("span",{className:"text-gray-200",children:"|"}),o.jsxs("span",{className:"inline-flex items-baseline gap-1.5",children:[o.jsx("span",{className:"text-base font-bold text-violet-600",children:vce(n.totalAreaHa)}),"ha covered"]})]}),i]})}function _ce(){return o.jsxs("section",{className:"w-full relative overflow-hidden",children:[o.jsx("div",{className:"container mx-auto px-4 md:px-6 pt-10 md:pt-14 pb-6 md:pb-8",children:o.jsxs("div",{className:"max-w-5xl mx-auto text-center space-y-4 mb-8 md:mb-10",children:[o.jsxs("div",{className:"inline-flex items-center rounded-full border border-gray-200 bg-white px-3 py-1 text-sm text-gray-700 shadow-sm",children:[o.jsx("span",{className:"mr-1",children:"🌲"})," Built on the experience of"," ",o.jsx("a",{href:"https://deadtrees.earth",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 hover:underline font-medium ml-1",children:"deadtrees.earth"})]}),o.jsxs("h1",{className:"mx-auto max-w-5xl text-3xl leading-tight font-bold tracking-tighter sm:text-4xl md:text-5xl lg:text-6xl text-gray-900",children:["Build ",o.jsx("em",{className:"font-serif font-medium italic",children:"the"}),o.jsx("br",{}),o.jsx("span",{className:"block bg-gradient-to-r from-blue-500 via-purple-500 to-pink-500 bg-clip-text text-transparent",children:"Global Forest Reference"})]}),o.jsx("p",{className:"max-w-2xl mx-auto text-base text-gray-600 md:text-lg lg:text-xl",children:"Researchers worldwide are sharing high-quality 3D forest data to advance science, AI, and sustainability. Explore what's already here, or contribute your own."}),o.jsx(yce,{}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-3 pt-2",children:[o.jsx(we,{asChild:!0,size:"lg",className:"text-base px-6",children:o.jsxs(Sr,{to:"/sign-up",children:["Start contributing",o.jsx(eu,{className:"ml-2 h-4 w-4"})]})}),o.jsx(we,{asChild:!0,variant:"outline",size:"lg",className:"text-base px-6",children:o.jsx(Sr,{to:"/map",children:"Explore the map"})})]})]})}),o.jsx("div",{className:"w-full px-3 sm:px-4 md:px-6 pb-8 md:pb-12",children:o.jsx(mce,{})})]})}const RS="https://s3.bwsfs.uni-freiburg.de/frct-3dtrees-visualization/homepage/screencasts/v1".replace(/\/$/,""),bce=[{number:"01",eyebrow:"Contribute",title:"Upload research-ready forest scans",description:"Bring terrestrial, mobile, or drone-based laser scans into a shared catalogue with structured metadata and persistent dataset pages.",videoSrc:`${RS}/3dtrees-upload-shorter.mp4`},{number:"02",eyebrow:"Visualize and process",title:"Process at scale, analyze in the browser",description:"Inspect point clouds directly in your browser, while heavier analyses run on our Galaxy-backed processing pipelines.",videoSrc:`${RS}/3dtrees-height-segmentation-vis.mp4`},{number:"03",eyebrow:"Download",title:"Get notified when your download is ready",description:"Request a dataset and we'll email you when the download is packaged and ready. Public datasets package automatically; private datasets require approval from the owner.",videoSrc:`${RS}/3dtrees-download.mp4`}];function wce({src:t,title:e}){return o.jsx("video",{className:"block w-full bg-white",src:t,title:e,autoPlay:!0,muted:!0,loop:!0,playsInl
516ine:!0,preload:"metadata"})}function xce(){const{user:t}=Ql(),e=t?"/account":"/sign-up",r=t?"Open your account":"Create an account to upload",n="/map",s=t?"/account?tab=downloads":"/sign-up",i=t?"Open downloads":"Sign up to download";return o.jsx("section",{className:"w-full bg-white py-24 md:py-32",children:o.jsxs("div",{className:"container mx-auto px-4 md:px-6",children:[o.jsxs("div",{className:"mx-auto max-w-3xl text-center",children:[o.jsx("p",{className:"mb-3 text-sm font-semibold uppercase tracking-[0.18em] text-blue-600",children:"Reference workflow"}),o.jsx("h2",{className:"text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl md:text-5xl",children:"From forest scans to reusable reference data"}),o.jsx("p",{className:"mx-auto mt-5 max-w-2xl text-base text-gray-600 md:text-lg",children:"3Dtrees.earth connects contribution, web inspection, and processing so each dataset can become part of a shared reference for 3D forest science."})]}),o.jsx("div",{className:"mx-auto mt-16 max-w-5xl divide-y divide-gray-100 md:mt-20",children:bce.map((a,l)=>{const u=l%2===1,h=l===0,p=a.eyebrow==="Contribute"?{href:e,label:r}:a.eyebrow==="Download"?{href:s,label:i}:{href:n,label:"Explore datasets on the map"};return o.jsxs("article",{className:ke("grid gap-8 md:grid-cols-[minmax(0,0.95fr)_minmax(0,1.05fr)] md:items-center md:gap-10 lg:gap-14",h?"pb-12 md:pb-16":"py-12 md:py-16"),children:[o.jsxs("div",{className:ke("max-w-lg",u&&"md:order-2"),children:[o.jsx("span",{className:"block text-[3.5rem] font-extralight leading-none tracking-tight text-gray-200 md:text-[4.5rem]",children:a.number}),o.jsx("p",{className:"mt-3 text-xs font-semibold uppercase tracking-[0.2em] text-blue-600",children:a.eyebrow}),o.jsx("h3",{className:"mt-3 text-2xl font-semibold tracking-tight text-gray-900 md:text-3xl",children:a.title}),o.jsx("p",{className:"mt-4 max-w-xl text-base leading-7 text-gray-600",children:a.description}),o.jsx(we,{asChild:!0,variant:"outline",size:"lg",className:"mt-6",children:o.jsxs(Sr,{to:p.href,children:[p.label,o.jsx(eu,{className:"h-4 w-4"})]})})]}),o.jsx("div",{className:ke("mx-auto w-full max-w-lg overflow-hidden rounded-lg md:max-w-xl",u?"md:mr-auto":"md:ml-auto"),children:o.jsx(wce,{src:a.videoSrc,title:`${a.title} screencast`})})]},a.eyebrow)})})]})})}const Sce="July 2026",kce=[{heading:"Recently Shipped",dotColor:"bg-green-500",items:[{title:"Dataset Access Controls",description:"Added public, view-only, and private visibility modes with role-based access for browsing and downloads."},{title:"Automated Dataset Download Packaging",description:"Users can request a complete dataset package, assembled asynchronously with metadata and supplementary files when available."},{title:"Processing Pipeline Improvements",description:"Improved preprocessing, segmentation, visualization, and workflow reliability across the end-to-end processing pipeline."},{title:"Supplementary Data",description:"Datasets can now include a supplementary ZIP with related tables, trajectories, GIS files, documentation, or scripts."},{title:"Tree Species Identification",description:"Integrated tree species identification into the processing and viewer workflow, including species-aware labels and colors."}]},{heading:"What's Happening Now",dotColor:"bg-blue-500",items:[{title:"3Dtrees.earth Manuscript",description:"Preparing the first academic manuscript about the platform, its community, and the growing dataset catalog."},{title:"DOI Provisioning",description:"Adding automatic DOI registration for published datasets so they can be persistently identified and cited in scientific work."},{title:"Fine-grained Access Control",description:"Building dataset sharing with specific people, including invitations and clear controls for managing individual access."},{title:"Audited Reference Data Release",description:"Reviewing public datasets, provenance, metadata, and quality so the first trustworthy reference release is ready for reuse."}]},{heading:"Where We're Heading",dotColor:"bg-purple-500",items:[{title:"Public Research Profiles",description:"Give contributors a public home for their datasets, affiliations, research interests, and impact across the 3Dtrees community."},{title:"Public, Shareable Collections",description:"Turn related datasets into explorable research collections that can be shared, cited, and revisited over time."},{title:"Benchmark and Reference Datasets",description:"Publish carefully reviewed datasets that support reproducible comparisons of forest methods, models, and derived products."}
516,{title:"Raster Products",description:"Developing reusable canopy height, terrain, surface, and related raster products from uploaded point clouds."},{title:"Programmatic Data Access",description:"Provide authenticated, documented ways for researchers and tools to discover metadata and retrieve permitted data."},{title:"Search and Dataset Discovery",description:"Complement the map with filters and search tools that help researchers find datasets suited to specific scientific questions."}]}];function Ece({item:t,dotColor:e}){return o.jsxs("div",{className:"flex items-start gap-3 py-4 first:pt-0 last:pb-0",children:[o.jsx("span",{className:`mt-2 h-2 w-2 shrink-0 rounded-full ${e}`}),o.jsxs("div",{children:[o.jsx("h4",{className:"text-base font-medium text-gray-900",children:t.title}),o.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-600",children:t.description})]})]})}function jce(){return o.jsx("section",{className:"w-full bg-white py-24 md:py-32",children:o.jsxs("div",{className:"container mx-auto px-4 md:px-6",children:[o.jsxs("div",{className:"mx-auto max-w-3xl text-center",children:[o.jsx("p",{className:"mb-3 text-sm font-semibold uppercase tracking-[0.18em] text-blue-600",children:"Roadmap"}),o.jsx("h2",{className:"text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl md:text-5xl",children:"Where we are and where we are going"}),o.jsx("p",{className:"mx-auto mt-5 max-w-2xl text-base text-gray-600 md:text-lg",children:"Where we are heading, what we are building now, and what we have shipped."}),o.jsxs("p",{className:"mt-3 text-sm text-gray-400",children:["Last updated: ",Sce]})]}),o.jsx("div",{className:"mx-auto mt-14 grid max-w-6xl grid-cols-1 gap-10 md:mt-16 lg:grid-cols-3 lg:gap-12",children:kce.map(t=>o.jsxs("div",{children:[o.jsxs("h3",{className:"flex items-center gap-2 text-sm font-semibold uppercase tracking-[0.15em] text-gray-900",children:[o.jsx("span",{className:`h-2.5 w-2.5 rounded-full ${t.dotColor}`}),t.heading]}),o.jsx("div",{className:"mt-5 divide-y divide-gray-100",children:t.items.map(e=>o.jsx(Ece,{item:e,dotColor:t.dotColor},e.title))})]},t.heading))})]})})}const cg=({content:t,children:e,side:r="top",disabled:n=!1,className:s})=>{const i=y.useId(),a=y.useRef(null),l=y.useRef(null),[u,h]=y.useState(!1),[p,f]=y.useState({top:0,left:0}),g=y.useCallback(()=>{if(!a.current||!l.current)return;const k=8,j=a.current.getBoundingClientRect(),C=l.current.getBoundingClientRect();let R=0,A=0;r==="top"?(R=j.top-C.height-k,A=j.left+j.width/2-C.width/2):r==="bottom"?(R=j.bottom+k,A=j.left+j.width/2-C.width/2):r==="left"?(R=j.top+j.height/2-C.height/2,A=j.left-C.width-k):(R=j.top+j.height/2-C.height/2,A=j.right+k);const I=window.innerWidth-C.width-8,P=window.innerHeight-C.height-8;f({top:Math.min(Math.max(8,R),Math.max(8,P)),left:Math.min(Math.max(8,A),Math.max(8,I))})},[r]),v=e.props,_=k=>{var j;(j=v.onPointerEnter)==null||j.call(v,k),n||h(!0)},x=k=>{var j;(j=v.onPointerLeave)==null||j.call(v,k),h(!1)},w=k=>{var j;(j=v.onFocus)==null||j.call(v,k),n||h(!0)},S=k=>{var j;(j=v.onBlur)==null||j.call(v,k),h(!1)};return y.useLayoutEffect(()=>{if(!u||n)return;g();const k=()=>g();return window.addEventListener("resize",k),window.addEventListener("scroll",k,!0),()=>{window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0)}},[n,u,g,t]),o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:a,className:ke("inline-flex",s),children:y.cloneElement(e,{"aria-describedby":n?void 0:i,onPointerEnter:_,onPointerLeave:x,onFocus:w,onBlur:S})}),!n&&u&&typeof document<"u"&&ou.createPortal(o.jsx("div",{ref:l,role:"tooltip",id:i,className:ke("ph-mask pointer-events-none fixed z-[100] w-max whitespace-pre-line rounded-md border bg-popover px-3 py-2 text-xs text-popover-foreground shadow-md","max-w-[340px]"),style:{top:p.top,left:p.left},children:t}),document.body)]})},gO="/assets/uni-freiburg-cropped-Dv_dsHuE.png",Cce="/assets/Logo_WWD-knn5fonx.png",Nce="/assets/gfz2-DsSnhTku.png",Pce="/assets/nibio-ueDyyGZ7.png",Rce="/assets/fhg-ipm-CUsMj8yn.svg",Ace="/assets/nfdi-DKcGqerv.png",Tce="/assets/future-forest-C9rs3egl.png",aj=[{name:"GeoSense (Uni Freiburg)",url:"https://uni-freiburg.de/enr-geosense/",logoSrc:gO,alt:"University of Freiburg logo – GeoSense"},{name:"Chair of Forest Growth and Dendroecology (Uni Freiburg)",url:"https://uni-freiburg.de/unr-wwd/",logoSrc:Cce,alt:"WWD – Chair of Forest Growth and Dendroecology logo"},{name:"GFZ Potsdam – Remote Sensing & Geoinformatics",url:"https://www.gfz.de/en/section/remote-sensing-and-geoinformatics/overview",logoSrc:Nce,alt:"GFZ Potsdam logo"},{name:"XR Future Forest Lab (Uni Freiburg)",url:"https://uni-freiburg.de/unr-xrlab/",logoSrc:gO,alt:"University of Freiburg logo – XR Future Forest Lab"},{name:"Norwegian Institute of Bioeconomy Research (NIBIO)",url:"https://www.nibio.no/en",logoSrc:Pce,alt:"NIBIO logo"},{name:"Fraunhofer IPM",url:"https://www.ipm.fraunhofer.de/",logoSrc:Rce,alt:"Fraunhofer IPM logo"},{name:"NFDI4Earth",url:"https://www.nfdi4earth.de/",logoSrc:Ace,alt:"NFDI4Earth logo"},{name:"Excellence Cluster Future Forest",url:"https://uni-freiburg.de/futureforests-en/",logoSrc:Tce,alt:"Excellence Cluster Future Forest logo"}];function Ice(){const t=y.useMemo(()=>[...aj,...aj],[]);return o.jsx("section",{className:"w-full py-16 md:py-20 bg-white relative",children:o.jsxs("div",{className:"container mx-auto px-4 md:px-6",children:[o.jsx("div",{className:"flex flex-col items-center text-center mb-8",children:o.jsx("h2",{className:"text-2xl md:text-3xl font-bold tracking-tight text-gray-900",children:"Partners"})}),o.jsxs(Vs,{className:"relative overflow-hidden border-none shadow-none",children:[o.jsx("div",{className:"pointer-events-none absolute left-0 top-0 h-full w-16 bg-gradient-to-r from-white to-transparent z-10"}),o.jsx("div",{className:"pointer-events-none absolute right-0 top-0 h-full w-16 bg-gradient-to-l from-white to-transparent z-10"}),o.jsx("div",{className:"relative w-full overflow-hidden",children:o.jsx("div",{className:"flex items-stretch gap-6 md:gap-8 pr-6 will-change-transform animate-partners-marquee hover:[animation-play-state:paused] focus-within:[animation-play-state:paused]","aria-label":"Partner logos carousel",children:t.map((e,r)=>o.jsx(cg,{content:e.name,children:o.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer","aria-label":e.name,className:"flex flex-col items-center justify-center min-w-[160px] sm:min-w-[180px] px-4 py-4 rounded-lg bg-white hover:bg-gray-50 border border-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500",children:[o.jsx("div",{className:"h-14 md:h-14 lg:h-16 w-full flex items-center justify-center",children:o.jsx("img",{src:e.logoSrc,alt:e.alt,className:"max-h-full object-contain"})}),o.jsx("div",{className:"mt-3 text-sm text-gray-700 text-center leading-tight",children:e.name})]})},`${e.name}-${r}`))})})]})]})})}var Dce=Object.defineProperty,Vg=(t,e)=>Dce(t,"name",{value:e,configurable:!0}),A1="Collapsible",[Oce,RU]=Vn(A1),[Mce,T1]=Oce(A1),Lce=y.forwardRef(Vg(function(e,r){const{__scopeCollapsible:n,open:s,defaultOpen:i,disabled:a,onOpenChange:l,...u}=e,[h,p]=$i({prop:s,defaultProp:i??!1,onChange:l,caller:A1});return o.jsx(Mce,{scope:n,disabled:a,contentId:Bn(),open:h,onOpenToggle:y.useCallback(()=>p(f=>!f),[p]),children:o.jsx(it.div,{"data-state":kw(h),"data-disabled":a?"":void 0,...u,ref:r})})},"Collapsible")),Fce="CollapsibleTrigger",AU=y.forwardRef(Vg(function(e,r){const{__scopeCollapsible:n,...s}=e,i=T1(Fce,n);return o.jsx(it.button,{type:"button","aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":kw(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...s,ref:r,onClick:Xe(e.onClick,i.onOpenToggle)})},"CollapsibleTrigger")),TU="CollapsibleContent",IU=y.forwardRef(Vg(function(e,r){const{forceMount:n,...s}=e,i=T1(TU,e.__scopeCollapsible);return o.jsx(os,{present:n||i.open,children:({present:a})=>o.jsx($ce,{...s,ref:r,present:a})})},"CollapsibleContent")),$ce=y.forwardRef(Vg(function(e,r){const{__scopeCollapsible:n,present:s,children:i,...a}=e,l=T1(TU,n),[u,h]=y.useState(s),p=y.useRef(null),f=Vt(r,p),g=y.useRef(0),v=g.current,_=y.useRef(0),x=_.current,w=l.open||u,S=y.useRef(w),k=y.useRef(void 0);return y.useEffect(()=>{const j=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(j)},[]),Xr(()=>{const j=p.current;if(j){k.current=k.current||{transitionDuration:j.style.transitionDuration,animationName:j.style.animationName},j.style.transitionDuration="0s",j.style.animationName="none";const C=j.getBoundingClientRect();g.current=C.height,_.current=C.width,S.current||(j.style.transitionDuration=k.current.transitionDuration,j.style.animationName=k.current.animationName),h(s)}},[l.open,s]),o.jsx(it.div,{"data-state":kw(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!w,...a,ref:f,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:w&&i})},"CollapsibleContentImpl"));function kw(t){return t?"open":"closed"}Vg(kw,"getState");var DU=Lce,zce=AU,Uce=IU,Bce=Object.defineProperty,Li=(t,e)=>Bce(t,"name",{value:e,configurable:!0}),Wo="Accordion",Vce=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[I1,Hce,qce]=Tg(Wo),[Ew,nke]=Vn(Wo,[qce,RU]),D1=RU(),Wce=y.forwardRef(Li(function(e,r){const{type:n,...s}=e,i=s,a=s;return o.jsx(I1.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?o.jsx(Zce,{...a,ref:r}):o.jsx(Yce,{...i,ref:r})})},"Accordion")),[OU,Gce]=Ew(Wo),[MU,Kce]=Ew(Wo,{collapsible:!1}),Yce=y.forwardRef(Li(function(e,r){const{value:n,defaultValue:s,onValueChange:i=Li(()=>{},"onValueChange"),collapsible:a=!1,...l}=e,[u,h]=$i({prop:n,defaultProp:s??"",onChange:i,caller:Wo});return o.jsx(OU,{scope:e.__scopeAccordion,value:y.useMemo(()=>u?[u]:[],[u]),onItemOpen:h,onItemClose:y.useCallback(()=>a&&h(""),[a,h]),children:o.jsx(MU,{scope:e.__scopeAccordion,collapsible:a,children:o.jsx(LU,{...l,ref:r})})})},"AccordionImplSingle")),Zce=y.forwardRef(Li(function(e,r){const{value:n,defaultValue:s,onValueChange:i=Li(()=>{},"onValueChange"),...a}=e,[l,u]=$i({prop:n,defaultProp:s??[],onChange:i,caller:Wo}),h=y.useCallback(f=>u((g=[])=>[...g,f]),[u]),p=y.useCallback(f=>u((g=[])=>g.filter(v=>v!==f)),[u]);return o.jsx(OU,{scope:e.__scopeAccordion,value:l,onItemOpen:h,onItemClose:p,children:o.jsx(MU,{scope:e.__scopeAccordion,collapsible:!0,children:o.jsx(LU,{...a,ref:r})})})},"AccordionImplMultiple")),[Jce,jw]=Ew(Wo),LU=y.forwardRef(Li(function(e,r){const{__scopeAccordion:n,disabled:s,dir:i,orientation:a="vertical",...l}=e,u=y.useRef(null),h=Vt(u,r),p=Hce(n),g=du(i)==="ltr",v=Xe(e.onKeyDown,_=>{var T;
516if(!Vce.includes(_.key))return;const x=_.target,w=p().filter(O=>{var G;return!((G=O.ref.current)!=null&&G.disabled)}),S=w.findIndex(O=>O.ref.current===x),k=w.length;if(S===-1)return;_.preventDefault();let j=S;const C=0,R=k-1,A=Li(()=>{j=S+1,j>R&&(j=C)},"moveNext"),I=Li(()=>{j=S-1,j<C&&(j=R)},"movePrev");switch(_.key){case"Home":j=C;break;case"End":j=R;break;case"ArrowRight":a==="horizontal"&&(g?A():I());break;case"ArrowDown":a==="vertical"&&A();break;case"ArrowLeft":a==="horizontal"&&(g?I():A());break;case"ArrowUp":a==="vertical"&&I();break}const P=j%k;(T=w[P].ref.current)==null||T.focus()});return o.jsx(Jce,{scope:n,disabled:s,direction:i,orientation:a,children:o.jsx(I1.Slot,{scope:n,children:o.jsx(it.div,{...l,"data-orientation":a,ref:h,onKeyDown:s?void 0:v})})})},"AccordionImpl")),oj="AccordionItem",[Qce,O1]=Ew(oj),Xce=y.forwardRef(Li(function(e,r){const{__scopeAccordion:n,value:s,...i}=e,a=jw(oj,n),l=Gce(oj,n),u=D1(n),h=Bn(),p=s&&l.value.includes(s)||!1,f=a.disabled||e.disabled;return o.jsx(Qce,{scope:n,open:p,disabled:f,triggerId:h,children:o.jsx(DU,{"data-orientation":a.orientation,"data-state":M1(p),...u,...i,ref:r,disabled:f,open:p,onOpenChange:g=>{g?l.onItemOpen(s):l.onItemClose(s)}})})},"AccordionItem")),eue="AccordionHeader",tue=y.forwardRef(Li(function(e,r){const{__scopeAccordion:n,...s}=e,i=jw(Wo,n),a=O1(eue,n);return o.jsx(it.h3,{"data-orientation":i.orientation,"data-state":M1(a.open),"data-disabled":a.disabled?"":void 0,...s,ref:r})},"AccordionHeader")),vO="AccordionTrigger",rue=y.forwardRef(Li(function(e,r){const{__scopeAccordion:n,...s}=e,i=jw(Wo,n),a=O1(vO,n),l=Kce(vO,n),u=D1(n);return o.jsx(I1.ItemSlot,{scope:n,children:o.jsx(zce,{"aria-disabled":a.open&&!l.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...u,...s,ref:r})})},"AccordionTrigger")),nue="AccordionContent",sue=y.forwardRef(Li(function(e,r){const{__scopeAccordion:n,...s}=e,i=jw(Wo,n),a=O1(nue,n),l=D1(n);return o.jsx(Uce,{role:"region","aria-labelledby":a.triggerId,"data-orientation":i.orientation,...l,...s,ref:r,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})},"AccordionContent"));function M1(t){return t?"open":"closed"}Li(M1,"getState");var iue=Wce,aue=Xce,oue=tue,lue=rue,cue=sue;function uue({...t}){return o.jsx(iue,{"data-slot":"accordion",...t})}function due({className:t,...e}){return o.jsx(aue,{"data-slot":"accordion-item",className:ke("border-b last:border-b-0",t),...e})}function hue({className:t,children:e,...r}){return o.jsx(oue,{className:"flex",children:o.jsxs(lue,{"data-slot":"accordion-trigger",className:ke("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",t),...r,children:[e,o.jsx(Od,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200"})]})})}function fue({className:t,children:e,...r}){return o.jsx(cue,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...r,children:o.jsx("div",{className:ke("pt-0 pb-4",t),children:e})})}function pue(){const t=[{question:"What can I contribute to 3Dtrees?",answer:"You can contribute LAS or LAZ point clouds from terrestrial, mobile, or drone-based laser scanning. A dataset can be one file or a multi-file acquisition from the same site, including tiled scans that belong together."},{question:"Do I need an account?",answer:"You can browse public datasets without an account. You need an account to upload datasets, manage visibility, request prepared downloads, and access private or owner-only material."},{question:"Who can see my dataset?",answer:o.jsxs(o.Fragment,{children:["You choose the visibility. ",o.jsx("strong",{children:"Public"})," datasets can be inspected and downloaded by everyone. ",o.jsx("strong",{children:"View only"})," datasets can be discovered and inspected, but downloads stay limited to the owner. ",o.jsx("strong",{children:"Private"})," datasets are visible and downloadable only by the owner."]}
516)},{question:"What happens after upload?",answer:"3Dtrees creates a dataset page, stores structured metadata, and prepares the point cloud for browser inspection when visualization outputs are available. Public and view-only datasets can also appear in the map and catalogue surfaces."},{question:"How do visualization and processing work?",answer:"Datasets can be inspected in the web viewer through generated visualization assets. Processing is being connected to scalable Galaxy workflows, including instance segmentation based on SegmentAnyTree where the required inputs and outputs are available."},{question:"How do downloads work?",answer:"Signed-in users can request downloads for datasets they are allowed to access. The platform prepares the package asynchronously and sends a private download link by email when it is ready."},{question:"Can I include supplementary material?",answer:"Yes. You can attach a supplementary ZIP archive with related material such as tables, trajectories, GIS files, documentation, or scripts. Supplementary material can be included when users request a dataset download."},{question:"Who should get in touch?",answer:o.jsxs(o.Fragment,{children:["3Dtrees is for researchers, forest managers, LiDAR operators, and teams building reusable 3D forest data. For collaboration, dataset, or workflow questions, please"," ",o.jsx("a",{href:"mailto:[email protected]",className:"text-blue-600 hover:underline cursor-pointer",children:"contact our team"}),"."]})}],e=["item-0"];return o.jsx("section",{className:"w-full bg-gray-50 py-24 md:py-32",children:o.jsxs("div",{className:"container mx-auto px-4 md:px-6",children:[o.jsxs("div",{className:"mx-auto max-w-3xl text-center",children:[o.jsx("p",{className:"mb-3 text-sm font-semibold uppercase tracking-[0.18em] text-blue-600",children:"FAQ"}),o.jsx("h2",{className:"text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl md:text-5xl",children:"Frequently Asked Questions"}),o.jsx("p",{className:"mx-auto mt-5 max-w-2xl text-base text-gray-600 md:text-lg",children:"Practical details about contributing, processing, and reusing 3D forest data."})]}),o.jsxs("div",{className:"mx-auto mt-12 max-w-3xl md:mt-16",children:[o.jsx(uue,{type:"multiple",defaultValue:e,className:"w-full divide-y divide-gray-200",children:t.map((r,n)=>o.jsxs(due,{value:`item-${n}`,className:"border-0",children:[o.jsx(hue,{className:"py-5 text-left text-base font-medium hover:no-underline md:text-lg",children:r.question}),o.jsx(fue,{className:"pb-5 text-sm leading-7 text-gray-600 md:text-base",children:r.answer})]},n))}),o.jsxs("p",{className:"mt-12 text-center text-sm text-gray-600 md:text-base",children:["Want the bigger picture?"," ",o.jsxs(Sr,{to:"/about",className:"inline-flex items-center gap-1 font-medium text-blue-600 underline-offset-4 hover:underline",children:["More about 3Dtrees.earth",o.jsx(eu,{className:"h-4 w-4","aria-hidden":"true"})]})]})]})]})})}const Nt=y.forwardRef(({className:t,type:e,...r},n)=>o.jsx("input",{type:e,"data-slot":"input",className:ke("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),ref:n,...r}));Nt.displayName="Input";const mue=(t={})=>vw(t);class gue{constructor(e){En(this,"baseUrl");this.baseUrl=e||"https://api.3dtrees.earth"}async subscribe(e,r){const n={"Content-Type":"application/json","X-Trace-ID":r.traceId};
516r.analyticsConsented&&(n["X-Analytics-Consent"]="granted",r.posthogSessionId&&(n["X-PostHog-Session-ID"]=r.posthogSessionId));const s=await fetch(`${this.baseUrl}/marketing/subscribers`,{method:"POST",headers:n,body:JSON.stringify(e)});if(!s.ok){const i=await s.json().catch(()=>({detail:`API request failed with status ${s.status}`}));throw new Error(i.detail||"Failed to record marketing subscription")}}}const vue=new gue;function yue({source:t="unknown",analyticsSource:e="homepage",label:r="Subscribe",className:n,inputClassName:s,buttonVariant:i="default",buttonClassName:a,successMessage:l="Thanks. You are subscribed."}){const[u,h]=y.useState(""),[p,f]=y.useState(!1),[g,v]=y.useState(!1),[_,x]=y.useState(null),w=async S=>{S.preventDefault(),f(!0),x(null);try{const k=mue();es("newsletter_signup_submitted",{contact_source:e,trace_id:k.traceId}),await vue.subscribe({email:u.trim().toLowerCase(),source:t},k),v(!0)}catch(k){console.error("Error submitting form:",k),x("Something went wrong. Please try again.")}finally{f(!1)}};return g?o.jsx("div",{className:"w-full rounded-lg border border-green-200 bg-green-50 p-4",children:o.jsx("p",{className:"text-sm font-medium text-green-800",children:l})}):o.jsxs("form",{onSubmit:w,className:ke("w-full space-y-3",n),children:[o.jsxs("div",{className:"flex w-full flex-col gap-3 sm:flex-row",children:[o.jsx(Nt,{type:"email",value:u,onChange:S=>h(S.target.value),placeholder:"Enter your email",required:!0,className:ke("h-10 flex-1",s)}),o.jsx(we,{type:"submit",disabled:p,variant:i,size:"lg",className:ke("h-10 min-w-[140px] px-6",a),children:p?"Joining...":r})]}),_&&o.jsx("p",{className:"text-red-600 text-sm",children:_})]})}function _ue(){return o.jsx("section",{id:"contact",className:"w-full bg-white py-24 md:py-32",children:o.jsxs("div",{className:"container mx-auto px-4 md:px-6",children:[o.jsxs("div",{className:"mx-auto max-w-3xl text-center",children:[o.jsx("p",{className:"mb-3 text-sm font-semibold uppercase tracking-[0.18em] text-blue-600",children:"Get involved"}),o.jsx("h2",{className:"text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl md:text-5xl",children:"Work with us on the Global Forest Reference"})]}),o.jsxs("div",{className:"mx-auto mt-14 grid max-w-5xl gap-12 md:mt-16 md:grid-cols-2 md:gap-16",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-xl font-semibold tracking-tight text-gray-900",children:"Contact the team"}),o.jsx("p",{className:"mt-3 text-base leading-7 text-gray-600 md:min-h-[5.25rem]",children:"Tell us about datasets, collaborations, processing needs, or research questions. The 3Dtrees team can help route contributions and workflow ideas to the right place."}),o.jsx("div",{className:"mt-6",children:o.jsx(we,{asChild:!0,variant:"outline",size:"lg",children:o.jsxs("a",{href:"mailto:[email protected]",children:["Send us an email",o.jsx(eu,{className:"h-4 w-4"})]})})})]}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-xl font-semibold tracking-tight text-gray-900",children:"Subscribe to updates"}),o.jsx("p",{className:"mt-3 text-base leading-7 text-gray-600 md:min-h-[5.25rem]",children:"Get notified when new reference datasets, processing capabilities, and community milestones are released."}),o.jsx("div",{className:"mt-6",children:o.jsx(yue,{source:"homepage_contact_newsletter",analyticsSource:"homepage",label:"Subscribe",buttonVariant:"outline",successMessage:"Thanks. You are subscribed to 3Dtrees updates."})})]})]})]})})}const FU=[{year:2026,venue:"arXiv",title:"SelectAnyTree: A Promptable Instance Segmentation Model for 3D Forest LiDAR Point Clouds",authors:"Nguyen, T. T., Lusk, D., Gerberding, K., Vajna-Jehle, J., Vu, T. A., Le, D. V., Vo, T., Nguyen, P. L., Kawanishi, Y., Komamizu, T., Ide, I., Frey, J., & Kattenborn, T.",url:"https://arxiv.org/abs/2606.27491"},{year:2026,venue:"Nucleic Acids Research",title:"Galaxy for accessible, reproducible, and collaborative data analyses: 2026 update",authors:"The Galaxy Community",url:"https://doi.org/10.1093/nar/gkag469"},{year:2026,venue:"arXiv",title:"ForestMamba: Sparse Mamba with Geometry-guided Queries for 3D Forest Point Cloud Segmentation",authors:"Nguyen, T. T., Vu, T. A., Le, D. V., Kawanishi, Y., Komamizu, T., Ide, I., & Kattenborn, T.",url:"https://arxiv.org/abs/2606.01549"},{year:2026,venue:"Schweizerische Zeitschrift für Forstwesen",title:"Waldmonitoring für alle: Wie KI den Zustand von Wäldern anal
516ysiert",authors:"Kattenborn, T., Mosig, C., Vajna-Jehle, J., Gerberding, K., Lusk, D., Mahecha, M. D., Seifert, T., Brede, B., & Frey, J.",url:"https://doi.org/10.3188/szf.20226.0168"},{year:2026,venue:"DGPF",title:"3Dtrees.earth: Technical Infrastructure for FAIR Forest LiDAR Data Management and Analysis",authors:"Gerberding, K., Vajna-Jehle, J., Lusk, D., Grüning, B., Kattenborn, T., Sperlich, M., Brede, B., Seifert, T., Scharinger, C., Greven, H., Nahrwold, L., Seiler, J., Reiterer, A., & Frey, J.",url:"https://doi.org/10.24407/KXP:1969219645"},{year:2026,venue:"Research Square",title:"Introducing GalaxyR: an easy-to-use R implementation of the Galaxy API",authors:"Frey, J., Schindler, Z., Ali, M., Braun-Wimmer, J., Gerberding, K., Kröner, K., Larysch, E., Lusk, D., Vajna-Jehle, J., Wardius, Y., Weidenfeller, M., Kattenborn, T., & Seifert, T.",url:"https://doi.org/10.21203/rs.3.rs-8927956/v1"}];function $U({pub:t}){const e=o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("span",{className:"rounded-md bg-gray-100 px-2 py-0.5 text-xs font-semibold text-gray-600",children:t.year}),o.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md bg-amber-50 px-2 py-0.5 text-xs font-semibold text-amber-700",children:[o.jsx(v9,{className:"h-3.5 w-3.5","aria-hidden":"true"}),t.venue]})]}),o.jsx("h3",{className:"mt-3 text-lg font-semibold leading-snug text-gray-900",children:t.title}),o.jsx("p",{className:"mt-2 text-sm leading-6 text-gray-500",children:t.authors})]}),t.url&&o.jsxs("span",{className:"mt-1 inline-flex shrink-0 items-center gap-1 text-sm font-semibold text-blue-600 group-hover:text-blue-700",children:["View paper",o.jsx(pL,{className:"h-4 w-4","aria-hidden":"true"})]})]}
516),r="flex flex-col gap-4 rounded-xl border border-gray-200 bg-white p-6 sm:flex-row sm:items-start sm:justify-between";return t.url?o.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:`group ${r} transition-colors hover:border-gray-300 hover:bg-gray-50`,children:e}):o.jsx("div",{className:r,children:e})}function bue(){return o.jsx("section",{id:"publications",className:"w-full bg-gray-50 py-24 md:py-32",children:o.jsxs("div",{className:"container mx-auto px-4 md:px-6",children:[o.jsxs("div",{className:"mx-auto max-w-3xl text-center",children:[o.jsx("p",{className:"mb-3 text-sm font-semibold uppercase tracking-[0.18em] text-blue-600",children:"Research"}),o.jsx("h2",{className:"text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl md:text-5xl",children:"Publications"}),o.jsx("p",{className:"mt-5 text-base leading-7 text-gray-600 md:text-lg",children:"Peer-reviewed papers, preprints, and conference contributions from the 3Dtrees.earth project, advancing open, FAIR 3D forest data."})]}),o.jsx("div",{className:"mx-auto mt-14 flex max-w-4xl flex-col gap-4 md:mt-16",children:FU.map(t=>o.jsx($U,{pub:t},t.title))})]})})}function wue(){return o.jsxs("div",{className:"w-full",children:[o.jsx(_ce,{}),o.jsx(xce,{}),o.jsx(jce,{}),o.jsx(Ice,{}),o.jsx(_ue,{}),o.jsx(bue,{}),o.jsx(pue,{})]})}const xue="/assets/hero-plot-BN931nJw.3dtd",Sue="/assets/re3data-badge-Dk57KO2e.svg",kue="/assets/anika-erxleben-eggenhofer-qJ790XrD.jpg",Eue="/assets/ayushi-sharma-WC00kPPX.jpg",jue="/assets/benjamin-brede-CsLpOVaR.jpg",Cue="/assets/bjoern-gruening-DuYxKmCN.jpg",Nue="/assets/daniel-lusk-DZ9jWFQ6.jpg",Pue="/assets/janusch-vajna-jehle-CSF58vCl.jpg",Rue="/assets/julian-frey-C0PICM21.jpg",Aue="/assets/kilian-gerberding-BeTJKeQT.jpg",Tue="/assets/martin-mokros-Cd4bPULr.jpg",Iue="/assets/salim-soltani-DRm2Sif1.jpg",Due="/assets/stefano-puliti-BvBdT8_l.jpg",Oue="/assets/teja-kattenborn-OcUdVRZF.jpg",Mue="/assets/thomas-seifert-CYw9tziw.jpg",Lue="/assets/trung-thanh-nguyen-C0EgHdF5.jpg",Ih="GeoSense, University of Freiburg",yO="Forest Growth and Dendroecology, University of Freiburg",Fue=[{name:"Teja Kattenborn",role:"Scientific Lead",affiliation:Ih,photo:{src:Oue,sourceUrl:"https://uni-freiburg.de/enr-geosense/team/kattenborn/",sourceLabel:"GeoSense team page"}},{name:"Julian Frey",role:"Scientific Lead",affiliation:yO,photo:{src:Rue,sourceUrl:"https://uni-freiburg.de/unr-wwd/team/julian-frey/",sourceLabel:"Forest Growth team page"}},{name:"Thomas Seifert",role:"Scientific Lead",affiliation:yO,photo:{src:Mue,sourceUrl:"https://uni-freiburg.de/unr-wwd/team/seifert-thomas/",sourceLabel:"Forest Growth team page"}},{name:"Daniel Lusk",role:"Project Manager",affiliation:Ih,photo:{src:Nue,sourceUrl:"https://uni-freiburg.de/enr-geosense/team/daniel_lusk/",sourceLabel:"GeoSense team page"}},{name:"Janusch Vajna-Jehle",role:"Lead Developer",affiliation:Ih,photo:{src:Pue,sourceUrl:"https://uni-freiburg.de/enr-geosense/team/janusch_vajna_jehle/",sourceLabel:"GeoSense team page"}},{name:"Kilian Gerberding",role:"Processing and Pipeline Management",affiliation:Ih,photo:{src:Aue,sourceUrl:"https://uni-freiburg.de/enr-geosense/team/kilian_gerberding/",sourceLabel:"GeoSense team page"}},{name:"Salim Soltani",role:"Data Acquisition and Integration",affiliation:Ih,photo:{src:Iue,sourceUrl:"https://uni-freiburg.de/enr-geosense/team/salim_soltani/",sourceLabel:"GeoSense team page"}},{name:"Ayushi Sharma",role:"AI Model Development",affiliation:Ih,photo:{src:Eue,sourceUrl:"https://uni-freiburg.de/enr-geosense/team/ayushi_sharma/",sourceLabel:"GeoSense team page"}},{name:"Trung Thanh Nguyen",role:"AI Model Development",affiliation:"Nagoya University",photo:{src:Lue,sourceUrl:"https://thanhhff.github.io/",sourceLabel:"personal website"}},{name:"Björn Grüning",role:"Galaxy Europe Infrastructure",affiliation:"Galaxy Europe, University of Freiburg",photo:{src:Cue,sourceUrl:"https://www.cibss.uni-freiburg.de/de/ueber-cibss/forschende/person-details/dr-bjoern-gruening",sourceLabel:"CIBSS profile, University of Freiburg"}},{name:"Anika Erxleben-Eggenhofer",role:"Research Data Management",affiliation:"Central Data Facility, University of Freiburg",photo:{src:kue,sourceUrl:"https://www.laborjournal.de/epaper/LJ_23_07.pdf",sourceLabel:'Laborjournal 7-8/2023, p. 62, "Zur Person"',credit:"Univ. Freiburg"}},{name:"Benjamin Brede",role:"Large-Scale Data Integration",affiliation:"GFZ Helmholtz Centre for Geosciences",photo:{src:jue,sourceUrl:"https://www.gfz.de/staff/benjamin.brede/sec14",sourceLabel:"GFZ staff page"}},{name:"Martin Mokroš",role:"Crowdsourcing and Data Acquisition",affiliation:"UCL Geography",photo:{src:Tue,sourceUrl:"https://martinmokros.
516com/about/",sourceLabel:"personal website"}},{name:"Stefano Puliti",role:"Benchmark and Reference Data",affiliation:"Norwegian Institute of Bioeconomy Research (NIBIO)",photo:{src:Due,sourceUrl:"https://www.nibio.no/nyheter/laerer-ki-a-se-hvert-enkelt-tre-i-skogen",sourceLabel:"NIBIO news article",credit:"Lars Sandved Dalen, NIBIO"}}],Ec={datasetId:1135,pointsUrl:xue,title:"Evo forest plot, Finland",authors:"Mikko Vastaranta, Ville Luoma, Harri Kaartinen, Antero Kukko and others",credit:"Vastaranta et al.",license:"CC BY 4.0"},$ue=[{year:2026,event:"EGU General Assembly, Vienna",title:"3Dtrees.earth: bringing forest LiDAR point clouds into Galaxy",speaker:"Kilian Gerberding",url:"https://galaxyproject.org/news/2026-05-13-egu/",linkLabel:"Galaxy Project report"}],nm={url:"https://www.re3data.org/repository/r3d100014950",doi:"10.17616/R31NJO12",badgeSrc:Sue},zue=y.lazy(()=>Nn(()=>import("./point-cloud-hero-BY2N3t9G.js"),__vite__mapDeps([0,1]))),AS="font-medium text-blue-700 underline-offset-4 hover:underline";function TS({id:t,title:e,lead:r}){return o.jsxs("div",{className:"max-w-3xl",children:[o.jsx("h2",{id:t,className:"text-3xl font-bold tracking-tight text-gray-900 md:text-4xl",children:e}),r&&o.jsx("p",{className:"mt-4 text-base leading-7 text-gray-600 md:text-lg md:leading-8",children:r})]})}function Uue(t){return t.split(/\s+/).filter(Boolean).map(e=>e[0]).slice(0,2).join("").toUpperCase()}function Bue({member:t}){return o.jsxs("li",{className:"flex w-[calc(50%-0.625rem)] flex-col items-center rounded-2xl border border-gray-200 bg-white px-3 pb-6 pt-7 text-center sm:w-[calc((100%-2.5rem)/3)] sm:px-5 lg:w-[calc((100%-3.75rem)/4)]",children:[t.photo?o.jsx("img",{src:t.photo.src,alt:"",width:112,height:112,className:"h-24 w-24 rounded-full bg-gray-100 object-cover ring-1 ring-gray-200 sm:h-28 sm:w-28",loading:"lazy"}):o.jsx("span",{"aria-hidden":"true",className:"flex h-24 w-24 items-center justify-center rounded-full bg-gray-100 text-2xl font-semibold text-gray-500 sm:h-28 sm:w-28",children:Uue(t.name)}),o.jsx("h3",{className:"mt-5 text-base font-semibold leading-snug text-gray-900",children:t.name}),o.jsx("p",{className:"mt-1.5 text-sm font-medium text-blue-700",children:t.role}),t.affiliation&&o.jsx("p",{className:"mt-1.5 text-sm leading-snug text-gray-500",children:t.affiliation})]})}function Vue({members:t}){return t.length===0?null:o.jsx("ul",{className:"mt-12 flex flex-wrap justify-center gap-5",children:t.map(e=>o.jsx(Bue,{member:e},e.name))})}function Hue(){return y.useEffect(()=>{window.scrollTo(0,0)},[]),o.jsxs("div",{className:"w-full",children:[o.jsx("section",{"aria-labelledby":"about-title",className:"w-full overflow-hidden bg-white",children:o.jsx("div",{className:"container mx-auto px-4 pb-14 pt-12 md:px-6 md:pb-20 md:pt-16",children:o.jsxs("div",{className:"mx-auto grid max-w-6xl items-center gap-10 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)] lg:gap-14",children:[o.jsxs("div",{children:[o.jsx("p",{className:"mb-4 text-sm font-semibold uppercase tracking-[0.18em] text-blue-700",children:"About"}),o.jsx("h1",{id:"about-title",className:"text-balance text-4xl font-bold leading-[1.1] tracking-tight text-gray-900 sm:text-5xl",children:"An open platform for 3D forest scans"}),o.jsx("p",{className:"mt-6 max-w-xl text-lg leading-8 text-gray-600",children:"3Dtrees.earth is building a shared reference for studying the 3D structure of trees. Researchers and practitioners can contribute LiDAR point clouds, discover public datasets, inspect processed scans in 3D and reuse data for new research and monitoring. Reproducible workflows help prepare suitable scans for further analysis of forest structure."}),o.jsxs(Sr,{to:"/map",className:"mt-7 inline-flex items-center gap-1.5 text-base font-semibold text-blue-700 underline-offset-4 hover:underline",children:["Explore the map",o.jsx(eu,{className:"h-4 w-4","aria-hidden":"true"})]})]}),o.jsx(y.Suspense,{fallback:null,children:o.jsx(zue,{src:Ec.pointsUrl,label:`Interactive 3D point cloud of a laser-scanned forest plot (${Ec.title}), each tree in its own colour. Drag or use the arrow keys to rotate.`,caption:o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"font-medium text-gray-700",children:"Drag to rotate"})," ·"," ",o.jsx(Sr,{to:`/datasets/${Ec.datasetId}`,title:`${Ec.title} by ${Ec.authors}`,className:"underline-offset-4 hover:underline",children:o.jsx("span",{className:"text-gray-600 hover:text-gray-900",children:Ec.title})}),", ",Ec.credit,", ",Ec.license]})})})]})})}),o.jsx("section",{"aria-labelledby":"about-why",className:"w-full bg-gray-50 py-20 md:py-28",children:o.jsx("div",{className:"container mx-auto px-4 md:px-6",children:o.jsxs("div",{className:"mx-auto max-w-3xl text-center",children:[o.jsx("span",{"aria-hidden":"true",className:"mx-auto mb-8 block h-1 w-12 rounded-full bg-blue-600"}),o.jsx("h2",{id:"about-why",className:"text-balance text-3xl font-bold leading-tight tracking-tight text-gray-900 md:text-4xl",children:"Forests are complex 3D structures."}),o.jsx("p",{className:"mt-6 text-lg leading-8 text-gray-600 md:text-xl md:leading-9",children:"To understand how forests grow, store carbon and respond to change, we need detailed 3D measurements. Laser scanners on tripods, backpacks and drones capture tree and stand structure down to single branches. Yet their point clouds are large, varied and often difficult to find or compare. Bringing scans together with acquisition context and repeatable processing makes it easier to build on data collected across sites and sensors."})]})})}),o.jsx("section",{"aria-labelledby":"about-team",className:"w-full bg-white py-16 md:py-24",children:o.jsx("div",{className:"container mx-auto px-4 md:px-6",children:o.jsxs("div",{className:"mx-auto max-w-6xl",children:[o.jsx(TS,{id:"about-team",title:"People behind 3Dtrees",lead:o.jsxs(o.Fragment,{children:["3Dtrees.earth is developed at the"," ",o.jsx("a",{href:"https://uni-freiburg.de/enr-geosense/",target:"_blank",rel:"noopener noreferrer",className:AS,children:"Chair of Sensor-based Geoinformatics (GeoSense)"})," ","at the University of Freiburg, together with researchers from the partner institutions below. It builds on the experience of"," ",o.jsx("a",{href:"https://deadtrees.earth",target:"_blank",rel:"noopener noreferrer",className:AS,children:"deadtrees.earth"}),"."]})}),o.jsx(Vue,{members:Fue})]})})}),o.jsx("section",{"aria-labelledby":"about-partners",className:"w-full bg-blue-50 py-16 md:py-24",children:o.jsx("div",{className:"container mx-auto px-4 md:px-6",children:o.jsxs("div",{className:"mx-auto max-w-6xl",children:[o.jsx(TS,{id:"about-partners",title:"Partner institutions",lead:"The institutions behind 3Dtrees.earth."}),o.jsx("ul",{className:"mt-12 grid grid-cols-2 gap-4 sm:gap-5 lg:grid-cols-4",children:aj.map(t=>o.jsx("li",{children:o.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"flex h-full flex-col items-center justify-start gap-4 roun
516ded-2xl border border-blue-100 bg-white px-4 py-6 text-center transition-colors hover:border-blue-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 sm:px-6 sm:py-8",children:[o.jsx("span",{className:"flex h-16 w-full items-center justify-center sm:h-20",children:o.jsx("img",{src:t.logoSrc,alt:"",className:"max-h-full max-w-full object-contain",loading:"lazy"})}),o.jsx("span",{className:"text-sm leading-snug text-gray-700",children:t.name})]})},t.name))})]})})}),o.jsx("section",{"aria-labelledby":"about-publications",className:"w-full bg-white py-16 md:py-24",children:o.jsx("div",{className:"container mx-auto px-4 md:px-6",children:o.jsxs("div",{className:"mx-auto max-w-6xl",children:[o.jsx(TS,{id:"about-publications",title:"Publications"}),o.jsx("div",{className:"mt-10 flex flex-col gap-4",children:FU.map(t=>o.jsx($U,{pub:t},t.title))}),o.jsx("h2",{id:"about-talks",className:"mt-16 text-2xl font-bold tracking-tight text-gray-900",children:"Talks"}),o.jsx("ul",{"aria-labelledby":"about-talks",className:"mt-6 flex flex-col gap-4",children:$ue.map(t=>
516o.jsxs("li",{className:"flex flex-col gap-4 rounded-xl border border-gray-200 bg-white p-6 sm:flex-row sm:items-start sm:justify-between",children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("span",{className:"rounded-md bg-gray-100 px-2 py-0.5 text-xs font-semibold text-gray-600",children:t.year}),o.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md bg-emerald-50 px-2 py-0.5 text-xs font-semibold text-emerald-700",children:[o.jsx(U9,{className:"h-3.5 w-3.5","aria-hidden":"true"}),t.event]})]}),o.jsx("h3",{className:"mt-3 text-lg font-semibold leading-snug text-gray-900",children:t.title}),o.jsx("p",{className:"mt-2 text-sm leading-6 text-gray-500",children:t.speaker})]}),o.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-1 text-sm font-semibold text-blue-600 hover:text-blue-700 hover:underline",children:[t.linkLabel,o.jsx(pL,{className:"h-4 w-4","aria-hidden":"true"})]})]},t.title))}),o.jsx("h2",{id:"about-cite",className:"mt-16 text-2xl font-bold tracking-tight text-gray-900",children:"Cite 3Dtrees.earth"}),o.jsxs("div",{className:"mt-6 flex flex-col gap-5 rounded-xl border border-gray-200 bg-white p-6 sm:flex-row sm:items-center",children:[o.jsx("a",{href:nm.url,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 self-start rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 sm:self-center",children:o.jsx("img",{src:nm.badgeSrc,alt:`re3data registry entry for 3Dtrees.earth, DOI ${nm.doi}`,width:300,height:100,className:"h-auto w-[300px] max-w-full",loading:"lazy"})}),o.jsxs("p",{className:"text-sm leading-6 text-gray-600",children:["3Dtrees.earth is listed in re3data, the Registry of Research Data Repositories. To cite the platform itself, use its registry DOI"," ",o.jsx("a",{href:`https://doi.org/${nm.doi}`,target:"_blank",rel:"noopener noreferrer",className:AS,children:nm.doi}),"."]})]})]})})}),o.jsx("section",{"aria-labelledby":"about-contact",className:"w-full bg-gradient-to-br from-blue-50 via-violet-50 to-pink-50",children:o.jsx("div",{className:"container mx-auto px-4 py-20 md:px-6 md:py-24",children:o.jsxs("div",{className:"mx-auto max-w-3xl text-center",children:[o.jsx("h2",{id:"about-contact",className:"text-balance text-3xl font-bold tracking-tight text-gray-900 md:text-4xl",children:"Have forest scans? Put them on the map."}),o.jsx("p",{className:"mt-5 text-lg leading-8 text-gray-600",children:"Terrestrial, mobile and drone scans are all welcome. Questions, or an idea for working together? Just write to us."}),o.jsxs("div",{className:"mt-9 flex flex-col justify-center gap-3 sm:flex-row",children:[o.jsx(we,{asChild:!0,size:"lg",className:"px-6 text-base",children:o.jsxs(Sr,{to:"/sign-up",children:["Start contributing",o.jsx(eu,{className:"h-4 w-4","aria-hidden":"true"})]})}),o.jsx(we,{asChild:!0,size:"lg",variant:"outline",className:"bg-white px-6 text-base",children:o.jsx("a",{href:"mailto:[email protected]",children:"[email protected]"})})]})]})})})]})}var que=Object.defineProperty,Wue=(t,e)=>que(t,"name",{value:e,configurable:!0}),Gue=y.forwardRef(Wue(function(e,r){return o.jsx(it.label,{...e,ref:r,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=e.onMouseDown)==null||i.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}})},"Label")),Kue=Gue;function ft({className:t,...e}){return o.jsx(Kue,{"data-slot":"label",className:ke("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}function Hu(t,e){return e.some(r=>t.includes(r))}function Hg(t,e){const n=(e instanceof Error?e.message:String(e??"")).toLowerCase();return Hu(n,["rate limit","too many requests","email rate limit"])?t==="recovery"?"Too many reset requests were made. Please wait a moment and try again.":"Too many attempts were made. Please wait a moment and try again.":t==="login"?Hu(n,["invali
516d login credentials","invalid credentials"])?"The email or password is incorrect.":n.includes("email not confirmed")?"Confirm your email address before logging in.":"We could not log you in. Please try again.":t==="signup"?Hu(n,["already registered","already exists"])?"An account may already exist for this email. Try logging in or resetting your password.":Hu(n,["password","weak"])?"Choose a stronger password with at least 8 characters.":"We could not create your account. Please try again.":t==="password-update"?Hu(n,["expired","invalid","session"])?"This password reset link is invalid or has expired. Request a new reset email.":Hu(n,["password","weak"])?"Choose a stronger password with at least 8 characters.":"We could not update your password. Please try again.":t==="code-verification"?Hu(n,["expired","invalid","token"])?"This verification code is invalid or has expired. Request a new email and try again.":"We could not verify this code. Please try again.":"We could not send the reset email. Please try again in a moment."}const _O={expired_link:{title:"This link has expired",description:"Request a new password reset email or start the signup process again."},invalid_link:{title:"This link is not valid",description:"The link may be incomplete or may already have been used."},verification_failed:{title:"We could not verify this link",description:"Please request a new email and try again."}};function Yue(t){return _O[t??""]??_O.verification_failed}const bO="/account";function Zue(t){return!t||!t.startsWith("/")||t.startsWith("//")?bO:t}const Jue=async({request:t})=>{const e=new URL(t.url),r=Zue(e.searchParams.get("next")),n=await t.formData(),s=n.get("email"),i=n.get("password");es("account_signin_submitted",{provider:"email"});const{error:a}=await Ye.auth.signInWithPassword({email:s,password:i});return a?(es("account_signin_failed",{reason_code:a.status===429?"rate_limited":"provider_error",provider:"email"}),{error:Hg("login",a)}):ga(r)};function Que(){var a;const t=Ag(),[e]=Rg(),r=e.get("next"),n=r?`/sign-up?next=${encodeURIComponent(r)}
516`:"/sign-up",s=(a=t.data)==null?void 0:a.error,i=t.state==="submitting";return o.jsx("div",{className:"flex min-h-svh w-full items-center justify-center p-6 md:p-10",children:o.jsx("div",{className:"w-full max-w-sm",children:o.jsx("div",{className:"flex flex-col gap-6",children:o.jsxs(Vs,{children:[o.jsxs(va,{children:[o.jsx(Ka,{className:"text-2xl",children:"Log in"}),o.jsx(nu,{children:"Enter your account email and password."})]}),o.jsx(zi,{children:o.jsxs(t.Form,{method:"post",children:[o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(ft,{htmlFor:"email",children:"Email"}),o.jsx(Nt,{id:"email",name:"email",type:"email",placeholder:"[email protected]",autoComplete:"email",required:!0})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx(ft,{htmlFor:"password",children:"Password"}),o.jsx(Sr,{to:"/forgot-password",className:"ml-auto inline-block text-sm underline-offset-4 hover:underline",children:"Forgot your password?"})]}),o.jsx(Nt,{id:"password",type:"password",name:"password",autoComplete:"current-password",required:!0})]}),s&&o.jsx("p",{className:"text-sm text-red-500",children:s}),o.jsx(we,{type:"submit",className:"w-full",disabled:i,children:i?"Logging in...":"Log in"})]}),o.jsxs("div",{className:"mt-4 text-center text-sm",children:["Don't have an account?"," ",o.jsx(Sr,{to:n,className:"underline underline-offset-4",children:"Sign up"})]})]})})]})})})})}const wO="/account";function Xue(t){return!t||!t.startsWith("/")||t.startsWith("//")?wO:t}const xO=async({request:t})=>{const e=new URL(t.url),r=e.origin,n=Xue(e.searchParams.get("next")),s=await t.formData(),i=s.get("email"),a=typeof i=="string"?i.trim().toLowerCase():"",l=s.get("password"),u=s.get("repeat-password"),h=s.get("marketing_opt_in")==="on",p=zo(),f=crypto.randomUUID(),g=p&&typeof localStorage<"u"?Iz({storage:localStorage,hasConsent:zo}).current():null,v=g?hX(g):{};if(es("account_signup_submitted",{provider:"email",trace_id:f,...v}),!a)return es("account_signup_failed",{reason_code:"validation_failed",provider:"email",stage:"validation",trace_id:f,...v}),{error:"Email is required"};if(l.length<8)return es("account_signup_failed",{reason_code:"validation_failed",provider:"email",stage:"validation",trace_id:f,...v}),{error:"Choose a password with at least 8 characters."};if(l!==u)return es("account_signup_failed",{reason_code:"validation_failed",provider:"email",stage:"validation",trace_id:f,...v}),{error:"Passwords do not match"};const _=kte({acceptedTos:s.get("accept-tos")==="on"});if(_)return es("account_signup_failed",{reason_code:"validation_failed",provider:"email",stage:"validation",trace_id:f,...v}),{error:_};const{error:x}=await Ye.auth.signUp({email:a,password:l,options:{emailRedirectTo:`${r}/auth/confirm?next=${encodeURIComponent(n)}`,data:{...k4(),...p?{analytics_consent:!0,analytics_trace_id:f,analytics_attribution:v}:{},...h?{marketing_consent:!0,marketing_consent_source:"account_signup"}:{}}}});return x?(es("account_signup_failed",{reason_code:x.status===429?"rate_limited":"provider_error",provider:"email",stage:"record_creation",trace_id:f,...v}),{error:Hg("signup",x)}):ga(`/sign-up?success&next=${encodeURIComponent(n)}`)};function SO(){var u;const t=Ag(),[e]=Rg(),r=!!e.has("success"),n=e.get("next"),s=n?`/login?next=${encodeURIComponent(n)}`:"/login",i=`/auth/verify-code?type=signup&next=${encodeURIComponent(n??"/account")}`,a=(u=t.data)==null?void 0:u.error,l=t.state==="submitting";return o.jsx("div",{className:"flex min-h-svh w-full items-center justify-center p-6 md:p-10",children:o.jsx("div",{className:"w-full max-w-sm",children:o.jsx("div",{className:"flex flex-col gap-6",children:r?o.jsxs(Vs,{children:[o.jsxs(va,{children:[o.jsx(Ka,{className:"text-2xl",children:"Check your email"}),o.jsx(nu,{children:"Confirm your email address to finish signing up."})]}),o.jsxs(zi,{className:"space-y-4",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"We sent a six-digit account confirmation code. Enter it before logging in to 3Dtrees.earth."}),o.jsx(we,{asChild:!0,variant:"outline",className:"w-full",children:o.jsx(Sr,{to:i,children:"Enter the 6-digit code"})})]})]}):o.jsxs(Vs,{children:[o.jsxs(va,{children:[o.jsx(Ka,{className:"text-2xl",children:"Create your account"}),o.jsx(nu,{children:"Join 3Dtrees.earth to contribute and manage datasets."})]}),o.jsx(zi,{children:o.jsxs(t.Form,{method:"post",children:[o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(ft,{htmlFor:"email",children:"Email"}),o.jsx(Nt,{id:"email",name:"email",type:"email",placeholder:"[email protected]",autoComplete:"email",required:!0})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"flex items-center",children:o.jsx(ft,{htmlFor:"password",children:"Password"})}),o.jsx(Nt,{id:"password",name:"password",type:"password",minLength:8,autoComplete:"new-password",required:!0})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"flex items-center",children:o.jsx(ft,{htmlFor:"repeat-password",children:"Repeat password"})}),o.jsx(Nt,{id:"repeat-password",name:"repeat-password",type:"password",minLength:8,autoComplete:"new-password",required:!0})]}),o.jsxs("div",{className:"grid gap-3 rounded-md border p-3 text-sm",children:[o.jsx("p",{className:"font-medium",children:"Legal acknowledgements"}),o.jsxs("label",{className:"flex items-start gap-2",children:[o.jsx("input",{type:"checkbox",name:"accept-tos",required:!0,className:"mt-0.5"}),o.jsxs("span",{children:["I have read and accept the"," ",o.jsx("a",{href:"/legal/terms",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Terms of Service"}),"."]})]}),o.jsx("p",{className:"text-muted-foreground",children:o.jsx(C4,{})})]}),o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(ya,{id:"marketing-opt-in",name:"marketing_opt_in"}),o.jsx(ft,{htmlFor:"marketing-opt-in",className:"text-sm font-normal leading-5",children:"Email me occasional 3Dtrees.earth news, feature updates, and dataset announcements. I can unsubscribe at any time."})]}),a&&o.jsx("p",{className:"text-sm text-red-500",children:a}),o.jsx(we,{type:"submit",className:"w-full",disabled:l,children:l?"Creating account...":"Create account"})]}),o.jsxs("div",{className:"mt-4 text-center text-sm",children:["Already have an account?"," ",o.jsx(Sr,{to:s,className:"underline underline-offset-4",children:"Log in"})]})]})})]})})})})}function ede(){const[t]=Rg(),e=Yue(t.get("reason"));return o.jsx("div",{className:"flex min-h-svh w-full items-center justify-center p-6 md:p-10",children:o.jsx("div",{className:"w-full max-w-md",children:o.jsx("div",{className:"flex flex-col gap-6",children:o.jsxs(Vs,{children:[o.jsxs(va,{children:[o.jsx(Ka,{className:"text-2xl",children:e.title}),o.jsx(nu,{children:e.description})]}),o.jsxs(zi,{className:"space-y-4",children:[o.jsxs("div",{className:"flex gap-2 pt-4",children:[o.jsx(we,{asChild:!0,className:"flex-1",children:o.jsx(Sr,{to:"/login",children:"Back to log in"})}),o.jsx(we,{variant:"outline",asChild:!0,className:"flex-1",children:o.jsx(Sr,{to:"/forgot-password",children:"Request a new email"})})]}),o.jsxs("div",{className:"space-y-2 text-center text-sm",children:[o.jsx("p",{className:"text-muted-foreground",children:"Have the 6-digit code from your email?"}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Sr,{to:"/auth/verify-code?type=signup",className:"underline underline-offset-4",children:"Enter confirmation code"}),o.jsx(Sr,{to:"/auth/verify-code?type=recovery",className:"underline underline-offset-4",children:"Enter password reset code"})]})]})]})]})})})})}const tde=async({request:t})=>{const r=(await t.formData()).get("email").trim(),n=new URL(t.url).origin,{error:s}=await Ye.auth.resetPasswordForEmail(r,{redirectTo:`${n}/auth/confirm?next=/update-password`});return s?{error:Hg("recovery",s),data:{email:r}}:ga("/forgot-password?success")};function rde(){var i;const t=Ag(),[e]=Rg(),r=!!e.has("success"),n=(i=t.data)==null?void 0:i.error,s=t.state==="submitting";return o.jsx("div",{className:"flex min-h-svh w-full items-center justify-center p-6 md:p-10",children:o.jsx("div",{className:"w-full max-w-sm",children:o.jsx("div",{className:"flex flex-col gap-6",children:r?o.jsxs(Vs,{children:[o.jsxs(va,{children:[o.jsx(Ka,{className:"text-2xl",children:"Check your email"}),o.jsx(nu,{children:"Password reset instructions have been sent."})]}),o.jsxs(zi,{className:"space-y-4",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"If an account exists for this email, you will receive a six-digit password reset code."}),o.jsx(we,{asChild:!0,variant:"outline",className:"w-full",children:o.jsx(Sr,{to:"/auth/verify-code?type=recovery",children:"Enter the 6-digit code"})})]})]}):o.jsxs(Vs,{children:[o.jsxs(va,{children:[o.jsx(Ka,{className:"text-2xl",children:"Reset your password"}),o.jsx(nu,{children:"Enter your account email and we'll send you a secure verification code."})]}),o.jsx(zi,{children:o.jsxs(t.Form,{method:"post",children:[o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(ft,{htmlFor:"email",children:"Email"}),o.jsx(Nt,{id:"email",name:"email",type:"email",placeholder:"[email protected]",autoComplete:"email",required:!0})]}),n&&o.jsx("p",{className:"text-sm text-red-500",children:n}),o.jsx(we,{type:"submit",className:"w-full",disabled:s,children:s?"Sending...":"Send reset email"})]}),o.jsxs("div",{className:"mt-4 text-center text-sm",children:["Already have an account?"," ",o.jsx(Sr,{to:"/login",className:"underline underline-offset-4",children:"Log in"})]})]})})]})})})})}const nde=async({request:t})=>{const e=await t.formData(),r=e.get("password"),n=e.get("repeat-password");if(r.length<8)return{error:"Choose a password with at least 8 characters."};if(r!==n)return{error:"Passwords do not match."};const{error:s}=await Ye.auth.updateUser({password:r});return s?{error:Hg("password-update",s)}:ga("/account")};function sde(){var n;const t=Ag(),e=(n=t.data)==null?void 0:n.error,r=t.state==="submitting";return o.jsx("div",{className:"flex min-h-svh w-full items-center justify-center p-6 md:p-10",children:o.jsx("div",{className:"w-full max-w-sm",children:o.jsx("div",{className:"flex flex-col gap-6",children:o.jsxs(Vs,{children:[o.jsxs(va,{children:[o.jsx(Ka,{className:"text-2xl",children:"Choose a new password"}),o.jsx(nu,{children:"Use at least 8 characters."})]}),o.jsx(zi,{children:o.jsx(t.Form,{method:"post",children:o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(ft,{htmlFor:"password",children:"New password"}),o.jsx(Nt,{id:"password",name:"password",type:"password",minLength:8,autoComplete:"new-password",required:!0})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(ft,{htmlFor:"repeat-password",children:"Repeat new password"}),o.jsx(Nt,{id:"repeat-password",name:"repeat-password",type:"password",minLength:8,autoComplete:"new-password",required:!0})]}),e&&o.jsx("p",{className:"text-sm text-red-500",children:e}),o.jsx(we,{type:"submit",className:"w-full",disabled:r,children:r?"Saving...":"Save new password"})]})})})]})})})})}function ide(t){return t==="signup"||t==="recovery"}function ade(t){return!t.startsWith("/")||t.startsWith("//")?"/account":t}const ode=async({request:t})=>{const e=await t.formData(),r=String(e.get("email")??"").trim().toLowerCase(),n=String(e.get("token")??"").trim(),s=String(e.get("type")??""),i=ade(String(e.get("next")??"/account"));if(!r)return{error:"Email is required.",data:{email:r}};if(!/^\d{6}$/.test(n))return{error:"Enter the 6-digit code from your email.",data:{email:r}};if(!ide(s))return{error:"Choose a valid verification type.",data:{email:r}};const{error:a}=await Ye.auth.verifyOtp({email:r,token:n,type:s});return a?{error:Hg("code-verification",a),data:{email:r}}:ga(s==="recovery"?"/update-password":i)};function lde(){var u,h,p;const t=Ag(),[e]=Rg(),r=e.get("type")==="recovery"?"recovery":"signup",n=e.get("next")??"/account",s=r==="recovery",i=(u=t.data)==null?void 0:u.error,a=((p=(h=t.data)==null?void 0:h.data)==null?void 0:p.email)??"",l=t.
516state==="submitting";return o.jsx("div",{className:"flex min-h-svh w-full items-center justify-center p-6 md:p-10",children:o.jsx("div",{className:"w-full max-w-sm",children:o.jsxs(Vs,{children:[o.jsxs(va,{children:[o.jsx(Ka,{className:"text-2xl",children:s?"Verify password reset":"Confirm your email"}),o.jsx(nu,{children:"Enter the email address and 6-digit code from your email."})]}),o.jsxs(zi,{children:[o.jsxs(t.Form,{method:"post",children:[o.jsx("input",{type:"hidden",name:"type",value:r}),o.jsx("input",{type:"hidden",name:"next",value:n}),o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(ft,{htmlFor:"email",children:"Email"}),o.jsx(Nt,{id:"email",name:"email",type:"email",defaultValue:a,autoComplete:"email",placeholder:"[email protected]",required:!0})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(ft,{htmlFor:"token",children:"Verification code"}),o.jsx(Nt,{id:"token",name:"token",type:"text",inputMode:"numeric",autoComplete:"one-time-code",pattern:"[0-9]{6}",maxLength:6,placeholder:"123456",required:!0})]}),i&&o.jsx("p",{className:"text-sm text-red-500",children:i}),o.jsx(we,{type:"submit",className:"w-full",disabled:l,children:l?"Verifying...":s?"Continue":"Confirm email"})]})]}),o.jsx("div",{className:"mt-4 text-center text-sm",children:o.jsx(Sr,{to:s?"/forgot-password":"/login",className:"underline underline-offset-4",children:s?"Request a new code":"Back to login"})})]})]})})})}function zU({children:t,className:e,maxWidth:r="2xl",padding:n=!0}){const s={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl",full:"max-w-full"};return o.jsx("div",{className:ke("mx-auto w-full",s[r],n&&"px-4 py-6 sm:px-6 lg:px-8",e),children:t})}const cde=async()=>{const{data:t,error:e}=await Ye.auth.getUser();return e||!(t!=null&&t.user)?ga("/login"):t};function ude(){const e=qM().user;return o.jsx(zU,{maxWidth:"md",children:o.jsxs(Vs,{children:[o.jsx(va,{children:o.jsxs(Ka,{className:"flex items-center gap-2",children:[o.jsx(gC,{className:"h-5 w-5"}),"Protected Page"]})}),o.jsxs(zi,{className:"space-y-4",children:[o.jsxs("p",{className:"ph-mask",children:["Hello ",e==null?void 0:e.email,"! This is a protected page."]}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"You can only see this because you're authenticated."}),o.jsx("div",{className:"pt-4",children:o.jsx(Sr,{to:"/account",children:o.jsxs(we,{className:"w-full gap-2",children:["Go to Account",o.jsx(eu,{className:"h-4 w-4"})]})})})]})]})})}function vt({level:t=2,className:e="",children:r}){const n="mt-4 text-gray-900",s=t===1?"text-3xl font-bold":t===2?"text-2xl font-semibold":t===3?"text-xl font-semibold":t===4?"text-lg font-semibold":"text-base font-semibold",i=`h${t}`;return o.jsx(i,{className:`${n} ${s} ${e}`.trim(),children:r})}function ze({className:t="",children:e}){return o.jsx("p",{className:`mt-3 text-gray-700 leading-relaxed ${t}`.trim(),children:e})}function Po({items:t}){return o.jsx("ul",{className:"mt-3 list-disc space-y-2 pl-6 text-gray-700 leading-relaxed",children:t.map(e=>o.jsx("li",{children:e},e))})}function Xs({items:t}){return o.jsx("dl",{className:"mt-3 space-y-3 text-gray-700 leading-relaxed",children:t.map(e=>o.jsxs("div",{children:[o.jsxs("dt",{className:e.bullets?"font-medium text-gray-900":"inline font-medium text-gray-900",children:[e.label,e.bullets?null:": "]}),o.jsxs("dd",{className:e.bullets?"mt-1":"inline",children:[e.content,e.bullets?o.jsx("ul",{className:"mt-1 list-disc space-y-1 pl-5",children:e.bullets.map(r=>o.jsx("li",{children:r},r))}):null]})]},String(e.label)))})}function kO(){const t=Vo();return o.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-12",children:[o.jsx("button",{className:"md:hidden inline-flex items-center rounded-md border px-3 py-2 text-sm hover:bg-gray-50",onClick:()=>t("/"),children:"← Back"}),o.jsx(vt,{level:1,children:"Terms of Service (Nutzungsbedingungen)"}),o.jsx(ze,{className:"mt-2 text-sm text-gray-500",children:"Version 1.1 – effective 13 July 2026 / Version 1.1 – gültig ab 13. Juli 2026"}),o.jsxs(Dg,{defaultValue:"en",className:"mt-6",children:[o.jsxs(Og,{className:"mb-6",children:[o.jsx(Is,{value:"en",children:"English"}),o.jsx(Is,{value:"de",children:"Deutsch"})]}),o.jsxs(Rf,{value:"en",className:"space-y-8",children:[o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"1. Scope"}),o.jsxs(ze,{children:["These Terms of Service govern the use of the website ",o.jsx("i",{children:"https://3dtrees.earth"}),' (hereinafter referred to as the "Platform") and all associated subdomains, operated by the Chair of Sensor-based Geoinformatics at the University of Freiburg (hereinafter referred to as the "Operator"). Registered users explicitly accept these Terms of Service during registration, and the version accepted is recorded. For purely read-only use of the Platform, these Terms apply upon access.']})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"2. Description of Services"}),o.jsx(ze,{children:"The Platform provides a dynamic, collaboratively built database for georeferenced 3D point clouds (e.g., LAS/LAZ, PLY, E57, PCD) and associated annotations/labels (e.g., GeoJSON, Shapefile, and GeoPackage). Users can upload and download point clouds and data, visualize them, and link them with metadata as well as existing segmentations and annotations."}),o.jsx(ze,{children:"Additionally, tools are available to search, filter, and download both machine-generated and manually created labels for research purposes. The Platform is intended for both research institutions and the general public, aiming to provide a valuable dataset for research on trees and forests."}),o.jsx(ze,{children:"The Platform is continuously developed. If maintenance work causes restrictions, this will be communicated in advance whenever possible."}),o.jsx(ze,{children:'For storage and processing, the Operator uses infrastru
516cture of the University of Freiburg, in particular the bwSFS "Storage for Science" service for storing datasets and the Galaxy Europe service (usegalaxy.eu, de.NBI) for automated processing of point clouds. Both services are operated in Germany. Details of the data processing are set out in the Privacy Policy.'})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"3. Registration and User Account"}),o.jsx(ze,{children:"Access to certain features (e.g., uploading point clouds or labels) requires registration. Users must provide a valid email address and choose a secure password. Login credentials must be kept confidential and not shared with third parties."}),o.jsx(ze,{children:"The Operator reserves the right to suspend or delete user accounts at any time, particularly in cases of violations of these Terms of Service or misuse of the Platform. Deleting a user account does not automatically delete datasets already made public: these remain on the Platform under the license selected for them (see Section 4). Personal data held with the user account is deleted in accordance with the Privacy Policy and the data subject rights under the GDPR (in particular Art. 17). Any further use of deleted content is governed by the license selected for the respective dataset."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"4. User Content"}),o.jsx(ze,{children:'Users can upload point clouds, labels/annotations, or other content (hereinafter referred to as "User Content"). By doing so, they affirm that they have all necessary rights to this content and that no third-party rights are infringed by their publication. In particular, personal data of third parties (e.g., identifiable individuals in images) must be avoided.'}),o.jsxs(ze,{children:[o.jsx("strong",{children:"Data Protection Responsibility:"})," Users are responsible for ensuring that uploading their content complies with all applicable data protection regulations and must not upload unauthorized personal data. For the processing of personal data in the course of operating the Platform, the Operator remains the controller within the meaning of the GDPR; details are set out in the Privacy Policy. The Operator is indemnified against claims arising from a user's culpably unlawful upload in accordance with Section 6."]}),o.jsx(ze,{children:"Uploaded point clouds and associated content are made available under the Creative Commons License CC BY 4.0 by default, unless the user selects a different available license at upload time or subsequently in the dataset metadata. Available options are CC BY 4.0, CC BY-SA 4.0, CC BY-NC 4.0, and CC0 1.0. Users retain ownership of their data and grant the public the rights under the license selected for the respective dataset; the terms of that license take precedence over these Terms of Service."}),o.jsx(ze,{children:"Regardless of the selected license, the user grants the Operator a non-exclusive, worldwide, royalty-free right to store, back up, and technically process the content (in particular format and coordinate conversion and the generation of preview and visualization data) to the extent necessary to operate the Platform. The extent to which the Operator makes the content available to other users or the public beyond this is determined solely by the visibility the user selects for the respective dataset:"}),o.jsx(Po,{items:['"Public": the dataset is made available to all users for inspection and download.','"View only": the dataset is made available to all users for inspection; downloads remain reserved to the owner.','"Private": the dataset is displayed and made available to the owner only. The Operator processes the content solely to host it technically for the owner (storage, backup, processing); it is not shown to other users and is not disclosed to third parties.']}),o.jsx(ze,{children:"No disclosure to third parties takes place beyond the selected visibility and the license chosen for the dataset."}),o.jsx(ze,{children:"Deletion removes a dataset from the Platform and ends further distribution by the Operator. Copies already shared with third parties under an open license cannot be recalled; the license rights granted to those third parties persist. Where content contains personal data, the data subject rights under the GDPR, in particular the right to erasure (Art. 17 GDPR), remain unaffected. Uploading personal data under an open license is not recommended, as its complete removal after distribution cannot be guaranteed."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"5. User Conduct and Obligations"}),o.jsx(ze,{children:"Users agree to use the Platform in compliance with applicable laws and these Terms of Service. In particular, it is prohibited to:"}),o.jsx(Po,{items:["Upload content that infringes copyrights, personal rights, or other third-party rights.","Provide false or misleading information.","Distribute malware, spam, or illegal content.","Manipulate, reverse-engineer, or attempt unauthorized access to backend systems of the Platform.","Distribute offensive, discriminatory, or extremist content.","Harass, threaten, intimidate, or otherwise treat other users disrespectfully or inappropriately."]}),o.jsx(ze,{children:"In addition, users should interact respectfully and courteously and resolve disputes objectively and constructively. The Operator reserves the right to suspend or remove content or user accounts in case of violations of these rules."}),o.jsxs(ze,{children:[o.jsx("strong",{children:"Acceptable Use and Commercial Use:"})," The Platform provides hosting, data-provision, and processing services for research purposes. Experimentation and testing of the Platform to a reasonable extent are expressly permitted. The following are not permitted: (a) commercial use of the processing services or of the results they produce without the Operator's express prior approval, and (b) mass scraping or systematic redistribution of the provided data in a manner that c
516ompetes with the Platform's data provision. For commercial use, please contact the Operator in advance to arrange a suitable agreement. The Operator reserves the right to reasonably limit usage (e.g., by capping the volume of processing) or to suspend user accounts where the Platform is commercially operationalized contrary to these terms."]})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"6. Indemnification and Responsibility"}),o.jsx(ze,{children:"Users are solely responsible for the content they upload and bear legal responsibility for any violations of copyright, data protection laws, or other legal provisions."}),o.jsx(ze,{children:"Users indemnify the Operator against claims from third parties arising from content they uploaded or published in a culpably unlawful manner. This includes claims for violations of copyright, personal rights, trademark, or other protective rights, together with the reasonable costs of the necessary legal defense. The Operator will promptly inform the user of such claims and give them the opportunity to comment and defend. The indemnification obligation does not apply to the extent the user is not responsible for the infringement."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"7. Disclaimer of Liability"}),o.jsx(ze,{children:"The Platform is provided with due care but without warranty of constant availability, freedom from errors, or the accuracy of user-generated content. The Operator is liable without limitation for damages arising from injury to life, body, or health and for intent and gross negligence. In the event of a slightly negligent breach of essential contractual duties (cardinal obligations), liability is limited to the foreseeable damage typical for this type of contract; otherwise liability for slight negligence is excluded. Liability under the Product Liability Act (Produkthaftungsgesetz) and for guarantees assumed remains unaffected. As use of the Platform is free of charge, the statutory liability privileges for gratuitous services apply in addition."}),o.jsx(ze,{children:"The Operator assumes no responsibility for the accuracy or quality of data uploaded by third parties. Likewise, no liability is assumed for third-party content linked from the Platform."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"8. Intellectual Property and Licenses"}),o.jsx(ze,{children:"The content provided on the Platform (point clouds, labels/annotations, metadata, documentation) is subject to the license selected for the respective dataset (CC BY 4.0 by default, see Section 4). Users must comply with the terms of the applicable license."}),o.jsx(ze,{children:"Derived works based on the provided data (e.g., models, analyses, or visualizations) are governed by the terms of the license under which the underlying dataset was provided. An obligation to place derived works under the same license exists only where the applicable license so requires (e.g., CC BY-SA 4.0)."}),o.jsxs(ze,{children:[o.jsx("strong",{children:"Use for Research and Training Purposes:"}),` Publicly provided datasets may be used within the scope of the selected license, including for text and data mining and for training machine-learning and AI models, where the license permits. For datasets under non-commercial licenses (CC BY-NC 4.0), such use is limited to non-commercial purposes. Datasets marked "private" are not used for training by third parties; use by the Operator for its own non-commercial research purposes occurs only with the user's separate consent. Where datasets contain personal data, processing for these purposes is governed exclusively by the Privacy Policy.`]})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"9. Data Protection"}),o.jsxs(ze,{children:["Information on the processing of personal data can be found in our"," ",o.jsx("a",{href:"/legal/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"10. Amendments to the Terms of Service"}),o.jsx(ze,{children:"The Operator may modify these Terms of Service with effect for the future where there is a valid reason (e.g., changes in law, supreme-court case law, or a change in the scope of services). Registered users will be notified of changes at least six weeks before they take effect in text form (e.g., by email); the current version is available on the Platform at all times. If the user does not object within six weeks of receiving the notification, the changes are deemed accepted; the Operator will specifically point out this consequence in the notification. In the event of an objection, either party may terminate use."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"11. Applicable Law and Jurisdiction"}),o.jsx(ze,{children:"The laws of the Federal Republic of Germany shall apply. The place of jurisdiction for disputes is Freiburg im Breisgau where the user is a merchant, a legal entity under public law, or a special fund under public law, or has no general place of jurisdiction in Germany. With respect to consumers, the statutory places of jurisdiction apply; mandatory consumer-protection provisions of the user's country of residence remain unaffected."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"12. Procedure for Legal Violations (Notice-and-Takedown)"}),o.jsx(ze,{children:"If users or third parties believe that content on the Platform constitutes a legal violation (e.g., copyright infringement, unauthorized personal data, etc.), they may report this to the Operator via email or the contact form. The Operator confirms receipt of such a report without undue delay, reviews the matter promptly, and removes or disables access to the affected content if a legal violation is present. The reporting person and the affected user are informed of the decision taken, stating the essential reasons; the affected user has the opportunity to respond. Further measures against the responsible user, including account suspension, remain reserved. The contact and reporting point is the address stated in the Impressum."})]})]}),o.jsxs(Rf,{value:"de",className:"space-y-8",children:[o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"1. Geltungsbereich"}),o.jsxs(ze,{children:["Diese Nutzungsbedingungen regeln die Nutzung der Website ",o.jsx("i",{children:"https://3dtrees.earth"}),' (nachfolgend „Plattform" genannt) sowie aller zugehörigen Subdomains, betrieben durch die Professur für Sensorgestützte Geoinformatik der Universität Freiburg (nachfolgend „Betreiber" genannt). Registrierte Nutzer stimmen diesen Nutzungsbedingungen bei der Registrierung ausdrücklich zu; die jeweils akzeptierte Fassung wird dokumentiert. Für die rein lesende Nutzung der Plattform gelten diese Nutzungsbedingungen mit dem Zugriff.']})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"2. Leistungsbeschreibung"}),o.jsx(ze,{children:"Die Plattform stellt eine dynamische, gemeinschaftlich aufgebaute Datenbank für georeferenzierte 3D‑Punktwolken (z. B. LAS/LAZ, PLY, E57, PCD) sowie zugehörige Annotationen/Labels (z. B. GeoJSON, Shapefile, GeoPackage) bereit. Nutzer können Punktwolken und Daten hoch- und herunterladen, visualisieren und mit Metadaten sowie ggf. vorhandenen Segmentierungen und Annotationen verknüpfen."}),o.jsx(ze,{children:"Zusätzlich stehen Tools zur Verfügung, um Daten zu durchsuchen, zu filtern und maschinell erstellte oder manuell erzeugte Labels für Forschungszwecke herunterzuladen. Die Plattform richtet sich sowohl an Forschungseinrichtungen als auch an die allgemeine Öffentlichkeit und zielt darauf ab, einen wertvollen Datensatz für die Forschung an Bäumen und Wäldern zu schaffen."}),o.jsx(ze,{children:"Die Plattform wird kontinuierlich weiterentwickelt. Sollten durch Wartungsarbeiten Einschränkungen entstehen, wird dies rechtzeitig kommuniziert."}),o.jsx(ze,{children:'Für Speicherung und Verarbeitung nutzt der Betreiber Infrastruktur der Universität Freiburg, insbesondere den Dienst bwSFS „Storage for Science" zur Ablage der Datensätze sowie den Dienst Galaxy Europe (usegalaxy.eu, de.NBI) zur automatisierten Verarbeitung der Punktwolken. Beide Dienste werden in Deutschland betrieben. Einzelheiten zur Datenverarbeitung regelt die Datenschutzerklärung.'})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"3. Registrierung und Nutzerkonto"}),o.jsx(ze,{children:"Für den Zugang zu bestimmten Funktionen (z. B. das Hochladen von Punktwolken oder Labels) ist eine Registrierung erforderlich. Nutzer müssen eine gültige E-Mail-Adresse angeben und ein sicheres Passwort wählen. Die Zugangsdaten sind vertraulich zu behandeln und dürfen nicht an Dritte weitergegeben werden."}),o.jsx(ze,{children:"Der Betreiber behält sich das Recht vor, Nutzerkonten jederzeit zu sperren oder zu löschen, insbesondere bei Verstößen gegen diese Nutzungsbedingungen oder bei Missbrauch der Plattform. Die Löschung des Nutzerkontos führt nicht automatisch zur Löschung bereits öffentlich bereitgestellter Datensätze: Diese verbleiben unter der jeweils gewählten Lizenz auf der Plattform (siehe § 4). Bei dem Nutzerkonto gespeicherte personenbezogene Daten werden nach Maßgabe der Datenschutzerklärung und der Betroffenenrechte aus der DSGVO (insbesondere Art. 17) gelöscht. Eine darüber hinausgehende Nutzung gelöschter Inhalte richtet sich nach der für den jeweiligen Datensatz gewählten Lizenz."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"4. Nutzerinhalte"}),o.jsx(ze,{children:'Nutzer können Punktwolken, Labels/Annotationen oder andere Inhalte (nachfolgend „Nutzerinhalte") hochladen. Dabei erklären sie, dass sie über alle erforderlichen Rechte an diesen Inhalten verfügen und dass durch die Veröffentlichung keine Rechte Dritter verletzt werden. Insbesondere sind personenbezogene Daten Dritter (z. B. identifizierbare Personen in Bildmaterial) zu vermeiden.'}),o.jsxs(ze,{children:[o.jsx("strong",{children:"Datenschutzrechtliche Verantwortung:"})," Nutzer sind dafür verantwortlich, dass das Hochladen ihrer Inhalte den geltenden datenschutzrechtlichen Bestimmungen entspricht, und dürfen keine unzulässigen personenbezogenen Daten hochladen. Für die Verarbeitung personenbezogener Daten im Rahmen des Betriebs der Plattform bleibt der Betreiber Verantwortlicher im Sinne der DSGVO; Einzelheiten regelt die Datenschutzerklärung. Von Ansprüchen, die auf einem schuldhaft rechtswidrigen Upload des Nutzers beruhen, wird der Betreiber nach Maßgabe von § 6 freigestellt."]}),o.jsx(ze,{children:"Hochgeladene Punktwolken und zugehörige Inhalte werden standardmäßig unter der Creative-Commons-Lizenz CC BY 4.0 bereitgestellt, sofern der Nutzer beim Upload oder nachträglich in de
516n Metadaten des Datensatzes keine andere der angebotenen Lizenzen auswählt. Zur Auswahl stehen CC BY 4.0, CC BY-SA 4.0, CC BY-NC 4.0 und CC0 1.0. Nutzer behalten das Eigentum an ihren Daten und räumen der Allgemeinheit die Rechte nach der jeweils gewählten Lizenz ein; deren Bedingungen gehen diesen Nutzungsbedingungen vor."}),o.jsx(ze,{children:"Unabhängig von der gewählten Lizenz räumt der Nutzer dem Betreiber ein einfaches, weltweites, vergütungsfreies Recht ein, die Inhalte zu speichern, zu sichern und technisch aufzubereiten (insbesondere Format- und Koordinatenkonvertierung sowie die Erzeugung von Vorschau- und Visualisierungsdaten), soweit dies für den Betrieb der Plattform erforderlich ist. In welchem Umfang der Betreiber die Inhalte darüber hinaus anderen Nutzern oder der Öffentlichkeit zugänglich macht, richtet sich ausschließlich nach der vom Nutzer für den jeweiligen Datensatz gewählten Sichtbarkeit:"}),o.jsx(Po,{items:['„Öffentlich": Der Datensatz wird allen Nutzern zur Ansicht und zum Download bereitgestellt.','„Nur Ansicht": Der Datensatz wird allen Nutzern zur Ansicht bereitgestellt; der Download bleibt dem Eigentümer vorbehalten.','„Privat": Der Datensatz wird ausschließlich dem Eigentümer angezeigt und bereitgestellt. Der Betreiber verarbeitet die Inhalte allein, um sie für den Eigentümer technisch vorzuhalten (Speicherung, Sicherung, Aufbereitung); eine Anzeige gegenüber anderen Nutzern oder eine Weitergabe an Dritte erfolgt nicht.']}),o.jsx(ze,{children:"Eine Weitergabe an Dritte, die über die gewählte Sichtbarkeit und die für den Datensatz gewählte Lizenz hinausgeht, erfolgt nicht."}),o.jsx(ze,{children:"Eine Löschung entfernt einen Datensatz von der Plattform und beendet die weitere Verbreitung durch den Betreiber. Bereits unter einer offenen Lizenz an Dritte weitergegebene Kopien können nicht zurückgerufen werden; die den Dritten eingeräumten Lizenzrechte bestehen fort. Enthalten Inhalte personenbezogene Daten, bleiben die Betroffenenrechte nach der DSGVO, insbesondere das Recht auf Löschung (Art. 17 DSGVO), unberührt. Das Hochladen personenbezogener Daten unter einer offenen Lizenz wird nicht empfohlen, da deren vollständige Entfernung nach einer Verbreitung nicht gewährleistet werden kann."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"5. Verhaltensregeln und Pflichten der Nutzer"}),o.jsx(ze,{children:"Nutzer verpflichten sich, die Plattform im Einklang mit geltendem Recht sowie den vorliegenden Nutzungsbedingungen zu verwenden. Insbesondere ist es untersagt:"}),o.jsx(Po,{items:["Inhalte hochzuladen, die gegen Urheberrechte, Persönlichkeitsrechte oder sonstige Rechte Dritter verstoßen.","Unwahre oder irreführende Informationen bereitzustellen.","Malware, Spam oder rechtswidrige Inhalte zu verbreiten.","Die Plattform oder deren Daten zu manipulieren, reverse-engineeren oder unautorisierten Zugriff auf die Backendsysteme zu versuchen.","Beleidigende, diskriminierende oder extremistische Inhalte zu verbreiten.","Andere Nutzer zu belästigen, zu bedrohen, einzuschüchtern oder in anderer Weise respektlos oder unangemessen zu behandeln."]}),o.jsx(ze,{children:"Darüber hinaus sollen Nutzer höflich und respektvoll miteinander umgehen und Streitigkeiten sachlich und konstruktiv klären. Der Betreiber behält sich vor, Inhalte oder Nutzerkonten zu sperren oder zu entfernen, wenn gegen diese Regeln verstoßen wird."}),o.jsxs(ze,{children:[o.jsx("strong",{children:"Zulässige Nutzung und kommerzielle Nutzung:"})," Die Plattform stellt Hosting-, Datenbereitstellungs- und Verarbeitungsdienste für Forschungszwecke bereit. Das Experimentieren und Testen der Plattform in angemessenem Umfang ist au
516sdrücklich gestattet. Nicht gestattet sind hingegen (a) die kommerzielle Nutzung der Verarbeitungsdienste oder der daraus erzeugten Ergebnisse ohne ausdrückliche vorherige Zustimmung des Betreibers sowie (b) das massenhafte Auslesen (Scraping) oder die systematische Weiterverbreitung der bereitgestellten Daten in einer Weise, die mit der Datenbereitstellung der Plattform in Wettbewerb tritt. Für eine kommerzielle Nutzung wenden Sie sich bitte vorab an den Betreiber, um eine geeignete Vereinbarung zu treffen. Der Betreiber behält sich vor, die Nutzung angemessen zu begrenzen (z. B. durch Begrenzung der Verarbeitungsmenge) oder Nutzerkonten zu sperren, wenn die Plattform entgegen diesen Bedingungen kommerziell operationalisiert wird."]})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"6. Haftungsfreistellung und Verantwortlichkeit (Indemnifizierung)"}),o.jsx(ze,{children:"Nutzer sind allein für die von ihnen hochgeladenen Inhalte verantwortlich und tragen die rechtliche Verantwortung für etwaige Verstöße gegen Urheberrechte, Datenschutzbestimmungen oder sonstige gesetzliche Vorschriften."}),o.jsx(ze,{children:"Nutzer stellen den Betreiber von Ansprüchen Dritter frei, die aus von ihnen schuldhaft rechtswidrig hochgeladenen oder veröffentlichten Inhalten entstehen. Dies umfasst insbesondere Ansprüche wegen der Verletzung von Urheber-, Persönlichkeits-, Marken- oder sonstigen Schutzrechten sowie die hierfür angemessenen Kosten der notwendigen Rechtsverteidigung. Der Betreiber wird den Nutzer über solche Ansprüche unverzüglich informieren und ihm Gelegenheit zur Stellungnahme und Verteidigung geben. Die Freistellungspflicht entfällt, soweit der Nutzer die Rechtsverletzung nicht zu vertreten hat."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"7. Haftungsausschluss"}),o.jsx(ze,{children:"Die Plattform wird mit Sorgfalt bereitgestellt, jedoch ohne Gewähr für ständige Verfügbarkeit, Fehlerfreiheit oder die Richtigkeit nutzergenerierter Inhalte. Der Betreiber haftet unbeschränkt für Schäden aus der Verletzung des Lebens, des Körpers oder der Gesundheit sowie für Vorsatz und grobe Fahrlässigkeit. Bei leicht fahrlässiger Verletzung wesentlicher Vertragspflichten (Kardinalpflichten) ist die Haftung auf den vertragstypischen, vorhersehbaren Schaden begrenzt; im Übrigen ist die Haftung für leichte Fahrlässigkeit ausgeschlossen. Die Haftung nach dem Produkthaftungsgesetz und für übernommene Garantien bleibt unberührt. Da die Nutzung der Plattform unentgeltlich erfolgt, gelten ergänzend die gesetzlichen Haftungserleichterungen für unentgeltliche Leistungen."}),o.jsx(ze,{children:"Der Betreiber übernimmt keine Verantwortung für die Richtigkeit oder Qualität von durch Dritte hochgeladenen Daten. Ebenso wird keine Haftung für Inhalte Dritter, auf die über Links verwiesen wird, übernommen."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"8. Geistiges Eigentum und Lizenzen"}),o.jsx(ze,{children:"Die auf der Plattform bereitgestellten Inhalte (Punktwolken, Labels/Annotationen, Metadaten, Dokumentationen) unterliegen der für den jeweiligen Datensatz gewählten Lizenz (standardmäßig CC BY 4.0, siehe § 4). Nutzer müssen die Bedingungen der jeweiligen Lizenz einhalten."}),o.jsx(ze,{children:"Aus den bereitgestellten Daten abgeleitete Werke (z. B. Modelle, Analysen oder Visualisierungen) richten sich nach den Bedingungen der Lizenz, unter der der zugrunde liegende Datensatz bereitgestellt wurde. Eine Pflicht, abgeleitete Werke unter dieselbe Lizenz zu stellen, besteht nur, soweit die jeweilige Lizenz dies vorsieht (z. B. CC BY-SA 4.0)."}),o.jsxs(ze,{children:[o.jsx("strong",{children:"Nutzung zu Forschungs- und Trainingszwecken:"}),' Öffentlich bereitgestellte Datensätze dürfen im Rahmen der jeweils gewählten Lizenz genutzt werden, einschließlich der Nutzung für Text- und Data-Mining sowie für das Training maschineller Lern- und KI-Modelle, soweit die Lizenz dies zulässt. Für Datensätze unter nicht-kommerziellen Lizenzen (CC BY-NC 4.0) ist eine solche Nutzung auf nicht-kommerzielle Zwecke beschränkt. Als „privat" markierte Datensätze werden nicht für das Training durch Dritte verwendet; eine Nutzung durch den Betreiber zu eigenen, nicht-kommerziellen Forschungszwecken erfolgt nur mit gesonderter Zustimmung des Nutzers. Enthalten Datensätze personenbezogene Daten, richtet sich deren Verarbeitung zu diesen Zwecken ausschließlich nach der Datenschutzerklärung.']})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"9. Datenschutz"}),o.jsxs(ze,{children:["Informationen zur Verarbeitung personenbezogener Daten finden Sie in unserer"," ",o.jsx("a",{href:"/legal/privacy",target:"_blank",rel:"noopener noreferrer",children:"Datenschutzerklärung"}),"."]})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"10. Änderungen der Nutzungsbedingungen"}),o.jsx(ze,{children:"Der Betreiber kann diese Nutzungsbedingungen mit Wirkung für die Zukunft ändern, wenn ein triftiger Grund vorliegt (z. B. Gesetzesänderungen, höchstrichterliche Rechtsprechung oder eine Änderung des Leistungsumfangs). Registrierte Nutzer werden über Änderungen mindestens sechs Wochen vor deren Inkrafttreten in Textform (z. B. per E-Mail) informiert; die jeweils aktuelle Version ist auf der Plattform abrufbar. Widerspricht der Nutzer nicht innerhalb von sechs Wochen n
516ach Zugang der Mitteilung, gelten die Änderungen als angenommen; auf diese Folge wird der Betreiber in der Mitteilung gesondert hinweisen. Im Falle eines Widerspruchs kann jede Partei die Nutzung beenden."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"11. Anwendbares Recht und Gerichtsstand"}),o.jsx(ze,{children:"Es gilt das Recht der Bundesrepublik Deutschland. Gerichtsstand für Streitigkeiten ist Freiburg im Breisgau, wenn der Nutzer Kaufmann, juristische Person des öffentlichen Rechts oder öffentlich-rechtliches Sondervermögen ist oder keinen allgemeinen Gerichtsstand im Inland hat. Gegenüber Verbrauchern gelten die gesetzlichen Gerichtsstände; zwingende verbraucherschützende Vorschriften des Aufenthaltsstaats des Nutzers bleiben unberührt."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"12. Verfahren bei Rechtsverletzungen (Notice-and-Takedown)"}),o.jsx(ze,{children:"Sollten Nutzer oder Dritte der Ansicht sein, dass Inhalte auf der Plattform Rechtsverletzungen darstellen (z. B. Urheberrechtsverletzungen, unzulässige personenbezogene Daten o. Ä.), können sie dies dem Betreiber per E-Mail oder über das Kontaktformular mitteilen. Der Betreiber bestätigt den Eingang einer solchen Meldung unverzüglich, prüft die Angelegenheit zeitnah und entfernt oder sperrt bei Vorliegen einer Rechtsverletzung die betroffenen In
516halte. Über die getroffene Entscheidung werden die meldende Person und der betroffene Nutzer unter Angabe der wesentlichen Gründe informiert; dem betroffenen Nutzer steht die Möglichkeit zur Stellungnahme offen. Weitergehende Maßnahmen gegen den verantwortlichen Nutzer, einschließlich der Sperrung des Nutzerkontos, bleiben vorbehalten. Als Kontakt- und Meldestelle dient die im Impressum angegebene Adresse."})]})]})]})]})}function IS(){const t=Vo();return o.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-12",children:[o.jsx("button",{className:"md:hidden inline-flex items-center rounded-md border px-3 py-2 text-sm hover:bg-gray-50",onClick:()=>t("/"),children:"← Back"}),o.jsx(vt,{level:1,children:"Privacy Policy (Datenschutzerklärung)"}),o.jsx(ze,{className:"mt-2 text-sm text-gray-500",children:"Version 1.0 – effective 13 July 2026 / Version 1.0 – gültig ab 13. Juli 2026"}),o.jsxs(Dg,{defaultValue:"en",className:"mt-6",children:[o.jsxs(Og,{className:"mb-6",children:[o.jsx(Is,{value:"en",children:"English"}),o.jsx(Is,{value:"de",children:"Deutsch"})]}),o.jsxs(Rf,{value:"en",className:"space-y-8",children:[o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"Controller"}),o.jsxs(ze,{children:["Universität Freiburg",o.jsx("br",{}),"Professur für Sensorgestützte Geoinformatik",o.jsx("br",{}),"Tennenbacher Str. 4",o.jsx("br",{}),"79106 Freiburg",o.jsx("br",{}),"Germany",o.jsx("br",{}),"Email: [email protected]",o.jsx("br",{}),"Phone: +49 (0)761 203 – 3694"]}),o.jsxs(ze,{children:["Data Protection Officer:",o.jsx("br",{}),"Albert-Ludwigs-Universität Freiburg",o.jsx("br",{}),"Der Datenschutzbeauftragte",o.jsx("br",{}),"Fahnenbergplatz",o.jsx("br",{}),"79085 Freiburg",o.jsx("br",{}),"Email: [email protected]"]})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"General Information on Data Processing"}),o.jsx(ze,{children:"We process personal data in accordance with the provisions of the General Data Protection Regulation (GDPR) and the German Federal Data Protection Act (BDSG). The GDPR is a European regulation that standardizes data protection across the European Union. The BDSG supplements the GDPR at the national level. The specific legal bases are stated in the respective sections of this policy. We process as little data as possible. Data is stored only as long as necessary for the respective purpose or as required by statutory retention periods."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"Provision of the Website and Server Log Files"}),o.jsx(ze,{children:"Our website is hosted on servers of Hetzner Online GmbH in Germany. When visiting our website, the following data is automatically collected:"}),o.jsx(Po,{items:["IP address (anonymized if possible by truncation)","Date/time of access","Accessed page","Browser type","Operating system","Referrer URL"]}),o.jsx(ze,{children:"This data processing is based on Art. 6(1)(f) GDPR (legitimate interest in the technical provision, security of IT systems, and ensuring the smooth operation of the website, particularly to detect and prevent attacks and improve system stability). The data is usually deleted after 7-14 days."}),o.jsx(ze,{children:"We reserve the right to retain certain log and analysis data beyond this period in an aggregated form to improve our platform in the long term and perform statistical evaluations. These aggregated data do not contain any directly identifiable personal characteristics and are used solely to optimize our services and ensure operational stability."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"Cookies"}),o.jsx(ze,{children:"We use cookies when you create a user account and log in. These cookies help maintain your session and facilitate future logins. The cookies remain valid for 30 days. The legal basis is Art. 6(1)(f) GDPR (legitimate interest in a user-friendly design). You will be informed that this website uses cookies. You can delete or block cookies in your browser, but this may result in functional limitations."}),o.jsx(ze,{children:"When we update our cookie policies or make changes to tracking technologies, you will be prompted to renew your cookie preferences. During the peri
516od between the update and your renewed consent, only data necessary for website functionality will be processed. The versioning of cookie settings ensures that your consent always corresponds to current practices."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"User Content and Uploaded Data"}),o.jsx(ze,{children:"Users can upload point clouds, images, or geodata for research on trees and forests. Please avoid uploading personal data. If such data is included, it will be processed based on your consent (Art. 6(1)(a) GDPR). By uploading data, you agree that they may be used by others in accordance with the license and visibility you select for the dataset. Unauthorized content may be deleted. Users may request the deletion of their content at any time by sending an email to the responsible contact mentioned above. Metadata is required for processing."}),o.jsx(ze,{children:"If uploaded images or geodata contain identifiable individuals or location information that allows conclusions about private property, it is the uploader's responsibility to obtain appropriate consent in advance or anonymize the data. Affected individuals can request blurring or complete deletion of these data. Please direct such requests to the responsible contact or data protection officer."}),o.jsxs(ze,{children:[o.jsx("strong",{children:"Use for Research and Training Purposes:"}),' Datasets made publicly available under an open license may be used by the Operator and by third parties, within the scope of the selected license, for research purposes and for training machine-learning and AI models (e.g., automated tree-species detection). Where personal data is processed in this context, such processing by the Operator is based on Art. 6(1)(f) GDPR (legitimate interest in non-commercial research) or, where you have given consent, on Art. 6(1)(a) GDPR. Datasets with "private" visibility are not used for training by third parties; use by the Operator for its own non-commercial research purposes occurs only with your separate consent, which you may withdraw at any time with effect for the future (Art. 7(3) GDPR).']})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"Recipients of Data"}),o.jsx(ze,{children:"Personal data is only shared with third parties if legally required, necessary for contract fulfillment, or if you have given consent. This concerns the following services:"}),o.jsx(Po,{items:["Hetzner Online GmbH (Hosting Provider)",'bwSFS "Storage for Science", University of Freiburg (dataset storage)',"Galaxy Europe / de.NBI, University of Freiburg (usegalaxy.eu, dataset processing)","Google Ireland Ltd. (Firebase)","Supabase Inc. (Supabase Auth)","PostHog Inc. (PostHog Analytics)","Microsoft Corporation (Bing Maps)"]}),o.jsx(ze,{children:"Third-party services are used in compliance with data protection regulations. Data processing outside the EU may occur. Below is a detailed overview of these services."}),o.jsx(vt,{level:4,children:"Hetzner Online GmbH"}),o.jsx(Xs,{items:[{label:"Purpose",content:"Server hosting for the platform application backend (API) and the metadata database, and temporary processing of dataset files while packaging download archives."},{label:"Data",bullets:["User account data and dataset metadata (titles, locations, contributors, attributes)","Processing job status and history","Dataset files temporarily processed while packaging download archives (ZIP)","Server access logs (IP addresses, timestamps, browser types)"]},{label:"Location",content:"Servers in Germany."},{label:"Handling",content:"IP addresses in server logs are truncated for anonymization and used exclusively for technical troubleshooting and security monitoring."},{label:"Legal basis",content:"Art. 6(1)(f) GDPR (secure hosting infrastructure)."},{label:"Retention",content:"Server logs are retained for 7-14 days."}]}),o.jsx(vt,{level:4,children:'bwSFS "Storage for Science" (University of Freiburg)'}),o.jsx(Xs,{items:[{label:"Purpose",content:"Object storage for uploaded point clouds and processed outputs (raw datasets, 3D tiles, download packages, and backups)."},{label:"Data",bullets:["Uploaded point-cloud files and their processed derivatives","Associated file metadata","Personal data only if included in user-uploaded content"]},{label:"Location",content:"University of Freiburg Computing Center, geo-redundant across two data centers in Baden-Württemberg, Germany."},{label:"Handling",content:"Operated by the University of Freiburg, the same institution as the Operator. Access is restricted to authorized platform and storage administrators."},{label:"Legal basis",content:"Art. 6(1)(b) GDPR (provision of the platform) and Art. 6(1)(f) GDPR (secure storage infrastru
516cture)."},{label:"Retention",content:"Stored until the dataset is deleted by the owner or the account is removed."}]}),o.jsx(vt,{level:4,children:"Galaxy Europe / de.NBI (University of Freiburg)"}),o.jsx(Xs,{items:[{label:"Purpose",content:"Automated processing of uploaded point clouds (validation and standardization, preview generation, AI-based tree segmentation, and 3D-tile conversion)."},{label:"Data",bullets:["Uploaded point-cloud files, transferred for the duration of processing","Personal data only if included in user-uploaded content"]},{label:"Location",content:"ISO 27001-certified data center operated by University of Freiburg IT Services, Germany."},{label:"Handling",content:"Data transfer is encrypted. The service does not use or share uploaded data for purposes unrelated to processing. Processing artifacts and histories are discarded after processing and are not retained."},{label:"Legal basis",content:"Art. 6(1)(b) GDPR (provision of the platform) and Art. 6(1)(f) GDPR (data processing for platform features)."},{label:"Retention",content:"Not retained beyond the processing run; outputs are stored on bwSFS."}]}),o.jsx(vt,{level:4,children:"Google Ireland Ltd."}),o.jsx(Xs,{items:[{label:"Purpose",content:"Infrastructure and hosting for application backend."},{label:"Data",bullets:["Technical usage data (e.g., server logs)","IP addresses","Device and browser information"]},{label:"Location",content:"Primarily EU servers, with possible transfers outside the EU."},{label:"Handling",content:"IP addresses are processed for security purposes and anonymized where possible."},{label:"Legal basis",content:"Art. 6(1)(f) GDPR (legitimate interest in secure and stable app provision)."},{label:"Retention",content:"Per Firebase's standard policies."}]}),o.jsx(vt,{level:4,children:"Supabase Inc."}),o.jsx(Xs,{items:[{label:"Purpose",content:"Provides database services, user authentication, and file metadata management."},{label:"Data",bullets:["Email addresses (for authentication)","Metadata on datasets and their processing status","Logs of user interactions (e.g., uploads, file management actions)"]},{label:"Location",content:"EU-based servers."},{label:"Handling",content:"Authentication data is stored securely; metadata includes user IDs and JSONB data storage."},{label:"Legal basis",content:"Art. 6(1)(b) GDPR (performance of contractual obligations)."},{label:"Retention",content:"Stored for the duration of account existence or until user-initiated deletion."}]}),o.jsx(vt,{level:4,children:"PostHog Inc."}),o.jsx(Xs,{items:[{label:"Purpose",content:"Analytics platform for tracking user behavior and improving user experience."},{label:"Data",bullets:["Usage data (click paths, page views, feature usage)","Device and browser information","Anonymized IP addresses (truncated before processing)"]},{label:"Location",content:"Servers located within the EU."},{label:"Handling",content:"All data is pseudonymized; no personal user identifiers are stored beyond anonymized IP addresses."},{label:"Legal basis",content:"Art. 6(1)(f) GDPR (legitimate interest in optimizing the app)."},{label:"Retention",content:"Data retained for 30 days."}]}),o.jsx(vt,{level:4,children:"Microsoft Corporation"}),o.jsx(Xs,{items:[{label:"Purpose",content:"Provides map visualization services within the application."},{label:"Data",bullets:["IP addresses","Geographical location data (when interacting with maps)","Usage patterns of map features"]},{label:"Location",content:"Possible processing on servers in the USA."},{label:"Handling",content:"Data is used only for rendering maps and is processed in accordance with Microsoft's privacy standards."},{label:"Legal basis",content:"Art. 6(1)(f) GDPR (enhancing functionality through map integration)."}]})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"International Data Transfers"}),o.jsx(ze,{children:"Some of the recipients listed above are based in a third country (in particular the USA) or may transfer personal data there. A transfer to third countries only takes place where an adequate level of data protection is ensured. Where the European Commission has issued an adequacy decision for the relevant third country and the respective recipient is certified accordingly – for the USA in particular the EU-US Data Privacy Framework (DPF) – the transfer is based on this (Art. 45 GDPR). Otherwise, we base the transfer on the Standard Contractual Clauses adopted by the European Commission (Art. 46(2)(c) GDPR) together with supplementary safeguards where necessary. In all other respects, transfers to third countries are governed by Art. 44 et seq. GDPR. You may request a copy of the relevant safeguards from the controller using the contact details provided above."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"Contact"}),o.jsx(ze,{children:"If you contact us via email, your email address and any other data you provide will be processed to handle your request. The legal basis is Art. 6(1)(b) GDPR (contract fulfillment) if the contact is necessary for the provision of a service or contract, otherwise Art. 6(1)(f) GDPR (legitimate interest). Once the request has been fully processed, the data will be deleted unless statutory retention periods apply, typically after 3–6 months."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"Your Rights"}),o.jsx(ze,{children:"You have the following rights:"}),o.jsx(Po,{items:["Access (Art. 15 GDPR)","Rectification (Art. 16 GDPR)","Erasure (Art. 17 GDPR)","Re
516striction of processing (Art. 18 GDPR)","Data portability (Art. 20 GDPR)","Objection to processing (Art. 21 GDPR)","Withdrawal of consent (Art. 7(3) GDPR)"]}),o.jsx(ze,{children:"You can exercise your rights by contacting the responsible controller or the data protection officer via the contact details provided above. You also have the right to lodge a complaint with a supervisory authority if you believe that the processing of your data violates applicable law. The responsible supervisory authority is the State Commissioner for Data Protection and Freedom of Information Baden-Württemberg, Lautenschlagerstraße 20, 70173 Stuttgart, Germany (Email: [email protected])."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"Changes to This Privacy Policy"}),o.jsx(ze,{children:"We reserve the right to modify this privacy policy as necessary. The current version is always available on this website. Changes will be published on this page and, if applicable, communicated to you via email."})]})]}),o.jsxs(Rf,{value:"de",className:"space-y-8",children:[o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"Verantwortlicher"}),o.jsxs(ze,{children:["Universität Freiburg",o.jsx("br",{}),"Professur für Sensorgestützte Geoinformatik",o.jsx("br",{}),"Tennenbacher Str. 4",o.jsx("br",{}),"79106 Freiburg",o.jsx("br",{}),"Deutschland",o.jsx("br",{}),"E-Mail: [email protected]",o.jsx("br",{}),"Telefon: +49 (0)761 203 – 3694"]}),o.jsxs(ze,{children:["Datenschutzbeauftragter:",o.jsx("br",{}),"Albert-Ludwigs-Universität Freiburg",o.jsx("br",{}),"Der Datenschutzbeauftragte",o.jsx("br",{}),"Fahnenbergplatz",o.jsx("br",{}),"79085 Freiburg",o.jsx("br",{}),"E-Mail: [email protected]"]})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"Allgemeine Hinweise zur Datenverarbeitung"}),o.jsx(ze,{children:"Wir verarbeiten personenbezogene Daten im Einklang mit den Bestimmungen der Datenschutzgrundverordnung (DSGVO) und dem Bundesdatenschutzgesetz (BDSG). Die DSGVO ist eine europäische Verordnung, welche den Datenschutz in der europäischen Union einheitlich regelt. Das BDSG ergänzt die DSGVO auf nationaler Ebene. Die konkreten Rechtsgrundlagen werden in den jeweiligen Abschnitten dieser Erklärung genannt. Wir verarbeiten dabei so wenige Daten wie möglich. Daten werden nur so lange gespeichert, wie sie für den jeweiligen Zweck erforderlich sind oder gesetzliche Aufbewahrungsfristen bestehen."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"Bereitstellung der Website und Server-Logfiles"}),o.jsx(ze,{children:"Unsere Website wird auf Servern der Hetzner Online GmbH in Deutschland gehostet. Beim Aufruf unserer Website werden automatisch folgende Daten erhoben:"}),o.jsx(Po,{items:["IP-Adresse (sofern möglich durch Kürzung anonymisiert)","Datum/Uhrzeit des Zugriffs","aufgerufene Seite","Browsertyp","Betriebssystem","Referrer-URL"]}),o.jsx(ze,{children:"Diese Datenverarbeitung erfolgt auf Grundlage von Art. 6 Abs. 1 lit. f DSGVO (berechtigtes Interesse an der technischen Bereitstellung, der Sicherheit der IT-Systeme sowie der Sicherstellung eines störungsfreien Betriebs der Website, insbesondere zur Erkennung und Abwehr von Angriffen und zur Verbesserung der Systemstabilität). Die Daten werden in der Regel nach 7-14 Tagen gelöscht."}),o.jsx(ze,{children:"Wir behalten uns vor, bestimmte Log- und Analyse-Daten über den zuvor genannten Zeitraum hinaus in aggregierter Form aufzubewahren, um unsere Plattform langfristig zu verbessern und statistische Auswertungen vorzunehmen. Diese aggregierten Daten enthalten keine direkten personenbezogenen Merkmale, sondern dienen ausschließlich der Optimierung unserer Angebote und der Sicherstellung des Betriebs."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"Cookies"}),o.jsx(ze,{children:"Wir setzen Cookies ein, sobald Sie ein Nutzerkonto erstellen und sich anmelden. Diese Cookies dienen dazu, Ihre Sitzung aufrechtzuerhalten und den erneuten Login zu erleichtern. Die Cookies sind dabei 30 Tage gültig. Rechtsgrundlage ist Art. 6 Abs. 1 lit. f DSGVO (berechtigtes Interesse an einer nutzerfreundlichen Gestaltung). Sie werden darauf hingewiesen, dass die Nutzung dieser Webseite Cookies setzt. Sie können Cookies im Browser löschen oder blockieren; dies kann jedoch zu Funktionseinschränkungen führen."}
516),o.jsx(ze,{children:"Bei Aktualisierungen unserer Cookie-Richtlinien oder Änderungen an den Tracking-Technologien werden Sie aufgefordert, Ihre Cookie-Einstellungen zu erneuern. In der Zeit zwischen der Aktualisierung und Ihrer erneuten Einwilligung werden nur für die Funktionalität der Website notwendige Daten verarbeitet. Die Versionierung der Cookie-Einstellungen stellt sicher, dass Ihre Einwilligung stets den aktuellen Praktiken entspricht."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"Nutzerinhalte und hochgeladene Daten"}),o.jsx(ze,{children:"Nutzer können Punktwolken, Bilder oder Geodaten zur Erforschung von Bäumen und Wäldern hochladen. Bitte vermeiden Sie das Hochladen personenbezogener Daten. Falls solche Daten dennoch enthalten sind, werden sie auf Basis Ihrer Einwilligung (Art. 6 Abs. 1 lit. a DSGVO) verarbeitet. Mit dem Hochladen der Daten stimmen Sie zu, dass diese entsprechend der von Ihnen für den Datensatz gewählten Lizenz und Sichtbarkeit genutzt werden dürfen. Unzulässige Inhalte können gelöscht werden. Nutzer können die Löschung ihrer Inhalte jederzeit beantragen, indem sie eine E-Mail an den oben genannten Verantwortlichen senden. Die Metadaten werden für die Verarbeitung benötigt."}),o.jsx(ze,{children:"Sollten auf hochgeladenen Bildern oder Geodaten identifizierbare Personen sichtbar sein oder Ortsangaben Rückschlüsse auf Privatgrundstücke ermöglichen, liegt es in der Verantwortung der hochladenden Person, vorab entsprechende Einwilligungen einzuholen oder die Daten zu anonymisieren. Betroffene Personen können einen Antrag auf Unkenntlichmachung (Blurring) oder vollständige Löschung dieser Daten stellen. Bitte richten Sie entsprechende Anfragen an den Verantwortlichen oder Datenschutzbeauftragten."}),o.jsxs(ze,{children:[o.jsx("strong",{children:"Nutzung zu Forschungs- und Trainingszwecken:"}),' Öffentlich unter einer offenen Lizenz bereitgestellte Datensätze können vom Betreiber sowie von Dritten im Rahmen der jeweils gewählten Lizenz für Forschungszwecke und für das Training maschineller Lern- und KI-Modelle (z. B. zur automatisierten Baumarterkennung) genutzt werden. Soweit hierbei personenbezogene Daten verarbeitet werden, stützt sich diese Verarbeitung durch den Betreiber auf Art. 6 Abs. 1 lit. f DSGVO (berechtigtes Interesse an nicht-kommerzieller Forschung) oder, soweit Sie eingewilligt haben, auf Art. 6 Abs. 1 lit. a DSGVO. Datensätze mit der Sichtbarkeit „privat" werden nicht für das Training durch Dritte verwendet; eine Nutzung durch den Betreiber zu eigenen, nicht-kommerziellen Forschungszwecken erfolgt nur mit Ihrer gesonderten Einwilligung, die Sie jederzeit mit Wirkung für die Zukunft widerrufen können (Art. 7 Abs. 3 DSGVO).']})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"Kontaktaufnahme"}),o.jsx(ze,{children:"Bei Kontakt per E-Mail werden Ihre E-Mail-Adresse und weitere von Ihnen zur Verfügung gestellte Daten zur Bearbeitung Ihrer Anfrage verarbeitet. Rechtsgrundlage ist Art. 6 Abs. 1 lit. b DSGVO (Vertragserfüllung), wenn die Kontaktaufnahme für die Erbringung einer Dienstleistung oder eines Vertrags notwendig ist, ansonsten Art. 6 Abs. 1 lit. f DSGVO (berechtigtes Interesse). Nach abschließender Bearbeitung der Anfrage werden die Daten gelöscht, sofern keine gesetzlichen Aufbewahrungspflichten entgegenstehen, im Regelfall nach 3-6 Monaten."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"Empfänger von Daten"}),o.jsx(ze,{children:"Eine Weitergabe personenbezogener Daten an Dritte erfolgt nur, wenn dies gesetzlich vorgeschrieben ist, zur Vertragserfüllung erforderlich ist oder Sie eingewilligt haben. Dies betrifft folgende Dienste:"}),o.jsx(Po,{items:["Hetzner Online GmbH (Hosting Provider)",'bwSFS „Storage for Science", Universität Freiburg (Datensatz-Speicherung)',"Galaxy Europe / de.NBI, Universität Freiburg (usegalaxy.eu, Datensatz-Verarbeitung)","Google Ireland Ltd. (Firebase)","Supabase Inc. (Supabase Auth)","PostHog Inc. (PostHog Analytics)","Microsoft Corporation (Bing Maps)"]}),o.jsx(ze,{children:"Dienste von Drittanbietern werden im Rahmen der datenschutzrechtlichen Vorgaben genutzt. Es kann zu einer Datenverarbeitung außerhalb der EU kommen. Es folgt eine detaillierte Übersicht der Dienste."}),o.jsx(vt,{level:4,children:"Hetzner Online GmbH"}),o.jsx(Xs,{items:[{label:"Zweck",content:"Server-Hosting für das Anwendungs-Backend (API) und die Metadaten-Datenbank sowie temporäre Verarbeitung von Datensatz-Dateien beim Erstellen der Download-Archive."},{label:"Daten",bullets:["Nutzerkontodaten und Datensatz-Metadaten (Titel, Standorte, Beitragende, Attribute)","Status und Verlauf der Verarbeitungsjobs","Datensatz-Dateien, die beim Erstellen der Download-Archive (ZIP) temporär verarbeitet werden","Serverzugriffsprotokolle (IP-Adressen, Zeitstempel, Browsertypen)"]},{label:"Standort",content:"Server in Deutschland."},{label:"Handling",content:"IP-Adressen in Serverlogs werden zur Anonymisierung gekürzt und ausschließlich für technische Fehlerbehebung und Sicherheitsüberwachung genutzt."},{label:"Rechtsgrundlage",content:"Art. 6 Abs. 1 lit. f DSGVO (sichere Hosting-Infrastruktur)."},{label:"Speicherung",content:"Serverlogs werden für 7–14 Tage gespeichert."}]}),o.jsx(vt,{level:4,children:'bwSFS „Storage for Science" (Universität Freiburg)'}),o.jsx(Xs,{items:[{label:"Zweck",content:"Objektspeicher für hochgeladene Punktwolken und Verarbeitungsergebnisse (Rohd
516atensätze, 3D-Tiles, Download-Pakete und Sicherungen)."},{label:"Daten",bullets:["Hochgeladene Punktwolken-Dateien und deren Verarbeitungsergebnisse","Zugehörige Datei-Metadaten","Personenbezogene Daten nur, sofern in den hochgeladenen Inhalten enthalten"]},{label:"Standort",content:"Rechenzentrum der Universität Freiburg, geo-redundant in zwei Rechenzentren in Baden-Württemberg, Deutschland."},{label:"Handling",content:"Betrieben durch die Universität Freiburg, dieselbe Institution wie der Betreiber. Der Zugriff ist auf autorisierte Plattform- und Speicheradministratoren beschränkt."},{label:"Rechtsgrundlage",content:"Art. 6 Abs. 1 lit. b DSGVO (Bereitstellung der Plattform) und Art. 6 Abs. 1 lit. f DSGVO (sichere Speicherinfrastruktur)."},{label:"Speicherung",content:"Speicherung bis zur Löschung des Datensatzes durch den Eigentümer oder bis zur Entfernung des Kontos."}]}),o.jsx(vt,{level:4,children:"Galaxy Europe / de.NBI (Universität Freiburg)"}),o.jsx(Xs,{items:[{label:"Zweck",content:"Automatisierte Verarbeitung hochgeladener Punktwolken (Validierung und Standardisierung, Vorschau-Erzeugung, KI-basierte Baumsegmentierung und 3D-Tile-Konvertierung)."},{label:"Daten",bullets:["Hochgeladene Punktwolken-Dateien, für die Dauer der Verarbeitung übertragen","Personenbezogene Daten nur, sofern in den hochgeladenen Inhalten enthalten"]},{label:"Standort",content:"ISO-27001-zertifiziertes Rechenzentrum der IT-Dienste der Universität Freiburg, Deutschland."},{label:"Handling",content:"Die Datenübertragung erfolgt verschlüsselt. Der Dienst nutzt oder teilt hochgeladene Daten nicht für verarbeitungsfremde Zwecke. Verarbeitungsartefakte und -verläufe werden nach der Verarbeitung verworfen und nicht aufbewahrt."},{label:"Rechtsgrundlage",content:"Art. 6 Abs. 1 lit. b DSGVO (Bereitstellung der Plattform) und Art. 6 Abs. 1 lit. f DSGVO (Datenverarbeitung für Plattformfunktionen)."},{label:"Speicherung",content:"Keine Aufbewahrung über den Verarbeitungslauf hinaus; Ergebnisse werden auf bwSFS gespeichert."}]}),o.jsx(vt,{level:4,children:"Google Ireland Ltd"}),o.jsx(Xs,{items:[{label:"Zweck",content:"Infrastruktur und Hosting für den Anwendungs-Backend."},{label:"Daten",bullets:["Technische Nutzungsdaten (z. B. Server-Logs)","IP-Adressen","Geräte- und Browserinformationen"]},{label:"Standort",content:"Hauptsächlich EU-Server, mögliche Transfers außerhalb der EU."},{label:"Handling",content:"IP-Adressen werden zur Sicherheit verarbeitet und soweit möglich anonymisiert."},{label:"Rechtsgrundlage",content:"Art. 6 Abs. 1 lit. f DSGVO (berechtigtes Interesse an sicherer und stabiler App-Bereitstellung)."},{label:"Speicherung",content:"Gemäß den Standardrichtlinien von Firebase."}]}),o.jsx(vt,{level:4,children:"Supabase Inc."}),o.jsx(Xs,{items:[{label:"Zweck",content:"Bereitstellung von Datenbankdiensten, Nutzer-Authentifizierung und Dateimetadaten-Management."},{label:"Daten",bullets:["E-Mail-Adressen (für Authentifizierung)","Metadaten zu Datensätzen und deren Bearbeitungsstatus","Logs zu Nutzerinteraktionen (z. B. Uploads, Dateiaktionen)"]},{label:"Standort",content:"Server in der EU."},{label:"Handling",content:"Authentifizierungsdaten werden sicher gespeichert, Metadaten enthalten Nutzer-IDs und JSONB-Datenspeicherung."},{label:"Rechtsgrundlage",content:"Art. 6 Abs. 1 lit. b DSGVO (Erfüllung vertraglicher Pflichten)."},{label:"Speicherung",content:"Solange das Nutzerkonto besteht oder bis zur Nutzer-initiierten Löschung."}]}),o.jsx(vt,{level:4,children:"PostHog Inc."}),o.jsx(Xs,{items:[{label:"Zweck",content:"Analyseplattform zur Nutzungsverfolgung und Verbesserung der Benutzererfahrung."},{label:"Daten",bullets:["Nutzungsdaten (Klickpfade, Seitenaufrufe, Feature-Nutzung)","Geräte- und Browserinformationen","Anonymisierte IP-Adressen (gekürzt vor Verarbeitung)"]},{label:"Standort",content:"Server innerhalb der EU."},{label:"Handling",content:"Alle Daten werden pseudonymisiert; es werden keine persönlichen Benutzerkennungen gespeichert."},{label:"Rechtsgrundlage",content:"Art. 6 Abs. 1 lit. f DSGVO (berechtigtes Interesse an der App-Optimierung)."},{label:"Speicherung",content:"Daten werden für 30 Tage gespeichert."}]}),o.jsx(vt,{level:4,children:"Microsoft Corporation"}),o.jsx(Xs,{items:[{label:"Zweck",content:"Bereitstellung von Kartendiensten in der Anwendung."},{label:"Daten",bullets:["IP-Adressen","Geografische Standortdaten (bei Interaktion mit Karten)","Nutzungsverhalten von Kartenfunktionen"]},{label:"Standort",content:"Mögliche Verarbeitung auf Servern in de
516n USA."},{label:"Handling",content:"Verarbeitung erfolgt nur zur Kartenanzeige gemäß den Microsoft-Datenschutzstandards."},{label:"Rechtsgrundlage",content:"Art. 6 Abs. 1 lit. f DSGVO (verbesserte Funktionalität durch Kartenintegration)."}]})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"Internationale Datenübermittlung"}),o.jsx(ze,{children:"Einige der oben genannten Empfänger haben ihren Sitz in einem Drittland (insbesondere den USA) oder können personenbezogene Daten dorthin übermitteln. Eine Übermittlung in Drittländer erfolgt nur, sofern ein angemessenes Datenschutzniveau gewährleistet ist. Soweit die Europäische Kommission für das betreffende Drittland einen Angemessenheitsbeschluss erlassen hat und der jeweilige Empfänger danach zertifiziert ist – für die USA insbesondere das EU-US Data Privacy Framework (DPF) –, erfolgt die Übermittlung auf dieser Grundlage (Art. 45 DSGVO). Andernfalls stützen wir die Übermittlung auf die von der Europäischen Kommission erlassenen Standardvertragsklauseln (Art. 46 Abs. 2 lit. c DSGVO) sowie erforderlichenfalls ergänzende Schutzmaßnahmen. Im Übrigen richtet sich eine Drittlandübermittlung nach Art. 44 ff. DSGVO. Eine Kopie der jeweiligen Garantien können Sie über die oben genannten Kontaktdaten beim Verantwortlichen anfordern."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"Ihre Rechte"}),o.jsx(ze,{children:"Sie haben folgende Rechte:"}),o.jsx(Po,{items:["Auskunft (Art. 15 DSGVO)","Berichtigung (Art. 16 DSGVO)","Löschung (Art. 17 DSGVO)","Einschränkung der Verarbeitung (Art. 18 DSGVO)","Datenübertragbarkeit (Art. 20 DSGVO)","Widerspruch gegen die Verarbeitung (Art. 21 DSGVO)","Widerruf von Einwilligungen (Art. 7 Abs. 3 DSGVO)"]}),o.jsx(ze,{children:"Sie können Ihre Rechte ausüben, indem Sie sich über die oben angegebenen Kontaktdaten an den Verantwortlichen oder den Datenschutzbeauftragten wenden. Sie haben zudem das Recht, bei einer Aufsichtsbehörde Beschwerde einzulegen, wenn Sie der Ansicht sind, dass die Verarbeitung Ihrer Daten gegen geltendes Recht verstößt. Zuständige Aufsichtsbehörde ist der Landesbeauftragte für den Datenschutz und die Informationsfreiheit Baden-Württemberg, Lautenschlagerstraße 20, 70173 Stuttgart, Deutschland (E-Mail: [email protected])."})]}),o.jsxs("section",{children:[o.jsx(vt,{level:3,children:"Änderungen dieser Datenschutzerklärung"}),o.jsx(ze,{children:"Wir behalten uns vor, diese Datenschutzerklärung bei Bedarf anzupassen. Die aktuelle Version ist jederzeit auf dieser Website abrufbar. Änderungen werden hier auf der Seite publiziert und Ihnen ggf. per E-Mail mitgeteilt."})]})]})]})]})}function ea({level:t=2,className:e="",children:r}){const n="mt-4 text-gray-900",s=t===1?"text-3xl font-bold":t===2?"text-2xl font-semibold":t===3?"text-xl font-semibold":t===4?"text-lg font-semibold":"text-base font-semibold",i=`h${t}`;return o.jsx(i,{className:`${n} ${s} ${e}`.trim(),children:r})}function _o({className:t="",children:e}){return o.jsx("p",{className:`text-gray-700 leading-relaxed ${t}`.trim(),children:e})}function dde(){const t=Vo();return o.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-12",children:[o.jsx("button",{className:"md:hidden inline-flex items-center rounded-md border px-3 py-2 text-sm hover:bg-gray-50",onClick:()=>t("/"),children:"← Zurück"}),o.jsx(ea,{level:1,children:"Impressum"}),o.jsxs("div",{className:"space-y-8",children:[o.jsxs("section",{children:[o.jsx(ea,{level:4,children:"Angaben gemäß § 5 TMG"}),o.jsxs(_o,{children:["Universität Freiburg",o.jsx("br",{}),"Lehrstuhl für Sensorbasierte Geoinformatik",o.jsx("br",{}),"Tennenbacher Str. 4",o.jsx("br",{}),"79106 Freiburg",o.jsx("br",{}),"Deutschland"]})]}),o.jsxs("section",{children:[o.jsx(ea,{level:4,children:"Vertreten durch"}),o.jsxs(_o,{children:["Der Lehrstuhl für Sensorbasierte Geoinformatik wird vertreten durch:",o.jsx("br",{}),"Prof. Dr. Teja Kattenborn"]})]}),o.jsxs("section",{children:[o.jsx(ea,{level:4,children:"Kontakt"}),o.jsxs(_o,{children:["Telefon: +49 (0)761 203 – 3694",o.jsx("br",{}),"E-Mail: [email protected]",o.jsx("br",{}),"[OPTIONAL: Link to Project Page at Chair]",o.jsx("br",{}),"[OPTIONAL: Email Address for general enquiries]"]})]}),o.jsxs("section",{children:[o.jsx(ea,{level:4,children:"Verantwortlich für den Inhalt nach § 55 Abs. 2 RStV"}
516),o.jsxs(_o,{children:["Prof. Dr. Teja Kattenborn",o.jsx("br",{}),"Universität Freiburg",o.jsx("br",{}),"Lehrstuhl für Sensorbasierte Geoinformatik",o.jsx("br",{}),"Tennenbacher Str. 4",o.jsx("br",{}),"79106 Freiburg",o.jsx("br",{}),"Deutschland"]})]}),o.jsxs("section",{children:[o.jsx(ea,{level:4,children:"Projektkontext"}),o.jsxs(_o,{children:["Dieses Datenportal (",o.jsx("i",{children:"3Dtrees.earth"}),") ist ein Projekt, das vom Lehrstuhl für Sensorbasierte Geoinformatik an der Universität Freiburg entwickelt wurde. Ziel des Projektes ist die Bereitstellung und Analyse von 3D-Walddaten (LiDAR) für Forschung und Monitoring."]})]}),o.jsxs("section",{children:[o.jsx(ea,{level:4,children:"Datenschutz"}),o.jsxs(_o,{children:["Hinweise zum Datenschutz entnehmen Sie bitte unserer"," ",o.jsx("a",{href:"/legal/privacy",target:"_blank",rel:"noopener noreferrer",children:"Datenschutzerklärung"}),"."]})]}),o.jsxs("section",{children:[o.jsx(ea,{level:4,children:"Icon-Nachweise"}),o.jsxs(_o,{children:["Wetter-Icons im 3D-Viewer:"," ",o.jsx("a",{href:"https://www.flaticon.com/free-icon/sun_606795",target:"_blank",rel:"noopener noreferrer",children:"Sun icon"})," ","und"," ",o.jsx("a",{href:"https://www.flaticon.com/free-icon/moon_606807",target:"_blank",rel:"noopener noreferrer",children:"Moon icon"})," ","erstellt von"," ",o.jsx("a",{href:"https://www.flaticon.com/authors/good-ware",target:"_blank",rel:"noopener noreferrer",children:"Good Ware"})," ","auf"," ",o.jsx("a",{href:"https://www.flaticon.com/",target:"_blank",rel:"noopener noreferrer",children:"Flaticon"}),"."]})]}),o.jsxs("section",{children:[o.jsx(ea,{level:4,children:"Haftungsausschluss (Disclaimer)"}),o.jsx(ea,{level:5,children:"Haftung für eigene Inhalte"}),o.jsx(_o,{children:"Als Diensteanbieter sind wir gemäß § 7 Abs. 1 TMG für eigene Inhalte auf diesen Seiten nach den allgemeinen Gesetzen verantwortlich. Wir sind bemüht, die Inhalte unserer Seite aktuell, korrekt und vollständig zu halten. Die Inhalte dieser Seite wurden nach bestem Wissen und Gewissen erstellt. Für die Richtigkeit, Vollständigkeit und Aktualität der Inhalte übernehmen wir jedoch keine Gewähr. Wir sind nicht verpflichtet, die von Nutzern hochgeladenen Inhalte zu überwachen. Eine Haftung unsererseits für Rechtsverstöße durch Nutzer, ist erst ab dem Zeitpunkt der Kenntnis einer konkreten Rechtsverletzung möglich. Sollten Sie auf eine Rechtsverletzung auf unserer Seite aufmerksam werden, so bitten wir um umgehende Mitteilung, damit wir diese prüfen und ggf. entfernen können."}),o.jsx(ea,{level:5,children:"Haftung für Links"}),o.jsx(_o,{children:"Unser Angebot enthält Links zu externen Websites Dritter, auf deren Inhalte wir keinen Einfluss haben. Deshalb können wir für diese fremden Inhalte keine Gewähr übernehmen. Für die Inhalte der verlinkten Seiten ist stets der jeweilige Anbieter oder Betreiber der Seiten verantwortlich. Die verlinkten Seiten wurden zum Zeitpunkt der Verlinkung auf mögliche Rechtsverstöße überprüft. Rechtswidrige Inhalte waren zum Zeitpunkt der Verlinkung nicht erkennbar. Wir bemühen uns, die Inhalte der von uns verlinkten Seiten zu überprüfen, eine ständige Kontrolle ist uns jedoch nicht möglich. Sollten Sie auf Inhalte verlinkter Seiten aufmerksam werden, welche rechtswidrig sind, so bitten wir um umgehende Mitteilung, damit wir diese prüfen und ggf. entfernen können."}),o.jsx(ea,{level:5,children:"Urheberrecht"}),o.jsx(_o,{children:"Die durch den Betreiber dieser Seite erstellten Inhalte und Werke unterliegen dem deutschen Urheberrecht. Die Vervielfältigung, Bearbeitung, Verbreitung und jede Art der Verwertung außerhalb der Grenzen des Urheberrechtes bedürfen der schriftlichen Zustimmung des jeweiligen Autors bzw. Erstellers. Downloads und Kopien dieser Seite sind nur für den privaten, nicht kommerziellen Gebrauch gestattet. Soweit die Inhalte auf dieser Seite nicht vom Betreiber erstellt wurden, werden die Urheberrechte Dritter beachtet und entsprechend gekennzeichnet. Die Urheberrechte der von den Nutzern hochgeladenen Inhalte liegen bei den jeweiligen Nutzern. Mit dem Hochladen von Inhalten stimmen die Nutzer zu, dass diese unter der von ihnen gewählten CC-Lizenz genutzt werden können. Sollten Sie trotzdem auf eine Urheberrechtsverletzung aufmerksam werden, bitten wir um einen entsprechenden Hinweis. Bei Bekanntwerden von Rechtsverletzungen werden wir derartige Inhalte umgehend entfernen."})]})]})]})}function UU(t){return`https://doi.org/${encodeURIComponent(t).replace(/%2F/g,"/")}`}async function hde(t){if(t.length===0)return[];const e=[];for(let r=0;r<t.length;r+=1e3)for(let n=0;;n+=500){const{data:s,error:i}=await Ye.rpc("dataset_publications",{p_dataset_ids:t.slice(r,r+1e3)}).range(n,n+499);if(i)throw new Error("Publication citations could not be loaded.");const a=s??[];if(e.push(...a),a.length<500)break}return e}function BU(t,e,r=!0){return fr({queryKey:["dataset-publications",e??"anonymous",t],queryFn:()=>hde(t),enabled:r&&t.length>0,refetchInterval:3e4})}function fde({items:t,compact:e=!1}){const[r,n]=y.useState(!1);return t.length?o.jsxs("div",{className:"space-y-2",children:[t.map(s=>o.jsxs("div",{className:"min-w-0 space-y-1",children:[o.jsxs("a",{href:UU(s.doi),target:"_blank",rel:"noopener noreferrer",className:"block break-all text-xs text-primary underline",title:s.title,children:["FreiDATA DOI: ",s.doi]}),!e&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"break-words text-sm",children:s.citation}),s.published_at&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Publication confirmed ",new Date(s.published_at).toLocaleDateString()]}),o.jsx(we,{variant:"outline",size:"sm",onClick:()=>{n(!1),navigator.clipboard.writeText(s.citation).catch(()=>n(!0))},children:"Copy citation"})]})]},s.publication_id)),r&&o.jsx("p",{role:"alert",children:"Could not copy the citation. Select the text to copy it."})]}):null}function ske({datasetId:t}){const{user:e,loading:r}=Ql(),n=BU([t],e==null?void 0:e.id,!r);return r?null:n.isError?o.jsxs("p",{role:"alert",className:"text-xs",children:["Publication citations could not be loaded."," ",o.jsx("button",{className:"underline",onClick:()=>void n.refetch(),children:"Try again"})]}):o.jsx(mde,{items:n.data??[]})}const pde="https://freidata.uni-freiburg.de/badge/DOI";function VU({doi:t,title:e}){return o.jsx("a",{href:UU(t),target:"_blank",rel:"noopener noreferrer",className:"inline-block min-w-0",title:e?`Published on FreiDATA: ${e}`:"Published on FreiDATA",children:o.jsx("img",{src:`${pde}/${encodeURIComponent(t).replace(/%2F/g,"/")}.svg`,alt:`DOI ${t}`,className:"block h-5 max-w-full"})})}function mde({items:t}){return t.length?o.jsx(o.Fragment,{children:t.map(e=>o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("span",{className:"shrink-0 text-muted-foreground",children:"Published"}),o.jsx(VU,{doi:e.doi,title:e.title})]},e.publication_id))}):null}function HU({className:t,...e}){return o.jsx("div",{"data-slot":"empty",className:ke("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 text-balance rounded-lg border-dashed p-6 text-center md:p-12",t),...e})}function qU({className:t,...e}){return o.jsx("div",{"data-slot":"empty-header",className:ke("flex max-w-sm flex-col items-center gap-2 text-center",t),...e})}const gde=Jb("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",icon:"bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-6"}},defaultVariants:{variant:"default"}});function WU({className:t,variant:e="default",...r}){return o.jsx("div",{"data-slot":"empty-icon","data-variant":e,className:ke(gde({variant:e,className:t})),...r})}function GU({className:t,...e}){return o.jsx("div",{"data-slot":"empty-title",className:ke("text-lg font-medium tracking-tight",t),...e})}function KU({className:t,...e}){return o.jsx("div",{"data-slot":"empty-description",className:ke("text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4",t),...e})}function YU({className:t,...e}){return o.jsx("div",{"data-slot":"empty-content",className:ke("flex w-full min-w-0 max-w-sm flex-col items-center gap-4 text-balance text-sm",t),...e})}function lj({icon:t,title:e,description:r,action:n}){return o.jsxs(HU,{className:"border bg-background/60 py-10",children:[o.jsxs(qU,{children:[o.jsx(WU,{variant:"icon",children:t}),o.jsx(GU,{children:e}),o.jsx(KU,{children:r})]}),n&&o.jsx(YU,{children:n})]})}var vde=Object.defineProperty,Kl=(t,e)=>vde(t,"name",{value:e,configurable:!0}),ZU="Avatar",[yde,ike]=Vn(ZU),_de=[0,()=>{}],[bde,JU]=yde(ZU),wde=y.forwardRef(Kl(function(e,r){const{__scopeAvatar:n,...s}=e,[i,a]=y.useState("idle"),[l,u]=XU();return o.jsx(bde,{scope:n,imageLoadingStatus:i,setImageLoadingStatus:a,imageCount:l,setImageCount:u,children:o.jsx(it.span,{...s,ref:r})})},"Avatar")),xde="AvatarImage",Sde=y.forwardRef(Kl(function(e,r){const{__scopeAvatar:n,src:s,onLoadingStatusChange:i,...a}=e,l=JU(xde,n);l.setImageCount;const u=QU(s,{referrerPolicy:a.referrerPolicy,crossOrigin:a.crossOrigin,loadingStatus:l.imageLoadingStatus,set
516LoadingStatus:l.setImageLoadingStatus}),h=Pn(f=>{i==null||i(f)}),p=y.useRef(u);return Xr(()=>{const f=p.current;p.current=u,u!==f&&h(u)},[u,h]),u==="loaded"?o.jsx(it.img,{...a,ref:r,src:s}):null},"AvatarImage")),kde="AvatarFallback",Ede=y.forwardRef(Kl(function(e,r){const{__scopeAvatar:n,delayMs:s,...i}=e,a=JU(kde,n),[l,u]=y.useState(s===void 0);return y.useEffect(()=>{if(s!==void 0){const h=window.setTimeout(()=>u(!0),s);return()=>window.clearTimeout(h)}},[s]),l&&a.imageLoadingStatus!=="loaded"?o.jsx(it.span,{...i,ref:r}):null},"AvatarFallback"));function QU(t,{loadingStatus:e,setLoadingStatus:r,referrerPolicy:n,crossOrigin:s}){return Xr(()=>{if(!t){r("error");return}const i=new window.Image,a=Kl(u=>{const h=u.currentTarget;r(cj(h))},"handleLoad"),l=Kl(()=>r("error"),"handleError");return i.addEventListener("load",a),i.addEventListener("error",l),n&&(i.referrerPolicy=n),i.crossOrigin=s??null,i.src=t,r(cj(i)),()=>{i.removeEventListener("load",a),i.removeEventListener("error",l),r("idle")}},[t,s,n,r]),e}Kl(QU,"useImageLoadingStatus");function cj(t){return t.complete?t.naturalWidth>0?"loaded":"error":"loading"}Kl(cj,"getImageLoadingStatus");function XU(){return _de}Kl(XU,"useImageCount");function jde(t){}Kl(jde,"useUpdateImageCount");function L1({className:t,...e}){return o.jsx(wde,{"data-slot":"avatar",className:ke("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...e})}function e3({className:t,...e}){return o.jsx(Sde,{"data-slot":"avatar-image",className:ke("aspect-square size-full",t),...e})}function kb({className:t,...e}){return o.jsx(Ede,{"data-slot":"avatar-fallback",className:ke("bg-muted flex size-full items-center justify-center rounded-full",t),...e})}function Cde({name:t,email:e,initials:r,pictureUrl:n,affiliation:s,orcid:i,memberSince:a,journey:l,journeyFailed:u,isNewContributor:h,uploadsAvailable:p,onEditProfile:f}){const g=[!i&&"ORCID",!s&&"affiliation"].filter(Boolean),v=g.length>0?o.jsxs(o.Fragment,{children:["Add your ",g.join(" and ")," so publications credit you correctly."," ",o.jsx("button",{type:"button",className:"font-medium underline underline-offset-2",onClick:f,children:"Complete profile"})]}):null;return o.jsxs("section",{"aria-label":"Your account",className:"mb-8 space-y-5",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("button",{type:"button","aria-label":"Change profile picture",className:"ph-no-capture group relative shrink-0 rounded-full focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",onClick:f,children:[o.jsxs(L1,{className:"h-14 w-14 sm:h-16 sm:w-16",children:[n!=null&&n.trim()?o.jsx(e3,{src:n,alt:"",className:"object-cover"}):null,o.jsx(kb,{className:"bg-gradient-to-br from-blue-500 to-indigo-600 text-lg font-medium text-white",children:r})]}),o.jsx("span",{className:"absolute inset-0 flex items-center justify-center rounded-full bg-black/50 opacity-0 transition-opacity group-hover:opacity-100",children:o.jsx(mL,{className:"h-5 w-5 text-white"})})]}),o.jsxs("div",{className:"ph-mask min-w-0 flex-1",children:[o.jsx("h1",{className:"truncate text-2xl font-semibold tracking-tight text-foreground",children:t}),o.jsxs("p",{className:"mt-0.5 flex flex-wrap items-center gap-x-1.5 text-sm text-muted-foreground",children:[s&&o.jsx("span",{children:s}),s&&o.jsx("span",{"aria-hidden":"true",children:"·"}),o.jsx("span",{className:"max-w-full truncate",children:e}),i&&o.jsxs(o.Fragment,{children:[o.jsx("span",{"aria-hidden":"true",children:"·"}),o.jsxs("a",{href:`https://orcid.org/${i}`,target:"_blank",rel:"noopener noreferrer",className:"ph-no-capture inline-flex items-center gap-1 text-green-700 hover:underline",children:["ORCID ",o.jsx(n_,{className:"h-3 w-3"})]})]}),o.jsx("span",{"aria-hidden":"true",children:"·"}),o.jsxs("span",{children:["member since ",a]})]})]}),o.jsxs(we,{variant:"outline",size:"sm",onClick:f,className:"shrink-0 gap-2",children:[o.jsx(Zb,{className:"h-4 w-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Edit profile"})]})]}),v&&o.jsxs("p",{role:"status",className:"flex items-start gap-2 text-sm text-amber-800",children:[o.jsx(Oo,{className:"mt-0.5 h-4 w-4 shrink-0"}),o.jsx("span",{children:v})]}),o.jsx("div",{className:"rounded-2xl bg-muted/50 py-2",children:h?o.jsx(Pde,{uploadsAvailable:p}):l===null?o.jsx("p",{className:"px-5 py-6 text-sm text-muted-foreground",role:"status",children:u?"Your numbers could not be loaded right now. Reload the page to try again.":"Loading your numbers…"}):o.jsx("ol",{"aria-label":"Your data on 3Dtrees",className:"grid grid-cols-2 lg:grid-cols-4 lg:divide-x lg:divide-border",children:l.map((_,x)=>o.jsx(Nde,{step:_,number:x+1},_.key))})}),o.jsxs("nav",{"aria-label":"Help",className:"ph-no-capture flex flex-wrap items-center justify-end gap-x-3 text-xs text-muted-foreground",children:[o.jsx(Sr,{to:"/about",className:"hover:text-foreground hover:underline underline-offset-2",children:"About 3Dtrees"}),o.jsx("span",{"aria-hidden":"true",children:"·"}),o.jsx(Sr,{to:"/legal/terms",className:"hover:text-foreground hover:underline underline-offset-2",children:"Terms of use"}),o.jsx("span",{"aria-hidden":"true",children:"·"}),o.jsx("a",{href:"mailto:[email protected]",className:"hover:text-foreground hover:underline underline-offset-2",children:"Contact the team"})]})]})}function EO(){return o.jsx("span",{className:"rounded bg-blue-50 px-1.5 py-px text-[10px] font-medium tracking-normal text-blue-700 normal-case",children:"soon"})}function Nde({step:t,number:e}){return o.jsxs("li",{className:"flex min-w-0 flex-col gap-3 px-3 py-3 sm:px-5 sm:py-4 xl:px-6",children:[o.jsxs("p",{className:"text-xs font-semibold tracking-wider text-muted-foreground uppercase",children:[o.jsx("span",{className:"tabular-nums",children:String(e).padStart(2,"0")}),o.jsx("span",{className:"ml-2",children:t.title})]}),o.jsxs("div",{children:[o.jsx("p",{className:"flex items-baseline gap-1.5 text-3xl font-semibold tracking-tight tabular-nums text-foreground sm:text-4xl",children:t.value??o.jsx("span",{className:"text-muted-foreground
516/50",children:"—"})}),o.jsxs("p",{className:"mt-0.5 flex items-center gap-1.5 text-sm text-muted-foreground",children:[t.label,t.value===null&&o.jsx(EO,{})]}),t.progress!==void 0&&o.jsx("div",{role:"progressbar","aria-label":`${t.title} progress`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(t.progress*100),className:"mt-2 h-1.5 overflow-hidden rounded-full bg-border",children:o.jsx("div",{className:"h-full rounded-full bg-emerald-600 transition-[width] duration-500 motion-reduce:transition-none",style:{width:`${Math.round(t.progress*100)}%`}})})]}),o.jsx("dl",{className:"space-y-1.5 text-xs sm:text-sm",children:t.details.map(r=>o.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[o.jsx("dt",{className:"min-w-0 truncate text-muted-foreground",children:r.label}),o.jsx("dd",{className:"shrink-0 font-medium whitespace-nowrap tabular-nums text-foreground",children:r.value??o.jsx(EO,{})})]},r.label))})]})}const jO=[{title:"Contribute",text:"Upload a forest point cloud with Add Dataset below."},{title:"Process",text:"3Dtrees processes it so you can explore it in 3D."},{title:"Publish",text:"Get a citable DOI for it under Publications."},{title:"Use",text:"Share it publicly and see how often it is viewed and downloaded."}];function Pde({uploadsAvailable:t}){const e=t?jO:[{title:"Contribute",text:"Uploads are paused right now; you can add datasets soon."},...jO.slice(1)];return o.jsx("ol",{"aria-label":"How 3Dtrees works",className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 lg:divide-x lg:divide-border",children:e.map((r,n)=>o.jsxs("li",{className:"flex gap-3 px-4 py-3 sm:px-5 sm:py-4",children:[o.jsx("span",{"aria-hidden":"true",className:`flex size-6 shrink-0 items-center justify-center rounded-full text-xs font-semibold ${n===0?"bg-primary text-primary-foreground":"bg-background text-muted-foreground"}`,children:n+1}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold text-foreground",children:r.title}),o.jsx("p",{className:"text-sm text-muted-foreground",children:r.text})]})]},r.title))})}function Rde(t){return t>=99995e4?`${(t/1e9).toFixed(1)} bn`:t>=999500?`${(t/1e6).toFixed(1)} M`:t>=1e4?`${Math.round(t/1e3)} k`:t.toLocaleString()}function Ade(t,e,r=!1,n,s,i=[]){const a=t.filter(_=>_.status==="completed"||_.status==="partial"||_.details_available===!0),l=t.filter(_=>_.status==="processing"),u=`${t.length.toLocaleString()}${r?"+":""}`,h=t.reduce((_,x)=>_+(x.point_count??0),0),p=new Set(t.map(_=>_.id)),f=new Set(e.filter(_=>_.doi).flatMap(_=>_.dataset_ids).filter(_=>p.has(_))),g=new Set(i.map(_=>_.dataset_id).filter(_=>p.has(_)&&!f.has(_))),v=f.size+g.size;return[{key:"contribute",title:"Contribute",value:u,label:t.length===1?"dataset shared":"datasets shared",details:[{label:"Points",value:h>0?Rde(h):"—"}]},{key:"process",title:"Process",value:a.length.toLocaleString(),label:`of ${u} processed`,progress:t.length?a.length/t.length:0,details:l.length>0?[{label:"Running now",value:l.length.toLocaleString()}]:[]},{key:"publish",title:"Publish",value:v.toLocaleString(),label:v===1?"dataset with a DOI":"datasets with a DOI",details:[...g.size>0?[{label:"Via 3Dtrees",value:f.size.toLocaleString()},{label:"Added at upload",value:g.size.toLocaleString()}]:[],{label:"Citations",value:s==null?null:s.toLocaleString()}]},{key:"use",title:"Use",value:n?n.views.toLocaleString():null,label:n!=null&&n.viewsThisMonth?`dataset views · +${n.viewsThisMonth.toLocaleString()} this month`:"dataset views",details:[{label:"Downloads",value:n?n.downloads.toLocaleString():null}]}]}function qg(t){if(!t||t.trim()==="")return{isValid:!1,error:"DOI cannot be empty"};const e=t.trim();let r=e;const n=/(?:https?:\/\/)?(?:dx\.)?doi\.org\/(.+)/i,s=e.match(n);return s&&(r=s[1]),/^10\.\d{4,}\/[^\s]+$/.test(r)?{isValid:!0,cleanDOI:r}:{isValid:!1,error:"Invalid DOI format. DOI should follow pattern: 10.XXXX/YYYY"}}function ake(t){const e=qg(t);return e.isValid&&e.cleanDOI?`https://doi.org/${e.cleanDOI}`:t}function wd(t){const e=qg(t??"");return!e.isValid||!e.cleanDOI?null:e.cleanDOI.trim()}async function Tde(t,e={}){var l,u,h;const r=wd(t);if(!r)throw new Error("Enter a valid DOI before fetching metadata.");const n=[],s=await __(`https://api.datacite.org/dois/${encodeURIComponent(r)}`,e,[404]);if(s.ok&&((u=(l=s.data)==null?void 0:l.data)!=null&&u.attributes))return Dde(s.data,r);!s.ok&&s.error&&n.push(`DataCite: ${s.error}`);const i=await __(`https://api.crossref.org/works/${encodeURIComponent(r)}`,e,[404]);if(i.ok&&((h=i.data)!=null&&h.message))return Ide(i.data,r);!i.ok&&i.error&&n.push(`Crossref: ${i.error}`);const a=await __(`https://doi.org/${encodeURIComponent(r)}`,{...e,headers:{Accept:"application/vnd.citationstyles.csl+json"}},[404,406]);if(a.ok&&a.data)return Ode(a.data,r);throw!a.ok&&a.error&&n.push(`DOI resolver: ${a.error}`),n.length>0?new Error(`Could not fetch DOI metadata. ${n.join(" ")}`):new Error("No supported metadata was found for this DOI.")}function Ide(t,e){const r=t.message??{},n=r.type;return{doi:r.DOI??e,sourceAgency:"crossref",resourceType:n,resourceKind:t3(n),title:ug(r.title),abstractOrDescription:$r(r.abstract),authors:(r.author??[]).map(Fde).filter($1),funding:zde(r.funder??[]),publisher:$r(r.publisher),publicationYear:jm(r["published-print"])??jm(r["published-online"])??jm(r.published)??jm(r.issued),journalOrContainerTitle:ug(r["container-title"])}}function Dde(t,e){var i,a,l,u,h;const r=((i=t.data)==null?void 0:i.attributes)??{},n=ug([(a=r.types)==null?void 0:a.resourceTypeGeneral,(l=r.types)==null?void 0:l.resourceType,(u=r.types)==null?void 0:u.citeproc,(h=r.types)==null?void 0:h.schemaOrg]),s=[...r.creators??[],...r.contributors??[]];return{doi:r.doi??e,sourceAgency:"datacite",resourceType:n,resourceKind:Hde(n),title:Bde(r.titles??[]),abstractOrDescription:Vde(r.descriptions??[]),authors:s.map($de).filter($1),funding:(r.fundingReferences??[]).map(Ude).filter(Wde),publisher:$r(r.publisher),publicationYear:r.publicationYear}}function Ode(t,e){return{doi:t.DOI??e,sourceAgency:"doi",resourceType:t.type,resourceKind:t3(t.type),title:$r(t.title),abstractOrDescription:$r(t.abstract),authors:(t.author??[]).map(r=>F1({givenName:r.given,familyName:r.family,displayName:r.literal,orcid:r.ORCID})).filter($1),funding:[],publisher:$r(t.publisher),publicationYear:jm(t.issued),journalOrContainerTitle:$r(t["container-title"])}}function Mde(t,e){const r=$r(t.title),n=$r(t.abstractOrDescription),s=r3(t.authors.map(a=>({...a}))),i=n3(t.funding.map(a=>({...a})));
516return{metadata:t,title:r,description:n,authors:s,fundingReferences:i,defaultSelected:{title:!!(r&&CO(e.title)&&t.resourceKind==="dataset"),description:!!(n&&CO(e.description)),authors:s.length>0&&(e.authors??[]).length===0,fundingReferences:i.length>0&&(e.fundingReferences??[]).length===0}}}function Lde(t,e,r){const n={};return r.title&&e.title&&(n.title=e.title),r.description&&e.description&&(n.description=e.description),r.authors&&e.authors.length>0&&(n.authors=r3([...t.authors??[],...e.authors])),r.fundingReferences&&e.fundingReferences.length>0&&(n.fundingReferences=n3([...t.fundingReferences??[],...e.fundingReferences])),n}async function __(t,e,r){var l,u,h;const n=e.fetcher??fetch,s=new AbortController,i=globalThis.setTimeout(()=>s.abort(),e.timeoutMs??1e4),a=()=>s.abort();try{(l=e.signal)!=null&&l.aborted?s.abort():(u=e.signal)==null||u.addEventListener("abort",a,{once:!0});const p=await n(t,{headers:{Accept:"application/json",...e.headers},signal:s.signal});return r.includes(p.status)?{ok:!0,data:null}:p.ok?{ok:!0,data:await p.json()}:{ok:!1,error:`${p.status} ${p.statusText}`}}catch(p){return p instanceof DOMException&&p.name==="AbortError"?{ok:!1,error:"Request timed out"}:{ok:!1,error:p instanceof Error?p.message:"Network error"}}finally{globalThis.clearTimeout(i),(h=e.signal)==null||h.removeEventListener("abort",a)}}function Fde(t){var e;return F1({givenName:t.given,familyName:t.family,displayName:t.name,organisation:ug((e=t.affiliation)==null?void 0:e.map(r=>r.name)),orcid:t.ORCID})}function $de(t){var r;const e=ug((r=t.affiliation)==null?void 0:r.map(n=>typeof n=="string"?n:n.name));return F1({givenName:t.givenName??void 0,familyName:t.familyName??void 0,displayName:t.name,organisation:t.nameType==="Organizational"?t.name:e,orcid:qde(t.nameIdentifiers??[]),isOrganisation:t.nameType==="Organizational"})}function F1(t){const e=$r(t.givenName),r=$r(t.familyName),n=$r(t.displayName),s=$r(t.organisation);if(e||r)return{first_name:e||"",last_name:r||n||"",organisation:s,orcid:sd(t.orcid)};if(t.isOrganisation&&n)return{first_name:"Organization",last_name:n,organisation:n,orcid:sd(t.orcid)};if(n){const i=n.split(/\s+/).filter(Boolean);return i.length===1?{first_name:"",last_name:i[0],organisation:s,orcid:sd(t.orcid)}:{first_name:i.slice(0,-1).join(" "),last_name:i[i.length-1],organisation:s,orcid:sd(t.orcid)}}return{first_name:"",last_name:"",organisation:s,orcid:sd(t.orcid)}}function zde(t){return t.flatMap(e=>{const r=$r(e.name);if(!r)return[];const n=(e.award??[]).map($r).filter(Boolean);return n.length===0?[{funderName:r,funderIdentifier:$r(e.DOI??e.doi)}]:n.map(s=>({funderName:r,funderIdentifier:$r(e.DOI??e.doi),awardNumber:s}))})}function Ude(t){return{funderName:$r(t.funderName)??"",funderIdentifier:$r(t.funderIdentifier),awardNumber:$r(t.awardNumber),awardTitle:$r(t.awardTitle)}}function Bde(t){var e,r;return $r(((e=t.find(n=>!n.titleType||n.titleType==="MainTitle"))==null?void 0:e.title)??((r=t[0])==null?void 0:r.title))}function Vde(t){const e=t.find(r=>r.descriptionType==="Abstract")??t.find(r=>r.descriptionType!=="TableOfContents")??t[0];return $r(e==null?void 0:e.description)}function t3(t){if(!t)return"unknown";const e=t.toLowerCase();return e.includes("dataset")?"dataset":e.includes("article")||e.includes("book")||e.includes("proceedings")||e.includes("report")||e.includes("posted-content")?"publication":"other"}function Hde(t){return t?t.toLowerCase()==="dataset"?"dataset":"other":"unknown"}function jm(t){var e,r;return(r=(e=t==null?void 0:t["date-parts"])==null?void 0:e[0])==null?void 0:r[0]}function ug(t){return t==null?void 0:t.map($r).find(Boolean)}function $r(t){return t&&t.replace(/<[^>]*>/g," ").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/\s+/g," ").trim()||void 0}function sd(t){var r;return((r=$r(t))==null?void 0:r.replace(/^https?:\/\/orcid\.org\//i,"").replace(/^orcid:/i,""))||void 0}function qde(t){const e=t.find(r=>`${r.nameIdentifierScheme??""} ${r.schemeUri??""}`.toLowerCase().includes("orcid")||(r.nameIdentifier??"").toLowerCase().includes("orcid.org"));return sd(e==null?void 0:e.nameIdentifier)}function CO(t){return!t||t.trim()===""}function $1(t){return!!(t.first_name.trim()&&t.last_name.trim())}function Wde(t){return!!t.funderName.trim()}function r3(t){const e=new Set,r=new Set;return t.filter(n=>{var a;const s=(a=sd(n.orcid))==null?void 0:a.toLowerCase(),i=Gde(n);return s&&e.has(s)||i&&r.has(i)?!1:(s&&e.add(s),i&&r.add(i),!0)})}function Gde(t){var n,s;const e=(n=$r(t.first_name))==null?void 0:n.toLowerCase(),r=(s=$r(t.last_name))==null?void 0:s.toLowerCase();if(!(!e||!r))return`${e}|${r}`}function n3(t){const e=new Set;return t.filter(r=>{const n=`${r.funderName}|${r.funderIdentifier??""}|${r.awardNumber??""}|${r.awardTitle??""}`.toLowerCase();return e.has(n)?!1:(e.add(n),!0)})}const s3="3dtrees.dataset-views.v1",uj=new Set;function Kde(){try{const t=JSON.parse(sessionStorage.getItem(s3)??"[]");return new Set([...t,...uj])}catch{return new Set(uj)}}async function oke(t){const e=Kde();if(!e.has(t)){e.add(t),uj.add(t);try{sessionStorage.setItem(s3,JSON.stringify([...e]))}catch{}try{await Ye.rpc("record_dataset_view_v1",{p_dataset_id:t})}catch{}}}async function Yde(){const{data:t,error:e}=await Ye.rpc("get_my_dataset_reach_v1");if(e)throw e;const r=(t??[])[0];return{views:Number((r==null?void 0:r.views)??0),viewsThisMonth:Number((r==null?void 0:r.views_this_month)??0),downloads:Number((r==null?void 0:r.downloads)??0)}}const NO=200;async function Zde(t){const e=[];for(let r=0;r<t.length;r+=NO){const{data:n,error:s}=await Ye.from("datacite").select("dataset_id, doi").in("dataset_id",t.slice(r,r+NO)).not("doi","is",null);if(s)throw s;for(const i of n??[]){const a=wd(i.doi);i.dataset_id!=null&&a&&e.push({dataset_id:i.dataset_id,doi:a})}}return e}async function Jde(t){const e=[...new Set(t)];if(e.length===0)return 0;const n=(await Promise.all(e.map(s=>__(`https://api.datacite.org/dois/${encodeURIComponent(s)}`,{},[404])))).filter(s=>s.ok);return n.length===0?null:n.reduce((s,i)=>{var a,l,u;return s+(i.ok?((u=(l=(a=i.data)==null?void 0:a.data)==null?void 0:l.attributes)==null?void 0:u.citationCount)??0:0)},0)}var Qde=Object.defineProperty,Xde=(t,e)=>Qde(t,"name",{value:e,configurable:!0});function Eb(t,[e,r]){return Math.min(r,Math.max(e,t))}Xde(Eb,"clamp");
vendor: 12,007 bytes, line 516
516const ehe=["top","right","bottom","left"],su=Math.min,Pi=Math.max,jb=Math.round,Wy=Math.floor,Lo=t=>({x:t,y:t}),the={left:"right",right:"left",bottom:"top",top:"bottom"};function dj(t,e,r){return Pi(t,su(e,r))}function Yl(t,e){return typeof t=="function"?t(e):t}function Zl(t){return t.split("-")[0]}function sp(t){return t.split("-")[1]}function z1(t){return t==="x"?"y":"x"}function U1(t){return t==="y"?"height":"width"}function To(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function B1(t){return z1(To(t))}function rhe(t,e,r){r===void 0&&(r=!1);const n=sp(t),s=B1(t),i=U1(s);let a=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=Cb(a)),[a,Cb(a)]}function nhe(t){const e=Cb(t);return[hj(t),e,hj(e)]}function hj(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const PO=["left","right"],RO=["right","left"],she=["top","bottom"],ihe=["bottom","top"];function ahe(t,e,r){switch(t){case"top":case"bottom":return r?e?RO:PO:e?PO:RO;case"left":case"right":return e?she:ihe;default:return[]}}function ohe(t,e,r,n){const s=sp(t);let i=ahe(Zl(t),r==="start",n);return s&&(i=i.map(a=>a+"-"+s),e&&(i=i.concat(i.map(hj)))),i}function Cb(t){const e=Zl(t);return the[e]+t.slice(e.length)}function lhe(t){return{top:0,right:0,bottom:0,left:0,...t}}function i3(t){return typeof t!="number"?lhe(t):{top:t,right:t,bottom:t,left:t}}function Nb(t){const{x:e,y:r,width:n,height:s}=t;return{width:n,height:s,top:r,left:e,right:e+n,bottom:r+s,x:e,y:r}}function AO(t,e,r){let{reference:n,floating:s}=t;const i=To(e),a=B1(e),l=U1(a),u=Zl(e),h=i==="y",p=n.x+n.width/2-s.width/2,f=n.y+n.height/2-s.height/2,g=n[l]/2-s[l]/2;let v;switch(u){case"top":v={x:p,y:n.y-s.height};break;case"bottom":v={x:p,y:n.y+n.height};break;case"right":v={x:n.x+n.width,y:f};break;case"left":v={x:n.x-s.width,y:f};break;default:v={x:n.x,y:n.y}}switch(sp(e)){case"start":v[a]-=g*(r&&h?-1:1);break;case"end":v[a]+=g*(r&&h?-1:1);break}return v}async function che(t,e){var r;e===void 0&&(e={});const{x:n,y:s,platform:i,rects:a,elements:l,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:p="viewport",elementContext:f="floating",altBoundary:g=!1,padding:v=0}=Yl(e,t),_=i3(v),w=l[g?f==="floating"?"reference":"floating":f],S=Nb(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(w)))==null||r?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:h,rootBoundary:p,strategy:u})),k=f==="floating"?{x:n,y:s,width:a.floating.width,height:a.floating.height}:a.reference,j=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),C=await(i.isElement==null?void 0:i.isElement(j))?await(i.getScale==null?void 0:i.getScale(j))||{x:1,y:1}:{x:1,y:1},R=Nb(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:k,offsetParent:j,strategy:u}):k);return{top:(S.top-R.top+_.top)/C.y,bottom:(R.bottom-S.bottom+_.bottom)/C.y,left:(S.left-R.left+_.left)/C.x,right:(R.right-S.right+_.right)/C.x}}const uhe=50,dhe=async(t,e,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:i=[],platform:a}=r,l=a.detectOverflow?a:{...a,detectOverflow:che},u=await(a.isRTL==null?void 0:a.isRTL(e));let h=await a.getElementRects({reference:t,floating:e,strategy:s}),{x:p,y:f}=AO(h,n,u),g=n,v=0;const _={};for(let x=0;x<i.length;x++){const w=i[x];if(!w)continue;const{name:S,fn:k}=w,{x:j,y:C,data:R,reset:A}=await k({x:p,y:f,initialPlacement:n,placement:g,strategy:s,middlewareData:_,rects:h,platform:l,elements:{reference:t,floating:e}});p=j??p,f=C??f,_[S]={..._[S],...R},A&&v<uhe&&(v++,typeof A=="object"&&(A.placement&&(g=A.placement),A.rects&&(h=A.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:s}):A.rects),{x:p,y:f}=AO(h,g,u)),x=-1)}return{x:p,y:f,placement:g,strategy:s,middlewareData:_}},hhe=t=>({name:"arrow",options:t,async fn(e){const{x:r,y:n,placement:s,rects:i,platform:a,elements:l,middlewareData:u}=e,{element:h,padding:p=0}=Yl(t,e)||{};if(h==null)return{};const f=i3(p),g={x:r,y:n},v=B1(s),_=U1(v),x=await a.getDimensions(h),w=v==="y",S=w?"top":"left",k=w?"bottom":"right",j=w?"clientHeight":"clientWidth",C=i.reference[_]+i.reference[v]-g[v]-i.floating[_],R=g[v]-i.reference[v],A=await(a.getOffsetParent==null?void 0:a.getOffsetParent(h));let I=A?A[j]:0;(!I||!await(a.isElement==null?void 0:a.isElement(A)))&&(I=l.floating[j]||i.floating[_]);const P=C/2-R/2,T=I/2-x[_]/2-1,O=su(f[S],T),G=su(f[k],T),M=O,U=I-x[_]-G,V=I/2-x[_]/2+P,H=dj(M,V,U),Y=!u.arrow&&sp(s)!=null&&V!==H&&i.reference[_]/2-(V<M?O:G)-x[_]/2<0,B=Y?V<M?V-M:V-U:0;return{[v]:g[v]+B,data:{[v]:H,centerOffset:V-H-B,...Y&&{alignmentOffset:B}},reset:Y}}}),fhe=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,n;const{placement:s,middlewareData:i,rects:a,initialPlacement:l,platform:u,elements:h}=e,{mainAxis:p=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:_="none",flipAlignment:x=!0,...w}=Yl(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};const S=Zl(s),k=To(l),j=Zl(l)===l,C=await(u.isRTL==null?void 0:u.isRTL(h.floating)),R=g||(j||!x?[Cb(l)]:nhe(l)),A=_!=="none";!g&&A&&R.push(...ohe(l,x,_,C));const I=[l,...R],P=await u.detectOverflow(e,w),T=[];let O=((n=i.flip)==null?void 0:n.overflows)||[];if(p&&T.push(P[S]),f){const V=rhe(s,a,C);T.push(P[V[0]],P[V[1]])}if(O=[...O,{placement:s,overflows:T}],!T.every(V=>V<=0)){var G,M;const V=(((G=i.flip)==null?void 0:G.index)||0)+1,H=I[V];if(H&&(!(f==="alignment"?k!==To(H):!1)||O.every(z=>To(z.placement)===k?z.overflows[0]>0:!0)))return{data:{index:V,overflows:O},reset:{placement:H}};let Y=(M=O.filter(B=>B.overflows[0]<=0).sort((B,z)=>B.overflows[1]-z.overflows[1])[0])==null?void 0:M.placement;if(!Y)switch(v){case"bestFit":{var U;const B=(U=O.filter(z=>{if(A){const ee=To(z.placement);return ee===k||ee==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(ee=>ee>0).reduce((ee,L)=>ee+L,0)]).sort((z,ee)=>z[1]-ee[1])[0])==null?void 0:U[0];B&&(Y=B);break}case"initialPlacement":Y=l;break}if(s!==Y)return{reset:{placement:Y}}}return{}}}};function TO(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function IO(t){return ehe.some(e=>t[e]>=0)}const phe=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r,platform:n}=e,{strategy:s="referenceHidden",...i}=Yl(t,e);switch(s){case"referenceHidden":{const a=await n.detectOverflow(e,{...i,elementContext:"reference"}),l=TO(a,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:IO(l)}}}case"escaped":{const a=await n.detectOverflow(e,{...i,altBoundary:!0}),l=TO(a,r.floating);return{data:{escapedOffsets:l,escaped:IO(l)}}}default:return{}}}}},a3=new Set(["left","top"]);async function mhe(t,e){const{placement:r,platform:n,elements:s}=t,i=await(n.isRTL==null?void 0:n.isRTL(s.floating)),a=Zl(r),l=sp(r),u=To(r)==="y",h=a3.has(a)?-1:1,p=i&&u?-1:1,f=Yl(e,t);let{mainAxis:g,crossAxis:v,alignmentAxis:_}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof _=="number"&&(v=l==="end"?_*-1:_),u?{x:v*p,y:g*h}:{x:g*h,y:v*p}}const ghe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;const{x:s,y:i,placement:a,middlewareData:l}=e,u=await mhe(e,t);return a===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:s+u.x,y:i+u.y,data:{...u,placement:a}}}}},vhe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:s,platform:i}=e,{mainAxis:a=!0,crossAxis:l=!1,limiter:u={fn:S=>{let{x:k,y:j}=S;return{x:k,y:j}}},...h}=Yl(t,e),p={x:r,y:n},f=await i.detectOverflow(e,h),g=To(Zl(s)),v=z1(g);let _=p[v],x=p[g];if(a){const S=v==="y"?"top":"left",k=v==="y"?"bottom":"right",j=_+f[S],C=_-f[k];_=dj(j,_,C)}if(l){const S=g==="y"?"top":"left",k=g==="y"?"bottom":"right",j=x+f[S],C=x-f[k];x=dj(j,x,C)}const w=u.fn({...e,[v]:_,[g]:x});return{...w,data:{x:w.x-r,y:w.y-n,enabled:{[v]:a,[g]:l}}}}}},yhe=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:n,placement:s,rects:i,middlewareData:a}=e,{offset:l=0,mainAxis:u=!0,crossAxis:h=!0}=Yl(t,e),p={x:r,y:n},f=To(s),g=z1(f);let v=p[g],_=p[f];const x=Yl(l,e),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(u){const j=g==="y"?"height":"width",C=i.reference[g]-i.floating[j]+w.mainAxis,R=i.reference[g]+i.reference[j]-w.mainAxis;v<C?v=C:v>R&&(v=R)}if(h){var S,k;const j=g==="y"?"width":"height",C=a3.has(Zl(s)),R=i.reference[f]-i.floating[j]+(C&&((S=a.offset)==null?void 0:S[f])||0)+(C?0:w.crossAxis),A=i.reference[f]+i.reference[j]+(C?0:((k=a.offset)==null?void 0:k[f])||0)-(C?w.crossAxis:0);_<R?_=R:_>A&&(_=A)}return{[g]:v,[f]:_}}}},_he=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,n;const{placement:s,rects:i,platform:a,elements:l}=e,{apply:u=()=>{},...h}=Yl(t,e),p=await a.detectOverflow(e,h),f=Zl(s),g=sp(s),v=To(s)==="y",{width:_,height:x}=i.floating;let w,S;f==="top"||f==="bottom"?(w=f,S=g===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(S=f,w=g==="end"?"top":"bottom");const k=x-p.top-p.bottom,j=_-p.left-p.right,C=su(x-p[w],k),R=su(_-p[S],j),A=!e.middlewareData.shift;let I=C,P=R;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(P=j),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(I=k),A&&!g){const O=Pi(p.left,0),G=Pi(p.right,0),M=Pi(p.top,0),U=Pi(p.bottom,0);v?P=_-2*(O!==0||G!==0?O+G:Pi(p.left,p.right)):I=x-2*(M!==0||U!==0?M+U:Pi(p.top,p.bottom))}await u({...e,availableWidth:P,availableHeight:I});const T=await a.getDimensions(l.floating);return _!==T.width||x!==T.height?{reset:{rects:!0}}:{}}}};function Cw(){return typeof window<"u"}function ip(t){return o3(t)?(t.nodeName||"").toLowerCase():"#document"}function Fi(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Go(t){var e;return(e=(o3(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function o3(t){return Cw()?t instanceof Node||t instanceof Fi(t).Node:!1}function Ya(t){return Cw()?t instanceof Element||t instanceof Fi(t).Element:!1}function Xl(t){return Cw()?t instanceof HTMLElement||t instanceof Fi(t).HTMLElement:!1}function DO(t){return!Cw()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Fi(t).ShadowRoot}function Wg(t){const{overflow:e,overflowX:r,overflowY:n,display:s}=Za(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&s!=="inline"&&s!=="contents"}function bhe(t){return/^(table|td|th)$/.test(ip(t))}function Nw(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const whe=/transform|translate|scale|rotate|perspective|filter/,xhe=/paint|layout|strict|content/,qu=t=>!!t&&t!=="none";let DS;function V1(t){const e=Ya(t)?Za(t):t;return qu(e.transform)||qu(e.translate)||qu(e.scale)||qu(e.rotate)||qu(e.perspective)||!H1()&&(qu(e.backdropFilter)||qu(e.filter))||whe.test(e.willChange||"")||xhe.test(e.contain||"")}function She(t){let e=iu(t);for(;Xl(e)&&!zf(e);){if(V1(e))return e;if(Nw(e))return null;e=iu(e)}return null}function H1(){return DS==null&&(DS=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),DS}function zf(t){return/^(html|body|#document)$/.test(ip(t))}function Za(t){return Fi(t).getComputedStyle(t)}function Pw(t){return Ya(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function iu(t){if(ip(t)==="html")return t;const e=t.assignedSlot||t.parentNode||DO(t)&&t.host||Go(t);return DO(e)?e.host:e}function l3(t){const e=iu(t);return zf(e)?t.ownerDocument?t.ownerDocument.body:t.body:Xl(e)&&Wg(e)?e:l3(e)}function dg(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const s=l3(t),i=s===((n=t.ownerDocument)==null?void 0:n.body),a=Fi(s);if(i){const l=fj(a);
vendor: 12,443 bytes, line 516
516return e.concat(a,a.visualViewport||[],Wg(s)?s:[],l&&r?dg(l):[])}else return e.concat(s,dg(s,[],r))}function fj(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function c3(t){const e=Za(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const s=Xl(t),i=s?t.offsetWidth:r,a=s?t.offsetHeight:n,l=jb(r)!==i||jb(n)!==a;return l&&(r=i,n=a),{width:r,height:n,$:l}}function q1(t){return Ya(t)?t:t.contextElement}function ff(t){const e=q1(t);if(!Xl(e))return Lo(1);const r=e.getBoundingClientRect(),{width:n,height:s,$:i}=c3(e);let a=(i?jb(r.width):r.width)/n,l=(i?jb(r.height):r.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const khe=Lo(0);function u3(t){const e=Fi(t);return!H1()||!e.visualViewport?khe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ehe(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Fi(t)?!1:e}function Cd(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const s=t.getBoundingClientRect(),i=q1(t);let a=Lo(1);e&&(n?Ya(n)&&(a=ff(n)):a=ff(t));const l=Ehe(i,r,n)?u3(i):Lo(0);let u=(s.left+l.x)/a.x,h=(s.top+l.y)/a.y,p=s.width/a.x,f=s.height/a.y;if(i){const g=Fi(i),v=n&&Ya(n)?Fi(n):n;let _=g,x=fj(_);for(;x&&n&&v!==_;){const w=ff(x),S=x.getBoundingClientRect(),k=Za(x),j=S.left+(x.clientLeft+parseFloat(k.paddingLeft))*w.x,C=S.top+(x.clientTop+parseFloat(k.paddingTop))*w.y;u*=w.x,h*=w.y,p*=w.x,f*=w.y,u+=j,h+=C,_=Fi(x),x=fj(_)}}return Nb({width:p,height:f,x:u,y:h})}function Rw(t,e){const r=Pw(t).scrollLeft;return e?e.left+r:Cd(Go(t)).left+r}function d3(t,e){const r=t.getBoundingClientRect(),n=r.left+e.scrollLeft-Rw(t,r),s=r.top+e.scrollTop;return{x:n,y:s}}function jhe(t){let{elements:e,rect:r,offsetParent:n,strategy:s}=t;const i=s==="fixed",a=Go(n),l=e?Nw(e.floating):!1;if(n===a||l&&i)return r;let u={scrollLeft:0,scrollTop:0},h=Lo(1);const p=Lo(0),f=Xl(n);if((f||!f&&!i)&&((ip(n)!=="body"||Wg(a))&&(u=Pw(n)),f)){const v=Cd(n);h=ff(n),p.x=v.x+n.clientLeft,p.y=v.y+n.clientTop}const g=a&&!f&&!i?d3(a,u):Lo(0);return{width:r.width*h.x,height:r.height*h.y,x:r.x*h.x-u.scrollLeft*h.x+p.x+g.x,y:r.y*h.y-u.scrollTop*h.y+p.y+g.y}}function Che(t){return Array.from(t.getClientRects())}function Nhe(t){const e=Go(t),r=Pw(t),n=t.ownerDocument.body,s=Pi(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Pi(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let a=-r.scrollLeft+Rw(t);const l=-r.scrollTop;return Za(n).direction==="rtl"&&(a+=Pi(e.clientWidth,n.clientWidth)-s),{width:s,height:i,x:a,y:l}}const OO=25;function Phe(t,e){const r=Fi(t),n=Go(t),s=r.visualViewport;let i=n.clientWidth,a=n.clientHeight,l=0,u=0;if(s){i=s.width,a=s.height;const p=H1();(!p||p&&e==="fixed")&&(l=s.offsetLeft,u=s.offsetTop)}const h=Rw(n);if(h<=0){const p=n.ownerDocument,f=p.body,g=getComputedStyle(f),v=p.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,_=Math.abs(n.clientWidth-f.clientWidth-v);_<=OO&&(i-=_)}else h<=OO&&(i+=h);return{width:i,height:a,x:l,y:u}}function Rhe(t,e){const r=Cd(t,!0,e==="fixed"),n=r.top+t.clientTop,s=r.left+t.clientLeft,i=Xl(t)?ff(t):Lo(1),a=t.clientWidth*i.x,l=t.clientHeight*i.y,u=s*i.x,h=n*i.y;return{width:a,height:l,x:u,y:h}}function MO(t,e,r){let n;if(e==="viewport")n=Phe(t,r);else if(e==="document")n=Nhe(Go(t));else if(Ya(e))n=Rhe(e,r);else{const s=u3(t);n={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Nb(n)}function h3(t,e){const r=iu(t);return r===e||!Ya(r)||zf(r)?!1:Za(r).position==="fixed"||h3(r,e)}function Ahe(t,e){const r=e.get(t);if(r)return r;let n=dg(t,[],!1).filter(l=>Ya(l)&&ip(l)!=="body"),s=null;const i=Za(t).position==="fixed";let a=i?iu(t):t;for(;Ya(a)&&!zf(a);){const l=Za(a),u=V1(a);!u&&l.position==="fixed"&&(s=null),(i?!u&&!s:!u&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Wg(a)&&!u&&h3(t,a))?n=n.filter(p=>p!==a):s=l,a=iu(a)}return e.set(t,n),n}function The(t){let{element:e,boundary:r,rootBoundary:n,strategy:s}=t;const a=[...r==="clippingAncestors"?Nw(e)?[]:Ahe(e,this._c):[].concat(r),n],l=MO(e,a[0],s);let u=l.top,h=l.right,p=l.bottom,f=l.left;for(let g=1;g<a.length;g++){const v=MO(e,a[g],s);u=Pi(v.top,u),h=su(v.right,h),p=su(v.bottom,p),f=Pi(v.left,f)}return{width:h-f,height:p-u,x:f,y:u}}function Ihe(t){const{width:e,height:r}=c3(t);return{width:e,height:r}}function Dhe(t,e,r){const n=Xl(e),s=Go(e),i=r==="fixed",a=Cd(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const u=Lo(0);function h(){u.x=Rw(s)}if(n||!n&&!i)if((ip(e)!=="body"||Wg(s))&&(l=Pw(e)),n){const v=Cd(e,!0,i,e);u.x=v.x+e.clientLeft,u.y=v.y+e.clientTop}else s&&h();i&&!n&&s&&h();const p=s&&!n&&!i?d3(s,l):Lo(0),f=a.left+l.scrollLeft-u.x-p.x,g=a.top+l.scrollTop-u.y-p.y;return{x:f,y:g,width:a.width,height:a.height}}function OS(t){return Za(t).position==="static"}function LO(t,e){if(!Xl(t)||Za(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return Go(t)===r&&(r=r.ownerDocument.body),r}function f3(t,e){const r=Fi(t);if(Nw(t))return r;if(!Xl(t)){let s=iu(t);for(;s&&!zf(s);){if(Ya(s)&&!OS(s))return s;s=iu(s)}return r}let n=LO(t,e);for(;n&&bhe(n)&&OS(n);)n=LO(n,e);return n&&zf(n)&&OS(n)&&!V1(n)?r:n||She(t)||r}const Ohe=async function(t){const e=this.getOffsetParent||f3,r=this.getDimensions,n=await r(t.floating);return{reference:Dhe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Mhe(t){return Za(t).direction==="rtl"}const Lhe={convertOffsetParentRelativeRectToViewportRelativeRect:jhe,getDocumentElement:Go,getClippingRect:The,getOffsetParent:f3,getElementRects:Ohe,getClientRects:Che,getDimensions:Ihe,getScale:ff,isElement:Ya,isRTL:Mhe};function p3(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Fhe(t,e){let r=null,n;const s=Go(t);function i(){var l;clearTimeout(n),(l=r)==null||l.disconnect(),r=null}function a(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),i();const h=t.getBoundingClientRect(),{left:p,top:f,width:g,height:v}=h;if(l||e(),!g||!v)return;const _=Wy(f),x=Wy(s.clientWidth-(p+g)),w=Wy(s.clientHeight-(f+v)),S=Wy(p),j={rootMargin:-_+"px "+-x+"px "+-w+"px "+-S+"px",threshold:Pi(0,su(1,u))||1};let C=!0;function R(A){const I=A[0].intersectionRatio;if(I!==u){if(!C)return a();I?a(!1,I):n=setTimeout(()=>{a(!1,1e-7)},1e3)}I===1&&!p3(h,t.getBoundingClientRect())&&a(),C=!1}try{r=new IntersectionObserver(R,{...j,root:s.ownerDocument})}catch{r=new IntersectionObserver(R,j)}r.observe(t)}return a(!0),i}function $he(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=n,h=q1(t),p=s||i?[...h?dg(h):[],...e?dg(e):[]]:[];p.forEach(S=>{s&&S.addEventListener("scroll",r,{passive:!0}),i&&S.addEventListener("resize",r)});const f=h&&l?Fhe(h,r):null;let g=-1,v=null;a&&(v=new ResizeObserver(S=>{let[k]=S;k&&k.target===h&&v&&e&&(v.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var j;(j=v)==null||j.observe(e)})),r()}),h&&!u&&v.observe(h),e&&v.observe(e));let _,x=u?Cd(t):null;u&&w();function w(){const S=Cd(t);x&&!p3(x,S)&&r(),x=S,_=requestAnimationFrame(w)}return r(),()=>{var S;p.forEach(k=>{s&&k.removeEventListener("scroll",r),i&&k.removeEventListener("resize",r)}),f==null||f(),(S=v)==null||S.disconnect(),v=null,u&&cancelAnimationFrame(_)}}const zhe=ghe,Uhe=vhe,Bhe=fhe,Vhe=_he,Hhe=phe,FO=hhe,qhe=yhe,Whe=(t,e,r)=>{const n=new Map,s={platform:Lhe,...r},i={...s.platform,_c:n};return dhe(t,e,{...s,platform:i})};var Ghe=typeof document<"u",Khe=function(){},b_=Ghe?y.useLayoutEffect:Khe;function Pb(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!Pb(t[n],e[n]))return!1;return!0}if(s=Object.keys(t),r=s.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,s[n]))return!1;for(n=r;n--!==0;){const i=s[n];if(!(i==="_owner"&&t.$$typeof)&&!Pb(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function m3(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function $O(t,e){const r=m3(t);return Math.round(e*r)/r}function MS(t){const e=y.useRef(t);return b_(()=>{e.current=t}),e}function Yhe(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:u,open:h}=t,[p,f]=y.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[g,v]=y.useState(n);Pb(g,n)||v(n);const[_,x]=y.useState(null),[w,S]=y.useState(null),k=y.useCallback(z=>{z!==A.current&&(A.current=z,x(z))},[]),j=y.useCallback(z=>{z!==I.current&&(I.current=z,S(z))},[]),C=i||_,R=a||w,A=y.useRef(null),I=y.useRef(null),P=y.useRef(p),T=u!=null,O=MS(u),G=MS(s),M=MS(h),U=y.useCallback(()=>{if(!A.current||!I.current)return;const z={placement:e,strategy:r,middleware:g};G.current&&(z.platform=G.current),Whe(A.current,I.current,z).then(ee=>{const L={...ee,isPositioned:M.current!==!1};V.current&&!Pb(P.current,L)&&(P.current=L,ou.flushSync(()=>{f(L)}))})},[g,e,r,G,M]);b_(()=>{h===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,f(z=>({...z,isPositioned:!1})))},[h]);const V=y.useRef(!1);b_(()=>(V.current=!0,()=>{V.current=!1}),[]),b_(()=>{if(C&&(A.current=C),R&&(I.current=R),C&&R){if(O.current)return O.current(C,R,U);U()}},[C,R,U,O,T]);const H=y.useMemo(()=>({reference:A,floating:I,setReference:k,setFloating:j}),[k,j]),Y=y.useMemo(()=>({reference:C,floating:R}),[C,R]),B=y.useMemo(()=>{const z={position:r,left:0,top:0};if(!Y.floating)return z;const ee=$O(Y.floating,p.x),L=$O(Y.floating,p.y);return l?{...z,transform:"translate("+ee+"px, "+L+"px)",...m3(Y.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:ee,top:L}},[r,l,Y.floating,p.x,p.y]);return y.useMemo(()=>({...p,update:U,refs:H,elements:Y,floatingStyles:B}),[p,U,H,Y,B])}const Zhe=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:n,padding:s}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?FO({element:n.current,padding:s}).fn(r):{}:n?FO({element:n,padding:s}).fn(r):{}}}},Jhe=(t,e)=>{const r=zhe(t);return{name:r.name,fn:r.fn,options:[t,e]}},Qhe=(t,e)=>{const r=Uhe(t);return{name:r.name,fn:r.fn,options:[t,e]}},Xhe=(t,e)=>({fn:qhe(t).fn,options:[t,e]}),efe=(t,e)=>{const r=Bhe(t);return{name:r.name,fn:r.fn,options:[t,e]}},tfe=(t,e)=>{const r=Vhe(t);return{name:r.name,fn:r.fn,options:[t,e]}},rfe=(t,e)=>{const r=Hhe(t);return{name:r.name,fn:r.fn,options:[t,e]}},nfe=(t,e)=>{const r=Zhe(t);return{name:r.name,fn:r.fn,options:[t,e]}};var sfe=Object.defineProperty,Jc=(t,e)=>sfe(t,"name",{value:e,configurable:!0}),g3="Popper",[v3,ap]=Vn(g3),[ife,y3]=v3(g3),afe=Jc(t=>{const{__scopePopper:e,children:r}=t,[n,s]=y.useState(null),[i,a]=y.useState(void 0);return o.jsx(ife,{scope:e,anchor:n,onAnchorChange:s,placementState:i,setPlacementState:a,children:r})},"Popper"),ofe="PopperAnchor",lfe=y.forwardRef(Jc(function(e,r){const{__scopePopper:n,virtualRef:s,...i}=e,a=y3(ofe,n),l=y.useRef(null),u=a.onAnchorChange,h=y.useCallback(x=>{l.current=x,x&&u(x)},[u]),p=Vt(r,h),f=y.useRef(null);y.useEffect(()=>{if(!s)return;const x=f.current;f.current=s.current,x!==f.current&&u(f.current)});const g=a.placementState&&Aw(a.placementState),v=g==null?void 0:g[0],_=g==null?void 0:g[1];return s?null:o.jsx(it.div,{"data-radix-popper-side":v,"data-radix-popper-align":_,...i,ref:p})},"PopperAnchor")),_3="PopperContent",[cfe,lke]=v3(_3),ufe=y.forwardRef(Jc(function(e,r){var pe,Ie,Ne,He,We,at,Xt;const{__scopePopper:n,side:s="bottom",sideOffset:i=0,align:a="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:h=!0,collisionBoundary:p=[],collisionPadding:f=0,sticky:g="partial",hideWhenDetached:v=!1,updatePositionStrategy:_="optimized",onPlaced:x,...w}=e,S=y3(_3,n),[k,j]=y.useState(null),C=Vt(r,j),[R,A]=y.useState(null),I=mw(R),P=(I==null?void 0:I.width)??0,T=(I==null?void 0:I.height)??0,O=s+(a!=="center"?"-"+a:""),G=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},M=Array.isArray(p)?p:[p],U=M.length>0,V={padding:G,boundary:M.filter(b3),altBoundary:U},{refs:H,floatingStyles:Y,placement:B,isPositioned:z,middlewareData:ee}=Yhe({strategy:"fixed",placement:O,whileElementsMounted:Jc((...Rt)=>$he(...Rt,{animationFrame:_==="always"}
516),"whileElementsMounted"),elements:{reference:S.anchor},middleware:[Jhe({mainAxis:i+T,alignmentAxis:l}),h&&Qhe({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?Xhe():void 0,...V}),h&&efe({...V}),tfe({...V,apply:Jc(({elements:Rt,rects:Ee,availableWidth:Et,availableHeight:Mt})=>{const{width:ot,height:De}=Ee.reference,St=Rt.floating.style;St.setProperty("--radix-popper-available-width",`${Et}px`),St.setProperty("--radix-popper-available-height",`${Mt}px`),St.setProperty("--radix-popper-anchor-width",`${ot}px`),St.setProperty("--radix-popper-anchor-height",`${De}px`)},"apply")}),R&&nfe({element:R,padding:u}),dfe({arrowWidth:P,arrowHeight:T}),v&&rfe({strategy:"referenceHidden",...V,boundary:U?V.boundary:void 0})]}),L=S.setPlacementState;Xr(()=>(L(B),()=>{L(void 0)}),[B,L]);const[$,F]=Aw(B),te=Pn(x);Xr(()=>{z&&(te==null||te())},[z,te]);const ue=(pe=ee.arrow)==null?void 0:pe.x,re=(Ie=ee.arrow)==null?void 0:Ie.y,se=((Ne=ee.arrow)==null?void 0:Ne.centerOffset)!==0,[ye,de]=y.useState();return Xr(()=>{k&&de(window.getComputedStyle(k).zIndex)},[k]),o.jsx("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...Y,transform:z?Y.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ye,"--radix-popper-transform-origin":[(He=ee.transformOrigin)==null?void 0:He.x,(We=ee.transformOrigin)==null?void 0:We.y].join(" "),...((at=ee.hide)==null?void 0:at.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(cfe,{scope:n,placedSide:$,placedAlign:F,onArrowChange:A,arrowX:ue,arrowY:re,shouldHideArrow:se,children:o.jsx(it.div,{"data-side":$,"data-align":F,...w,ref:C,style:{...w.style,animation:z?(Xt=w.style)==null?void 0:Xt.animation:"none"}})})})},"PopperContent"));function b3(t){return t!==null}Jc(b3,"isNotNull");var dfe=Jc(t=>({name:"transformOrigin",options:t,fn(e){var w,S,k;const{placement:r,rects:n,middlewareData:s}=e,a=((w=s.arrow)==null?void 0:w.centerOffset)!==0,l=a?0:t.arrowWidth,u=a?0:t.arrowHeight,[h,p]=Aw(r),f={start:"0%",center:"50%",end:"100%"}[p],g=(((S=s.arrow)==null?void 0:S.x)??0)+l/2,v=(((k=s.arrow)==null?void 0:k.y)??0)+u/2;let _="",x="";return h==="bottom"?(_=a?f:`${g}px`,x=`${-u}px`):h==="top"?(_=a?f:`${g}px`,x=`${n.floating.height+u}px`):h==="right"?(_=`${-u}px`,x=a?f:`${v}px`):h==="left"&&(_=`${n.floating.width+u}px`,x=a?f:`${v}px`),{data:{x:_,y:x}}}}),"transformOrigin");function Aw(t){const[e,r="center"]=t.split("-");return[e,r]}Jc(Aw,"getSideAndAlignFromPlacement");var W1=afe,G1=lfe,K1=ufe,hfe=Object.defineProperty,ffe=(t,e)=>hfe(t,"name",{value:e,configurable:!0});function w3(t){const e=y.useRef({value:t,previous:t});return y.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}ffe(w3,"usePrevious");var pfe=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),mfe=Object.defineProperty,mr=(t,e)=>mfe(t,"name",{value:e,configurable:!0}),gfe=[" ","Enter","ArrowUp","ArrowDown"],vfe=[" ","Enter"],Uf="Select",[Tw,Iw,yfe]=Tg(Uf),[$d,cke]=Vn(Uf,[yfe,ap]),Y1=ap(),[_fe,pu]=$d(Uf),[bfe,wfe]=$d(Uf);function x3(t){const{__scopeSelect:e,children:r,open:n,defaultOpen:s,onOpenChange:i,value:a,defaultValue:l,onValueChange:u,dir:h,name:p,autoComplete:f,disabled:g,required:v,form:_,internal_do_not_use_render:x}=t,w=Y1(e),[S,k]=y.useState(null),[j,C]=y.useState(null),[R,A]=y.useState(!1),I=du(h),[P,T]=$i({prop:n,defaultProp:s??!1,onChange:i,caller:Uf}),[O,G]=$i({prop:a,defaultProp:l,onChange:u,caller:Uf}),M=y.useRef(null),U=y.useRef(O);y.useEffect(()=>{const F=_?S==null?void 0:S.ownerDocument.getElementById(_):S==null?void 0:S.form;if(F instanceof HTMLFormElement){const te=mr(()=>G(U.current),"reset");return F.addEventListener("reset",te),()=>F.removeEventListener("reset",te)}},[_,S,G]);const V=S?!!_||!!S.closest("form"):!0,[H,Y]=y.useState(new Set),B=Bn(),z=Array.from(H).map(F=>F.props.value).join(";"),ee=y.useCallback(F=>{Y(te=>new Set(te).add(F))},[]),L=y.useCallback(F=>{Y(te=>{const ue=new Set(te);return ue.delete(F),ue})},[]),$={required:v,trigger:S,onTriggerChange:k,valueNode:j,onValueNodeChange:C,valueNodeHasChildren:R,onValueNodeHasChildrenChange:A,contentId:B,value:O,onValueChange:G,open:P,onOpenChange:T,dir:I,triggerPointerDownPosRef:M,disabled:g,name:p,autoComplete:f,form:_,nativeOptions:H,nativeSelectKey:z,isFormControl:V};return o.jsx(W1,{...w,children:o.jsx(_fe,{scope:e,...$,children:o.jsx(Tw.Provider,{scope:e,children:o.jsx(bfe,{scope:e,onNativeOptionAdd:ee,onNativeOptionRemove:L,children:j3(x)?x($):r})})})})}mr(x3,"SelectProvider");var xfe=mr(t=>{const{__scopeSelect:e,children:r,...n}=t;return o.jsx(x3,{__scopeSelect:e,...n,internal_do_not_use_render:({isFormControl:s})=>o.jsxs(o.Fragment,{children:[r,s?o.jsx(Kfe,{__scopeSelect:e}):null]})})},"Select"),Sfe="SelectTrigger",kfe=y.forwardRef(mr(function(e,r){const{__scopeSelect:n,disabled:s=!1,...i}=e,a=Y1(n),l=pu(Sfe,n),u=l.disabled||s,h=Vt(r,l.onTriggerChange),p=Iw(n),f=y.useRef("touch"),[g,v,_]=J1(w=>{const S=p().filter(C=>!C.disabled),k=S.find(C=>C.value===l.value),j=Q1(S,w,k);j!==void 0&&l.onValueChange(j.value)}),x=mr(w=>{u||(l.onOpenChange(!0),_()),w&&(l.triggerPointerDownPosRef.current={x:Math.round(w.pageX),y:Math.round(w.pageY)})},"handleOpen");return o.jsx(G1,{asChild:!0,...a,children:o.jsx(it.button,{type:"button",role:"combobox","aria-controls":l.open?l.contentId:void 0,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":Gg(l.value)?"":void 0,...i,ref:h,onClick:Xe(i.onClick,w=>
516{w.currentTarget.focus(),f.current!=="mouse"&&x(w)}),onPointerDown:Xe(i.onPointerDown,w=>{f.current=w.pointerType;const S=w.target;S.hasPointerCapture(w.pointerId)&&S.releasePointerCapture(w.pointerId),w.button===0&&w.ctrlKey===!1&&w.pointerType==="mouse"&&(x(w),w.preventDefault())}),onKeyDown:Xe(i.onKeyDown,w=>{const S=g.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&v(w.key),!(S&&w.key===" ")&&gfe.includes(w.key)&&(x(),w.preventDefault())})})})},"SelectTrigger")),Efe="SelectValue",jfe=y.forwardRef(mr(function(e,r){const{__scopeSelect:n,className:s,style:i,children:a,placeholder:l="",...u}=e,h=pu(Efe,n),{onValueNodeHasChildrenChange:p}=h,f=a!==void 0,g=Vt(r,h.onValueNodeChange);Xr(()=>{p(f)},[p,f]);const v=Gg(h.value);return o.jsx(it.span,{...u,asChild:v?!1:u.asChild,ref:g,style:{pointerEvents:"none"},children:o.jsx(y.Fragment,{children:v?l:a},v?"placeholder":"value")})},"SelectValue")),Cfe=y.forwardRef(mr(function(e,r){const{__scopeSelect:n,children:s,...i}=e;return o.jsx(it.span,{"aria-hidden":!0,...i,ref:r,children:s||"▼"})},"SelectIcon")),Nfe="SelectPortal",[Pfe,Rfe]=$d(Nfe,{forceMount:void 0}),Afe=mr(t=>{const{__scopeSelect:e,forceMount:r,...n}=t;return o.jsx(Pfe,{scope:t.__scopeSelect,forceMount:r,children:o.jsx(uw,{asChild:!0,...n})})},"SelectPortal"),Nd="SelectContent",Tfe=y.forwardRef(mr(function(e,r){const n=Rfe(Nd,e.__scopeSelect),{forceMount:s=n.forceMount,...i}=e,a=pu(Nd,e.__scopeSelect),[l,u]=y.useState();return Xr(()=>{u(new DocumentFragment)},[]),o.jsx(os,{present:s||a.open,children:({present:h})=>h?o.jsx(Ofe,{...i,ref:r}):o.jsx(Ife,{...i,fragment:l})})},"SelectContent")),Ife=y.forwardRef(mr(function(e,r){const{__scopeSelect:n,children:s,fragment:i}=e;return i?ou.createPortal(o.jsx(S3,{scope:n,children:o.jsx(Tw.Slot,{scope:n,children:o.jsx("div",{ref:r,children:s})})}),i):null},"SelectContentFragment")),Fa=10,[S3,zd]=$d(Nd),Dfe=Ga("SelectContent.RemoveScroll"),Ofe=y.forwardRef(mr(function(e,r){const{__scopeSelect:n}=e,{position:s="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:l,side:u,sideOffset:h,align:p,alignOffset:f,arrowPadding:g,collisionBoundary:v,collisionPadding:_,sticky:x,hideWhenDetached:w,avoidCollisions:S,...k}=e,j=pu(Nd,n),[C,R]=y.useState(null),[A,I]=y.useState(null),P=Vt(r,R),[T,O]=y.useState(null),[G,M]=y.useState(null),U=Iw(n),[V,H]=y.useState(!1),Y=y.useRef(!1);y.useEffect(()=>{if(C)return hw(C)},[C]),rp();const B=y.useCallback(de=>{const[pe,...Ie]=U().map(We=>We.ref.current),[Ne]=Ie.slice(-1),He=document.activeElement;for(const We of de)if(We===He||(We==null||We.scrollIntoView({block:"nearest"}),We===pe&&A&&(A.scrollTop=0),We===Ne&&A&&(A.scrollTop=A.scrollHeight),We==null||We.focus(),document.activeElement!==He))return},[U,A]),z=y.useCallback(()=>B([T,C]),[B,T,C]);y.useEffect(()=>{V&&z()},[V,z]);const{onOpenChange:ee,triggerPointerDownPosRef:L}=j;y.useEffect(()=>{if(C){let de={x:0,y:0};const pe=mr(Ne=>{var He,We;de={x:Math.abs(Math.round(Ne.pageX)-(((He=L.current)==null?void 0:He.x)??0)),y:Math.abs(Math.round(Ne.pageY)-(((We=L.current)==null?void 0:We.y)??0))}},"handlePointerMove"),Ie=mr(Ne=>{de.x<=10&&de.y<=10?Ne.preventDefault():Ne.composedPath().includes(C)||ee(!1),document.removeEventListener("pointermove",pe),L.current=null},"handlePointerUp");return L.current!==null&&(document.addEventListener("pointermove",pe),document.addEventListener("pointerup",Ie,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",pe),document.removeEventListener("pointerup",Ie,{capture:!0})}}},[C,ee,L]),y.useEffect(()=>{const de=mr(()=>ee(!1),"close");return window.addEventListener("blur",de),window.addEventListener("resize",de),()=>{window.removeEventListener("blur",de),window.removeEventListener("resize",de)}},[ee]);const[$,F]=J1(de=>{const pe=U().filter(He=>!He.disabled),Ie=pe.find(He=>He.ref.current===document.activeElement),Ne=Q1(pe,de,Ie);Ne&&setTimeout(()=>{var He;return(He=Ne.ref.current)==null?void 0:He.focus()})}),te=y.useCallback((de,pe,Ie)=>{const Ne=!Y.current&&!Ie;(j.value!==void 0&&j.value===pe||Ne)&&(O(de),Ne&&(Y.current=!0))},[j.value]),ue=y.useCallback(()=>C==null?void 0:C.focus(),[C]),re=y.useCallback((de,pe,Ie)=>{const Ne=!Y.current&&!Ie;(j.value!==void 0&&j.value===pe||Ne)&&M(de)},[j.value]),se=s==="popper"?zO:Mfe,ye=se===zO?{side:u,sideOffset:h,align:p,alignOffset:f,arrowPadding:g,collisionBoundary:v,collisionPadding:_,sticky:x,hideWhenDetached:w,avoidCollisions:S}:{};return o.jsx(S3,{scope:n,content:C,viewport:A,onViewportChange:I,itemRefCallback:te,selectedItem:T,onItemLeave:ue,itemTextRefCallback:re,focusSelectedItem:z,selectedItemText:G,position:s,isPositioned:V,searchRef:$,children:o.jsx(zg,{as:Dfe,allowPinchZoom:!0,children:o.jsx(cw,{asChild:!0,trapped:j.open,onMountAutoFocus:de=>{de.preventDefault()},onUnmountAutoFocus:Xe(i,de=>{var pe;(pe=j.trigger)==null||pe.focus({preventScroll:!0}),de.preventDefault()}),children:o.jsx(lw,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:de=>de.preventDefault(),onDismiss:()=>j.onOpenChange(!1),children:o.jsx(se,{role:"listbox",id:j.contentId,"data-state":j.open?"open":"closed",dir:j.dir,onContextMenu:de=>de.preventDefault(),...k,...ye,onPlaced:()=>H(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:Xe(k.onKeyDown,de=>{const pe=de.ctrlKey||de.altKey||de.metaKey;if(de.key==="Tab"&&de.preventDefault(),!pe&&de.key.length===1&&F(de.key),["ArrowUp","ArrowDown","Home","End"].includes(de.key)){let Ne=U().filter(He=>!He.disabled).map(He=>He.ref.current);
vendor: 5,606 bytes, line 516
516if(["ArrowUp","End"].includes(de.key)&&(Ne=Ne.slice().reverse()),["ArrowUp","ArrowDown"].includes(de.key)){const He=de.target,We=Ne.indexOf(He);Ne=Ne.slice(We+1)}setTimeout(()=>B(Ne)),de.preventDefault()}})})})})})})},"SelectContentImpl")),Mfe=y.forwardRef(mr(function(e,r){const{__scopeSelect:n,onPlaced:s,...i}=e,a=pu(Nd,n),l=zd(Nd,n),[u,h]=y.useState(null),[p,f]=y.useState(null),g=Vt(r,f),v=Iw(n),_=y.useRef(!1),x=y.useRef(!0),{viewport:w,selectedItem:S,selectedItemText:k,focusSelectedItem:j}=l,C=y.useCallback(()=>{if(a.trigger&&a.valueNode&&u&&p&&w&&S&&k){const P=a.trigger.getBoundingClientRect(),T=p.getBoundingClientRect(),O=a.valueNode.getBoundingClientRect(),G=k.getBoundingClientRect();if(a.dir!=="rtl"){const He=G.left-T.left,We=O.left-He,at=P.left-We,Xt=P.width+at,Rt=Math.max(Xt,T.width),Ee=window.innerWidth-Fa,Et=Eb(We,[Fa,Math.max(Fa,Ee-Rt)]);u.style.minWidth=Xt+"px",u.style.left=Et+"px"}else{const He=T.right-G.right,We=window.innerWidth-O.right-He,at=window.innerWidth-P.right-We,Xt=P.width+at,Rt=Math.max(Xt,T.width),Ee=window.innerWidth-Fa,Et=Eb(We,[Fa,Math.max(Fa,Ee-Rt)]);u.style.minWidth=Xt+"px",u.style.right=Et+"px"}const M=v(),U=window.innerHeight-Fa*2,V=w.scrollHeight,H=window.getComputedStyle(p),Y=parseInt(H.borderTopWidth,10),B=parseInt(H.paddingTop,10),z=parseInt(H.borderBottomWidth,10),ee=parseInt(H.paddingBottom,10),L=Y+B+V+ee+z,$=Math.min(S.offsetHeight*5,L),F=window.getComputedStyle(w),te=parseInt(F.paddingTop,10),ue=parseInt(F.paddingBottom,10),re=P.top+P.height/2-Fa,se=U-re,ye=S.offsetHeight/2,de=S.offsetTop+ye,pe=Y+B+de,Ie=L-pe;if(pe<=re){const He=M.length>0&&S===M[M.length-1].ref.current;u.style.bottom="0px";const We=p.clientHeight-w.offsetTop-w.offsetHeight,at=Math.max(se,ye+(He?ue:0)+We+z),Xt=pe+at;u.style.height=Xt+"px"}else{const He=M.length>0&&S===M[0].ref.current;u.style.top="0px";const at=Math.max(re,Y+w.offsetTop+(He?te:0)+ye)+Ie;u.style.height=at+"px",w.scrollTop=pe-re+w.offsetTop}u.style.margin=`${Fa}px 0`,u.style.minHeight=$+"px",u.style.maxHeight=U+"px",s==null||s(),requestAnimationFrame(()=>_.current=!0)}},[v,a.trigger,a.valueNode,u,p,w,S,k,a.dir,s]);Xr(()=>C(),[C]);const[R,A]=y.useState();Xr(()=>{p&&A(window.getComputedStyle(p).zIndex)},[p]);const I=y.useCallback(P=>{P&&x.current===!0&&(C(),j==null||j(),x.current=!1)},[C,j]);return o.jsx(Lfe,{scope:n,contentWrapper:u,shouldExpandOnScrollRef:_,onScrollButtonChange:I,children:o.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:o.jsx(it.div,{...i,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})},"SelectItemAlignedPosition")),zO=y.forwardRef(mr(function(e,r){const{__scopeSelect:n,align:s="start",collisionPadding:i=Fa,...a}=e,l=Y1(n);return o.jsx(K1,{...l,...a,ref:r,align:s,collisionPadding:i,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[Lfe,Z1]=$d(Nd,{}),UO="SelectViewport",Ffe=y.forwardRef(mr(function(e,r){const{__scopeSelect:n,nonce:s,...i}=e,a=zd(UO,n),l=Z1(UO,n),u=Vt(r,a.onViewportChange),h=y.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),o.jsx(Tw.Slot,{scope:n,children:o.jsx(it.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Xe(i.onScroll,p=>{const f=p.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:v}=l;if(v!=null&&v.current&&g){const _=Math.abs(h.current-f.scrollTop);if(_>0){const x=window.innerHeight-Fa*2,w=parseFloat(g.style.minHeight),S=parseFloat(g.style.height),k=Math.max(w,S);if(k<x){const j=k+_,C=Math.min(x,j),R=j-C;g.style.height=C+"px",g.style.bottom==="0px"&&(f.scrollTop=R>0?R:0,g.style.justifyContent="flex-end")}}}h.current=f.scrollTop})})})]})},"SelectViewport")),$fe="SelectGroup",[uke,dke]=$d($fe),pj="SelectItem",[zfe,k3]=$d(pj),Ufe=y.forwardRef(mr(function(e,r){const{__scopeSelect:n,value:s,disabled:i=!1,textValue:a,...l}=e,u=pu(pj,n),h=zd(pj,n),p=u.value===s,[f,g]=y.useState(a??""),[v,_]=y.useState(!1),x=Pn(C=>{var R;return(R=h.itemRefCallback)==null?void 0:R.call(h,C,s,i)}),w=Vt(r,x),S=Bn(),k=y.useRef("touch"),j=mr(()=>{i||(u.onValueChange(s),u.onOpenChange(!1))},"handleSelect");return o.jsx(zfe,{scope:n,value:s,disabled:i,textId:S,isSelected:p,onItemTextChange:y.useCallback(C=>{g(R=>R||((C==null?void 0:C.textContent)??"").trim())},[]),children:o.jsx(Tw.ItemSlot,{scope:n,value:s,disabled:i,textValue:f,children:o.jsx(it.div,{role:"option","aria-labelledby":S,"data-highlighted":v?"":void 0,"aria-selected":p&&v,"data-state":p?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...l,ref:w,onFocus:Xe(l.onFocus,()=>_(!0)),onBlur:Xe(l.onBlur,()=>_(!1)),onClick:Xe(l.onClick,()=>{k.current!=="mouse"&&j()}),onPointerUp:Xe(l.onPointerUp,()=>{k.current==="mouse"&&j()}),onPointerDown:Xe(l.onPointerDown,C=>{k.current=C.pointerType}),onPointerMove:Xe(l.onPointerMove,C=>{var R;k.current=C.pointerType,i?(R=h.onItemLeave)==null||R.call(h):k.current==="mouse"&&C.currentTarget.focu
516s({preventScroll:!0})}),onPointerLeave:Xe(l.onPointerLeave,C=>{var R;C.currentTarget===document.activeElement&&((R=h.onItemLeave)==null||R.call(h))}),onKeyDown:Xe(l.onKeyDown,C=>{var A;i||C.target!==C.currentTarget||((A=h.searchRef)==null?void 0:A.current)!==""&&C.key===" "||(vfe.includes(C.key)&&j(),C.key===" "&&C.preventDefault())})})})})},"SelectItem")),Gy="SelectItemText",Bfe=y.forwardRef(mr(function(e,r){const{__scopeSelect:n,className:s,style:i,...a}=e,l=pu(Gy,n),u=zd(Gy,n),h=k3(Gy,n),p=wfe(Gy,n),[f,g]=y.useState(null),v=Pn(j=>{var C;return(C=u.itemTextRefCallback)==null?void 0:C.call(u,j,h.value,h.disabled)}),_=Vt(r,g,h.onItemTextChange,v),x=f==null?void 0:f.textContent,w=y.useMemo(()=>o.jsx("option",{value:h.value,disabled:h.disabled,children:x},h.value),[h.disabled,h.value,x]),{onNativeOptionAdd:S,onNativeOptionRemove:k}=p;return Xr(()=>(S(w),()=>k(w)),[S,k,w]),o.jsxs(o.Fragment,{children:[o.jsx(it.span,{id:h.textId,...a,ref:_}),h.isSelected&&l.valueNode&&!l.valueNodeHasChildren&&!Gg(l.value)?ou.createPortal(a.children,l.valueNode):null]})},"SelectItemText")),Vfe="SelectItemIndicator",Hfe=y.forwardRef(mr(function(e,r){const{__scopeSelect:n,...s}=e;return k3(Vfe,n).isSelected?o.jsx(it.span,{"aria-hidden":!0,...s,ref:r}):null},"SelectItemIndicator")),BO="SelectScrollUpButton",qfe=y.forwardRef(mr(function(e,r){const n=zd(BO,e.__scopeSelect),s=Z1(BO,e.__scopeSelect),[i,a]=y.useState(!1),l=Vt(r,s.onScrollButtonChange);return Xr(()=>{if(n.viewport&&n.isPositioned){let u=function(){const p=h.scrollTop>0;a(p)};mr(u,"handleScroll");const h=n.viewport;return u(),h.addEventListener("scroll",u),()=>h.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),i?o.jsx(E3,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:h}=n;u&&h&&(u.scrollTop=u.scrollTop-h.offsetHeight)}}):null},"SelectScrollUpButton")),VO="SelectScrollDownButton",Wfe=y.forwardRef(mr(function(e,r){const n=zd(VO,e.__scopeSelect),s=Z1(VO,e.__scopeSelect),[i,a]=y.useState(!1),l=Vt(r,s.onScrollButtonChange);return Xr(()=>{if(n.viewport&&n.isPositioned){let u=function(){const p=h.scrollHeight-h.clientHeight,f=Math.ceil(h.scrollTop)<p;a(f)};mr(u,"handleScroll");const h=n.viewport;return u(),h.addEventListener("scroll",u),()=>h.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),i?o.jsx(E3,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:h}=n;u&&h&&(u.scrollTop=u.scrollTop+h.offsetHeight)}}):null},"SelectScrollDownButton")),E3=y.forwardRef(mr(function(e,r){const{__scopeSelect:n,onAutoScroll:s,...i}=e,a=zd("SelectScrollButton",n),l=y.useRef(null),u=Iw(n),h=y.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return y.useEffect(()=>()=>h(),[h]),Xr(()=>{var f;const p=u().find(g=>g.ref.current===document.activeElement);(f=p==null?void 0:p.ref.current)==null||f.scrollIntoView({block:"nearest"})},[u]),o.jsx(it.div,{"aria-hidden":!0,...i,ref:r,style:{flexShrink:0,...i.style},onPointerDown:Xe(i.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(s,50))}),onPointerMove:Xe(i.onPointerMove,()=>{var p;(p=a.onItemLeave)==null||p.call(a),l.current===null&&(l.current=window.setInterval(s,50))}),onPointerLeave:Xe(i.onPointerLeave,()=>{h()})})},"SelectScrollButtonImpl")),Gfe="SelectBubbleInput",Kfe=y.forwardRef(mr(function({__scopeSelect:e,...r},n){const s=pu(Gfe,e),{value:i,onValueChange:a,required:l,disabled:u,name:h,autoComplete:p,form:f}=s,{nativeOptions:g,nativeSelectKey:v}=s,_=y.useRef(null),x=Vt(n,_),w=i??"",S=w3(w),k=Array.from(g).some(j=>(j.props.value??"")==="");return y.useEffect(()=>{const j=_.current;if(!j)return;const C=window.HTMLSelectElement.prototype,A=Object.getOwnPropertyDescriptor(C,"value").set;if(S!==w&&A){const I=new Event("change",{bubbles:!0});A.call(j,w),j.dispatchEvent(I)}},[S,w]),o.jsxs(it.select,{"aria-hidden":!0,required:l,tabIndex:-1,name:h,autoComplete:p,disabled:u,form:f,onChange:j=>a(j.target.value),...r,style:{...pfe,...r.style},ref:x,defaultValue:w,children:[Gg(i)&&!k?o.jsx("option",{value:""}):null,Array.from(g)]},v)},"SelectBubbleInput"));function j3(t){return typeof t=="function"}mr(j3,"isFunction");function Gg(t){return t===""||t===void 0}mr(Gg,"shouldShowPlaceholder");function J1(t){const e=Pn(t),r=y.useRef(""),n=y.useRef(0),s=y.useCallback(a=>
vendor: 4,084 bytes, line 516
516{const l=r.current+a;e(l),mr((function u(h){r.current=h,window.clearTimeout(n.current),h!==""&&(n.current=window.setTimeout(()=>u(""),1e3))}),"updateSearch")(l)},[e]),i=y.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,i]}mr(J1,"useTypeaheadSearch");function Q1(t,e,r){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=r?t.indexOf(r):-1;let a=C3(t,Math.max(i,0));s.length===1&&(a=a.filter(h=>h!==r));const u=a.find(h=>h.textValue.toLowerCase().startsWith(s.toLowerCase()));return u!==r?u:void 0}mr(Q1,"findNextItem");function C3(t,e){return t.map((r,n)=>t[(e+n)%t.length])}mr(C3,"wrapArray");function Bf({...t}){return o.jsx(xfe,{"data-slot":"select",...t})}function Vf({...t}){return o.jsx(jfe,{"data-slot":"select-value",...t})}function Hf({className:t,size:e="default",children:r,...n}){return o.jsxs(kfe,{"data-slot":"select-trigger","data-size":e,className:ke("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n,children:[r,o.jsx(Cfe,{asChild:!0,children:o.jsx(Od,{className:"size-4 opacity-50"})})]})}function qf({className:t,children:e,position:r="popper",...n}){return o.jsx(Afe,{children:o.jsxs(Tfe,{"data-slot":"select-content",className:ke("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...n,children:[o.jsx(Yfe,{}),o.jsx(Ffe,{className:ke("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:e}),o.jsx(Zfe,{})]})})}function Ul({className:t,children:e,...r}){return o.jsxs(Ufe,{"data-slot":"select-item",className:ke("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...r,children:[o.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:o.jsx(Hfe,{children:o.jsx(Vl,{className:"size-4"})})}),o.jsx(Bfe,{children:e})]})}function Yfe({className:t,...e}){return o.jsx(qfe,{"data-slot":"select-scroll-up-button",className:ke("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(vL,{className:"size-4"})})}function Zfe({className:t,...e}){return o.jsx(Wfe,{"data-slot":"select-scroll-down-button",className:ke("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(Od,{className:"size-4"})})}
516const Jfe=Jb("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function _n({className:t,variant:e,asChild:r=!1,...n}){const s=r?yC:"span";return o.jsx(s,{"data-slot":"badge",className:ke(Jfe({variant:e}),t),...n})}function Kg(t){if(!t||t.trim()==="")return{isValid:!1,error:"ORCID iD cannot be empty"};const e=t.trim();let r=e;const n=/(?:https?:\/\/)?(?:www\.)?orcid\.org\/(.+)/i,s=e.match(n);s&&(r=s[1]),r=r.replace(/\s/g,"");const i=/^(\d{4})-?(\d{4})-?(\d{4})-?(\d{3}[\dX])$/i,a=r.match(i);if(!a)return{isValid:!1,error:"Invalid ORCID iD format. Expected format: XXXX-XXXX-XXXX-XXXX"};const l=`${a[1]}-${a[2]}-${a[3]}-${a[4]}`;return Qfe(l)?{isValid:!0,cleanORCID:l}:{isValid:!1,error:"Invalid ORCID iD checksum. Please verify the ORCID iD is correct."}}function Qfe(t){const e=t.replace(/-/g,"").toUpperCase();let r=0;for(let a=0;a<15;a++){const l=parseInt(e[a],10);r=(r+l)*2}const s=(12-r%11)%11;return(s===10?"X":s.toString())===e[15]}async function Ky(t,e){const{data:{session:r}}=await Ye.auth.getSession();if(!r)throw new Error("Sign in to manage publications.");const n=await fetch(`https://api.3dtrees.earth/publications${t}`,{method:e===void 0?"GET":"POST",headers:{Authorization:`Bearer ${r.access_token}`,"Content-Type":"application/json"},body:e===void 0?void 0:JSON.stringify(e)});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(typeof s.detail=="string"?s.detail:"Publication service is unavailable. Your request may already be saved; check Publications before trying again.")}return n.json()}const hg={capabilities:()=>Ky("/capabilities"),list:(t=0)=>Ky(`?offset=${t}`),create:(t,e,r)=>Ky("",{request_id:t,dataset_ids:e.map(n=>n.id).sort((n,s)=>n-s),title:r.title.trim(),description:r.description.trim(),authors:r.authors.map(n=>{var s;return{given_name:n.givenName.trim(),family_name:n.familyName.trim(),affiliation:n.affiliation.trim(),orcid:((s=Kg(n.orcid).cleanORCID)==null?void 0:s.toUpperCase())??n.orcid.trim()}}),license:e[0].license,publication_date:r.publicationDate,files_access:r.filesAccess,embargo_until:r.embargoUntil||null,rights_confirmed:r.rightsConfirmed}),retry:t=>Ky(`/${encodeURIComponent(t)}/retry`,{})},Xfe={queued:"Queued",preparing:"Preparing export",transferring:"Transferring raw files",verifying:"Verifying files",submitting:"Submitting for review",in_review:"Awaiting FreiDATA review",published:"Published",failed:"Export stopped",needs_attention:"Needs attention"},epe={published:"border-green-200 bg-green-50 text-green-700",in_review:"border-blue-200 bg-blue-50 text-blue-700",failed:"border-red-200 bg-red-50 text-red-700",needs_attention:"border-amber-200 bg-amber-50 text-amber-800"},tpe={authority_changed:"Your Admin access or terms acceptance changed. Restore access before retrying.",provider_limit:"This selection exceeds the configured FreiDATA file or size limit. Contact the project team.",source_changed:"A source file changed. This frozen request cannot safely continue; contact the project team.",checksum_mismatch:"A transferred file failed verification. Contact the project team before continuing.",unconfirmed_operation:"The remote operation has not been confirmed. Check again to reconcile it safely.",galaxy_import_failed:"Galaxy could not read a raw file. Retry after the source service recovers.",galaxy_export_failed:"Galaxy could not export a file. Retry will preserve completed files.",partial_export:"A partial remote file needs an operator check. 
516Completed files have been retained.",provider_rejected:"FreiDATA or Galaxy rejected the request. The project team may need to correct the service configuration.",review_declined:"FreiDATA declined the review. Contact the project team to resolve the feedback.",review_cancelled:"The FreiDATA review was cancelled. Contact the project team.",review_expired:"The FreiDATA review expired. Contact the project team."};function rpe({userId:t,onChoose:e}){var f,g,v,_,x;const[r,n]=y.useState(0),[s,i]=y.useState(null),[a,l]=y.useState(""),u=lu(),h=fr({queryKey:["publications",t,r],queryFn:()=>hg.list(r),refetchInterval:15e3});async function p(w){i(w),l("");try{await hg.retry(w),await u.invalidateQueries({queryKey:["publications",t]})}catch(S){l(S instanceof Error?S.message:"Could not retry publication.")}finally{i(null)}}return o.jsxs("div",{className:"space-y-4",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Exports continue after you leave this page. FreiDATA reviews each publication before a DOI is confirmed."}),h.isPending&&o.jsx("p",{role:"status",children:"Loading publications…"}),h.isError&&o.jsxs("div",{role:"alert",children:[h.error.message," ",o.jsx(we,{variant:"outline",onClick:()=>void h.refetch(),children:"Try again"})]}),a&&o.jsx("p",{role:"alert",children:a}),((f=h.data)==null?void 0:f.items.length)===0&&o.jsx(lj,{icon:o.jsx(Yb,{className:"size-5"}),title:"Get a citable DOI for your data",description:"Publish a collection or a set of datasets to FreiDATA. Each publication gets one DOI that others can cite.",action:o.jsx(we,{onClick:e,children:"Choose what to publish"})}),(g=h.data)==null?void 0:g.items.map(w=>o.jsxs("article",{className:"ph-mask space-y-3 rounded-lg border bg-background p-5",children:[o.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[o.jsx("h3",{className:"font-semibold",children:w.title}),o.jsx(_n,{role:"status",variant:"outline",className:ke(epe[w.state]??"border-slate-200 bg-slate-50 text-slate-700"),children:Xfe[w.state]??w.state})]}),w.state==="published"&&w.doi&&o.jsx(VU,{doi:w.doi,title:w.title}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:[w.dataset_ids.length," datasets · ",w.verified_files," of ",w.file_count," raw files verified · Requested ",new Date(w.created_at).toLocaleDateString(),w.published_at&&` · Published ${new Date(w.published_at).toLocaleDateString()}`]}),w.state==="in_review"&&o.jsxs("p",{className:"text-sm text-muted-foreground",children:["FreiDATA is reviewing this publication. We'll email you when the DOI is live.",w.last_checked_at&&` Last checked ${new Date(w.last_checked_at).toLocaleString()}.`]}),w.error_code&&o.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-300",children:tpe[w.error_code]??"The export needs a service check. Completed files and the draft are retained."}),w.citation&&o.jsx("p",{className:"ph-mask break-words rounded-md bg-muted p-3 text-sm",children:w.citation}),o.jsxs("div",{className:"flex gap-2",children:[w.record_url&&o.jsx(we,{asChild:!0,variant:"outline",children:o.jsx("a",{href:w.record_url,target:"_blank",rel:"noopener noreferrer",children:"View on FreiDATA"})}),w.citation&&o.jsx(we,{variant:"outline",onClick:()=>void navigator.clipboard.writeText(w.citation).catch(()=>l("Could not copy the citation. Select the citation text to copy it.")),children:"Copy citation"}),w.can_retry&&o.jsx(we,{variant:"outline",disabled:s!==null,onClick:()=>void p(w.id),children:s===w.id?"Checking…":w.state==="needs_attention"?"Check again":"Retry export"})]})]},w.id)),(r>0||((v=h.data)==null?void 0:v.next_offset)!==null&&((_=h.data)==null?void 0:_.next_offset)!==void 0)&&o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{variant:"outline",disabled:r===0,onClick:()=>n(Math.max(0,r-50)),children:"Previous"}),o.jsx(we,{variant:"outline",disabled:((x=h.data)==null?void 0:x.next_offset)==null,onClick:()=>n(h.data.next_offset),children:"Next"})]})]})}function npe(t,e){const r=new Map;for(const i of t){const a=i.collectionId??null;r.set(a,[...r.get(a)??[],i])}const n=e.filter(i=>r.has(i.id)).map(i=>({collection:i,datasets:r.get(i.id)})),s=[...r.entries()].filter(([i])=>i===null||!e.some(a=>a.id===i)).flatMap(([,i])=>i);return s.length>0&&n.push({collection:null,datasets:s}),n}function spe(t,e){if(t.length===0)return null;const r=new Set(t),n=e.find(s=>
516{var i;return((i=s.collection)==null?void 0:i.publishable)&&s.collection.activeDatasetCount===s.datasets.length&&s.datasets.length===r.size&&s.datasets.every(a=>r.has(a.id))});return n!=null&&n.collection?{collectionId:n.collection.id}:{datasetIds:t}}function ipe({open:t,datasets:e,collections:r,onCancel:n,onContinue:s}){const[i,a]=y.useState([]),[l,u]=y.useState(""),h=y.useMemo(()=>npe(e,r),[e,r]),p=l.trim().toLowerCase(),f=p?h.map(S=>{var k;return(k=S.collection)!=null&&k.name.toLowerCase().includes(p)?S:{...S,datasets:S.datasets.filter(j=>j.title.toLowerCase().includes(p)||String(j.id).includes(p))}}).filter(S=>S.datasets.length>0):h,g=spe(i,h),v=g&&"collectionId"in g?r.find(S=>S.id===g.collectionId):void 0,_=new Set(f.flatMap(S=>S.datasets.map(k=>k.id))),x=i.filter(S=>!_.has(S)).length,w=(S,k)=>a(j=>k?[...new Set([...j,...S])]:j.filter(C=>!S.includes(C)));return o.jsx(hi,{open:t,onOpenChange:S=>!S&&n(),children:o.jsxs($s,{className:"ph-mask flex max-h-[85vh] flex-col sm:max-w-xl",children:[o.jsxs(zs,{children:[o.jsx(Us,{children:"Publish with DOI"}),o.jsx(Mi,{children:"Tick a collection to publish all its datasets, or tick single datasets. Everything you tick becomes one FreiDATA publication with one citable DOI."})]}),o.jsx(Nt,{"aria-label":"Filter datasets and collections",placeholder:"Filter by name or ID...",className:"shrink-0",value:l,onChange:S=>u(S.target.value)}),o.jsx("div",{className:"-mx-1 min-h-0 flex-1 overflow-y-auto px-1","data-testid":"publication-picker-list",children:f.length===0?o.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:p?"No datasets you can publish match this filter.":"You have no active datasets that you can publish yet."}):f.map(S=>{var P,T;const j=(h.find(O=>{var G,M;return((G=O.collection)==null?void 0:G.id)===((M=S.collection)==null?void 0:M.id)})??S).datasets.map(O=>O.id),C=j.filter(O=>i.includes(O)).length,R=C===0?!1:C===j.length?!0:"indeterminate",A=((P=S.collection)==null?void 0:P.name)??"Datasets without a collection",I=`publish-group-${((T=S.collection)==null?void 0:T.id)??"none"}`;return o.jsxs("div",{className:"border-b py-2 last:border-b-0",children:[o.jsxs("label",{htmlFor:I,className:"flex cursor-pointer items-center gap-3 rounded-md px-2 py-1.5 hover:bg-muted/50",children:[o.jsx(ya,{id:I,"aria-label":`Select all in ${A}`,checked:R,onCheckedChange:O=>w(j,O===!0)}),o.jsx(fC,{className:"size-4 shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:A}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[j.length," ",j.length===1?"dataset":"datasets"]})]}),S.datasets.map(O=>{const G=`publish-dataset-${O.id}`;return o.jsxs("label",{htmlFor:G,className:"flex cursor-pointer items-center gap-3 rounded-md py-1.5 pr-2 pl-9 hover:bg-muted/50",children:[o.jsx(ya,{id:G,"aria-label":`Select ${O.title}`,checked:i.includes(O.id),onCheckedChange:M=>w([O.id],M===!0)}),o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:O.title}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:["ID ",O.id]})]},O.id)})]},I)})}),o.jsxs(Mo,{className:"items-center gap-2 sm:justify-between",children:[o.jsxs("p",{className:"text-sm text-muted-foreground",role:"status",children:[i.length===0?"Nothing selected yet":v?`Collection “${v.name}” · ${i.length} ${i.length===1?"dataset":"datasets"}`:`${i.length} ${i.length===1?"dataset":"datasets"} · one DOI`,x>0&&` · ${x} hidden by the filter`]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{variant:"outline",onClick:n,children:"Cancel"}),o.jsx(we,{disabled:!g,onClick:()=>g&&s(g),children:"Continue"})]})]})]})})}const Jl=y.forwardRef(({className:t,...e},r)=>o.jsx("textarea",{"data-slot":"textarea",className:ke("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...e}));Jl.displayName="Textarea";const ape=new Set(["title","description","acquisition_date","platform","sensor","scan_pattern","preprocessing_steps","coordinate_accuracy","coordinate_reference","point_attributes_description"]);function N3(t){const e=t==="admin",r=e||t==="editor",n=r||t==="reader";return{read:n,download:n,editMetadata:r,manageLifecycle:e,manageFiles:e,manageProcessing:e,managePublication:e,makeRightsWarranty:e,manageMembership:e,manageAccess:e}}function ope(t,e){return e?t:Object.fromEntries(Object.entries(t).filter(([r])=>ape.has(r)))}function LS(t){return t===null?"Size not yet verified":t>=1e9?`${(t/1e9).toFixed(2)} GB`:`${(t/1e6).toFixed(1)} MB`}function lpe(t){const e=[];t.length||e.push("Select at least one dataset.");for(const n of t)N3(n.role).managePublication||e.push(`${n.title}: an Admin must request publication.`),n.rawFiles||e.push(`${n.title}: no raw files are available.`),(n.bytes===null||!Number.isFinite(n.bytes)||n.bytes<=0)&&e.push(`${n.title}: raw-file sizes must be verified before publication.`),n.license||e.push(`${n.title}: confirm its license first.`);return new Set(t.map(n=>
516n.license).filter(Boolean)).size>1&&e.push("These datasets have different licenses. Their publication needs a rights review."),e}function cpe(t){const e=[];return t.title.trim()||e.push("Enter a publication title."),t.description.trim()||e.push("Add a description of the data and its acquisition."),t.authors.length||e.push("Add at least one author."),t.authors.forEach((r,n)=>{r.familyName.trim()||e.push(`Enter a family name for author ${n+1}.`),r.orcid.trim()&&!Kg(r.orcid).isValid&&e.push(`Check the ORCID for author ${n+1}.`)}),(!t.publicationDate||t.publicationDate>new Date().toISOString().slice(0,10))&&e.push("Choose today or an earlier publication date."),t.embargoUntil&&(t.filesAccess!=="restricted"||t.embargoUntil<=new Date().toISOString().slice(0,10))&&e.push("An embargo requires restricted files and a future end date."),t.rightsConfirmed||e.push("Confirm your authority to publish these files."),e}function upe({datasets:t,initialAuthors:e,initialDescription:r="",onClose:n,onSubmit:s,capabilities:i,availabilityError:a}){var I,P;const l=new Set(t.map(T=>T.collection)),[u,h]=y.useState({title:t.length===1?t[0].title:l.size===1?((I=t[0])==null?void 0:I.collection)??"":"",description:r,authors:e.map(T=>({...T})),rightsConfirmed:!1,publicationDate:new Date().toISOString().slice(0,10),filesAccess:"public",embargoUntil:""}),p=y.useRef(crypto.randomUUID()),[f,g]=y.useState([]),v=y.useRef(null),_=y.useRef(null);y.useEffect(()=>{var T;f.length&&((T=v.current)==null||T.focus({preventScroll:!0}),_.current&&(_.current.scrollTop=_.current.scrollHeight))},[f]);const[x,w]=y.useState(!1),S=lpe(t),k=t.reduce((T,O)=>T+O.rawFiles,0),j=t.some(T=>T.bytes===null)?null:t.reduce((T,O)=>T+(O.bytes??0),0);i&&(k+2>i.max_files||(j??0)>=i.max_bytes)&&S.push(`This export exceeds the configured limit of ${i.max_files} files (including metadata and citation) or ${LS(i.max_bytes)}.`);function C(T,O){h(G=>({...G,authors:G.authors.map(M=>M.id===T?{...M,...O}:M)}))}function R(T,O){h(G=>{const M=[...G.authors];return[M[T],M[T+O]]=[M[T+O],M[T]],{...G,authors:M}})}async function A(T){if(T.preventDefault(),!s)return;const O=[...S,...cpe(u)];if(g(O),!O.length){w(!0);try{await s(u,p.current)}catch(G){g([G instanceof Error?G.message:"Your request could not be confirmed. Check Publications or retry with this form."])}finally{w(!1)}}}return o.jsx(hi,{open:!0,onOpenChange:T=>{!T&&!x&&n()},children:o.jsxs($s,{className:"ph-mask flex h-[min(92dvh,850px)] flex-col gap-0 overflow-hidden p-0 sm:max-w-3xl",onInteractOutside:T=>T.preventDefault(),children:[o.jsxs(zs,{className:"shrink-0 border-b px-6 py-5 text-left",children:[o.jsx(Us,{children:"Publish datasets to FreiDATA"}),o.jsx(Mi,{children:"Create one citable publication from the selected raw datasets."})]}),o.jsxs("form",{onSubmit:T=>void A(T),className:"flex min-h-0 flex-1 flex-col",children:[o.jsx("fieldset",{disabled:x,className:"contents",children:o.jsxs("div",{ref:_,className:"min-h-0 flex-1 space-y-7 overflow-y-auto px-6 py-5",children:[o.jsxs("section",{"aria-labelledby":"selected-datasets-heading",children:[o.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2",children:[o.jsxs("h3",{id:"selected-datasets-heading",className:"font-semibold",children:["Selected datasets (",t.length,")"]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[k," raw ",k===1?"file":"files"," ·"," ",LS(j)]})]}),o.jsx("div",{className:"max-h-40 divide-y overflow-auto rounded-lg border",children:t.map(T=>o.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2 text-sm",children:[o.jsx("span",{className:"min-w-0 break-words",children:T.title}),o.jsx("span",{className:"shrink-0 text-muted-foreground",children:LS(T.bytes)})]},T.id))}),o.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Original raw files plus metadata and citation files. Later collection edits will not change this publication."}),S.length>0&&o.jsx("ul",{className:"mt-3 space-y-1 rounded-md bg-amber-50 p-3 text-sm text-amber-900",children:S.map(T=>o.jsx("li",{children:T},T))})]}),o.jsxs("section",{className:"space-y-4","aria-label":"Publication details",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"publication-title",children:"Publication title"}),o.jsx(Nt,{id:"publication-title",maxLength:250,value:u.title,onChange:T=>h({...u,title:T.target.value}),placeholder:"Give this set of data a descriptive title"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"publication-description",children:"Description"}),o.jsx(Jl,{id:"publication-description",maxLength:2e4,rows:4,value:u.description,onChange:T=>h({...u,description:T.target.value}),placeholder:"Describe the study sites, acquisition methods, and what these files contain."})]})]}),o.jsxs("section",{className:"grid gap-4 sm:grid-cols-2","aria-label":"Publication access",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"publication-date",children:"Publication date"}),o.jsx(Nt,{id:"publication-date",type:"date",value:u.publicationDate,max:new Date().toISOString().slice(0,10),onChange:T=>h({...u,publicationDate:T.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"publication-access",children:"File access on FreiDATA"}),o.jsxs("select",{id:"publication-access",className:"w-full rounded-md border bg-background p-2",value:u.filesAccess,onChange:T=>h({...u,filesAccess:T.target.value,embargoUntil:""}),children:[o.jsx("option",{value:"public",children:"Public files"}),o.jsx("option",{value:"restricted",children:"Restricted files"})]})]}),u.filesAccess==="restricted"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"publication-embargo",children:"Embargo end (optional)"}),o.jsx(Nt,{id:"publication-embargo",type:"date",value:u.embargoUntil,onCh
516ange:T=>h({...u,embargoUntil:T.target.value})})]}),o.jsxs("p",{className:"text-xs text-muted-foreground sm:col-span-2",children:["The published title, authors, description and DOI will be public. Restricted files remain restricted unless an embargo end date is set. Publisher:"," ",(i==null?void 0:i.publisher)||"configured by the project team","."]})]}),o.jsxs("section",{"aria-labelledby":"publication-authors-heading",children:[o.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[o.jsx("h3",{id:"publication-authors-heading",className:"font-semibold",children:"Authors"}),o.jsxs(we,{type:"button",variant:"outline",size:"sm",onClick:()=>h({...u,authors:[...u.authors,{id:crypto.randomUUID(),name:"",givenName:"",familyName:"",affiliation:"",orcid:""}]}),children:[o.jsx(Zc,{}),"Add author"]})]}),o.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Review the author list and citation order. Authors do not need a 3Dtrees account."}),o.jsx("div",{className:"space-y-3",children:u.authors.map((T,O)=>o.jsxs("fieldset",{className:"rounded-lg border p-3",children:[o.jsxs("legend",{className:"px-1 text-xs font-medium",children:["Author ",O+1]}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ft,{htmlFor:`name-${T.id}`,children:"Given names"}),o.jsx(Nt,{id:`name-${T.id}`,maxLength:200,value:T.givenName,onChange:G=>C(T.id,{givenName:G.target.value})})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ft,{htmlFor:`family-${T.id}`,children:"Family name"}),o.jsx(Nt,{id:`family-${T.id}`,maxLength:200,value:T.familyName,onChange:G=>C(T.id,{familyName:G.target.value})})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs(ft,{htmlFor:`affiliation-${T.id}`,children:["Affiliation"," ",o.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),o.jsx(Nt,{id:`affiliation-${T.id}`,maxLength:500,value:T.affiliation,onChange:G=>C(T.id,{affiliation:G.target.value})})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs(ft,{htmlFor:`orcid-${T.id}`,children:["ORCID"," ",o.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),o.jsx(Nt,{id:`orcid-${T.id}`,value:T.orcid,onChange:G=>C(T.id,{orcid:G.target.value}),placeholder:"0000-0000-0000-0000"})]}),o.jsxs("div",{className:"flex items-end justify-end gap-1",children:[o.jsx(we,{type:"button",variant:"ghost",size:"icon","aria-label":`Move author ${O+1} up`,disabled:O===0,onClick:()=>R(O,-1),children:o.jsx(Hq,{})}),o.jsx(we,{type:"button",variant:"ghost",size:"icon","aria-label":`Move author ${O+1} down`,disabled:O===u.authors.length-1,onClick:()=>R(O,1),children:o.jsx($q,{})}),o.jsx(we,{type:"button",variant:"ghost",size:"icon","aria-label":`Remove author ${O+1}`,onClick:()=>h({...u,authors:u.authors.filter(G=>G.id!==T.id)}),children:o.jsx(pC,{})})]})]})]},T.id))})]}),o.jsxs("section",{className:"space-y-3 rounded-lg border bg-muted/30 p-4","aria-label":"Rights and publication",children:[o.jsxs("div",{className:"flex items-center gap-2 font-medium",children:[o.jsx(Yb,{className:"size-4"}),"One publication · one DOI"]}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["License: ",((P=t[0])==null?void 0:P.license)??"Not confirmed",". Publication preserves a fixed copy on FreiDATA. Making data visible on 3Dtrees is a separate setting."]}),t.some(T=>T.sourceDoi)&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"Existing source DOIs will remain linked as provenance."}),o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(ya,{id:"publication-rights",className:"mt-0.5",checked:u.rightsConfirmed,onCheckedChange:T=>h({...u,rightsConfirmed:T===!0})}),o.jsx(ft,{htmlFor:"publication-rights",className:"block text-sm leading-relaxed font-normal",children:"I am authorized to publish every selected file under the stated license, and have confirmed the authors and their approval."})]})]}),f.length>0&&o.jsx("ul",{ref:v,tabIndex:-1,role:"alert",className:"space-y-1 rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-800",children:f.map(T=>o.jsx("li",{children:T},T))})]})}),o.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-between gap-3 border-t bg-background px-6 py-4",children:[o.jsx("p",{className:"max-w-xs text-xs text-muted-foreground",children:a?"Could not check publication availability. Close and reopen this form to try again.":i?i.enabled?"Files transfer in the background, then go to FreiDATA community review. Track your request in Publications.":"Publication export is not configured. Contact the project team. Form edits are not saved.":"Checking publication availability…"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{type:"button",variant:"outline",disabled:x,onClick:n,children:"Cancel"}),o.jsx(we,{type:"submit",disabled:!s||!(i!=null&&i.enabled)||x||S.length>0,children:x?"Saving request…":"Submit publication"})]})]})]})]})})}const Yg=6e4;function P3(t,{hasPlatformDatasetAdmin:e,showingPlatformAdminDatasets:r}){const n=N3(r?"admin":t);return!e||n.manageAccess?n:{...n,manageAccess:!0}}const sm=500;async function dpe(t,e=Ye){if(t.length===0)return[];const{data:r,error:n}=await e.rpc("get_dataset_admin_emails",{p_dataset_ids:t});if(n)throw n;return r??[]}async function Zg(t,e,r=Ye){if(t.length===0&&e.length===0)return[];const n=[],s=Math.max(Math.ceil(t.length/sm),Math.ceil(e.length/sm));for(let i=0;i<s;i+=1){const a=i*sm,{data:l,error:u}=await r.rpc("get_my_account_resource_roles_v1",{p_dataset_ids:t.slice(a,a+sm),p_collection_ids:e.slice(a,a+sm)});if(u)throw u;n.push(...l??[])}return n}function hpe(t){const e=new Map,r=new Map;for(const n of t)n.resource_kind==="dataset"?e.set(n.resource_id,n.effective_role):r.set(n.resource_id,n.effective_role);return{datasetAccessRoleById:e,collectionAccessRoleById:r}}function fpe({userId:t,datasetIds:e,collections:r,hasPlatformDatasetAdmin:n,showingPlatformAdminDatasets:s}){const i=y.useMemo(()=>r.map(f=>f.id),[r]),a=fr({queryKey:["account-resource-roles",t,e,i],enabled:!!t&&(e.length>0||i.length>0),queryFn:()=>
516Zg(e,i),refetchInterval:Yg,refetchIntervalInBackground:!1}),{datasetAccessRoleById:l,collectionAccessRoleById:u}=y.useMemo(()=>hpe(a.data??[]),[a.data]),h=y.useMemo(()=>Object.fromEntries(r.map(f=>[f.uuid,{name:f.name,canManageAccess:!f.archived&&P3(u.get(f.id)??null,{hasPlatformDatasetAdmin:n,showingPlatformAdminDatasets:s}).manageAccess}])),[u,r,n,s]),p=y.useMemo(()=>s?r.filter(f=>!f.archived):r.filter(f=>!f.archived&&u.get(f.id)==="admin"),[u,r,s]);return{rolesQuery:a,datasetAccessRoleById:l,collectionAccessRoleById:u,manageAccessCollections:h,selectableCollections:p}}async function ppe(t,e,r){const n=await Zg([],[t]);if(!r&&!n.some(u=>u.resource_kind==="collection"&&u.resource_id===t&&u.effective_role==="admin"))throw new Error("An Admin of this collection must request publication.");const{data:s,error:i}=await Ye.from("collections").select("id").eq("id",t).eq("archived",!1).maybeSingle();if(i||!s)throw new Error("This collection is no longer available for publication.");const a=[],l=500;for(let u=0;;u+=l){const{data:h,error:p}=await Ye.from("datasets").select("id").eq("collection_id",t).eq("archived",!1).order("id").range(u,u+l-1);if(p)throw new Error("Could not load the complete collection. Please try again.");if(a.push(...h.map(f=>f.id)),h.length<l)break}if(!a.length)throw new Error("This collection has no active datasets to publish.");return R3(a,e,r)}async function R3(t,e,r){const n=[...new Set(t)],s=[];for(let h=0;h<n.length;h+=50){const{data:p,error:f}=await Ye.from("datasets").select(`
517      id, title, description, collection_id,
518      license:licenses(spdx_id),
519      dataset_items(id,file_name,bucket_path,file_size_bytes),
520      dataset_authors(first_name,last_name,organisation,orcid),
521      datacite(doi)
522    `).in("id",n.slice(h,h+50)).eq("archived",!1);if(f)throw new Error("Could not load publication metadata. Please try again.");s.push(...p)}if(s.length!==n.length)throw new Error("Some selected datasets are no longer available. Please refresh your selection.");const i=await Zg(n,[]),a=new Map(i.map(h=>[h.resource_id,h.effective_role])),l=s.map(h=>{var f,g;const p=h.dataset_items.filter(v=>v.bucket_path);return{id:h.id,title:h.title,collection:h.collection_id==null?"":e.get(h.collection_id)??"",rawFiles:p.length,bytes:h.dataset_items.some(v=>!v.bucket_path||v.file_size_bytes===null||!Number.isFinite(v.file_size_bytes)||v.file_size_bytes<=0)?null:p.reduce((v,_)=>v+(_.file_size_bytes??0),0),role:r?"admin":a.get(h.id)??null,license:((f=h.license)==null?void 0:f.spdx_id)??null,sourceDoi:(g=h.datacite)==null?void 0:g.doi}}),u=new Map;for(const h of s)for(const p of h.dataset_authors){const f=`${p.first_name} ${p.last_name}`.trim(),g=JSON.stringify([f,p.organisation,p.orcid]);u.has(g)||u.set(g,{id:String(u.size),name:f,givenName:p.first_name,familyName:p.last_name,affiliation:p.organisation??"",orcid:p.orcid??""})}return{datasets:l,authors:[...u.values()],description:s.length===1?s[0].description??"":""}}function mpe(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}const gpe=t=>{switch(t){case"success":return _pe;case"info":return wpe;case"warning":return bpe;case"error":return xpe;default:return null}},vpe=Array(12).fill(0),ype=({visible:t,className:e})=>K.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},K.createElement("div",{className:"sonner-spinner"},vpe.map((r,n)=>K.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),_pe=K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},K.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),bpe=K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"
522currentColor",height:"20",width:"20"},K.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),wpe=K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},K.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),xpe=K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},K.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Spe=K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},K.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),K.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),kpe=()=>{const[t,e]=K.useState(document.hidden);return K.useEffect(()=>{const r=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t};let mj=1;class Epe{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const r=this.subscribers.indexOf(e);this.subscribers.splice(r,1)}),this.publish=e=>{this.subscribers.forEach(r=>r(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var r;const{message:n,...s}=e,i=typeof(e==null?void 0:e.id)=="number"||((r=e.id)==null?void 0:r.length)>0?e.id:mj++,a=this.toasts.find(u=>u.id===i),l=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),a?this.toasts=this.toasts.map(u=>u.id===i?(this.publish({...u,...e,id:i,title:n}),{...u,...e,id:i,dismissible:l,title:n}):u):this.addToast({title:n,...s,dismissible:l,id:i}),i},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:e,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),e),this.message=(e,r)=>this.create({...r,message:e}),this.error=(e,r)=>this.create({...r,message:e,type:"error"}),this.success=(e,r)=>this.create({...r,type:"success",message:e}),this.info=(e,r)=>this.create({...r,type:"info",message:e}),this.warning=(e,r)=>this.create({...r,type:"warning",message:e}),this.loading=(e,r)=>this.create({...r,type:"loading",message:e}),this.promise=(e,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:e,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const s=Promise.resolve(e instanceof Function?e():e);let i=n!==void 0,a;const l=s.then(async h=>{if(a=["resolve",h],K.isValidElement(h))i=!1,this.create({id:n,type:"default",message:h});else if(Cpe(h)&&!h.ok){i=!1;const f=typeof r.error=="function"?await r.error(`HTTP error! status: ${h.status}`):r.error,g=typeof r.description=="function"?await r.description(`HTTP error! status: ${h.status}`):r.description,_=typeof f=="object"&&!K.isValidElement(f)?f:{message:f};this.create({id:n,type:"error",description:g,..._})}else if(h instanceof Error){i=!1;const f=typeof r.error=="function"?await r.error(h):r.error,g=typeof r.description=="function"?await r.description(h):r.description,_=typeof f=="object"&&!K.isValidElement(f)?f:{message:f};this.create({id:n,type:"error",description:g,..._})}else if(r.success!==void 0){i=!1;const f=typeof r.success=="function"?await r.success(h):r.success,g=typeof r.description=="function"?await r.description(h):r.description,_=typeof f=="object"&&!K.isValidElement(f)?f:{message:f};this.create({id:n,type:"success",description:g,..._})}}).catch(async h=>{if(a=["reject",h],r.error!==void 0){i=!1;const p=typeof r.error=="function"?await r.error(h):r.error,f=typeof r.description=="function"?await r.description(h):r.description,v=typeof p=="object"&&!K.isValidElement(p)?p:{message:p};this.create({id:n,type:"error",description:f,...v})}}).finally(()=>
vendor: 961 bytes, line 522
522{i&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),u=()=>new Promise((h,p)=>l.then(()=>a[0]==="reject"?p(a[1]):h(a[1])).catch(p));return typeof n!="string"&&typeof n!="number"?{unwrap:u}:Object.assign(n,{unwrap:u})},this.custom=(e,r)=>{const n=(r==null?void 0:r.id)||mj++;return this.create({jsx:e(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const ni=new Epe,jpe=(t,e)=>{const r=(e==null?void 0:e.id)||mj++;return ni.addToast({title:t,...e,id:r}),r},Cpe=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",Npe=jpe,Ppe=()=>ni.toasts,Rpe=()=>ni.getActiveToasts(),qt=Object.assign(Npe,{success:ni.success,info:ni.info,warning:ni.warning,error:ni.error,custom:ni.custom,message:ni.message,promise:ni.promise,dismiss:ni.dismiss,loading:ni.loading},{getHistory:Ppe,getToasts:Rpe});mp
vendor: 14,874 bytes, line 522
522e("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function 
vendor: 2,023 bytes, line 522
522Yy(t){return t.label!==void 0}const Ape=3,Tpe="24px",Ipe="16px",HO=4e3,Dpe=356,Ope=14,Mpe=45,Lpe=200;function bo(...t){return t.filter(Boolean).join(" ")}function Fpe(t){const[e,r]=t.split("-"),n=[];return e&&n.push(e),r&&n.push(r),n}const $pe=t=>{var e,r,n,s,i,a,l,u,h;const{invert:p,toast:f,unstyled:g,interacting:v,setHeights:_,visibleToasts:x,heights:w,index:S,toasts:k,expanded:j,removeToast:C,defaultRichColors:R,closeButton:A,style:I,cancelButtonStyle:P,actionButtonStyle:T,className:O="",descriptionClassName:G="",duration:M,position:U,gap:V,expandByDefault:H,classNames:Y,icons:B,closeButtonAriaLabel:z="Close toast"}=t,[ee,L]=K.useState(null),[$,F]=K.useState(null),[te,ue]=K.useState(!1),[re,se]=K.useState(!1),[ye,de]=K.useState(!1),[pe,Ie]=K.useState(!1),[Ne,He]=K.useState(!1),[We,at]=K.useState(0),[Xt,Rt]=K.useState(0),Ee=K.useRef(f.duration||M||HO),Et=K.useRef(null),Mt=K.useRef(null),ot=S===0,De=S+1<=x,St=f.type,jt=f.dismissible!==!1,Cr=f.className||"",Or=f.descriptionClassName||"",Nr=K.useMemo(()=>w.findIndex(Ze=>Ze.toastId===f.id)||0,[w,f.id]),rr=K.useMemo(()=>{var Ze;return(Ze=f.closeButton)!=null?Ze:A},[f.closeButton,A]),Pr=K.useMemo(()=>f.duration||M||HO,[f.duration,M]),At=K.useRef(0),ar=K.useRef(0),wn=K.useRef(0),W=K.useRef(null),[ie,le]=U.split("-"),be=K.useMemo(()=>w.reduce((Ze,Gt,_t)=>_t>=Nr?Ze:Ze+Gt.height,0),[w,Nr]),je=kpe(),Be=f.invert||p,Te=St==="loading";ar.current=K.useMemo(()=>Nr*V+be,[Nr,be]),K.useEffect(()=>{Ee.current=Pr},[Pr]),K.useEffect(()=>{ue(!0)},[]),K.useEffect(()=>{const Ze=Mt.current;if(Ze){const Gt=Ze.getBoundingClientRect().height;return Rt(Gt),_(_t=>[{toastId:f.id,height:Gt,position:f.position},..._t]),()=>_(_t=>_t.filter(Kt=>Kt.toastId!==f.id))}},[_,f.id]),K.useLayoutEffect(()=>{if(!te)return;const Ze=Mt.current,Gt=Ze.style.height;Ze.style.height="auto";const _t=Ze.getBoundingClientRect().height;Ze.style.height=Gt,Rt(_t),_(Kt=>Kt.find(ur=>ur.toastId===f.id)?Kt.map(ur=>ur.toastId===f.id?{...ur,height:_t}:ur):[{toastId:f.id,height:_t,position:f.position}
vendor: 7,139 bytes, line 522
522,...Kt])},[te,f.title,f.description,_,f.id,f.jsx,f.action,f.cancel]);const Oe=K.useCallback(()=>{se(!0),at(ar.current),_(Ze=>Ze.filter(Gt=>Gt.toastId!==f.id)),setTimeout(()=>{C(f)},Lpe)},[f,C,_,ar]);K.useEffect(()=>{if(f.promise&&St==="loading"||f.duration===1/0||f.type==="loading")return;let Ze;return j||v||je?(()=>{if(wn.current<At.current){const Kt=new Date().getTime()-At.current;Ee.current=Ee.current-Kt}wn.current=new Date().getTime()})():(()=>{Ee.current!==1/0&&(At.current=new Date().getTime(),Ze=setTimeout(()=>{f.onAutoClose==null||f.onAutoClose.call(f,f),Oe()},Ee.current))})(),()=>clearTimeout(Ze)},[j,v,f,St,je,Oe]),K.useEffect(()=>{f.delete&&(Oe(),f.onDismiss==null||f.onDismiss.call(f,f))},[Oe,f.delete]);function ae(){var Ze;if(B!=null&&B.loading){var Gt;return K.createElement("div",{className:bo(Y==null?void 0:Y.loader,f==null||(Gt=f.classNames)==null?void 0:Gt.loader,"sonner-loader"),"data-visible":St==="loading"},B.loading)}return K.createElement(ype,{className:bo(Y==null?void 0:Y.loader,f==null||(Ze=f.classNames)==null?void 0:Ze.loader),visible:St==="loading"})}const Ge=f.icon||(B==null?void 0:B[St])||gpe(St);var Ft,or;return K.createElement("li",{tabIndex:0,ref:Mt,className:bo(O,Cr,Y==null?void 0:Y.toast,f==null||(e=f.classNames)==null?void 0:e.toast,Y==null?void 0:Y.default,Y==null?void 0:Y[St],f==null||(r=f.classNames)==null?void 0:r[St]),"data-sonner-toast":"","data-rich-colors":(Ft=f.richColors)!=null?Ft:R,"data-styled":!(f.jsx||f.unstyled||g),"data-mounted":te,"data-promise":!!f.promise,"data-swiped":Ne,"data-removed":re,"data-visible":De,"data-y-position":ie,"data-x-position":le,"data-index":S,"data-front":ot,"data-swiping":ye,"data-dismissible":jt,"data-type":St,"data-invert":Be,"data-swipe-out":pe,"data-swipe-direction":$,"data-expanded":!!(j||H&&te),"data-testid":f.testId,style:{"--index":S,"--toasts-before":S,"--z-index":k.length-S,"--offset":`${re?We:ar.current}px`,"--initial-height":H?"auto":`${Xt}px`,...I,...f.style},onDragEnd:()=>{de(!1),L(null),W.current=null},onPointerDown:Ze=>{Ze.button!==2&&(Te||!jt||(Et.current=new Date,at(ar.current),Ze.target.setPointerCapture(Ze.pointerId),Ze.target.tagName!=="BUTTON"&&(de(!0),W.current={x:Ze.clientX,y:Ze.clientY})))},onPointerUp:()=>{var Ze,Gt,_t;if(pe||!jt)return;W.current=null;const Kt=Number(((Ze=Mt.current)==null?void 0:Ze.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),zr=Number(((Gt=Mt.current)==null?void 0:Gt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ur=new Date().getTime()-((_t=Et.current)==null?void 0:_t.getTime()),Tt=ee==="x"?Kt:zr,xn=Math.abs(Tt)/ur;if(Math.abs(Tt)>=Mpe||xn>.11){at(ar.current),f.onDismiss==null||f.onDismiss.call(f,f),F(ee==="x"?Kt>0?"right":"left":zr>0?"down":"up"),Oe(),Ie(!0);return}else{var Ur,Z;(Ur=Mt.current)==null||Ur.style.setProperty("--swipe-amount-x","0px"),(Z=Mt.current)==null||Z.style.setProperty("--swipe-amount-y","0px")}He(!1),de(!1),L(null)},onPointerMove:Ze=>{var Gt,_t,Kt;if(!W.current||!jt||((Gt=window.getSelection())==null?void 0:Gt.toString().length)>0)return;const ur=Ze.clientY-W.current.y,Tt=Ze.clientX-W.current.x;var xn;const Ur=(xn=t.swipeDirections)!=null?xn:Fpe(U);!ee&&(Math.abs(Tt)>1||Math.abs(ur)>1)&&L(Math.abs(Tt)>Math.abs(ur)?"x":"y");let Z={x:0,y:0};const J=ce=>1/(1.5+Math.abs(ce)/20);if(ee==="y"){if(Ur.includes("top")||Ur.includes("bottom"))if(Ur.includes("top")&&ur<0||Ur.includes("bottom")&&ur>0)Z.y=ur;else{const ce=ur*J(ur);Z.y=Math.abs(ce)<Math.abs(ur)?ce:ur}}else if(ee==="x"&&(Ur.includes("left")||Ur.includes("right")))if(Ur.includes("left")&&Tt<0||Ur.includes("right")&&Tt>0)Z.x=Tt;else{const ce=Tt*J(Tt);Z.x=Math.abs(ce)<Math.abs(Tt)?ce:Tt}(Math.abs(Z.x)>0||Math.abs(Z.y)>0)&&He(!0),(_t=Mt.current)==null||_t.style.setProperty("--swipe-amount-x",`${Z.x}px`),(Kt=Mt.current)==null||Kt.style.setProperty("--swipe-amount-y",`${Z.y}px`)}},rr&&!f.jsx&&St!=="loading"?K.createElement("button",{"aria-label":z,"data-disabled":Te,"data-close-button":!0,onClick:Te||!jt?()=>{}:()=>{Oe(),f.onDismiss==null||f.onDismiss.call(f,f)},className:bo(Y==null?void 0:Y.closeButton,f==null||(n=f.classNames)==null?void 0:n.closeButton)},(or=B==null?void 0:B.close)!=null?or:Spe):null,(St||f.icon||f.promise)&&f.icon!==null&&((B==null?void 0:B[St])!==null||f.icon)?K.createElement("div",{"data-icon":"",className:bo(Y==null?void 0:Y.icon,f==null||(s=f.classNames)==null?void 0:s.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||ae():null,f.type!=="loading"?Ge:null):null,K.createElement("div",{"data-content":"",className:bo(Y==null?void 0:Y.content,f==null||(i=f.classNames)==null?void 0:i.content)},K.createElement("div",{"data-title":"",className:bo(Y==null?void 0:Y.title,f==null||(a=f.classNames)==null?void 0:a.title)},f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title),f.description?K.createElement("div",{"data-description":"",className:bo(G,Or,Y==null?void 0:Y.description,f==null||(l=f.classNames)==null?void 0:l.description)},typeof f.description=="function"?f.description():f.description):null),K.isValidElement(f.cancel)?f.cancel:f.cancel&&Yy(f.cancel)?K.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||P,onClick:Ze=>{Yy(f.cancel)&&jt&&(f.cancel.onClick==null||f.cancel.onClick.call(f.cancel,Ze),Oe())},className:bo(Y==null?void 0:Y.cancelButton,f==null||(u=f.classNames)==null?void 0:u.cancelButton)},f.cancel.label):null,K.isValidElement(f.action)?f.action:f.action&&Yy(f.action)?K.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||T,onClick:Ze=>{Yy(f.action)&&(f.action.onClick==null||f.action.onClick.call(f.action,Ze),!Ze.defaultPrevented&&Oe())},className:bo(Y==null?void 0:Y.actionButton,f==null||(h=f.classNames)==null?void 0:h.actionButton)},f.action.label):null)};function qO(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function zpe(t,e){const r={};return[t,e].forEach((n,s)=>{const i=s===1,a=i?"--mobile-offset":"--offset",l=i?Ipe:Tpe;function u(h){["top","right","bottom","left"].forEach(p=>{r[`${a}-${p}`]=typeof h=="number"?`${h}px`:h})}typeof n=="number"||typeof n=="string"?u(n):typeof n=="object"?["top","right","bottom","left"].forEach(h=>{n[h]===void 0?r[`${a}-${h}`]=l:r[`${a}-${h}`]=typeof n[h]=="number"?`${n[h]}px`:n[h]}):u(l)}),r}const Upe=K.forwardRef(function(e,r){const{id:n,invert:s,position:i="bottom-right",hotkey:a=["altKey","KeyT"],expand:l,closeButton:u,className:h,offset:p,mobileOffset:f,theme:g="light",richColors:v,duration:_,style:x,visibleToasts:w=Ape,toastOptions:S,dir:k=qO(),gap:j=Ope,icons:C,containerAriaLabel:R="Notifications"}=e,[A,I]=K.useState([]),P=K.useMemo(()=>n?A.filter(te=>te.toasterId===n):A.filter(te=>!te.toasterId),[A,n]),T=K.useMemo(()=>Array.from(new Set([i].concat(P.filter(te=>te.position).map(te=>te.position)))),[P,i]),[O,G]=K.useState([]),[M,U]=K.useState(!1),[V,H]=K.useState(!1),[Y,B]=K.useState(g!=="system"?g:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dar
522k":"light"),z=K.useRef(null),ee=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),L=K.useRef(null),$=K.useRef(!1),F=K.useCallback(te=>{I(ue=>{var re;return(re=ue.find(se=>se.id===te.id))!=null&&re.delete||ni.dismiss(te.id),ue.filter(({id:se})=>se!==te.id)})},[]);return K.useEffect(()=>ni.subscribe(te=>{if(te.dismiss){requestAnimationFrame(()=>{I(ue=>ue.map(re=>re.id===te.id?{...re,delete:!0}:re))});return}setTimeout(()=>{qH.flushSync(()=>{I(ue=>{const re=ue.findIndex(se=>se.id===te.id);return re!==-1?[...ue.slice(0,re),{...ue[re],...te},...ue.slice(re+1)]:[te,...ue]})})})}),[A]),K.useEffect(()=>{if(g!=="system"){B(g);return}if(g==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?B("dark"):B("light")),typeof window>"u")return;const te=window.matchMedia("(prefers-color-scheme: dark)");try{te.addEventListener("change",({matches:ue})=>{B(ue?"dark":"light")})}catch{te.addListener(({matches:re})=>{try{B(re?"dark":"light")}catch(se){console.error(se)}})}},[g]),K.useEffect(()=>{A.length<=1&&U(!1)},[A]),K.useEffect(()=>{const te=ue=>{var re;if(a.every(de=>ue[de]||ue.code===de)){var ye;U(!0),(ye=z.current)==null||ye.focus()}ue.code==="Escape"&&(document.activeElement===z.current||(re=z.current)!=null&&re.contains(document.activeElement))&&U(!1)};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[a]),K.useEffect(()=>{if(z.current)return()=>{L.current&&(L.current.focus({preventScroll:!0}),L.current=null,$.current=!1)}},[z.current]),K.createElement("section",{ref:r,"aria-label":`${R} ${ee}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},T.map((te,ue)=>{var re;const[se,ye]=te.split("-");return P.length?K.createElement("ol",{key:te,dir:k==="auto"?qO():k,tabIndex:-1,ref:z,className:h,"data-sonner-toaster":!0,"data-sonner-theme":Y,"data-y-position":se,"data-x-position":ye,style:{"--front-toast-height":`${((re=O[0])==null?void 0:re.height)||0}px`,"--width":`${Dpe}px`,"--gap":`${j}px`,...x,...zpe(p,f)},onBlur:de=>{$.current&&!de.currentTarget.contains(de.relatedTarget)&&($.current=!1,L.current&&(L.current.focus({preventScroll:!0}),L.current=null))},onFocus:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||$.current||($.current=!0,L.current=de.relatedTarget)},onMouseEnter:()=>U(!0),onMouseMove:()=>U(!0),onMouseLeave:()=>{V||U(!1)},onDragEnd:()=>U(!1),onPointerDown:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||H(!0)},onPointerUp:()=>H(!1)},P.filter(de=>!de.position&&ue===0||de.position===te).map((de,pe)=>{var Ie,Ne;return K.createElement($pe,{key:de.id,icons:C,index:pe,toast:de,defaultRichColors:v,duration:(Ie=S==null?void 0:S.duration)!=null?Ie:_,className:S==null?void 0:S.className,descriptionClassName:S==null?void 0:S.descriptionClassName,invert:s,visibleToasts:w,closeButton:(Ne=S==null?void 0:S.closeButton)!=null?Ne:u,interacting:V,position:te,style:S==null?void 0:S.style,unstyled:S==null?void 0:S.unstyled,classNames:S==null?void 0:S.classNames,cancelButtonStyle:S==null?void 0:S.cancelButtonStyle,actionButtonStyle:S==null?void 0:S.actionButtonStyle,closeButtonAriaLabel:S==null?void 0:S.closeButtonAriaLabel,removeToast:F,toasts:P.filter(He=>He.position==de.position),heights:O.filter(He=>He.position==de.position),setHeights:G,expandByDefault:l,gap:j,expanded:M,swipeDirections:e.swipeDirections})})):null}))}),hke="Please sign in to download datasets. Requiring an account helps us prevent misuse and keep downloads available for everyone.",Bpe="download";function fke(t){return`/datasets/${t}?${Bpe}=1`}function A3(t,e){return new Date(t).toLocaleString(e,{weekday:"short",hour:"2-digit",minute:"2-digit"})}function pke(t,e){var n,s;const r=A3(t.resets_at,e);return(n=t.dataset)!=null&&n.exempt?{message:"Datasets you own or that are shared with you do not count toward your daily download limit.",blocked:!1}:(s=t.dataset)!=null&&s.included_today?{message:`This dataset already counts toward today’s limit, so more files from it are free until ${r}.`,blocked:!1}:t.remaining<=0?{message:`You have reached today’s limit of ${t.limit} datasets. Downloads reset at ${r}. Datasets you own or that are shared with you remain available.`,blocked:!0}:{message:`${t.remaining} of ${t.limit} dataset downloads left today. All files from one dataset count once. Resets at ${r}.`,blocked:!1}}function T3(t,e,r){return t instanceof r1?T3(t.failure,e,r):t instanceof Vz?`You have reached today’s limit of ${t.limit} datasets. Downloads reset at ${A3(t.resetsAt,r)}. Datasets you own or that are shared with you remain available.`:t instanceof Error?t.message:e}async function mke(t,e){const[r,n]=await Promise.allSettled([t,e]),s=[];let i=null;return r.status==="fulfilled"?s.push(...r.value.artifacts):(i=r.reason,r.reason instanceof r1&&s.push(...r.reason.artifacts)),n.status==="fulfilled"?n.value&&s.push({artifact_type:"supplementary",dataset_item_id:null,filename:n.value.filename,url:n.value.url}):i??(i=n.reason),{links:s,error:i}}function WO({className:t,containerClassName:e,...r}){return o.jsx("div",{"data-slot":"table-container",className:ke("relative w-full overflow-x-auto",e),children:o.jsx("table",{"data-slot":"table",className:ke("w-full caption-bottom text-sm",t),...r})})}function FS({className:t,...e}){return o.jsx("thead",{"data-slot":"table-header",className:ke("[&_tr]:border-b",t),...e})}function GO({className:t,...e}){return o.jsx("tbody",{"data-slot":"table-body",className:ke("[&_tr:last-child]:border-0",t),...e})}function Cm({className:t,...e}){return o.jsx("tr",{"data-slot":"table-row",className:ke("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...e})}function ml({className:t,...e}){return o.jsx("th",{"data-slot":"table-head",className:ke("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}function Cn({className:t,...e}){return o.jsx("td",{"data-slot":"table-cell",className:ke("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}var Jg=t=>t.type==="checkbox",Dw=t=>t.type==="file",Fl=t=>t instanceof Date,Jn=t=>t==null;const X1=t=>typeof t=="object";var an=t=>!Jn(t)&&!Array.isArray(t)&&X1(t)&&!Fl(t),gj=t=>an(t)&&t.target?Jg(t.target)?t.target.checked:Dw(t.target)?t.target.files:t.target.value:t,I3=(t,e)=>e.split(".").some((r,n,s)=>!isNaN(Number(r))&&t.has(s.slice(0,n).join("."))),D3=t=>{const e=t.constructor&&t.constructor.prototype;return an(e)&&e.hasOwnProperty("isPrototypeOf")},Ow=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function xr(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(Ow&&(t instanceof Blob||e))return t;const r=Array.isArray(t);if(!r&&!(an(t)&&D3(t)))return t;const n=r?[]:Object.create(Object.getPrototypeOf(t));for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[s]=xr(t[s]));return n}const Ac={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},ca={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},$a={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},O3="root",eN=["__proto__","constructor","prototype"],Vpe=/^\w*$/;var Wf=t=>Vpe.test(t),Tr=t=>t===void 0;const Hpe=/[.[\]'"]/;var fg=t=>
522t.split(Hpe).filter(Boolean),Fe=(t,e,r)=>{if(!e||!an(t))return r;const n=Wf(e)?[e]:fg(e);if(n.some(i=>eN.includes(i)))return r;const s=n.reduce((i,a)=>Jn(i)?void 0:i[a],t);return Tr(s)||s===t?Tr(t[e])?r:t[e]:s},ii=t=>typeof t=="boolean",_s=t=>typeof t=="function",br=(t,e,r)=>{let n=-1;const s=Wf(e)?[e]:fg(e),i=s.length,a=i-1;for(;++n<i;){const l=s[n];let u=r;if(n!==a){const h=t[l];u=an(h)||Array.isArray(h)?h:isNaN(+s[n+1])?{}:[]}if(eN.includes(l))return;t[l]=u,t=t[l]}};const tN=K.createContext(null);tN.displayName="HookFormControlContext";const Mw=()=>K.useContext(tN);var M3=(t,e,r,n=!0)=>{const s={};for(const i in t)Object.defineProperty(s,i,{get:()=>{const a=i;return e._proxyFormState[a]!==ca.all&&(e._proxyFormState[a]=!n||ca.all),r&&(r[a]=!0),t[a]}});return s};const Lw=Ow?K.useLayoutEffect:K.useEffect;var vj=t=>Jn(t)||!X1(t);const KO=(t,e)=>e.length===0&&!Array.isArray(t)&&!D3(t);function ai(t,e,r=new WeakMap){if(t===e)return!0;if(vj(t)||vj(e))return Object.is(t,e);if(Fl(t)&&Fl(e))return Object.is(t.getTime(),e.getTime());const n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;if(KO(t,n)||KO(e,s))return Object.is(t,e);if(!n.length&&Array.isArray(t)!==Array.isArray(e))return!1;const i=r.get(t);if(i&&i.has(e))return!0;if(i)i.add(e);else{const a=new WeakSet;a.add(e),r.set(t,a)}for(const a of n){const l=t[a];if(!(a in e))return!1;if(a!=="ref"){const u=e[a];if(Fl(l)&&Fl(u)||(an(l)||Array.isArray(l))&&(an(u)||Array.isArray(u))?!ai(l,u,r):!Object.is(l,u))return!1}}return!0}function rN(){const t=K.useRef(!1),e=K.useRef(void 0),r=K.useCallback((s,i,a)=>{if(s&&t.current){const l=i();ai(e.current,l)||a(l)}t.current=!0},[]),n=K.useCallback((s,i)=>{s&&(e.current=xr(i()))},[]);return{resyncIfNeeded:r,snapshot:n}}function nN(t){const e=Mw(),{control:r=e,disabled:n,name:s,exact:i}=t||{},[a,l]=K.useState(()=>({...r._formState,defaultValues:r._defaultValues})),u=K.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),{resyncIfNeeded:h,snapshot:p}=rN();return Lw(()=>{const f=()=>({...r._formState,defaultValues:r._defaultValues});h(!n,f,l);const g=r._subscribe({name:s,formState:u.current,exact:i,callback:v=>{!n&&l({...r._formState,...v,defaultValues:r._defaultValues})}});return()=>{g(),p(!n,f)}},[s,n,i,h,p]),K.useEffect(()=>{u.current.isValid&&r._setValid(!0)},[r]),K.useMemo(()=>M3(a,r,u.current,!1),[a,r])}var is=t=>typeof t=="string",yj=(t,e,r,n,s)=>is(t)?(n&&e.watch.add(t),Fe(r,t,s)):Array.isArray(t)?t.map(i=>(n&&e.watch.add(i),Fe(r,i))):(n&&(e.watchAll=!0),r);function pa(t){const e=Mw(),{control:r=e,name:n,defaultValue:s,disabled:i,exact:a,compute:l}=t||{},u=K.useRef(s),h=K.useRef(l),p=K.useRef(void 0),f=K.useRef(r),g=K.useRef(n);h.current=l;const[v,_]=K.useState(()=>{const P=r._getWatch(n,u.current);return h.current?h.current(P):P}),x=K.useCallback(P=>{const T=yj(n,r._names,P||r._formValues,!1,u.current);return h.current?h.current(T):T},[r._formValues,r._names,n]),w=K.useCallback(P=>{if(!i){const T=yj(n,r._names,P||r._formValues,!1,u.current);if(h.current){const O=h.current(T);ai(O,p.current)||(_(O),p.current=O)}else _(T)}},[r._formValues,r._names,i,n]),{resyncIfNeeded:S,snapshot:k}=rN(),j=K.useRef(w);j.current=w;const C=K.useRef(x);C.current=x,Lw(()=>{f.current!==r||!ai(g.current,n)?(f.current=r,g.current=n,j.current()):S(!i,()=>C.current(),T=>{_(T),p.current=T});const P=r._subscribe({name:n,formState:{values:!0},exact:a,callback:T=>{j.current(T.values)}});return()=>{P(),k(!i,()=>C.current())}},[r,a,n,i,S,k]),K.useEffect(()=>r._removeUnmounted());const R=f.current!==r,A=g.current,I=K.useMemo(()=>{if(i)return null;const P=!R&&!ai(A,n);return R||P?x():null},[i,R,n,A,x]);return I!==null?I:v}function qpe(t){const e=Mw(),{name:r,disabled:n,control:s=e,shouldUnregister:i,defaultValue:a,exact:l=!0}=t,u=I3(s._names.array,r),h=K.useMemo(()=>Fe(s._formValues,r,Fe(s._defaultValues,r,a)),[s,r,a]),p=pa({control:s,name:r,defaultValue:h,exact:l}),f=nN({control:s,name:r,exact:l}),g=K.useRef(t),v=K.useRef(null),_=K.useRef(s.register(r,{...t.rules,value:p,...ii(t.disabled)?{disabled:t.disabled}:{}}));g.current=t;const x=K.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Fe(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!Fe(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!Fe(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!Fe(f.validatingFields,r)},error:{enumerable:!0,get:()=>Fe(f.errors,r)}}),[f,r]),w=K.useCallback(C=>{const R=gj(C);return Fe(s._fields,r)||(_.current=s.register(r,{...g.current.rules,value:R})),_.current.onChange({target:{value:gj(C),name:r},type:Ac.CHANGE})},[r,s]),S=K.useCallback(()=>_.current.onBlur({target:{value:Fe(s._formValues,r),name:r},type:Ac.BLUR}),[r,s._formValues]),k=K.useCallback(C=>{C&&(v.current={focus:()=>_s(C.focus)&&C.focus(),select:()=>_s(C.select)&&C.select(),setCustomValidity:A=>_s(C.setCustomValidity)&&C.setCustomValidity(A),reportValidity:()=>_s(C.reportValidity)&&C.reportValidity()});const R=Fe(s._fields,r);
522R&&R._f&&C&&(R._f.ref=v.current)},[s._fields,r]),j=K.useMemo(()=>({name:r,value:p,...ii(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:w,onBlur:S,ref:k}),[r,n,f.disabled,w,S,k,p]);return K.useEffect(()=>{const C=s._options.shouldUnregister||i;_.current=s.register(r,{...g.current.rules,...ii(g.current.disabled)?{disabled:g.current.disabled}:{}});const R=(A,I)=>{const P=Fe(s._fields,A);P&&P._f&&(P._f.mount=I)};if(R(r,!0),C){const A=xr(Fe(i?s._defaultValues:s._options.values||s._defaultValues,r,Fe(s._options.defaultValues,r,g.current.defaultValue)));br(s._defaultValues,r,A),Tr(Fe(s._formValues,r))&&br(s._formValues,r,A)}if(!u&&s.register(r),v.current){const A=Fe(s._fields,r);A&&A._f&&(A._f.ref=v.current)}return()=>{(u?C&&!s._state.action:C)?s.unregister(r):R(r,!1)}},[r,s,u,i]),K.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),K.useMemo(()=>({field:j,formState:f,fieldState:x}),[j,f,x])}const Ti=t=>t.render(qpe(t));var jc=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const t=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const r=(Math.random()*16+t)%16|0;return(e=="x"?r:r&3|8).toString(16)})},$S=(t,e,r={})=>r.shouldFocus||Tr(r.shouldFocus)?r.focusName||`${t}.${Tr(r.focusIndex)?e:r.focusIndex}.`:"",Kc=t=>({isOnSubmit:!t||t===ca.onSubmit,isOnBlur:t===ca.onBlur,isOnChange:t===ca.onChange,isOnAll:t===ca.all,isOnTouch:t===ca.onTouched}),w_=(t,e,r)=>{if(r)return!1;if(e.watchAll||e.watch.has(t))return!0;for(const n of e.watch)if(t.startsWith(n)&&t.charAt(n.length)===".")return!0;return!1};const pf=(t,e,r,n)=>{for(const s of r||Object.keys(t)){if(s==="_f")continue;const i=r?Fe(t,s):t[s];if(i){const{_f:a}=i;if(a){if(a.refs&&a.refs[0]&&e(a.refs[0],s)&&!n)return!0;if(a.ref&&e(a.ref,a.name)&&!n)return!0;if(pf(i,e))break}else if((an(i)||Array.isArray(i))&&pf(i,e))break}}};var Rb=(t,e,r)=>{const n=Fe(t,r),s=Array.isArray(n)?n:[];return br(s,O3,e[r]),br(t,r,s),t},Zn=t=>an(t)&&!Object.keys(t).length,Ab=t=>{if(!Ow)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},sN=t=>t.type==="radio",Tb=t=>t instanceof RegExp,iN=(t,e,r,n,s)=>e?{...r[t],types:{...r[t]&&r[t].types?r[t].types:{},[n]:s||!0}}:{};const YO={value:!1,isValid:!1},ZO={value:!0,isValid:!0};var L3=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!Tr(t[0].attributes.value)?Tr(t[0].value)||t[0].value===""?ZO:{value:t[0].value,isValid:!0}:ZO:YO}return YO};const JO={isValid:!1,value:null};var F3=t=>Array.isArray(t)?t.reduce((e,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:e,JO):JO;function QO(t,e,r="validate"){if(is(t)||Array.isArray(t)&&t.every(is)||ii(t)&&!t)return{type:r,message:is(t)?t:"",ref:e}}var Dh=t=>an(t)&&!Tb(t)?t:{value:t,message:""},_j=async(t,e,r,n,s,i)=>{const{ref:a,refs:l,required:u,maxLength:h,minLength:p,min:f,max:g,pattern:v,validate:_,name:x,valueAsNumber:w,mount:S}=t._f,k=Fe(r,x);if(!S||e.has(x))return{};const j=l?l[0]:a,C=M=>{if(s&&j.reportValidity){const U=ii(M)?"":M||"";l?l.forEach(V=>V.setCustomValidity(U)):j.setCustomValidity(U),j.reportValidity()}},R={},A=sN(a),I=Jg(a),P=A||I,T=(w||Dw(a))&&Tr(a.value)&&Tr(k)||Ab(a)&&a.value===""||k===""||Array.isArray(k)&&!k.length,O=iN.bind(null,x,n,R),G=(M,U,V,H=$a.maxLength,Y=$a.minLength)=>{const B=M?U:V;R[x]={type:M?H:Y,message:B,ref:a,...O(M?H:Y,B)}};if(i?!Array.isArray(k)||!k.length:u&&(!P&&(T||Jn(k))||ii(k)&&!k||I&&!L3(l).isValid||A&&!F3(l).isValid)){const{value:M,message:U}=is(u)?{value:!!u,message:u}:Dh(u);if(M&&(R[x]={type:$a.required,message:U,ref:j,...O($a.required,U)},!n))return C(U),R}if(!T&&(!Jn(f)||!Jn(g))){let M,U;const V=Dh(g),H=Dh(f);if(!Jn(k)&&!Fl(k)&&!isNaN(k)){const Y=a.valueAsNumber||k&&+k;Jn(V.value)||(M=Y>V.value),Jn(H.value)||(U=Y<H.value)}else{const Y=a.valueAsDate||new Date(k),B=L=>new Date(new Date().toDateString()+" "+L),z=a.type=="time",ee=a.type=="week";is(V.value)&&k&&(M=z?B(k)>B(V.value):ee?k>V.value:Y>new Date(V.value)),is(H.value)&&k&&(U=z?B(k)<B(H.value):ee?k<H.value:Y<new Date(H.value))}if((M||U)&&(G(!!M,V.message,H.message,$a.max,$a.min),!n))return C(R[x].message),R}if((h||p)&&!T&&(is(k)||i&&Array.isArray(k))){const M=Dh(h),U=Dh(p),V=!Jn(M.value)&&k.length>+M.value,H=!Jn(U.value)&&k.length<+U.value;if((V||H)&&(G(V,M.message,U.message),!n))return C(R[x].message),R}if(v&&!T&&is(k)){const{value:M,message:U}=Dh(v);if(Tb(M)&&!k.match(M)&&(R[x]={type:$a.pattern,message:U,ref:a,...O($a.pattern,U)},!n))return C(U),R}if(_){if(_s(_)){const M=await _(k,r),U=QO(M,j);
522if(U&&(R[x]={...U,...O($a.validate,U.message)},!n))return C(U.message),R}else if(an(_)){let M={};for(const U in _){if(!Zn(M)&&!n)break;const V=QO(await _[U](k,r),j,U);V&&(M={...V,...O(U,V.message)},C(V.message),n&&(R[x]=M))}if(!Zn(M)&&(R[x]={ref:j,...M},!n))return R}}return C(!0),R},Ii=t=>Array.isArray(t)?t:[t],zS=(t,e)=>[...t,...Ii(e)],US=t=>Array.isArray(t)?t.map(()=>{}):void 0;function BS(t,e,r){return[...t.slice(0,e),...Ii(r),...t.slice(e)]}var VS=(t,e,r)=>Array.isArray(t)?(Tr(t[r])&&(t[r]=void 0),t.splice(r,0,t.splice(e,1)[0]),t):[],HS=(t,e)=>[...Ii(e),...Ii(t)],aN=t=>Array.isArray(t)?t.filter(Boolean):[];function Wpe(t,e){let r=0;const n=[...t];for(const s of e)n.splice(s-r,1),r++;return aN(n).length?n:[]}var qS=(t,e)=>Tr(e)?[]:Wpe(t,Ii(e).sort((r,n)=>r-n)),WS=(t,e,r)=>{[t[e],t[r]]=[t[r],t[e]]};function Gpe(t,e){const r=e.length-1;let n=0;for(;n<r;){if(Jn(t)){t=void 0;break}t=t[e[n]],n++}return t}function Kpe(t){for(const e in t)if(t.hasOwnProperty(e)&&!Tr(t[e]))return!1;return!0}function gn(t,e){if(is(e)&&Object.prototype.hasOwnProperty.call(t,e))return delete t[e],t;const r=Array.isArray(e)?e:Wf(e)?[e]:fg(e);if(r.some(a=>eN.includes(String(a))))return t;const n=r.length===1?t:Gpe(t,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(an(n)&&Zn(n)||Array.isArray(n)&&Kpe(n))&&gn(t,r.slice(0,-1)),t}var XO=(t,e,r)=>(t[e]=r,t);function $3(t){const e=Mw(),{control:r=e,name:n,keyName:s="id",disabled:i,shouldUnregister:a,rules:l}=t,[u,h]=K.useState(r._getFieldArray(n)),p=K.useRef(r._getFieldArray(n).map(jc)),f=K.useRef(!1);i||r._names.array.add(n),K.useMemo(()=>!i&&l&&u.length>=0&&r.register(n,l),[r,n,u.length,l,i]),Lw(()=>{if(!i)return r._subjects.array.subscribe({next:({values:R,name:A})=>{if(A===n||!A){const I=Fe(R,n);Array.isArray(I)?(h(I),p.current=I.map(jc)):A||(h([]),p.current=[])}}}).unsubscribe},[r,n,i]);const g=K.useCallback(R=>{f.current=!0,r._setFieldArray(n,R)},[r,n]),v=(R,A)=>{if(i)return;const I=Ii(xr(R)),P=zS(r._getFieldArray(n),I);r._names.focus=$S(n,P.length-1,A),p.current=zS(p.current,I.map(jc)),g(P),h(P),r._setFieldArray(n,P,zS,{argA:US(R)})},_=(R,A)=>{if(i)return;const I=Ii(xr(R)),P=HS(r._getFieldArray(n),I);r._names.focus=$S(n,0,A),p.current=HS(p.current,I.map(jc)),g(P),h(P),r._setFieldArray(n,P,HS,{argA:US(R)})},x=R=>{if(i)return;const A=qS(r._getFieldArray(n),R);p.current=qS(p.current,R),g(A),h(A),!Array.isArray(Fe(r._fields,n))&&br(r._fields,n,void 0),r._setFieldArray(n,A,qS,{argA:R})},w=(R,A,I)=>{if(i)return;const P=Ii(xr(A)),T=BS(r._getFieldArray(n),R,P);r._names.focus=$S(n,R,I),p.current=BS(p.current,R,P.map(jc)),g(T),h(T),r._setFieldArray(n,T,BS,{argA:R,argB:US(A)})},S=(R,A)=>{if(i)return;const I=r._getFieldArray(n);WS(I,R,A),WS(p.current,R,A),g(I),h(I),r._setFieldArray(n,I,WS,{argA:R,argB:A},!1)},k=(R,A)=>{if(i)return;const I=r._getFieldArray(n);VS(I,R,A),VS(p.current,R,A),g(I),h(I),r._setFieldArray(n,I,VS,{argA:R,argB:A},!1)},j=(R,A)=>{if(i)return;const I=xr(A),P=XO(r._getFieldArray(n),R,I);p.current=[...P].map((T,O)=>!T||O===R?jc():p.current[O]),g(P),h([...P]),r._setFieldArray(n,P,XO,{argA:R,argB:I},!0,!1)},C=R=>{if(i)return;const A=Ii(xr(R));p.current=A.map(jc),g([...A]),h([...A]),r._setFieldArray(n,[...A],I=>I,{},!0,!1)};return K.useEffect(()=>{if(i){r._state.actionArrayLengths.delete(n);return}r._state.action=!1,r._state.actionArrayLengths.delete(n),w_(n,r._names)&&r._subjects.state.next({...r._formState});const R=Kc(r._options.mode);if(f.current&&(!R.isOnSubmit||r._formState.isSubmitted)&&!Kc(r._options.reValidateMode).isOnSubmit&&!R.isOnBlur)if(r._options.resolver)r._runSchema([n]).then(A=>{var I,P;r._updateIsValidating([n]);const T=Fe(A.errors,n),O=Fe(r._formState.errors,n),G=O&&(O.type||((I=O.root)===null||I===void 0?void 0:I.type)),M=O&&(O.message||((P=O.root)===null||P===void 0?void 0:P.message));(O?!T&&G||T&&(G!==T.type||M!==T.message):T&&T.type)&&(T?an(T)&&!Object.keys(T).some(U=>!Number.isNaN(+U))?Rb(r._formState.errors,{[n]:T},n):br(r._formState.errors,n,T):gn(r._formState.errors,n),r._subjects.state.next({errors:r._formState.errors}))});else{const A=Fe(r._fields,n);A&&A._f&&!(Kc(r._options.reValidateMode).isOnSubmit&&Kc(r._options.mode).isOnSubmit)&&_j(A,r._names.disabled,r._formValues,r._options.criteriaMode===ca.all,r._options.shouldUseNativeValidation,!0).then(I=>!Zn(I)&&r._subjects.state.next({errors:Rb(r._formState.errors,I,n)}))}f.current&&r._subjects.state.next({name:n,values:xr(r._formValues)}
522),r._names.focus&&pf(r._fields,(A,I)=>{if(r._names.focus&&I.startsWith(r._names.focus)&&A.focus)return A.focus(),1}),r._names.focus="",r._setValid(),f.current=!1},[u,n,r,i]),K.useEffect(()=>(i||!Fe(r._formValues,n)&&r._setFieldArray(n),()=>{if(r._state.actionArrayLengths.delete(n),i)return;const R=!(r._options.shouldUnregister||a),A=(I,P)=>{const T=Fe(r._fields,I);T&&T._f&&(T._f.mount=P)};f.current&&R&&r._subjects.state.next({name:n,values:xr(r._formValues)}),R?A(n,!1):r.unregister(n)}),[n,r,s,a,i]),{swap:K.useCallback(S,[g,n,r,i]),move:K.useCallback(k,[g,n,r,i]),prepend:K.useCallback(_,[g,n,r,i]),append:K.useCallback(v,[g,n,r,i]),remove:K.useCallback(x,[g,n,r,i]),insert:K.useCallback(w,[g,n,r,i]),update:K.useCallback(j,[g,n,r,i]),replace:K.useCallback(C,[g,n,r,i]),fields:K.useMemo(()=>u.map((R,A)=>({...R,...ii(i)?{disabled:i}:{},[s]:p.current[A]||jc()})),[u,s,i])}}const z3=t=>{const e={};for(const r of Object.keys(t))if(X1(t[r])&&t[r]!==null&&!Fl(t[r])){const n=z3(t[r]);for(const s of Object.keys(n))e[`${r}.${s}`]=n[s]}else e[r]=t[r];return e},oN=K.createContext(null);oN.displayName="HookFormContext";const Fw=()=>K.useContext(oN),Ype=({children:t,watch:e,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:a,setValues:l,trigger:u,formState:h,resetField:p,reset:f,resetDefaultValues:g,handleSubmit:v,unregister:_,control:x,register:w,setFocus:S,subscribe:k})=>{const j=K.useMemo(()=>({watch:e,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:a,setValues:l,trigger:u,formState:h,resetField:p,reset:f,resetDefaultValues:g,handleSubmit:v,unregister:_,control:x,register:w,setFocus:S,subscribe:k}),[i,x,h,n,r,v,w,f,g,p,s,S,a,l,k,u,_,e]);return K.createElement(oN.Provider,{value:j},K.createElement(tN.Provider,{value:j.control},t))};var e2=()=>{let t=[];return{get observers(){return t},next:s=>{for(const i of t)i.next&&i.next(s)},subscribe:s=>(t.push(s),{unsubscribe:()=>{t=t.filter(i=>i!==s)}}),unsubscribe:()=>{t=[]}}};function U3(t,e){const r={};for(const n in t)if(t.hasOwnProperty(n)){const s=t[n],i=e[n];if(s&&an(s)&&i){const a=U3(s,i);an(a)&&(r[n]=a)}else t[n]&&(r[n]=i)}return r}var B3=t=>t.type==="select-multiple",Zpe=t=>sN(t)||Jg(t),GS=t=>Ab(t)&&t.isConnected;function t2(t){return Array.isArray(t)||an(t)}function V3(t,e,r="",n=[]){for(const s in t){const i=r?`${r}.${s}`:s,a=t[s];t2(a)&&t2(Fe(e,i))?V3(a,e,i,n):n.push(i)}return n}var Jpe=t=>{for(const e in t)if(_s(t[e]))return!0;return!1};function H3(t){return Array.isArray(t)||an(t)&&!Jpe(t)}function q3(t){return!!(t&&"_f"in t)}function W3(t){return Array.isArray(t)?!t.some(e=>!Tr(e)):!Object.keys(t).length}function bj(t,e){Array.isArray(t)?t[e]=void 0:delete t[e]}function wj(t,e={},r){for(const n in t){const s=t[n],i=r&&r[n];H3(s)&&(!Array.isArray(s)||!q3(i))?(e[n]=Array.isArray(s)?[]:{},wj(s,e[n],i),W3(e[n])&&bj(e,n)):Tr(s)||(e[n]=!0)}return e}function ed(t,e,r,n){r||(r=wj(e,{},n));for(const s in t){const i=t[s],a=n&&n[s];H3(i)&&(!Array.isArray(i)||!q3(a))?(Tr(e)||vj(r[s])?r[s]=wj(i,Array.isArray(i)?[]:{},a):ed(i,Jn(e)?{}:e[s],r[s],a),W3(r[s])&&bj(r,s)):ai(i,e[s])?bj(r,s):r[s]=!0}return r}var G3=(t,{valueAsNumber:e,valueAsDate:r,setValueAs:n})=>Tr(t)?t:e?t===""?NaN:t&&+t:r&&is(t)?new Date(t):n?n(t):t;function r2(t){const e=t.ref;return Dw(e)?e.files:sN(e)?F3(t.refs).value:B3(e)?[...e.selectedOptions].map(({value:r})=>r):Jg(e)?L3(t.refs).value:G3(e.value,t)}var Qpe=(t,e,r,n)=>{const s={};for(const i of t){const a=Fe(e,i);a&&br(s,i,a._f)}return{criteriaMode:r,names:[...t],fields:s,shouldUseNativeValidation:n}},im=t=>Tr(t)?t:Tb(t)?t.source:an(t)?Tb(t.value)?t.value.source:t.value:t;const n2="AsyncFunction";var Xpe=t=>{if(!t||!t.validate)return!1;if(_s(t.validate))return t.validate.constructor.name===n2;if(an(t.validate)){for(const e in t.validate)if(t.validate[e].constructor.name===n2)return!0}return!1},eme=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function s2(t,e,r){const n=Fe(t,r);if(n||Wf(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),a=Fe(e,i),l=Fe(t,i);if(a&&!Array.isArray(a)&&r!==i)return{name:r};
522if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};s.pop()}return{name:r}}var tme=(t,e,r,n)=>{r(t);const s=Object.keys(t).filter(i=>i!=="name");return!s.length||n&&s.length>=Object.keys(e).length||s.find(i=>e[i]===(!n||ca.all))},rme=(t,e,r)=>!t||!e||t===e||Ii(t).some(n=>n&&(r?n===e||n.startsWith(e+"."):n.startsWith(e)||e.startsWith(n))),nme=(t,e,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(e||t):(r?n.isOnBlur:s.isOnBlur)?!t:(r?n.isOnChange:s.isOnChange)?t:!0,sme=(t,e)=>{const r=Fe(t,e);!aN(r).length&&!(r!=null&&r.root)&&gn(t,e)};const ime={mode:ca.onSubmit,reValidateMode:ca.onChange,shouldFocusError:!0},KS="form",ame=(t,e)=>{for(const r in t)r in e||delete t[r];Object.assign(t,e)},K3={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function ome(t={}){let e={...ime,...t},r={...xr(K3),isLoading:_s(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1},n={},s=an(e.defaultValues)||an(e.values)?xr(e.defaultValues||e.values)||{}:{},i=e.shouldUnregister?{}:xr(s),a={action:!1,actionArrayLengths:new Map,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set};const u={},h={};let p=0,f=Kc(e.mode),g=Kc(e.reValidateMode);const v={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},_={...v};let x={..._};const w={array:e2(),state:e2()};let S=0;const k=e.criteriaMode===ca.all,j=(W,ie)=>le=>{clearTimeout(h[W]),h[W]=setTimeout(ie,le)},C=async W=>{if(!a.keepIsValid&&!e.disabled&&(_.isValid||x.isValid||W)){const ie=++S;let le;e.resolver?(le=Zn((await H()).errors),ie===S&&R()):le=await z({fields:n,onlyCheckValid:!0,eventType:Ac.VALID}),ie===S&&le!==r.isValid&&w.state.next({isValid:le})}},R=(W,ie)=>{!e.disabled&&(_.isValidating||_.validatingFields||x.isValidating||x.validatingFields)&&((W||Array.from(l.mount)).forEach(le=>{le&&(ie?br(r.validatingFields,le,ie):gn(r.validatingFields,le))}),w.state.next({validatingFields:r.validatingFields,isValidating:!Zn(r.validatingFields)}))},A=()=>{r.dirtyFields=ed(s,i,void 0,n)},I=(W,ie=[],le,be,je=!0,Be=!0)=>{if(be&&le&&!e.disabled){if(a.action=!0,!a.actionArrayLengths.has(W)){const Te=Fe(n,W);a.actionArrayLengths.set(W,Array.isArray(Te)?Te.length:0)}if(Be&&Array.isArray(Fe(n,W))){const Te=le(Fe(n,W),be.argA,be.argB);je&&br(n,W,Te)}if(Be&&Array.isArray(Fe(r.errors,W))){const Te=Fe(r.errors,W),Oe=Te.root,ae=le(Te,be.argA,be.argB)||Te;Oe&&(ae.root=Oe),je&&br(r.errors,W,ae),sme(r.errors,W)}if((_.touchedFields||x.touchedFields)&&Be&&Array.isArray(Fe(r.touchedFields,W))){const Te=le(Fe(r.touchedFields,W),be.argA,be.argB);je&&br(r.touchedFields,W,Te)}(_.dirtyFields||x.dirtyFields)&&A(),w.state.next({name:W,isDirty:L(W,ie),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else br(i,W,ie)},P=(W,ie)=>{br(r.errors,W,ie),r.errors={...r.errors},w.state.next({errors:r.errors})},T=W=>{r.errors=W,w.state.next({errors:r.errors,isValid:!1})},O=W=>{const ie=Wf(W)?[W]:fg(W);let le=i,be=s;for(let je=0;je<ie.length-1;je++){const Be=ie[je];if(le=Jn(le)?le:le[Be],be=Jn(be)?be:be[Be],le===null&&be!==null)return!0}return!1},G=W=>{if(!a.actionArrayLengths.size)return!1;const ie=Wf(W)?[W]:fg(W);let le=i,be="",je=-1,Be=0;for(let Te=0;Te<ie.length;Te++){if(Jn(le))return!1;const Oe=ie[Te];if(be=be?`${be}.${Oe}`:Oe,Array.isArray(le)&&+Oe>=le.length)return je===-1?!1:Te===je?+Oe<Be:!0;a.actionArrayLengths.has(be)&&(je=Te+1,Be=a.actionArrayLengths.get(be)),le=le[Oe]}return!1},M=(W,ie,le,be)=>{const je=Fe(n,W);if(je){if(O(W)||G(W))return;const Be=Tr(Fe(i,W)),Te=Fe(i,W,Tr(le)?Fe(s,W):le);Tr(Te)||be&&be.defaultChecked||ie?br(i,W,ie?Te:r2(je._f)):te(W,Te),a.mount&&!a.action&&(C(),Be&&r.isDirty&&(_.isDirty||x.isDirty)&&(L()||(r.isDirty=!1,w.state.next({...r}))),t.shouldUnregister&&Be&&!Tr(Fe(i,W))&&w_(W,l)&&(a.watch=!0))}},U=(W,ie,le,be,je)=>{let Be=!1,Te=!1;const Oe={name:W};if(!e.disabled||be===!0){if(!le||be){const ae=ai(Fe(s,W),ie);
vendor: 16,337 bytes, line 522
522(_.isDirty||x.isDirty)&&(Te=r.isDirty,r.isDirty=Oe.isDirty=!ae||L(),Be=Te!==Oe.isDirty),Te=!!Fe(r.dirtyFields,W),ae!==r.isDirty?ame(r.dirtyFields,ed(s,i,void 0,n)):ae?gn(r.dirtyFields,W):br(r.dirtyFields,W,!0),Oe.dirtyFields=r.dirtyFields,Be=Be||(_.dirtyFields||x.dirtyFields)&&Te!==!ae}if(le){const ae=Fe(r.touchedFields,W);ae||(br(r.touchedFields,W,le),Oe.touchedFields=r.touchedFields,Be=Be||(_.touchedFields||x.touchedFields)&&ae!==le)}Be&&je&&w.state.next(Oe)}return Be?Oe:{}},V=(W,ie,le,be)=>{const je=Fe(r.errors,W),Be=(_.isValid||x.isValid)&&ii(ie)&&r.isValid!==ie;if(e.delayError&&le?(u[W]=j(W,()=>P(W,le)),u[W](e.delayError)):(clearTimeout(h[W]),delete u[W],le?br(r.errors,W,le):gn(r.errors,W),r.errors={...r.errors}),(le?!ai(je,le):je)||!Zn(be)||Be){const Te={...be,...Be&&ii(ie)?{isValid:ie}:{},errors:r.errors,name:W};r={...r,...Te},w.state.next(Te)}},H=async W=>(R(W,!0),await e.resolver(i,e.context,Qpe(W||l.mount,n,e.criteriaMode,e.shouldUseNativeValidation))),Y=async W=>{const{errors:ie}=await H(W);if(R(W),W){for(const le of W){const be=Fe(ie,le);be?l.array.has(le)&&an(be)&&!Object.keys(be).some(je=>!Number.isNaN(Number(je)))?Rb(r.errors,{[le]:be},le):br(r.errors,le,be):gn(r.errors,le)}r.errors={...r.errors}}else r.errors=ie;return ie},B=async({name:W,eventType:ie})=>{if(t.validate){const le=await t.validate({formValues:i,formState:r,name:W,eventType:ie});if(an(le))for(const be in le){const je=le[be];je&&at(`${KS}.${be}`,{message:is(je.message)?je.message:"",type:je.type||$a.validate})}else is(le)||!le?at(KS,{message:le||"",type:$a.validate}):We(KS);return le}return!0},z=async({fields:W,onlyCheckValid:ie,name:le,eventType:be,context:je={valid:!0,runRootValidation:!1}})=>{if(t.validate&&(je.runRootValidation=!0,!await B({name:le,eventType:be})&&(je.valid=!1,ie)))return je.valid;for(const Be in W){const Te=W[Be];if(Te){const{_f:Oe,...ae}=Te;if(Oe){const Ge=l.array.has(Oe.name),Ft=Te._f&&Xpe(Te._f),or=_.validatingFields||_.isValidating||x.validatingFields||x.isValidating;Ft&&or&&R([Oe.name],!0);const Ze=await _j(Te,l.disabled,i,k,e.shouldUseNativeValidation&&!ie,Ge);if(Ft&&or&&R([Oe.name]),Ze[Oe.name]&&(je.valid=!1,ie)||(!ie&&(Fe(Ze,Oe.name)?Ge?Rb(r.errors,Ze,Oe.name):br(r.errors,Oe.name,Ze[Oe.name]):gn(r.errors,Oe.name)),t.shouldUseNativeValidation&&Ze[Oe.name]))break}!Zn(ae)&&await z({context:je,onlyCheckValid:ie,fields:ae,name:Be,eventType:be})}}return je.valid},ee=()=>{for(const W of l.unMount){const ie=Fe(n,W);ie&&(ie._f.refs?ie._f.refs.every(le=>!GS(le)):!GS(ie._f.ref))&&Et(W)}l.unMount=new Set},L=(W,ie)=>(W&&ie&&br(i,W,ie),!ai(a.mount?i:s,s)),$=(W,ie,le)=>yj(W,l,{...a.mount?i:Tr(ie)||is(W)?s:ie},le,ie),F=W=>aN(Fe(a.mount?i:s,W,e.shouldUnregister?Fe(s,W,[]):[])),te=(W,ie,le={},be=!1,je=!1,Be=!1)=>{const Te=Fe(n,W);let Oe=ie;if(Te){const ae=Te._f;ae&&(!ae.disabled&&br(i,W,G3(ie,ae)),Oe=Ab(ae.ref)&&Jn(ie)?"":ie,B3(ae.ref)?[...ae.ref.options].forEach(Ge=>Ge.selected=Oe.includes(Ge.value)):ae.refs?Jg(ae.ref)?ae.refs.forEach(Ge=>{(!Ge.defaultChecked||!Ge.disabled)&&(Array.isArray(Oe)?Ge.checked=!!Oe.find(Ft=>Ft===Ge.value):Ge.checked=Oe===Ge.value||!!Oe)}):ae.refs.forEach(Ge=>Ge.checked=Ge.value===Oe):Dw(ae.ref)?ae.ref.value="":(ae.ref.value=Oe,!ae.ref.type&&!je&&!Be&&w.state.next({name:W,values:be?i:xr(i)})))}(le.shouldDirty||le.shouldTouch)&&U(W,Oe,le.shouldTouch,le.shouldDirty,!je),le.shouldValidate&&Ie(W,{delayError:le.delayError})},ue=(W,ie,le,be=!1,je=!1,Be=!1)=>{l.array.has(W)&&w.array.next({name:W,values:be?i:xr(i)});for(const Te in ie){if(!ie.hasOwnProperty(Te))return;const Oe=ie[Te],ae=W+"."+Te,Ge=Fe(n,ae);(l.array.has(W)||an(Oe)||Ge&&!Ge._f)&&!Fl(Oe)?ue(ae,Oe,le,be,je,Be):te(ae,Oe,le,be,je,Be)}},re=(W,ie,le,be,je=!1)=>{const Be=Fe(n,W),Te=l.array.has(W),Oe=be?ie:xr(ie),ae=Fe(i,W),Ge=ai(ae,Oe);if(Ge||br(i,W,Oe),Te)w.array.next({name:W,values:be?i:xr(i)}),(_.isDirty||_.dirtyFields||x.isDirty||x.dirtyFields)&&le.shouldDirty&&(A(),je||w.state.next({name:W,dirtyFields:r.dirtyFields,isDirty:L(W,Oe)}));else{const Ft=Array.isArray(Oe)&&!Oe.length||Zn(Oe),or=!Ge&&!je;!Be||Be._f||Jn(Oe)||Ft?te(W,Oe,le,be,je,or):ue(W,Oe,le,be,je,or)}if(!Ge&&!je){const Ft=w_(W,l),or=be?i:xr(i);w.state.next({...Ft&&r,name:a.mount||Ft?W:void 0,values:or})}},se=(W,ie,le={})=>re(W,ie,le,!1),ye=(W,ie={})=>{const le=_s(W)?W(i):W;if(!ai(i,le)){i={...i,...le};const be=z3(le);for(const je of l.mount)je in be&&re(je,be[je],ie,!0,!0);w.state.next({...r,name:void 0,type:void 0,...p?{values:i}:{}}),ie.shouldValidate&&C()}},de=async W=>{a.mount=!0;const ie=W.target;let le=ie.name,be=!0;const je=Fe(n,le),Be=Te=>{be=Number.isNaN(Te)||Fl(Te)&&isNaN(Te.getTime())||ai(Te,Fe(i,le,Te))};if(je){let Te,Oe;const ae=ie.type?r2(je._f):gj(W),Ge=W.type===Ac.BLUR||W.type===Ac.FOCUS_OUT,Ft=!eme(je._f)&&!t.validate&&!e.resolver&&!Fe(r.errors,le)&&!je._f.deps,or=Ft||nme(Ge,Fe(r.touchedFields,le),r.isSubmitted,g,f),Ze=w_(le,l,Ge);if(br(i,le,ae),Ge){if(!ie||!ie.readOnly){je._f.onBlur&&je._f.onBlur(W);const Kt=u[le];Kt&&Kt(0)}}else je._f.onChange&&je._f.onChange(W);const Gt=U(le,ae,Ge),_t=!Zn(Gt)||Ze;if(!Ge&&w.state.next({name:le,type:W.type,...p?{values:xr(i)}:{}}),or)return(!Ft||!r.isValid)&&(_.isValid||x.isValid)&&(e.mode==="onBlur"?Ge&&C():Ge||C()),_t&&w.state.next({name:le,...Ze?{}:Gt});if(!e.resolver&&t.validate&&await B({name:le,eventType:W.type}),!Ge&&Ze&&w.state.next({...r}),e.resolver){const{errors:Kt}=await H([le]);if(R([le]),Be(ae),!be){!Zn(Gt)&&w.state.next(Gt);return}const zr=s2(r.errors,n,le),ur=s2(Kt,n,zr.name||le);Te=ur.error,le=ur.name,Oe=Zn(Kt)}else R([le],!0),Te=(await _j(je,l.disabled,i,k,e.shouldUseNativeValidation))[le],R([le]),Be(ae),be&&(Te?Oe=!1:(_.isValid||x.isValid)&&(Oe=await z({fields:n,onlyCheckValid:!0,name:le,eventType:W.type})));be&&(je._f.deps&&(!Array.isArray(je._f.deps)||je._f.deps.length>0)&&Ie(je._f.deps),V(le,Oe,Te,Gt))}},pe=(W,ie)=>{if(Fe(r.errors,ie)&&W.focus)return W.focus(),1},Ie=async(W,ie={})=>{let le,be;const je=Ii(W);if(e.resolver){const Be=await Y(Tr(W)?W:je);le=Zn(Be),be=W?!je.some(Te=>Fe(Be,Te)):le}else W?(be=(await Promise.all(je.map(async Be=>{const Te=Fe(n,Be);return await z({fields:Te&&Te._f?{[Be]:Te}:Te,eventType:Ac.TRIGGER})}))).every(Boolean),!(!be&&!r.isValid)&&C()):be=le=await z({fields:n,name:W,eventType:Ac.TRIGGER});if(ie.delayError&&e.delayError&&is(W)){const Be=Fe(r.errors,W);Be?(gn(r.errors,W),u[W]=j(W,()=>P(W,Be)),u[W](e.delayError)):(clearTimeout(h[W]),delete u[W])}return w.state.next({...!is(W)||(_.isValid||x.isValid)&&le!==r.isValid?{}:{name:W},...e.resolver||!W?{isValid:le}:{},errors:r.errors}),ie.shouldFocus&&!be&&pf(n,pe,W?je:l.mount),be},Ne=(W,ie)=>{let le={...a.mount?i:s};return ie&&(le=U3(ie.dirtyFields?r.dirtyFields:r.touchedFields,le)),Tr(W)?le:is(W)?Fe(le,W):W.map(be=>Fe(le,be))},He=(W,ie)=>({invalid:!!Fe((ie||r).errors,W),isDirty:!!Fe((ie||r).dirtyFields,W),error:Fe((ie||r).errors,W),isValidating:!!Fe(r.validatingFields,W),isTouched:!!Fe((ie||r).touchedFields,W)}),We=W=>{const ie=W?Ii(W):void 0;ie==null||ie.forEach(le=>gn(r.errors,le)),ie?ie.forEach(le=>{w.state.next({name:le,errors:r.errors})}):(r.errors={},w.state.next({errors:r.errors}))},at=(W,ie,le)=>{const be=(Fe(n,W,{_f:{}})._f||{}).ref,je=Fe(r.errors,W)||{},{ref:Be,message:Te,type:Oe,...ae}=je;br(r.errors,W,{...ae,...ie,ref:be}),w.state.next({name:W,errors:r.errors,isValid:!1}),le&&le.shouldFocus&&be&&be.focus&&be.focus()},Xt=(W,ie)=>{if(_s(W)){p++;const{unsubscribe:le}=w.state.subscribe({next:je=>"values"in je&&W(je.values||$(void 0,ie),je)});let be=!1;return{unsubscribe:()=>{be||(be=!0,p--,le())}}}return $(W,ie,!0)},Rt=W=>{var ie;const le=!!(!((ie=W.formState)===null||ie===void 0)&&ie.values);le&&p++;const{unsubscribe:be}=w.state.subscribe({next:Be=>{if(rme(W.name,Be.name,W.exact)&&tme(Be,W.formState||_,Pr,W.reRenderRoot)){const Te={...i};W.callback({values:Te,...r,...Be,defaultValues:s})}}});if(!le)return be;let je=!1;return()=>{je||(je=!0,p--,be())}},Ee=W=>(a.mount=!0,x={...x,...W.formState},Rt({...W,formState:{...v,...W.formState}})),Et=(W,ie={})=>{for(const le of W?Ii(W):l.mount)l.mount.delete(le),l.array.delete(le),ie.keepValue||(gn(n,le),gn(i,le)),!ie.keepError&&gn(r.errors,le),!ie.keepDirty&&gn(r.dirtyFields,le),!ie.keepTouched&&gn(r.touchedFields,le),!ie.keepIsValidating&&gn(r.validatingFields,le),!e.shouldUnregister&&!ie.keepDefaultValue&&gn(s,le);w.state.next({values:xr(i)}),w.state.next({...r,...ie.keepDirty?{isDirty:L()}:{}}),!ie.keepIsValid&&C()},Mt=({disabled:W,name:ie})=>{if(ii(W)&&a.mount||W||l.disabled.has(ie)){const je=l.disabled.has(ie)!==!!W;W?l.disabled.add(ie):l.disabled.delete(ie),je&&a.mount&&!a.action&&C()}},ot=(W,ie={})=>{let le=Fe(n,W);const be=ii(ie.disabled)||ii(e.disabled),je=!l.registerName.has(W)&&le&&le._f&&!le._f.mount;return br(n,W,{...le||{},_f:{...le&&le._f?le._f:{ref:{name:W}},name:W,mount:!0,...ie}}),l.mount.add(W),le&&!je?Mt({disabled:ii(ie.disabled)?ie.disabled:e.disabled,name:W}):M(W,!0,ie.value),{...be?{disabled:ie.disabled||e.disabled}:{},...e.progressive?{required:!!ie.required,min:im(ie.min),max:im(ie.max),minLength:im(ie.minLength),maxLength:im(ie.maxLength),pattern:im(ie.pattern)}:{},name:W,onChange:de,onBlur:de,ref:Be=>{if(Be){l.registerName.add(W),ot(W,ie),l.registerName.delete(W),le=Fe(n,W);const Te=Tr(Be.value)&&Be.querySelectorAll&&Be.querySelectorAll("input,select,textarea")[0]||Be,Oe=Zpe(Te),ae=le._f.refs||[];if(Oe?ae.find(Ft=>Ft===Te):Te===le._f.ref)return;const Ge={...le._f};Oe?(Ge.refs=[...ae.filter(GS),Te,...Array.isArray(Fe(s,W))?[{}]:[]],Ge.ref={type:Te.type,name:W}):(Ge.ref=Te,delete Ge.refs),br(n,W,{_f:Ge}),M(W,!1,void 0,Te)}else le=Fe(n,W,{}),le._f&&(le._f.mount=!1),(e.shouldUnregister||ie.shouldUnregister)&&!(I3(l.array,W)&&a.action)&&l.unMount.add(W)}}},De=()=>e.shouldFocusError&&!e.shouldUseNativeValidation&&pf(n,pe,l.mount),St=W=>{ii(W)&&(w.state.next({disabled:W}),pf(n,(ie,le)=>{const be=Fe(n,le);be&&(ie.disabled=be._f.disabled||W,Array.isArray(be._f.refs)&&be._f.refs.forEach(je=>{je.disabled=be._f.disabled||W}))},0,!1))},jt=(W,ie)=>async le=>{let be,je;le&&(le.preventDefault&&le.preventDefault(),le.persist&&le.persist());let Be=xr(i);if(w.state.next({isSubmitting:!0}),e.resolver){const{errors:Te,values:Oe}=await H();R(),r.errors=Te,Be=xr(Oe)}else await z({fields:n,eventType:Ac.SUBMIT});if(l.disabled.size)for(const Te of l.disabled)gn(Be,Te);if(gn(r.errors,O3),Zn(r.errors)){w.state.next({errors:{}});try{be=await W(Be,le)}catch(Te){je=Te}}else ie&&await ie({...r.errors},le),De(),setTimeout(De);if(w.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Zn(r.errors)&&!je,submitCount:r.submitCount+1,errors:r.errors}),je)throw je;return be},Cr=(W,ie={})=>{Fe(n,W)&&(Tr(ie.defaultValue)?se(W,xr(Fe(s,W))):(se(W,ie.defaultValue),br(s,W,xr(ie.defaultValue))),ie.keepTouched||gn(r.touchedFields,W),ie.keepDirty||(gn(r.dirtyFields,W),r.isDirty=ie.defaultValue?L(W,xr(Fe(s,W))):L()),ie.keepError||(gn(r.errors,W),_.isValid&&C()),w.state.next({...r}))},Or=(W,ie={})=>{const le=W?xr(W):s,be=xr(le),je=Zn(W),Be=be,Te=n;if(ie.keepDefaultValues||(s=le),!ie.keepValues){if(ie.keepDirtyValues){const Oe=new Set([...l.mount,...V3(ed(s,i,void 0,Te),r.dirtyFields)]);for(const ae of Array.from(Oe)){const Ge=Fe(r.dirtyFields,ae),Ft=Fe(i,ae),or=Fe(Be,ae);Ge&&!Tr(Ft)?br(Be,ae,Ft):!Ge&&!Tr(or)&&se(ae,or)}}else{if(Ow&&Tr(W))for(const Oe of l.mount){const ae=Fe(n,Oe);if(ae&&ae._f){const Ge=Array.isArray(ae._f.refs)?ae._f.refs[0]:ae._f.ref;if(Ab(Ge)){const Ft=Ge.closest("form");if(Ft){Ft.reset();break}}}}if(ie.keepFieldsRef)for(const Oe of l.mount)se(Oe,Fe(Be,Oe));else n={}}if(e.shouldUnregister){if(i=ie.keepDefaultValues?xr(s):{},ie.keepFieldsRef)for(const Oe of l.mount)br(i,Oe,Fe(Be,Oe))}else i=xr(Be);w.array.next({values:{...Be}}),w.state.next({name:void 0,type:void 0,values:{...Be}})}l={mount:ie.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!_.isValid||!!ie.keepIsValid||!!ie.keepDirtyValues||!e.shouldUnregister&&!Zn(Be),a.watch=!!e.shouldUnregister,a.keepIsValid=!!ie.keepIsValid,a.action=!1,a.actionArrayLengths.clear(),ie.keepErrors||(r.errors={}),w.state.next({submitCount:ie.keepSubmitCount?r.submitCount:0,isDirty:je?!1:ie.keepDirty?r.isDirty:ie.keepValues?L():!!(ie.keepDefaultValues&&!ai(W,s)),isSubmitted:ie.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:je?{}:ie.keepDirtyValues?ie.keepDefaultValues&&i?ed(s,i,void 0,Te):r.dirtyFields:ie.keepDefaultValues&&W?ed(s,W,void 0,Te):ie.keepDirty?r.dirtyFields:{},touchedFields:ie.keepTouched?r.touchedFields:{},errors:ie.keepErrors?r.errors:{},isSubmitSuccessful:ie.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Nr=(W,ie)=>Or(_s(W)?W(i):W,{...e.resetOptions,...ie}),rr=(W,ie={})=>{const le=Fe(n,W),be=le&&le._f;if(be){const je=be.refs?be.refs[0]:be.ref;je.focus&&setTimeout(()=>{je.focus(),ie.shouldSelect&&_s(je.select)&&je.select()})}},Pr=W=>{const{name:ie,type:le,values:be,...je}=W;r={...r,...je}};w.state.subscribe({next:Pr});const wn={control:{register:ot,unregister:Et,getFieldState:He,handleSubmit:jt,setError:at,_subscribe:Rt,_runSchema:H,_updateIsValidating:R,_focusError:De,_getWatch:$,_getDirty:L,_setValid:C,_setFieldArray:I,_setDisabledField:Mt,_setErrors:T,_getFieldArray:F,_reset:Or,_resetDefaultValues:()=>_s(e.defaultValues)&&e.defaultValues().then(W=>{Nr(W,e.resetOptions),w.state.next({isLoading:!1})}),_removeUnmounted:ee,_disableForm:St,_subjects:w,_proxyFormState:_,get _fields(){return n},get _formValues(){return i},get _state(){return a},set _state(W){a=W},get _defaultValues(){return s},get _names(){return l},set _names(W){l=W},get _formState(){return r},get _options(){return e},set _options(W){e={...e,...W},f=Kc(e.mode),g=Kc(e.reValidateMode)}},subscribe:Ee,trigger:Ie,register:ot,handleSubmit:jt,watch:Xt,setValue:se,setValues:ye,getValues:Ne,reset:Nr,resetField:Cr,resetDefaultValues:(W,ie={})=>{if(s=xr(W),!ie.keepDirty){const le=ed(s,i,void 0,n);r.dirtyFields=le,r.isDirty=!Zn(le)}ie.keepIsValid||C(),w.state.next({...r,defaultValues:s})},clearErrors:We,unregister:Et,setError:at,setFocus:rr,getFieldState:He};return{...wn,formControl:wn}}function Y3(t={}){const e=K.useRef(void 0),r=K.useRef(void 0),n=K.useRef(t.formControl),[s,i]=K.useState(()=>({...xr(K3),isLoading:_s(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1,defaultValues:_s(t.defaultValues)?void 0:t.defaultValues}));if(!e.current||t.formControl&&n.current!==t.formControl)if(n.current=t.formControl,t.formControl)e.current={...t.formControl,formState:s},t.defaultValues&&!_s(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:h,...p}=ome(t);e.current={...p,formState:s}}const a=e.current.control;a._options=t;const{resyncIfNeeded:l,snapshot:u}=rN();return Lw(()=>{const h=()=>({...a._formState,defaultValues:a._defaultValues});l(!0,h,i);const p=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState,defaultValues:a._defaultValues}),reRenderRoot:!0});return i(f=>({...f,isReady:!0})),a._formState.isReady=!0,()=>{p(),u(!0,h)}},[a,l,u]),K.useEffect(()=>a._disableForm(t.disabled),[a,t.disabled]),K.useEffect(()=>{t.mode&&(a._options.mode=t.mode),t.reValidateMode&&(a._options.reValidateMode=t.reValidateMode)},[a,t.mode,t.reValidateMode]),K.useEffect(()=>{t.errors&&(a._setErrors(t.errors),a._focusError())},[a,t.errors]),K.useEffect(()=>{t.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,t.shouldUnregister]),K.useEffect(()=>{if(a._proxyFormState.isDirty){const h=a._getDirty();h!==s.isDirty&&a._subjects.state.next({isDirty:h})}},[a,s.isDirty]),K.useEffect(()=>{var h;t.values&&!ai(t.values,r.current)?(a._reset(t.values,{keepFieldsRef:!0,...a._options.resetOptions}),!((h=a._options.resetOptions)===null||h===void 0)&&h.keepIsValid||a._setValid(),r.current=t.values,i(p=>({...p}))):a._resetDefaultValues()},[a,t.values]),K.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),e.current.formState=K.useMemo(()=>M3(s,a),[a,s]),e.current}const i2=(t,e,r)=>{if(t&&"reportValidity"in t){const n=Fe(r,e);t.setCustomValidity(n&&n.message||""),t.reportValidity()}},xj=(t,e)=>{for(const r in e.fields){const n=e.fields[r];n&&n.ref&&"reportValidity"in n.ref?i2(n.ref,r,t):n&&n.refs&&n.refs.forEac
522h(s=>i2(s,r,t))}},a2=(t,e)=>{e.shouldUseNativeValidation&&xj(t,e);const r={};for(const n in t){const s=Fe(e.fields,n),i=Object.assign(t[n]||{},{ref:s&&s.refs?s.refs[0]:s&&s.ref});if(lme(e.names||Object.keys(t),n)){const a=Object.assign({},Fe(r,n));br(a,"root",i),br(r,n,a)}else br(r,n,i)}return r},lme=(t,e)=>{const r=o2(e).replace(/[.*+?^${}()|\\]/g,"\\$&");return t.some(n=>o2(n).match(`^${r}\\.\\d+`))};function o2(t){return t.replace(/[\[\]]/g,"")}function Sj(){return Sj=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Sj.apply(null,arguments)}function l2(t,e){try{var r=t()}catch(n){return e(n)}return r&&r.then?r.then(void 0,e):r}function cme(t,e){for(var r=Object.create(null);t.length;){var n=t[0],s=n.code,i=n.message,a=n.path.join(".");if(!r[a])if("unionErrors"in n){var l,u,h=n.unionErrors.reduce(function(g,v){return v.errors.length<g.errors.length?v:g}).errors[0];r[a]={message:(l=h==null?void 0:h.message)!=null?l:i,type:(u=h==null?void 0:h.code)!=null?u:s}}else r[a]={message:i,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(g){return g.errors.forEach(function(v){return t.push(v)})}),e){var p=r[a].types,f=p&&p[n.code];r[a]=iN(a,e,r,s,f?[].concat(f,n.message):n.message)}t.shift()}return r}function ume(t,e){for(var r=Object.create(null),n=function(){var s=t[0],i=s.code,a=s.message,l=s.path.join(".");if(!r[l])if(s.code==="invalid_union"&&s.errors.length>0){var u,h,p=s.errors.reduce(function(v,_){return _.length<v.length?_:v})[0];r[l]={message:(u=p==null?void 0:p.message)!=null?u:a,type:(h=p==null?void 0:p.code)!=null?h:i}}else r[l]={message:a,type:i};if(s.code==="invalid_union"&&s.errors.forEach(function(v){return v.forEach(function(_){return t.push(Sj({},_,{path:[].concat(s.path,_.path)}))})}),e){var f=r[l].types,g=f&&f[s.code];r[l]=iN(l,e,r,i,g?[].concat(g,s.message):s.message)}t.shift()};t.length;)n();return r}function Z3(t,e,r){if(r===void 0&&(r={}),(function(n){return"_zod"in n&&typeof n._zod=="object"})(t))return function(n,s,i){try{return Promise.resolve(l2(function(){function a(u){return i.shouldUseNativeValidation&&xj({},i),{errors:{},values:r.raw?Object.assign({},n):u}}var l=t;return r.mode==="sync"?a(l.parse(n,e)):Promise.resolve(l.parseAsync(n,e)).then(a)},function(a){if((function(l){var u;return!(l==null||(u=l._zod)==null||(u=u.traits)==null||!u.has("$ZodError"))})(a))return{values:{},errors:a2(ume(a.issues,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw a}))}catch(a){return Promise.reject(a)}};if((function(n){return"_def"in n&&typeof n._def=="object"})(t))return function(n,s,i){try{return Promise.resolve(l2(function(){return Promise.resolve(t[r.mode==="sync"?"parse":"parseAsync"](n,e)).then(function(a){return i.shouldUseNativeValidation&&xj({},i),{errors:{},values:r.raw?Object.assign({},n):a}})},function(a){if((function(l){return Array.isArray(l==null?void 0:l.issues)})(a))return{values:{},errors:a2(cme(a.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw a}))}catch(a){return Promise.reject(a)}};throw new Error("Invalid input: not a Zod schema")}const J3=Ype,Q3=y.createContext({}),ui=({...t})=>o.jsx(Q3.Provider,{value:{name:t.name},children:o.jsx(Ti,{...t})}),$w=()=>{const t=y.useContext(Q3),e=y.useContext(X3),{getFieldState:r}=Fw(),n=nN({name:t.name}),s=r(t.name,n);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:i}=e;return{id:i,name:t.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...s}},X3=y.createContext({});function Ls({className:t,...e}){const r=y.useId();return o.jsx(X3.Provider,{value:{id:r},children:o.jsx("div",{"data-slot":"form-item",className:ke("grid gap-2",t),...e})})}function Io({className:t,...e}){const{error:r,formItemId:n}=$w();return o.jsx(ft,{"data-slot":"form-label","data-error":!!r,className:ke("data-[error=true]:text-destructive",t),htmlFor:n,...e})}function Di({...t}){const{error:e,formItemId:r,formDescriptionId:n,formMessageId:s}=$w();return o.jsx(yC,{"data-slot":"form-control",id:r,"aria-describedby":e?`${n} ${s}`:`${n}`,"aria-invalid":!!e,...t})}function dme({className:t,...e}){const{formDescriptionId:r}=$w();return o.jsx("p",{"data-slot":"form-description",id:r,className:ke("text-muted-foreground text-sm",t),...e})}function Pd({className:t,...e}){const{error:r,formMessageId:n}=$w(),s=r?String((r==null?void 0:r.message)??""):e.children;return s?o.jsx("p",{"data-slot":"form-message",id:n,className:ke("text-destructive text-sm",t),...e,children:s}):null}var hme=Object.defineProperty,cr=(t,e)=>hme(t,"name",{value:e,configurable:!0});function e5(t,e){return y.useReducer((r,n)=>e[r][n]??r,t)}cr(e5,"useStateMachine");var t5="ScrollArea",[r5,gke]=Vn(t5),[fme,xa]=r5(t5),pme=y.forwardRef(cr(function(e,r){const{__scopeScrollArea:n,type:s="hover",dir:i,scrollHideDelay:a=600,...l}=e,[u,h]=y.useState(null),[p,f]=y.useState(null),[g,v]=y.useState(null),[_,x]=y.useState(null),[w,S]=y.useState(null),[k,j]=y.useState(0),[C,R]=y.useState(0),[A,I]=y.useState(!1),[P,T]=y.useState(!1),O=Vt(r,h),G=du(i);return o.jsx(fme,{scope:n,type:s,dir:G,scrollHideDelay:a,scrollArea:u,viewport:p,onViewportChange:f,content:g,onContentChange:v,scrollbarX:_,onScrollbarXChange:x,scrollbarXEnabled:A,onScrollbarXEnabledChange:I,scrollbarY:w,onScrollbarYChange:S,scrollbarYEnabled:P,onScrollbarYEnabledChange:T,onCornerWidthChange:j,onCornerHeight
522Change:R,children:o.jsx(it.div,{dir:G,...l,ref:O,style:{position:"relative","--radix-scroll-area-corner-width":k+"px","--radix-scroll-area-corner-height":C+"px",...e.style}})})},"ScrollArea")),mme="ScrollAreaViewport",gme=y.forwardRef(cr(function(e,r){const{__scopeScrollArea:n,children:s,nonce:i,...a}=e,l=xa(mme,n),u=y.useRef(null),h=Vt(r,u,l.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx(vme,{nonce:i}),o.jsx(it.div,{"data-radix-scroll-area-viewport":"",...a,ref:h,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:o.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})},"ScrollAreaViewport")),vme=y.memo(cr(function({nonce:e}){return o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:e})},"ScrollAreaViewportStyle"),(t,e)=>t.nonce===e.nonce),ec="ScrollAreaScrollbar",yme=y.forwardRef(cr(function(e,r){const{forceMount:n,...s}=e,i=xa(ec,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:l}=i,u=e.orientation==="horizontal";return y.useEffect(()=>(u?a(!0):l(!0),()=>{u?a(!1):l(!1)}),[u,a,l]),i.type==="hover"?o.jsx(_me,{...s,ref:r,forceMount:n}):i.type==="scroll"?o.jsx(bme,{...s,ref:r,forceMount:n}):i.type==="auto"?o.jsx(n5,{...s,ref:r,forceMount:n}):i.type==="always"?o.jsx(lN,{...s,ref:r,"data-state":"visible"}):null},"ScrollAreaScrollbar")),_me=y.forwardRef(cr(function(e,r){const{forceMount:n,...s}=e,i=xa(ec,e.__scopeScrollArea),[a,l]=y.useState(!1);return y.useEffect(()=>{const u=i.scrollArea;let h=0;if(u){const p=cr(()=>{window.clearTimeout(h),l(!0)},"handlePointerEnter"),f=cr(()=>{h=window.setTimeout(()=>l(!1),i.scrollHideDelay)},"handlePointerLeave");return u.addEventListener("pointerenter",p),u.addEventListener("pointerleave",f),()=>{window.clearTimeout(h),u.removeEventListener("pointerenter",p),u.removeEventListener("pointerleave",f)}}},[i.scrollArea,i.scrollHideDelay]),o.jsx(os,{present:n||a,children:o.jsx(n5,{"data-state":a?"visible":"hidden",...s,ref:r})})},"ScrollAreaScrollbarHover")),bme=y.forwardRef(cr(function(e,r){const{forceMount:n,...s}=e,i=xa(ec,e.__scopeScrollArea),a=e.orientation==="horizontal",l=Xg(()=>h("SCROLL_END"),100),[u,h]=e5("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return y.useEffect(()=>{if(u==="idle"){const p=window.setTimeout(()=>h("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(p)}},[u,i.scrollHideDelay,h]),y.useEffect(()=>{const p=i.viewport,f=a?"scrollLeft":"scrollTop";if(p){let g=p[f];const v=cr(()=>{const _=p[f];g!==_&&(h("SCROLL"),l()),g=_},"handleScroll");return p.addEventListener("scroll",v),()=>p.removeEventListener("scroll",v)}},[i.viewport,a,h,l]),o.jsx(os,{present:n||u!=="hidden",children:o.jsx(lN,{"data-state":u==="hidden"?"hidden":"visible",...s,ref:r,onPointerEnter:Xe(e.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:Xe(e.onPointerLeave,()=>h("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),n5=y.forwardRef(cr(function(e,r){const n=xa(ec,e.__scopeScrollArea),{forceMount:s,...i}=e,[a,l]=y.useState(!1),u=e.orientation==="horizontal",h=Xg(()=>{if(n.viewport){const p=n.viewport.offsetWidth<n.viewport.scrollWidth,f=n.viewport.offsetHeight<n.viewport.scrollHeight;l(u?p:f)}},10);return Rd(n.viewport,h),Rd(n.content,h),o.jsx(os,{present:s||a,children:o.jsx(lN,{"data-state":a?"visible":"hidden",...i,ref:r})})},"ScrollAreaScrollbarAuto")),lN=y.forwardRef(cr(function(e,r){const{orientation:n="vertical",...s}=e,i=xa(ec,e.__scopeScrollArea),a=y.useRef(null),l=y.useRef(0),[u,h]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=cN(u.viewport,u.content),f={...s,sizes:u,onSizesChange:h,hasThumb:p>0&&p<1,onThumbChange:cr(v=>a.current=v,"onThumbChange"),onThumbPointerUp:cr(()=>l.current=0,"onThumbPointerUp"),onThumbPointerDown:cr(v=>l.current=v,"onThumbPointerDown")};function g(v,_){return o5(v,l.current,u,_)}return cr(g,"getScrollPosition"),n==="horizontal"?o.jsx(wme,{...f,ref:r,onThumbPositionChange:()=>{if(i.viewport&&a.current){const v=i.viewport.scrollLeft,_=Ej(v,u,i.dir);a.current.style.transform=`translate3d(${_}px, 0, 0)`}}
vendor: 2,173 bytes, line 522
522,onWheelScroll:v=>{i.viewport&&(i.viewport.scrollLeft=v)},onDragScroll:v=>{i.viewport&&(i.viewport.scrollLeft=g(v,i.dir))}}):n==="vertical"?o.jsx(xme,{...f,ref:r,onThumbPositionChange:()=>{if(i.viewport&&a.current){const v=i.viewport.scrollTop,_=Ej(v,u);a.current.style.transform=`translate3d(0, ${_}px, 0)`}},onWheelScroll:v=>{i.viewport&&(i.viewport.scrollTop=v)},onDragScroll:v=>{i.viewport&&(i.viewport.scrollTop=g(v))}}):null},"ScrollAreaScrollbarVisible")),wme=y.forwardRef(cr(function(e,r){const{sizes:n,onSizesChange:s,...i}=e,a=xa(ec,e.__scopeScrollArea),[l,u]=y.useState(),h=y.useRef(null),p=Vt(r,h,a.onScrollbarXChange);return y.useEffect(()=>{h.current&&u(getComputedStyle(h.current))},[h]),o.jsx(i5,{"data-orientation":"horizontal",...i,ref:p,sizes:n,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Qg(n)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,g)=>{if(a.viewport){const v=a.viewport.scrollLeft+f.deltaX;e.onWheelScroll(v),dN(v,g)&&f.preventDefault()}},onResize:()=>{h.current&&a.viewport&&l&&s({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:pg(l.paddingLeft),paddingEnd:pg(l.paddingRight)}})}})},"ScrollAreaScrollbarX")),xme=y.forwardRef(cr(function(e,r){const{sizes:n,onSizesChange:s,...i}=e,a=xa(ec,e.__scopeScrollArea),[l,u]=y.useState(),h=y.useRef(null),p=Vt(r,h,a.onScrollbarYChange);return y.useEffect(()=>{h.current&&u(getComputedStyle(h.current))},[h]),o.jsx(i5,{"data-orientation":"vertical",...i,ref:p,sizes:n,style:{top:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Qg(n)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,g)=>{if(a.viewport){const v=a.viewport.scrollTop+f.deltaY;e.onWheelScroll(v),dN(v,g)&&f.preventDefault()}},onResize:()=>{h.current&&a.viewport&&l&&s({content:a.viewport.scrollHeight,viewport:
522a.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:pg(l.paddingTop),paddingEnd:pg(l.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[Sme,s5]=r5(ec),i5=y.forwardRef(cr(function(e,r){const{__scopeScrollArea:n,sizes:s,hasThumb:i,onThumbChange:a,onThumbPointerUp:l,onThumbPointerDown:u,onThumbPositionChange:h,onDragScroll:p,onWheelScroll:f,onResize:g,...v}=e,_=xa(ec,n),[x,w]=y.useState(null),S=Vt(r,w),k=y.useRef(null),j=y.useRef(""),C=_.viewport,R=s.content-s.viewport,A=Pn(f),I=Pn(h),P=Xg(g,10);function T(O){if(k.current){const G=O.clientX-k.current.left,M=O.clientY-k.current.top;p({x:G,y:M})}}return cr(T,"handleDragScroll"),y.useEffect(()=>{const O=cr(G=>{const M=G.target;(x==null?void 0:x.contains(M))&&A(G,R)},"handleWheel");return document.addEventListener("wheel",O,{passive:!1}),()=>document.removeEventListener("wheel",O,{passive:!1})},[C,x,R,A]),y.useEffect(I,[s,I]),Rd(x,P),Rd(_.content,P),o.jsx(Sme,{scope:n,scrollbar:x,hasThumb:i,onThumbChange:Pn(a),onThumbPointerUp:Pn(l),onThumbPositionChange:I,onThumbPointerDown:Pn(u),children:o.jsx(it.div,{...v,ref:S,style:{position:"absolute",...v.style},onPointerDown:Xe(e.onPointerDown,O=>{O.button===0&&(O.target.setPointerCapture(O.pointerId),k.current=x.getBoundingClientRect(),j.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",_.viewport&&(_.viewport.style.scrollBehavior="auto"),T(O))}),onPointerMove:Xe(e.onPointerMove,T),onPointerUp:Xe(e.onPointerUp,O=>{const G=O.target;G.hasPointerCapture(O.pointerId)&&G.releasePointerCapture(O.pointerId),document.body.style.webkitUserSelect=j.current,_.viewport&&(_.viewport.style.scrollBehavior=""),k.current=null})})})},"ScrollAreaScrollbarImpl")),kj="ScrollAreaThumb",kme=y.forwardRef(cr(function(e,r){const{forceMount:n,...s}=e,i=s5(kj,e.__scopeScrollArea);return o.jsx(os,{present:n||i.hasThumb,children:o.jsx(Eme,{ref:r,...s})})},"ScrollAreaThumb")),Eme=y.forwardRef(cr(function(e,r){const{__scopeScrollArea:n,style:s,...i}=e,a=xa(kj,n),l=s5(kj,n),{onThumbPositionChange:u}=l,h=Vt(r,l.onThumbChange),p=y.useRef(void 0),f=Xg(()=>{p.current&&(p.current(),p.current=void 0)},100);return y.useEffect(()=>{const g=a.viewport;if(g){const v=cr(()=>{if(f(),!p.current){const _=Nme(g,u);p.current=_,u()}},"handleScroll");return u(),g.addEventListener("scroll",v),()=>g.removeEventListener("scroll",v)}},[a.viewport,f,u]),o.jsx(it.div,{"data-state":l.hasThumb?"visible":"hidden",...i,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:Xe(e.onPointerDownCapture,g=>{const _=g.target.getBoundingClientRect(),x=g.clientX-_.left,w=g.clientY-_.top;l.onThumbPointerDown({x,y:w})}),onPointerUp:Xe(e.onPointerUp,l.onThumbPointerUp)})},"ScrollAreaThumbImpl")),a5="ScrollAreaCorner",jme=y.forwardRef(cr(function(e,r){const n=xa(a5,e.__scopeScrollArea),s=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&s?o.jsx(Cme,{...e,ref:r}):null},"ScrollAreaCorner")),Cme=y.forwardRef(cr(function(e,r){const{__scopeScrollArea:n,...s}=e,i=xa(a5,n),[a,l]=y.useState(0),[u,h]=y.useState(0),p=!!(a&&u),{onCornerWidthChange:f,onCornerHeightChange:g}=i;return Rd(i.scrollbarX,()=>{var _;const v=((_=i.scrollbarX)==null?void 0:_.offsetHeight)||0;i.onCornerHeightChange(v),h(v)}),Rd(i.scrollbarY,()=>{var _;const v=((_=i.scrollbarY)==null?void 0:_.offsetWidth)||0;i.onCornerWidthChange(v),l(v)}),y.useEffect(()=>()=>{f(0),g(0)},[f,g]),p?o.jsx(it.div,{...s,ref:r,style:{width:a,height:u,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null},"ScrollAreaCornerImpl"));function pg(t){return t?parseInt(t,10):0}cr(pg,"toInt");function cN(t,e){const r=t/e;return isNaN(r)?0:r}cr(cN,"getThumbRatio");function Qg(t){const e=cN(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}cr(Qg,"getThumbSize");function o5(t,e,r,n="ltr"){const s=Qg(r),i=s/2,a=e||i,l=s-a,u=r.scrollbar.paddingStart+a,h=r.scrollbar.size-r.scrollbar.paddingEnd-l,p=r.content-r.viewport,f=n==="ltr"?[0,p]:[p*-1,0];return uN([u,h],f)(t)}cr(o5,"getScrollPositionFromPointer");function Ej(t,e,r="ltr"){const n=Qg(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,a=e.content-e.viewport,l=i-n,u=r==="ltr"?[0,a]:[a*-1,0],h=Eb(t,u);return uN([0,a],[0,l])(h)}cr(Ej,"getThumbOffsetFromScroll");function uN(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(r-t[0])}}cr(uN,"linearScale");function dN(t,e){return t>0&&t<e}cr(dN,"isScrollingWithinScrollbarBounds");var Nme=cr((t,e=()=>{})=>{let r={left:t.scrollLeft,top:t.scrollTop},n=0;return cr((function s(){const i={left:t.scrollLeft,top:t.scrollTop},a=r.left!==i.left,l=r.top!==i.top;(a||l)&&e(),r=i,n=window.requestAnimationFrame(s)}),"loop")(),()=>window.cancelAnimationFrame(n)},"addUnlinkedScrollListener");function Xg(t,e){const r=Pn(t),n=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(n.current),[]),y.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}cr(Xg,"useDebounceCallback");function Rd(t,e){const r=Pn(e);Xr(()=>{let n=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(t),()=>{window.cancelAnimationFrame(n),s.unobserve(t)}}},[t,r])}cr(Rd,"useResizeObserver");var Pme=pme,Rme=gme,Ame=yme,Tme=kme,Ime=jme;function Dme({className:t,children:e,...r}){return o.jsxs(Pme,{"data-slot":"scroll-area",className:ke("relative overflow-hidden",t),...r,children:[o.jsx(Rme,{className:"h-full w-full rounded-[inherit]",children:e}),o.jsx(Ome,{}),o.jsx(Ime,{})]})}function Ome({className:t,orientation:e="vertical",...r}){return o.jsx(Ame,{"data-slot":"scrollbar",orientation:e,className:ke("touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 w-full border-t border-t-transparent p-[1px]",t),...r,children:o.jsx(Tme,{className:"bg-border relative flex-1 rounded-full"})})}var Mme=Object.defineProperty,mu=(t,e)=>Mme(t,"name",{value:e,configurable:!0}),hN="Popover",[l5,vke]=Vn(hN,[ap]),fN=ap(),[Lme,op]=l5(hN),Fme=mu(t=>{const{__scopePopover:e,children:r,open:n,defaultOpen:s,onOpenChange:i,modal:
522a=!1}=t,l=fN(e),u=y.useRef(null),[h,p]=y.useState(!1),[f,g]=$i({prop:n,defaultProp:s??!1,onChange:i,caller:hN});return o.jsx(W1,{...l,children:o.jsx(Lme,{scope:e,contentId:Bn(),triggerRef:u,open:f,onOpenChange:g,onOpenToggle:y.useCallback(()=>g(v=>!v),[g]),hasCustomAnchor:h,onCustomAnchorAdd:y.useCallback(()=>p(!0),[]),onCustomAnchorRemove:y.useCallback(()=>p(!1),[]),modal:a,children:r})})},"Popover"),$me="PopoverTrigger",zme=y.forwardRef(mu(function(e,r){const{__scopePopover:n,...s}=e,i=op($me,n),a=fN(n),l=Vt(r,i.triggerRef),u=o.jsx(it.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":pN(i.open),...s,ref:l,onClick:Xe(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?u:o.jsx(G1,{asChild:!0,...a,children:u})},"PopoverTrigger")),c5="PopoverPortal",[Ume,Bme]=l5(c5,{forceMount:void 0}),Vme=mu(t=>{const{__scopePopover:e,forceMount:r,children:n,container:s}=t,i=op(c5,e);return o.jsx(Ume,{scope:e,forceMount:r,children:o.jsx(os,{present:r||i.open,children:o.jsx(uw,{asChild:!0,container:s,children:n})})})},"PopoverPortal"),mg="PopoverContent",Hme=y.forwardRef(mu(function(e,r){const n=Bme(mg,e.__scopePopover),{forceMount:s=n.forceMount,...i}=e,a=op(mg,e.__scopePopover);return o.jsx(os,{present:s||a.open,children:a.modal?o.jsx(Wme,{...i,ref:r}):o.jsx(Gme,{...i,ref:r})})},"PopoverContent")),qme=Ga("PopoverContent.RemoveScroll"),Wme=y.forwardRef(mu(function(e,r){const n=op(mg,e.__scopePopover),s=y.useRef(null),i=Vt(r,s),a=y.useRef(!1);return y.useEffect(()=>{const l=s.current;if(l)return hw(l)},[]),o.jsx(zg,{as:qme,allowPinchZoom:!0,children:o.jsx(u5,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Xe(e.onCloseAutoFocus,l=>{var u;l.preventDefault(),a.current||(u=n.triggerRef.current)==null||u.focus()}),onPointerDownOutside:Xe(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,h=u.button===0&&u.ctrlKey===!0,p=u.button===2||h;a.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:Xe(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),Gme=y.forwardRef(mu(function(e,r){const n=op(mg,e.__scopePopover),s=y.useRef(!1),i=y.useRef(!1);return o.jsx(u5,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,u;(l=e.onCloseAutoFocus)==null||l.call(e,a),a.defaultPrevented||(s.current||(u=n.triggerRef.current)==null||u.focus(),a.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:a=>{var h,p;(h=e.onInteractOutside)==null||h.call(e,a),a.defaultPrevented||(s.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=a.target;((p=n.triggerRef.current)==null?void 0:p.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})},"PopoverContentNonModal")),u5=y.forwardRef(mu(function(e,r){const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:f,...g}=e,v=op(mg,n),_=fN(n);return rp(),o.jsx(cw,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:a,children:o.jsx(lw,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:f,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:p,onDismiss:()=>v.onOpenChange(!1),deferPointerDownOutside:!0,children:o.jsx(K1,{"data-state":pN(v.open),role:"dialog",id:v.contentId,..._,...g,ref:r,style:{...g.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})},"PopoverContentImpl"));function pN(t){return t?"open":"closed"}mu(pN,"getState");var Kme=Fme,Yme=zme,Zme=Vme,Jme=Hme;function Ib({...t}){return o.jsx(Kme,{"data-slot":"popover",...t})}function Db({...t}){return o.jsx(Yme,{"data-slot":"popover-trigger",...t})}function Ob({className:t,align:e="center",sideOffset:r=4,...n}){return o.jsx(Zme,{children:o.jsx(Jme,{"data-slot":"popover-content",align:e,sideOffset:r,className:ke("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
vendor: 11,754 bytes, line 522
522de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...n})})}var c2=1,Qme=.9,Xme=.8,ege=.17,YS=.1,ZS=.999,tge=.9999,rge=.99,nge=/[\\\/_+.#"@\[\(\{&]/,sge=/[\\\/_+.#"@\[\(\{&]/g,ige=/[\s-]/,d5=/[\s-]/g;function jj(t,e,r,n,s,i,a){if(i===e.length)return s===t.length?c2:rge;var l=`${s},${i}`;if(a[l]!==void 0)return a[l];for(var u=n.charAt(i),h=r.indexOf(u,s),p=0,f,g,v,_;h>=0;)f=jj(t,e,r,n,h+1,i+1,a),f>p&&(h===s?f*=c2:nge.test(t.charAt(h-1))?(f*=Xme,v=t.slice(s,h-1).match(sge),v&&s>0&&(f*=Math.pow(ZS,v.length))):ige.test(t.charAt(h-1))?(f*=Qme,_=t.slice(s,h-1).match(d5),_&&s>0&&(f*=Math.pow(ZS,_.length))):(f*=ege,s>0&&(f*=Math.pow(ZS,h-s))),t.charAt(h)!==e.charAt(i)&&(f*=tge)),(f<YS&&r.charAt(h-1)===n.charAt(i+1)||n.charAt(i+1)===n.charAt(i)&&r.charAt(h-1)!==n.charAt(i))&&(g=jj(t,e,r,n,h+1,i+2,a),g*YS>f&&(f=g*YS)),f>p&&(p=f),h=r.indexOf(u,h+1);return a[l]=p,p}function u2(t){return t.toLowerCase().replace(d5," ")}function age(t,e,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,jj(t,e,u2(t),u2(e),0,0,{})}var am='[cmdk-group=""]',JS='[cmdk-group-items=""]',oge='[cmdk-group-heading=""]',h5='[cmdk-item=""]',d2=`${h5}:not([aria-disabled="true"])`,Cj="cmdk-item-select",Gh="data-value",lge=(t,e,r)=>age(t,e,r),f5=y.createContext(void 0),ev=()=>y.useContext(f5),p5=y.createContext(void 0),mN=()=>y.useContext(p5),m5=y.createContext(void 0),g5=y.forwardRef((t,e)=>{let r=Kh(()=>{var F,te;return{search:"",value:(te=(F=t.value)!=null?F:t.defaultValue)!=null?te:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=Kh(()=>new Set),s=Kh(()=>new Map),i=Kh(()=>new Map),a=Kh(()=>new Set),l=v5(t),{label:u,children:h,value:p,onValueChange:f,filter:g,shouldFilter:v,loop:_,disablePointerSelection:x=!1,vimBindings:w=!0,...S}=t,k=Bn(),j=Bn(),C=Bn(),R=y.useRef(null),A=_ge();Ad(()=>{if(p!==void 0){let F=p.trim();r.current.value=F,I.emit()}},[p]),Ad(()=>{A(6,U)},[]);let I=y.useMemo(()=>({subscribe:F=>(a.current.add(F),()=>a.current.delete(F)),snapshot:()=>r.current,setState:(F,te,ue)=>{var re,se,ye,de;if(!Object.is(r.current[F],te)){if(r.current[F]=te,F==="search")M(),O(),A(1,G);else if(F==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let pe=document.getElementById(C);pe?pe.focus():(re=document.getElementById(k))==null||re.focus()}if(A(7,()=>{var pe;r.current.selectedItemId=(pe=V())==null?void 0:pe.id,I.emit()}),ue||A(5,U),((se=l.current)==null?void 0:se.value)!==void 0){let pe=te??"";(de=(ye=l.current).onValueChange)==null||de.call(ye,pe);return}}I.emit()}},emit:()=>{a.current.forEach(F=>F())}}),[]),P=y.useMemo(()=>({value:(F,te,ue)=>{var re;te!==((re=i.current.get(F))==null?void 0:re.value)&&(i.current.set(F,{value:te,keywords:ue}),r.current.filtered.items.set(F,T(te,ue)),A(2,()=>{O(),I.emit()}))},item:(F,te)=>(n.current.add(F),te&&(s.current.has(te)?s.current.get(te).add(F):s.current.set(te,new Set([F]))),A(3,()=>{M(),O(),r.current.value||G(),I.emit()}),()=>{i.current.delete(F),n.current.delete(F),r.current.filtered.items.delete(F);let ue=V();A(4,()=>{M(),(ue==null?void 0:ue.getAttribute("id"))===F&&G(),I.emit()})}),group:F=>(s.current.has(F)||s.current.set(F,new Set),()=>{i.current.delete(F),s.current.delete(F)}),filter:()=>l.current.shouldFilter,label:u||t["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:k,inputId:C,labelId:j,listInnerRef:R}),[]);function T(F,te){var ue,re;let se=(re=(ue=l.current)==null?void 0:ue.filter)!=null?re:lge;return F?se(F,r.current.search,te):0}function O(){if(!r.current.search||l.current.shouldFilter===!1)return;let F=r.current.filtered.items,te=[];r.current.filtered.groups.forEach(re=>{let se=s.current.get(re),ye=0;se.forEach(de=>{let pe=F.get(de);ye=Math.max(pe,ye)}),te.push([re,ye])});let ue=R.current;H().sort((re,se)=>{var ye,de;let pe=re.getAttribute("id"),Ie=se.getAttribute("id");return((ye=F.get(Ie))!=null?ye:0)-((de=F.get(pe))!=null?de:0)}).forEach(re=>{let se=re.closest(JS);se?se.appendChild(re.parentElement===se?re:re.closest(`${JS} > *`)):ue.appendChild(re.parentElement===ue?re:re.closest(`${JS} > *`))}),te.sort((re,se)=>se[1]-re[1]).forEach(re=>{var se;let ye=(se=R.current)==null?void 0:se.querySelector(`${am}[${Gh}="${encodeURIComponent(re[0])}"]`);ye==null||ye.parentElement.appendChild(ye)})}function G(){let F=H().find(ue=>ue.getAttribute("aria-disabled")!=="true"),te=F==null?void 0:F.getAttribute(Gh);I.setState("value",te||void 0)}function M(){var F,te,ue,re;if(!r.current.search||l.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let se=0;for(let ye of n.current){let de=(te=(F=i.current.get(ye))==null?void 0:F.value)!=null?te:"",pe=(re=(ue=i.current.get(ye))==null?void 0:ue.keywords)!=null?re:[],Ie=T(de,pe);r.current.filtered.items.set(ye,Ie),Ie>0&&se++}for(let[ye,de]of s.current)for(let pe of de)if(r.current.filtered.items.get(pe)>0){r.current.filtered.groups.add(ye);break}r.current.filtered.count=se}function U(){var F,te,ue;let re=V();re&&(((F=re.parentElement)==null?void 0:F.firstChild)===re&&((ue=(te=re.closest(am))==null?void 0:te.querySelector(oge))==null||ue.scrollIntoView({block:"nearest"})),re.scrollIntoView({block:"nearest"}))}function V(){var F;return(F=R.current)==null?void 0:F.querySelector(`${h5}[aria-selected="true"]`)}function H(){var F;return Array.from(((F=R.current)==null?void 0:F.querySelectorAll(d2))||[])}function Y(F){let te=H()[F];te&&I.setState("value",te.getAttribute(Gh))}function B(F){var te;let ue=V(),re=H(),se=re.findIndex(de=>de===ue),ye=re[se+F];(te=l.current)!=null&&te.loop&&(ye=se+F<0?re[re.length-1]:se+F===re.length?re[0]:re[se+F]),ye&&I.setState("value",ye.getAttribute(Gh))}function z(F){let te=V(),ue=te==null?void 0:te.closest(am),re;for(;ue&&!re;)ue=F>0?vge(ue,am):yge(ue,am),re=ue==null?void 0:ue.querySelector(d2);re?I.setState("value",re.getAttribute(Gh)):B(F)}let ee=()=>Y(H().length-1),L=F=>{F.preventDefault(),F.metaKey?ee():F.altKey?z(1):B(1)},$=F=>{F.preventDefault(),F.metaKey?Y(0):F.altKey?z(-1):B(-1)};return y.createElement(it.div,{ref:e,tabIndex:-1,...S,"cmdk-root":"",onKeyDown:F=>{var te;(te=S.onKeyDown)==null||te.call(S,F);let ue=F.nativeEvent.isComposing||F.keyCode===229;if(!(F.defaultPrevented||ue))switch(F.key){case"n":case"j":{w&&F.ctrlKey&&L(F);break}case"ArrowDown":{L(F);break}case"p":case"k":{w&&F.ctrlKey&&$(F);break}case"ArrowUp":{$(F);break}case"Home":{F.preventDefault(),Y(0);break}case"End":{F.preventDefault(),ee();break}case"Enter":{F.preventDefault();let re=V();if(re){let se=new Event(Cj);re.dispatchEvent(se)}}}}},y.createElement("label",{"cmdk-label":"",htmlFor:P.inputId,id:P.labelId,style:wge},u),zw(t,F=>y.createElement(p5.Provider,{value:I},y.createElement(f5.Provider,{value:P},F))))}),cge=y.forwardRef((t,e)=>{var r,n;let s=Bn(),i=y.useRef(null),a=y.useContext(m5),l=ev(),u=v5(t),h=(n=(r=u.current)==null?void 0:r.forceMount)!=null?n:a==null?void 0:a.forceMount;Ad(()=>{if(!h)return l.item(s,a==null?void 0:a.id)},[h]);let p=y5(s,i,[t.value,t.children,i],t.keywords),f=mN(),g=au(A=>A.value&&A.value===p.current),v=au(A=>h||l.filter()===!1?!0:A.search?A.filtered.items.get(s)>0:!0);y.useEffect(()=>{let A=i.current;if(!(!A||t.disabled))return A.addEventListener(Cj,_),()=>A.removeEventListener(Cj,_)},[v,t.onSelect,t.disabled]);function _(){var A,I;x(),(I=(A=u.current).onSelect)==null||I.call(A,p.current)}function x(){f.setState("value",p.current,!0)}if(!v)return null;let{disabled:w,value:S,onSelect:k,forceMount:j,keywords:C,...R}=t;return y.createElement(it.div,{ref:Ed(i,e),...R,id:s,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!g,"data-disabled":!!w,"data-selected":!!g,onPointerMove:w||l.getDisablePointerSelection()?void 0:x,onClick:w?void 0:_},t.children)}),uge=y.forwardRef((t,e)=>{let{heading:r,children:n,forceMount:s,...i}=t,a=Bn(),l=y.useRef(null),u=y.useRef(null),h=Bn(),p=ev(),f=au(v=>s||p.filter()===!1?!0:v.search?v.filtered.groups.has(a):!0);Ad(()=>p.group(a),[]),y5(a,l,[t.value,t.heading,u]);let g=y.useMemo(()=>({id:a,forceMount:s}),[s]);return y.createElement(it.div,{ref:Ed(l,e),...i,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},r&&y.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:h},r),zw(t,v=>y.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?h:void 0},y.createElement(m5.Provider,{value:g},v))))}),dge=y.forwardRef((t,e)=>{let{alwaysRender:r,...n}=t,s=y.useRef(null),i=au(a=>!a.search);return!r&&!i?null:y.createElement(it.div,{ref:Ed(s,e),...n,"cmdk-separator":"",role:"separator"})}),hge=y.forwardRef((t,e)=>{let{onValueChange:r,...n}=t,s=t.value!=null,i=mN(),a=au(h=>h.search),l=au(h=>h.selectedItemId),u=ev();return y.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),y.createElement(it.input,{ref:e,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":l,id:u.inputId,type:"text",value:s?t.value:a,onChange:h=>{s||i.setState("search",h.target.value),r==null||r(h.target.value)}})}),fge=y.forwardRef((t,e)=>{let{children:r,label:n="Suggestions",...s}=t,i=y.useRef(null),a=y.useRef(null),l=au(h=>h.selectedItemId),u=ev();return y.useEffect(()=>{if(a.current&&i.current){let h=a.current,p=i.current,f,g=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let v=h.offsetHeight;p.style.setProperty("--cmdk-list-height",v.toFixed(1)+"px")})});return g.observe(h),()=>{cancelAnimationFrame(f),g.unobserve(h)}}},[]),y.createElement(it.div,{ref:Ed(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":n,id:u.listId},zw(t,h=>y.createElement("div",{ref:Ed(a,u.listInnerRef),"cmdk-list-sizer":""},h)))}),pge=y.forwardRef((t,e)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:i,container:a,...l}=t;return y.createElement(c4,{open:r,onOpenChange:n},y.createElement(f4,{container:a},y.createElement(o1,{"cmdk-overlay":"",className:s}),y.createElement(l1,{"aria-label":t.label,"cmdk-dialog":"",className:i},y.createElement(g5,{ref:e,...l}))))}),mge=y.forwardRef((t,e)=>au(r=>r.filtered.count===0)?y.createElement(it.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),gge=y.forwardRef((t,e)=>{let{progress:r,children:n,label:s="Loading...",...i}=t;return y.createElement(it.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},zw(t,a=>y.createElement("div",{"aria-hidden":!0},a)))}),lp=Object.assign(g5,{List:fge,Item:cge,Input:hge,Group:uge,Separator:dge,Dialog:pge,Empty:mge,Loading:gge});function vge(t,e){let r=t.nextElementSibling;for(;r;){if(r.matches(e))return r;r=r.nextElementSibling}}function yge(t,e){let r=t.previousElementSibling;for(;r;){if(r.matches(e))return r;r=r.previousElementSibling}}function v5(t){let e=y.useRef(t);return Ad(()=>{e.current=t}),e}var Ad=typeof window>"u"?y.useEffect:y.useLayoutEffect;function Kh(t){let e=y.useRef();return e.current===void 0&&(e.current=t()),e}function au(t){let e=mN(),r=()=>t(e.snapshot());return y.useSyncExternalStore(e.subscribe,r,r)}function y5(t,e,r,n=[]){let s=y.useRef(),i=ev();return Ad(()=>{var a;let l=(()=>{var h;for(let p of r){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(h=p.current.textContent)==null?void 0:h.trim():s.current}})(),u=n.map(h=>h.trim());i.value(t,l,u),(a=e.current)==null||a.setAttribute(Gh,l),s.current=l}),s}var _ge=()=>{let[t,e]=y.useState(),r=Kh(()=>new Map);return Ad(()=>{r.current.forEach(n=>
522n()),r.current=new Map},[t]),(n,s)=>{r.current.set(n,s),e({})}};function bge(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function zw({asChild:t,children:e},r){return t&&y.isValidElement(e)?y.cloneElement(bge(e),{ref:e.ref},r(e.props.children)):r(e)}var wge={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Nj({className:t,...e}){return o.jsx(lp,{"data-slot":"command",className:ke("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),...e})}function Pj({className:t,...e}){return o.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[o.jsx(EL,{className:"size-4 shrink-0 opacity-50"}),o.jsx(lp.Input,{"data-slot":"command-input",className:ke("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t),...e})]})}function Rj({className:t,...e}){return o.jsx(lp.List,{"data-slot":"command-list",className:ke("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),...e})}function x_({...t}){return o.jsx(lp.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t})}function S_({className:t,...e}){return o.jsx(lp.Group,{"data-slot":"command-group",className:ke("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),...e})}function k_({className:t,...e}){return o.jsx(lp.Item,{"data-slot":"command-item",className:ke("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...e})}function Aj({open:t,onOpenChange:e,value:r,onValueChange:n,triggerLabel:s,placeholder:i,searchPlaceholder:a,emptyText:l,loading:u=!1,loadingText:h="Loading...",options:p,className:f}){const g=y.useMemo(()=>{const v=new Map;for(const _ of p){const x=_.group??"default";v.has(x)||v.set(x,[]),v.get(x).push(_)}return Array.from(v.entries())},[p]);return o.jsxs(Ib,{open:t,onOpenChange:e,children:[o.jsx(Db,{asChild:!0,children:o.jsxs(we,{type:"button",variant:"outline",role:"combobox","aria-expanded":t,className:ke("ph-mask w-full justify-between",f),children:[u?h:s||i||"Select option",o.jsx(I_,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(Ob,{className:"ph-mask max-h-[min(24rem,var(--radix-popover-content-available-height))] w-[var(--radix-popover-trigger-width)] overflow-hidden p-0",children:o.jsxs(Nj,{className:"max-h-[min(24rem,var(--radix-popover-content-available-height))]",children:[o.jsx(Pj,{placeholder:a}),o.jsx(Rj,{className:"max-h-[16rem] overscroll-contain",onWheel:v=>{v.preventDefault(),v.stopPropagation(),v.currentTarget.scrollTop+=v.deltaY},children:u?o.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:h}):o.jsxs(o.Fragment,{children:[o.jsx(x_,{children:l}),g.map(([v,_])=>o.jsx(S_,{children:_.map(x=>o.jsxs(k_,{value:x.value,keywords:[x.label,x.searchText].filter(Boolean),onSelect:()=>{n(x.value),e(!1)},children:[o.jsx(Vl,{className:ke("mr-2 h-4 w-4",r===x.value?"opacity-100":"opacity-0")}),x.icon,x.label]},x.value))},v))]})})]})})]})}var xge=Object.defineProperty,_5=(t,e)=>xge(t,"name",{value:e,configurable:!0}),h2="horizontal",Sge=["horizontal","vertical"],kge=y.forwardRef(_5(function(e,r){const{decorative:n,orientation:s=h2,...i}=e,a=b5(s)?s:h2,u=n?{role:"none"}:{"aria-orientation":a==="vertical"?a:void 0,role:"separator"};return o.jsx(it.div,{"data-orientation":a,...u,...i,ref:r})},"Separator"));function b5(t){return Sge.includes(t)}_5(b5,"isValidOrientation");var w5=kge;const gl=y.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},s)=>o.jsx(w5,{ref:s,decorative:r,orientation:e,className:ke("bg-border shrink-0",e==="horizontal"?"h-px w-full":"h-full w-px",t),...n}));gl.displayName=w5.displayName;const f2=t=>{const e=t.reduce((r,n)=>r+Math.max(1,Math.ceil(n.totalParts/1e3)),0);return 2e4*(1+Math.max(1,e))};
522class Mc extends Error{constructor(r,n){super(r);En(this,"status");this.status=n}}class Ege{constructor(e){En(this,"baseUrl");this.baseUrl=e||"https://api.3dtrees.earth"}async getAuthHeaders(){const{data:{session:e}}=await Ye.auth.getSession(),r=e==null?void 0:e.access_token;if(!r)throw new Error("You need to sign in to upload files.");return{"Content-Type":"application/json",Authorization:`Bearer ${r}`}}addAnalyticsHeaders(e,r){r&&(e["X-Trace-ID"]=r.traceId,r.posthogSessionId&&(e["X-PostHog-Session-ID"]=r.posthogSessionId,e["X-Analytics-Consent"]="granted"))}async createJob(e){const r=await this.getAuthHeaders(),n=new URL("/jobs",this.baseUrl);n.searchParams.set("dataset_id",e.dataset_id.toString()),n.searchParams.set("workflow_name",e.workflow_name),e.overwrite!==void 0&&n.searchParams.set("overwrite",e.overwrite.toString());const s=await fetch(n.toString(),{method:"POST",headers:r,body:JSON.stringify(e.parameters||{})});if(!s.ok){const i=await s.json().catch(()=>({detail:`API request failed with status ${s.status}`}));throw new Error(i.detail||"Failed to create job")}return await s.json()}async createIngestion(e,r,n){const s=await this.getAuthHeaders();r&&(s["Idempotency-Key"]=r),this.addAnalyticsHeaders(s,n);const i=await fetch(`${this.baseUrl}/ingestions`,{method:"POST",headers:s,signal:AbortSignal.timeout(2e4*(1+e.items.length)),body:JSON.stringify(e)});if(!i.ok){const a=await i.json().catch(()=>({detail:`API request failed with status ${i.status}`}));throw new Error(a.detail||"Failed to create ingestion session")}return await i.json()}async recordIngestionProgress(e,r,n){const s=await this.getAuthHeaders();n&&(s["X-Upload-Owner"]=n);const i=await fetch(`${this.baseUrl}/ingestions/${e}/progress`,{method:"POST",headers:s,signal:AbortSignal.timeout(2e4),body:JSON.stringify(r)});if(!i.ok){const a=await i.json().catch(()=>({detail:`API request failed with status ${i.status}`}));throw new Error(a.detail||"Failed to record upload progress")}return await i.json()}async abortIngestion(e,r="user_cancelled",n){const s=await this.getAuthHeaders();n&&(s["X-Upload-Owner"]=n);const i=await fetch(`${this.baseUrl}/ingestions/${e}/abort`,{method:"POST",headers:s,body:JSON.stringify({reason_code:r})});if(!i.ok){const a=await i.json().catch(()=>({detail:`API request failed with status ${i.status}`}));throw new Error(a.detail||"Failed to abort upload session")}return await i.json()}async getIngestionCapabilities(){const e=await fetch(`${this.baseUrl}/ingestions/capabilities`);if(!e.ok){const r=await e.json().catch(()=>({detail:`API request failed with status ${e.status}`}));throw new Error(r.detail||"Failed to load ingestion capabilities")}return await e.json()}async presignIngestionParts(e,r,n){const s=await this.getAuthHeaders();n&&(s["X-Upload-Owner"]=n);const i=await fetch(`${this.baseUrl}/ingestions/${e}/presign`,{method:"POST",headers:s,signal:AbortSignal.timeout(2e4),body:JSON.stringify(r)});if(!i.ok){const a=await i.json().catch(()=>({detail:`API request failed with status ${i.status}`}));throw new Error(a.detail||"Failed to presign ingestion parts")}return await i.json()}async completeIngestion(e,r,n){const s=await this.getAuthHeaders();n&&(s["X-Upload-Owner"]=n);const i=await fetch(`${this.baseUrl}/ingestions/${e}/complete`,{method:"POST",headers:{...s,"X-Upload-Completion-Mode":"async"},body:JSON.stringify(r),signal:AbortSignal.timeout(2e4)});if(!i.ok){const a=await i.json().catch(()=>({detail:`API request failed with status ${i.status}`}));throw new Mc(a.detail||"Failed to complete ingestion",i.status)}return await i.json()}async listIngestionParts(e,r=[]){const n=await this.getAuthHeaders(),s=await fetch(`${this.baseUrl}/ingestions/${e}/parts`,{method:"GET",headers:n,signal:AbortSignal.timeout(f2(r))});if(!s.ok){const i=await s.json().catch(()=>({detail:`API request failed with status ${s.status}`}));throw new Error(i.detail||"Failed to list uploaded ingestion parts")}return await s.json()}async failIngestion(e,r,n){const s=await this.getAuthHeaders();n&&(s["X-Upload-Owner"]=n);const i=await fetch(`${this.baseUrl}/ingestions/${e}/fail`,{method:"POST",headers:s,body:JSON.stringify(r)});if(!i.ok){const a=await i.json().catch(()=>({detail:`API request failed with status ${i.status}`}));throw new Error(a.detail||"Failed to mark ingestion failed")}return await i.json()}async createSupplementaryUpload(e,r){const n=await this.getAuthHeaders();this.addAnalyticsHeaders(n,r);const s=await fetch(`${this.baseUrl}/supplementary-data`,{method:"POST",headers:n,body:JSON.stringify(e)});if(!s.ok){const i=await s.json().catch(()=>({detail:`API request failed with status ${s.status}`}));throw new Error(i.detail||"Failed to create supplementary upload")}return await s.json()}async presignSupplementaryParts(e,r){const n=await this.getAuthHeaders(),s=await fetch(`${this.baseUrl}/supplementary-data/${e}/presign`,{method:"POST",headers:n,body:JSON.stringify(r)});if(!s.ok){const i=await s.json().catch(()=>({detail:`API request failed with status ${s.status}`}));throw new Error(i.detail||"Failed to presign supplementary upload parts")}return await s.json()}async completeSupplementaryUpload(e,r){const n=await this.getAuthHeaders(),s=await fetch(`${this.baseUrl}/supplementary-data/${e}/complete`,{method:"POST",headers:n,body:JSON.stringify({parts:r})});if(!s.ok){const i=await s.json().catch(()=>({detail:`API request failed with status ${s.status}`}));throw new Error(i.detail||"Failed to complete supplementary upload")}return await s.json()}async listAllCollections(e={}){const r=await this.getAuthHeaders(),n=new Map,s=100;for(let i=0;;i+=s){const a=await this.fetchCollectionsPage({...e,limit:s,offset:i},r),l=n.size;
522for(const u of a)n.set(u.id,u);if(a.length<s)return[...n.values()];if(n.size===l)throw new Error("Collection pagination did not advance. Please refresh.")}}async listCollections(e=!1){const r=await this.getAuthHeaders();return this.fetchCollectionsPage(e,r)}async fetchCollectionsPage(e,r){const n=new URL("/collections",this.baseUrl),s=typeof e=="boolean"?e:!!e.includeArchived,i=typeof e=="boolean"?void 0:e.adminUserId,a=typeof e=="boolean"?void 0:e.scope,l=typeof e=="boolean"?void 0:e.limit,u=typeof e=="boolean"?void 0:e.offset;s&&n.searchParams.set("include_archived","true"),i&&n.searchParams.set("admin_user_id",i),a==="all"&&n.searchParams.set("scope","all"),typeof l=="number"&&n.searchParams.set("limit",String(l)),typeof u=="number"&&n.searchParams.set("offset",String(u));const h=await fetch(n.toString(),{method:"GET",headers:r});if(!h.ok){const p=await h.json().catch(()=>({detail:`API request failed with status ${h.status}`}));throw new Error(p.detail||"Failed to list collections")}return await h.json()}async createCollection(e){const r=await this.getAuthHeaders(),n=await fetch(`${this.baseUrl}/collections`,{method:"POST",headers:r,body:JSON.stringify(e)});if(!n.ok){const s=await n.json().catch(()=>({detail:`API request failed with status ${n.status}`}));throw new Error(s.detail||"Failed to create collection")}return await n.json()}async updateCollection(e,r){const n=await this.getAuthHeaders(),s=await fetch(`${this.baseUrl}/collections/${e}`,{method:"PATCH",headers:n,body:JSON.stringify(r)});if(!s.ok){const i=await s.json().catch(()=>({detail:`API request failed with status ${s.status}`}));throw new Error(i.detail||"Failed to update collection")}return await s.json()}async archiveCollection(e,r){const n=await this.getAuthHeaders();this.addAnalyticsHeaders(n,r);const s=await fetch(`${this.baseUrl}/collections/${e}`,{method:"DELETE",headers:n});if(!s.ok){const i=await s.json().catch(()=>({detail:`API request failed with status ${s.status}`}));throw new Error(i.detail||"Failed to archive collection")}return await s.json()}async assignDatasetToCollection(e,r,n){const s=await this.getAuthHeaders();this.addAnalyticsHeaders(s,n);const i=await fetch(`${this.baseUrl}/collections/datasets/${e}/collection`,{method:"PUT",headers:s,body:JSON.stringify({collection_id:r})});if(!i.ok){const a=await i.json().catch(()=>({detail:`API request failed with status ${i.status}`}));throw new Error(a.detail||"Failed to assign dataset to collection")}return await i.json()}async listDatasetCollectionAssignments(e=1e3,r=0){const n=await this.getAuthHeaders(),s=new URL("/collections/datasets",this.baseUrl);s.searchParams.set("limit",String(e)),s.searchParams.set("offset",String(r));const i=await fetch(s.toString(),{method:"GET",headers:n});if(!i.ok){const a=await i.json().catch(()=>({detail:`API request failed with status ${i.status}`}));throw new Error(a.detail||"Failed to list dataset collection assignments")}return await i.json()}async listDatasetCollectionAssignmentsForAdmin(e,r=1e3,n=0){const s=await this.getAuthHeaders(),i=new URL("/collections/datasets",this.baseUrl);i.searchParams.set("admin_user_id",e),i.searchParams.set("limit",String(r)),i.searchParams.set("offset",String(n));const a=await fetch(i.toString(),{method:"GET",headers:s});if(!a.ok){const l=await a.json().catch(()=>({detail:`API request failed with status ${a.status}`}));throw new Error(l.detail||"Failed to list dataset collection assignments")}return await a.json()}async listIngestions(e,r=100,n=0){const s=await this.getAuthHeaders(),i=new URL("/ingestions",this.baseUrl);i.searchParams.set("limit",r.toString()),i.searchParams.set("offset",n.toString()),typeof e=="number"&&i.searchParams.set("dataset_id",e.toString());const a=await fetch(i.toString(),{method:"GET",headers:s,signal:AbortSignal.timeout(2e4)});if(!a.ok){const l=await a.json().catch(()=>({detail:`API request failed with status ${a.status}`}));throw new Error(l.detail||"Failed to list ingestions")}return await a.json()}async listRecoverableIngestions(){const e=await fetch(`${this.baseUrl}/ingestions/recoveries`,{headers:await this.getAuthHeaders(),signal:AbortSignal.timeout(2e4)});if(!e.ok)throw new Mc("Could not check interrupted uploads.",e.status);return e.json()}async resumeIngestion(e,r,n=[],s,i=!1){const a=await fetch(`${this.baseUrl}/ingestions/${e}/resume${i?"?restart_transfer=true":""}`,{method:"POST",headers:{...await this.getAuthHeaders(),"Content-Type":"application/json",...s?{"X-Upload-Owner":s}:{}},body:r?JSON.stringify(r):void 0,signal:AbortSignal.timeout(f2(n))});if(!a.ok){const l=await a.json().catch(()=>({}));throw new Mc(l.detail||"Could not resume this upload.",a.status)}return a.json()}async listPendingFinalizations(){const e=await this.getAuthHeaders(),r=await fetch(`${this.baseUrl}/ingestions/finalizations`,{headers:e,signal:AbortSignal.timeout(1e4)});if(!r.ok)throw new Mc("Could not check pending uploads",r.status);return await r.json()}async getIngestion(e){const r=await this.getAuthHeaders(),n=await fetch(`${this.baseUrl}/ingestions/${e}`,{method:"GET",headers:r,signal:AbortSignal.timeout(1e4)});if(!n.ok){const s=await n.json().catch(()=>({detail:`API request failed with status ${n.status}`}));throw new Mc(s.detail||"Failed to get ingestion",n.status)}return await n.json()}async getJobs(e){const r=await this.getAuthHeaders(),n=new URL("/jobs",this.baseUrl);n.searchParams.set("dataset_id",e.toString());const s=await fetch(n.toString(),{headers:r});if(!s.ok)throw new Error(`Failed to get jobs: ${s.statusText}`);return await s.json()}async healthCheck(){const e=await fetch(`${this.baseUrl}/health`);if(!e.ok)throw new Error("API health check failed");return await e.json()}}const Ba=new Ege,x5="3dtrees:upload-manifests:v1",S5=()=>{try{return typeof window<"u"&&typeof window.localStorage<"u"}catch{return!1}},tv=()=>{if(!S5())return[];try{const t=window.localStorage.getItem(x5);if(!t)return[];const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch(t){return console.warn("Failed to read upload manifests",t),[]}},gN=t=>{if(S5())try{window.localStorage.setItem(x5,JSON.stringify(t)),window.dispatchEvent(new Event("upload-manifests-changed"))}catch(e){console.warn("Failed to persist upload manifests",e)}},Wu=()=>tv(),E_=t=>tv().filter(e=>["uploading","failed","finalizing"].includes(e.status)&&!!t&&e.ownerUserId===t),ul=t=>{const e=tv(),r=e.findIndex(s=>s.id===t.id),n={...t,updatedAt:new Date().toISOString()};return r===-1?e.push(n):e[r]=n,gN(e),n},xo=(t,e)=>
522{const r=tv(),n=r.findIndex(i=>i.id===t);if(n===-1)return null;const s={...e(r[n]),updatedAt:new Date().toISOString()};return r[n]=s,gN(r),s},p2=t=>{gN(tv().filter(e=>e.id!==t))},jge=(t,e,r,n)=>{xo(t,s=>({...s,items:s.items.map(i=>i.ingestionItemId===e?{...i,uploadedParts:{...i.uploadedParts,[String(r)]:n}}:i)}))},Cge=t=>{const e=t.webkitRelativePath;return e&&e.trim()?e:t.name},m2=(t,e)=>{const r=t.items.map(s=>e.filter(i=>(i.name===s.fileName||Cge(i)===s.fileName)&&i.size===s.fileSizeBytes&&(s.identityUnverified||i.lastModified===s.lastModified))),n=new Map;for(const s of r)for(const i of s)n.set(i,(n.get(i)??0)+1);return t.items.map((s,i)=>{const a=r[i],l=a.length===1?a[0]:null;return{item:s,file:l&&n.get(l)===1?l:null}})},Yh=es,j_=(t={})=>{const{traceId:e,posthogSessionId:r}=vw(t);return{traceId:e,...r?{posthogSessionId:r}:{}}},QS=t=>{const e=t.trim().toLowerCase().split(".").pop();return e==="las"||e==="laz"||e==="zip"?e:"other"},k5=[25,50,75,90],Nge=300*1e3,XS=t=>{const e=t.now??Date.now,r=t.intervalMs??Nge;let n=e();return()=>{const s=e();s-n<r||(n=s,t.heartbeat())}},ek=t=>{for(const e of k5)t.progress>=e&&t.emitted.add(e)},g2=t=>{var r;const e=t.capture??Yh;for(const n of k5)t.progress<n||t.emitted.has(n)||(t.emitted.add(n),(r=t.onMilestone)==null||r.call(t,n),e("upload_transfer_progressed",{dataset_id:String(t.datasetId),upload_session_id:String(t.uploadSessionId),progress_milestone:n,...t.traceId?{trace_id:t.traceId}:{}}))},Fm={interfaceOpened(t="account",e=Yh){e("upload_interface_opened",{origin_surface:t})},submissionAttempted(t,e=Yh){e("upload_submission_attempted",{file_type:QS(t.fileName),file_size_bytes:t.fileSizeBytes,trace_id:t.traceId})},validationFailed(t,e=Yh){e("upload_validation_failed",{reason_code:"validation_failed",stage:"validation",trace_id:t.traceId,...t.fileName?{file_type:QS(t.fileName)}:{},...typeof t.fileSizeBytes=="number"?{file_size_bytes:t.fileSizeBytes}:{}})},transferStarted(t,e=Yh){e("upload_transfer_started",{dataset_id:String(t.datasetId),upload_session_id:String(t.uploadSessionId),file_type:QS(t.fileName),file_size_bytes:t.fileSizeBytes,...t.traceId?{trace_id:t.traceId}:{}})},sessionResumed(t,e=Yh){e("upload_session_resumed",{dataset_id:String(t.datasetId),upload_session_id:String(t.uploadSessionId),...t.traceId?{trace_id:t.traceId}:{},...t.progressMilestone?{progress_milestone:t.progressMilestone}:{}})}};function Pge(t,e=new Date){return{license_id:t.licenseId,rights_warranty_at:t.rightsWarranty?e.toISOString():null,tos_version:pw}}const Rge=12e4;function Age(t,e,r,n){return new Promise((s,i)=>{const a=new XMLHttpRequest;let l=0;const u=()=>{r.removeEventListener("abort",p),a.onload=a.onerror=a.onabort=null,a.upload.onprogress=null},h=f=>{u(),i(f)},p=()=>{h(r.reason),a.abort()};try{a.open("PUT",t),a.upload.onprogress=f=>{f.loaded>l&&(l=f.loaded,n())},a.onload=()=>{if(a.status<200||a.status>=300){h(new Error(`Upload request failed (${a.status}).`));return}const f=a.getResponseHeader("ETag");if(!f){h(new Error("Upload response did not include an ETag."));return}u(),s(f)},a.onerror=()=>h(new Error("Upload network request failed.")),a.onabort=()=>h(new Error("Upload request was interrupted.")),r.addEventListener("abort",p,{once:!0}),r.throwIfAborted(),a.send(e)}catch(f){h(f)}})}async function Tge(t,e,r,n,s){for(let i=0;;i++){r.throwIfAborted();const a=new AbortController,l=()=>a.abort(r.reason);r.addEventListener("abort",l,{once:!0});let u;const h=()=>{clearTimeout(u),u=setTimeout(()=>a.abort(new Error("Upload request timed out. Resume when your connection is ready.")),Rge)};try{return await Promise.race([(async()=>{const p=await e(i);return a.signal.throwIfAborted(),Age(p,t,a.signal,()=>{h(),s==null||s()})})(),new Promise((p,f)=>{a.signal.addEventListener("abort",()=>f(a.signal.reason),{once:!0}),h()})])}catch(p){if(r.aborted||i>=n)throw p}finally{clearTimeout(u),r.removeEventListener("abort",l),a.abort()}await new Promise((p,f)=>{const g=()=>{clearTimeout(v),f(r.reason)},v=setTimeout(()=>{r.removeEventListener("abort",g),p()},500*2**i);r.addEventListener("abort",g,{once:!0}),r.aborted&&g()})}}const Tj=1024*1024,v2=!0,Ige=t=>Math.ceil(t/Tj)*Tj,om=t=>{const e=32*Tj,r=Ige(t/1e4);return Math.max(e,r)};class Dge{constructor(e,r){En(this,"dbService");En(this,"apiService");En(this,"transferControllers",new Map);En(this,"activeTransfers",new Set);this.dbService=e||Rs,this.apiService=r||Ba}isTransferActive(e){return this.activeTransfers.has(e)}async runTransfer(e,r){const n=async()=>
522{if(this.activeTransfers.has(e))throw new Error("This upload is already running.");this.activeTransfers.add(e),window.dispatchEvent(new Event("upload-manifests-changed"));try{return await r()}finally{this.activeTransfers.delete(e),window.dispatchEvent(new Event("upload-manifests-changed"))}};return typeof navigator<"u"&&navigator.locks?navigator.locks.request(`3dtrees:ingestion:${e}`,{ifAvailable:!0},s=>{if(!s)throw new Error("This upload is already running in another tab.");return n()}):n()}interrupted(e,r,n){var s;return xo(e.id,i=>({...i,status:"uploading",transferError:r,dismissAfter:new Date(Date.now()+15*6e4).toISOString()})),(s=n.onProgress)==null||s.call(n,{datasetId:e.datasetId,phase:"incomplete",percentage:0}),{success:!1,datasetId:e.datasetId,error:r}}async getCurrentUserId(){var e;try{const{data:r}=await Ye.auth.getUser();return((e=r.user)==null?void 0:e.id)??null}catch(r){return console.warn("Failed to resolve current user for upload manifest",r),null}}async saveDatasetDOI(e,r){const n=r==null?void 0:r.trim();if(!n)return[];try{const s=await this.dbService.upsertDatasetDOI(e,n);if(!s.success){const i=s.error||"Failed to save DOI metadata";return console.warn("Failed to save DOI:",i),[i]}}catch(s){const i=s instanceof Error?s.message:"DOI save operation failed";return console.warn("DOI save operation failed:",s),[i]}return[]}async discardUploadManifest(e){if(e.status==="finalizing")throw new Error("Finalization is already being checked for this dataset.");if(this.isTransferActive(e.ingestionId))throw new Error("This upload is active. Wait for its current operation to finish.");await this.runTransfer(e.ingestionId,async()=>{const r=await this.apiService.getIngestion(e.ingestionId);if(r.status==="finalizing")throw new Error("Finalization is already being checked for this dataset.");["completed","aborted","expired"].includes(r.status)||await this.apiService.abortIngestion(e.ingestionId,"user_discarded_recovery",e.transferOwnerId),p2(e.id)})}async discoverFinalizations(e){const r=await this.apiService.listPendingFinalizations(),n=Wu();for(const s of r)n.some(i=>i.ingestionId===s.id&&i.ownerUserId===e)||this.manifestForFinalization(s,e)}async discoverTransfers(e){const r=await this.apiService.listRecoverableIngestions(),n=Wu();for(const s of r)n.some(i=>i.ingestionId===s.id&&i.ownerUserId===e)||this.manifestForTransfer(s,e)}manifestForTransfer(e,r){const n=e.metadata.transfer,s=(n==null?void 0:n.version)===1&&Array.isArray(n.files)?n.files:[];return ul({id:`ingestion-${e.id}`,restartRequired:!0,transferOwnerId:crypto.randomUUID(),ownerUserId:r,ingestionId:e.id,datasetId:e.dataset_id,title:typeof e.metadata.title=="string"?e.metadata.title:`Dataset ${e.dataset_id}`,workflowName:e.workflow_name||"EndToEndPipeline",doi:typeof e.metadata.doi=="string"?e.metadata.doi:void 0,totalSizeBytes:e.items.reduce((i,a)=>i+a.file_size_bytes,0),status:"uploading",createdAt:e.created_at||new Date().toISOString(),updatedAt:new Date().toISOString(),items:e.items.map(i=>{const a=s.find(h=>h.dataset_item_id===i.dataset_item_id),l=!!a&&Number.isSafeInteger(a.part_size)&&a.part_size>=5*1024*1024&&a.part_size<=5*1024**3&&Math.ceil(i.file_size_bytes/a.part_size)<=1e4&&Number.isSafeInteger(a.last_modified)&&a.last_modified>0,u=l?a.part_size:om(i.file_size_bytes);return{ingestionItemId:i.id,datasetItemId:i.dataset_item_id,fileName:i.file_name,fileSizeBytes:i.file_size_bytes,lastModified:l?a.last_modified:0,identityUnverified:!l,contentType:i.content_type,s3Key:i.s3_key,uploadId:i.upload_id,partSize:u,totalParts:Math.ceil(i.file_size_bytes/u),status:"pending",uploadedParts:{}}})})}manifestForFinalization(e,r){return ul({id:`ingestion-${e.id}`,ownerUserId:r,ingestionId:e.id,datasetId:e.dataset_id,title:typeof e.metadata.title=="string"?e.metadata.title:`Dataset ${e.dataset_id}`,workflowName:e.workflow_name||"EndToEndPipeline",doi:typeof e.metadata.doi=="string"?e.metadata.doi:void 0,totalSizeBytes:e.items.reduce((n,s)=>n+s.file_size_bytes,0),status:"finalizing",finalization:e.finalization,createdAt:e.created_at||new Date().toISOString(),updatedAt:e.updated_at||new Date().toISOString(),items:e.items.map(n=>({ingestionItemId:n.id,datasetItemId:n.dataset_item_id,fileName:n.file_name,fileSizeBytes:n.file_size_bytes,lastModified:0,contentType:n.content_type,s3Key:n.s3_key,uploadId:n.upload_id,partSize:0,totalParts:0,status:n.status==="completed"?"completed":"uploading",uploadedParts:{}}))})}async finalizationResult(e,r,n){var h;const s=r.finalization;if(r.status==="finalizing"&&!s)return this.rejectedFinalization(e,n,new Mc("Legacy completion is unconfirmed",409));const i=r.status==="completed",a=(s==null?void 0:s.attention_required)===!0,l=i&&(!s||s.stage==="done"&&!a);xo(e.id,p=>({...p,status:"finalizing",completionUnknown:!1,finalization:s,finalizationError:void 0,finalizationErrorStatus:void 0})),(h=n.onProgress)==null||h.call(n,{datasetId:e.datasetId,percentage:i?100:95,phase:l?(s==null?void 0:s.processing_status)==="submitted"?"processing":"completed":"finalizing"});const u=i?await this.saveDatasetDOI(e.datasetId,e.doi):[];return i&&e.doi&&u.length===0&&xo(e.id,p=>({...p,doi:void 0})),i&&u.length>0?(xo(e.id,p=>({...p,finalizationError:"Your files are uploaded, but the DOI could not be saved. Keep this browser data to retry saving it."})),{success:!0,datasetId:e.datasetId,completionState:"needs_review",warnings:u}):l?(p2(e.id),{success:!0,datasetId:e.datasetId,completionState:"completed",warnings:u}):{success:!0,datasetId:e.datasetId,completionState:a?"needs_review":"finalizing",warnings:u}}unknownFinalization(e,r){var n;return xo(e.id,s=>({...s,status:"finalizing",completionUnknown:!0})),(n=r.onProgress)==null||n.call(r,{phase:"finalizing",percentage:95,datasetId:e.datasetId}),{success:!0,datasetId:e.datasetId,completionState:"unknown"}}rejectedFinalization(e,r,n){var i;const s=[401,403].includes(n.status)?"Sign in with current upload access to check this dataset.":"This upload needs attention. Its existing dataset has been kept.";return xo(e.id,a=>({...a,status:"finalizing",completionUnknown:!1,finalizationError:s,finalizationErrorStatus:n.status})),(i=r.onProgress)==null||i.call(r,{phase:"finalizing",percentage:95,datasetId:e.datasetId}),{success:!0,datasetId:e.datasetId,completionState:"needs_review"}}async submitFinalization(e,r,n){var a;const i={...Wu().find(l=>
522l.id===e.id)||e,status:"finalizing",finalizationRequest:r,completionUnknown:!0};ul(i),(a=n.onProgress)==null||a.call(n,{phase:"finalizing",percentage:95,datasetId:e.datasetId});try{const l=await this.apiService.completeIngestion(e.ingestionId,r,e.transferOwnerId);return await this.finalizationResult(i,l,n)}catch(l){try{const u=await this.apiService.getIngestion(e.ingestionId);if(["finalizing","completed"].includes(u.status))return await this.finalizationResult(i,u,n)}catch{}return l instanceof Mc&&l.status>=400&&l.status<500?this.rejectedFinalization(i,n,l):this.unknownFinalization(i,n)}}async recoverFinalization(e,r={}){try{const n=await this.apiService.getIngestion(e.ingestionId);if(["finalizing","completed"].includes(n.status))return await this.finalizationResult(e,n,r);if(["pending","uploading"].includes(n.status)&&e.finalizationRequest&&(!e.finalizationError||[401,403].includes(e.finalizationErrorStatus??0)))return await this.submitFinalization(e,e.finalizationRequest,r);if(["failed","aborted","expired"].includes(n.status))return xo(e.id,s=>({...s,status:"failed"})),{success:!1,datasetId:e.datasetId,error:`Upload is ${n.status}.`}}catch(n){if(n instanceof Mc&&[401,403,404].includes(n.status))return this.rejectedFinalization(e,r,n)}return this.unknownFinalization(e,r)}async uploadFile(e,r={},n,s,i,a){try{const l=await this.uploadViaIngestion(e,r,n,s,i,a);if(!l.success)throw new Error(l.error||"Upload failed");return l}catch(l){return{success:!1,error:l instanceof Error?l.message:"Upload failed"}}}async completeUpload(e,r={}){var h,p,f,g;const{onProgress:n}=r,s=Array.isArray(e.file)?e.file:[e.file],i=s.reduce((v,_)=>v+_.size,0),a=e.title??((h=s[0])==null?void 0:h.name);let l=null,u=null;try{const v={title:a,description:e.description||null,acquisition_date:e.acquisitionDate?`${e.acquisitionDate.getFullYear()}-${String(e.acquisitionDate.getMonth()+1).padStart(2,"0")}-${String(e.acquisitionDate.getDate()).padStart(2,"0")}`:null,visibility:e.visibility||"public",hide_location:e.hideLocation,collection_id:e.collectionId??null,...Pge({licenseId:e.licenseId,rightsWarranty:e.rightsWarranty})},x={file_size_mb:Math.round(s[0].size/(1024*1024)),platform:e.platform,sensor:e.sensor||null,scan_pattern:e.scanPattern||null,preprocessing_steps:e.preprocessingSteps,coordinate_accuracy:e.coordinateAccuracy,coordinate_reference:e.coordinateReference||null,point_attributes_description:e.pointAttributesDescription||null},w=e.authors.map(H=>({dataset_id:0,first_name:H.firstName,last_name:H.lastName,organisation:H.organisation||null,orcid:H.orcid||null})),S=e.funding.map(H=>({dataset_id:0,funder_name:H.funderName,funder_identifier:H.funderIdentifier||null,award_number:H.awardNumber||null,award_title:H.awardTitle||null}));let k;const j=async()=>{if(u===null)throw new Error("Retry dataset is unavailable.");const H=await this.dbService.updateDatasetMetadata(u,{title:v.title,description:v.description,acquisition_date:v.acquisition_date,visibility:v.visibility,hide_location:v.hide_location,collection_id:v.collection_id,license_id:v.license_id,rights_warranty_at:v.rights_warranty_at,platform:x.platform||void 0,sensor:x.sensor,scan_pattern:x.scan_pattern,preprocessing_steps:x.preprocessing_steps,coordinate_accuracy:x.coordinate_accuracy||void 0,coordinate_reference:x.coordinate_reference,point_attributes_description:x.point_attributes_description},w,S,"Upload retry metadata refresh",void 0,{replaceLists:!0});if(!H.success)throw new Error(H.error||"Failed to update retry dataset metadata");await this.apiService.assignDatasetToCollection(u,v.collection_id??null)},C=H=>this.runTransfer(H.ingestionId,()=>{var B;const Y=(B=e.analyticsContext)!=null&&B.traceId?ul({...H,analyticsTraceId:e.analyticsContext.traceId}):H;return this.resumeTransfer(Y,s,r,async z=>{var L;await j();const ee=ul({...z,title:a,doi:((L=e.doi)==null?void 0:L.trim())||void 0});return await this.apiService.resumeIngestion(H.ingestionId,{title:a,doi:ee.doi??null},H.items,z.transferOwnerId),ee})}),R=await this.getCurrentUserId();if(!e.retryDatasetId){const H=await this.findIncompleteUploadOfFiles(R,s);if(H)try{return u=H.datasetId,await C(H)}catch{u=null}}if(e.retryDatasetId){u=e.retryDatasetId;const H=Wu().find(L=>L.datasetId===u&&L.ownerUserId===R&&["uploading","failed","finalizing"].includes(L.status));
522if(H){if(H.items.length!==s.length)throw new Error("Retry must include the original complete file set.");return await C(H)}const B=(await this.apiService.listIngestions(u,1))[0];if(B&&["finalizing","completed"].includes(B.status)){const L=this.manifestForFinalization(B,R);return this.finalizationResult(L,B,r)}if(B){if(!["pending","uploading","failed"].includes(B.status))throw new Error(`Upload session is ${B.status}. Contact support with the dataset ID.`);if(B.items.length!==s.length)throw new Error("Upload initialization is incomplete. Contact support with the dataset ID before resuming.");return await C(this.manifestForTransfer(B,R))}const z=await this.dbService.getDatasetItemsForDataset(u);if(!z.success)throw new Error(z.error||"Failed to load retry dataset items");const ee=z.data??[];if(ee.length!==s.length)throw new Error(`Retry upload must use the same number of files as the failed dataset (${ee.length})`);k=ee.map((L,$)=>{const F=s[$];if(L.file_name!==F.name)throw new Error(`Retry file mismatch for item ${$+1}: expected ${L.file_name}, got ${F.name}`);if(typeof L.file_size_bytes=="number"&&L.file_size_bytes!==F.size)throw new Error(`Retry file size mismatch for ${F.name}`);return L.id}),await j()}else{const H=await this.dbService.createDatasetWithMetadata(v,x,w,S,s[0].name,s[0].size,e.analyticsContext);if(!H.success)throw new Error(H.error||"Failed to create dataset record");u=H.data.id,k=[H.data.dataset_item_id];for(let B=1;B<s.length;B++){const z=await this.dbService.createAdditionalDatasetItem(u,s[B].name,s[B].size);if(!z.success)throw new Error(`Failed to create dataset_item for file ${s[B].name}: ${z.error||"unknown error"}`);k.push(z.data.dataset_item_id)}}if(u===null)throw new Error("Failed to create dataset record");const A=u;n==null||n({datasetId:A,phase:"uploading",percentage:0});const I="EndToEndPipeline-GalaxyEU",P=crypto.randomUUID(),T=await this.apiService.createIngestion({dataset_id:A,transfer_owner_id:P,items:s.map((H,Y)=>({dataset_item_id:k[Y],file_name:H.name,file_size_bytes:H.size,content_type:H.type||"application/octet-stream"})),workflow_name:I,metadata:{source:"web",file_count:s.length,title:a,doi:((p=e.doi)==null?void 0:p.trim())||void 0,transfer:{version:1,files:s.map((H,Y)=>({dataset_item_id:k[Y],last_modified:H.lastModified,part_size:om(H.size)}))}}},`web-${u}-${Date.now()}`,e.analyticsContext);l=T.id;const O=new Map(T.items.map(H=>[H.dataset_item_id,H])),G=`ingestion-${T.id}`,M=R,U=((f=e.doi)==null?void 0:f.trim())||void 0,V=ul({id:G,transferOwnerId:P,ownerUserId:M,datasetId:A,ingestionId:T.id,title:a,workflowName:I,totalSizeBytes:i,doi:U,analyticsTraceId:(g=e.analyticsContext)==null?void 0:g.traceId,status:"uploading",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),items:s.map((H,Y)=>{const B=O.get(k[Y]),z=om(H.size);return{ingestionItemId:(B==null?void 0:B.id)??0,datasetItemId:k[Y],fileName:H.name,fileSizeBytes:H.size,lastModified:H.lastModified,contentType:H.type||"application/octet-stream",s3Key:(B==null?void 0:B.s3_key)??"",uploadId:(B==null?void 0:B.upload_id)??"",partSize:z,totalParts:Math.ceil(H.size/z),status:"pending",uploadedParts:{}}})});return await this.runTransfer(T.id,async()=>{var $;const H=[];await this.recordUploadProgressFailOpen(T.id,{state:"started"}),Fm.transferStarted({datasetId:A,uploadSessionId:T.id,fileName:s[0].name,fileSizeBytes:i,traceId:($=e.analyticsContext)==null?void 0:$.traceId});const Y=new Set,B=XS({heartbeat:()=>{this.recordUploadProgressFailOpen(T.id,{state:"active"})}}),z=s.map(F=>({fileName:F.name,status:"pending",percentage:0}));n==null||n({phase:"uploading",percentage:5,datasetId:A,files:z,currentFileIndex:0,totalFiles:s.length});const ee=95/s.length;let L=5;for(let F=0;F<s.length;F++){const te=s[F];z[F].status="uploading";const ue=k[F],re=O.get(ue);if(!re)throw new Error(`Missing ingestion item for dataset_item_id ${ue}`);const se=await this.uploadFile(te,{onProgress:ye=>{var Ne;B(),z[F].percentage=ye.percentage;const de=ye.percentage/100*ee,pe=L+de,Ie={phase:"uploading",percentage:Math.round(pe),datasetId:A,files:[...z],currentFileIndex:F,totalFiles:s.length};g2({datasetId:A,uploadSessionId:T.id,traceId:(Ne=e.analyticsContext)==null?void 0:Ne.traceId,progress:Ie.percentage,emitted:Y,onMilestone:He=>{this.recordUploadProgressFailOpen(T.id,{state:"progressed",progress_milestone:He})}}),n==null||n(Ie)},partSize:om(te.size),manifestId:G}
522,A,T.id,re.id,re.s3_key);if(!se.success)throw z[F].status="error",new Error(`File upload failed for ${te.name}: ${se.error}`);z[F].status="completed",z[F].percentage=100,H.push({ingestion_item_id:re.id,parts:se.uploadedParts||[]}),xo(G,ye=>({...ye,items:ye.items.map(de=>de.ingestionItemId===re.id?{...de,status:"completed"}:de)})),L+=ee,n==null||n({phase:"uploading",percentage:Math.round(L),datasetId:A,files:[...z],currentFileIndex:F+1<s.length?F+1:F,totalFiles:s.length})}return await this.submitFinalization(V,{items:H,auto_process:v2,workflow_name:I,overwrite:!1,parameters:{source:"web",file_count:s.length}},r)})}catch(v){const _=v instanceof Error?v.message:"Upload failed";if(l!==null){const x=Wu().find(w=>w.ingestionId===l);if(x)return this.interrupted(x,_,r)}return u!==null&&(n==null||n({datasetId:u,phase:"incomplete",percentage:0})),{success:!1,datasetId:u??void 0,error:_}}}async findIncompleteUploadOfFiles(e,r){if(!e)return null;for(const n of E_(e))if(!(n.status!=="uploading"||n.items.length!==r.length||this.isTransferActive(n.ingestionId)||m2(n,r).some(i=>!i.file||i.item.identityUnverified)))try{const i=await this.apiService.getIngestion(n.ingestionId);if(["pending","uploading"].includes(i.status))return n}catch{}return null}async resumeUploadFromManifest(e,r=[],n={}){if(e.status==="finalizing")return this.recoverFinalization(e,n);try{return await this.runTransfer(e.ingestionId,()=>this.resumeTransfer(e,r,n))}catch(s){return{success:!1,datasetId:e.datasetId,error:s instanceof Error?s.message:"Could not resume upload."}}}async resumeTransfer(e,r,n,s){var i,a;try{e.transferOwnerId||(e=ul({...e,transferOwnerId:crypto.randomUUID()})),xo(e.id,j=>({...j,transferError:void 0})),Fm.sessionResumed({datasetId:e.datasetId,uploadSessionId:e.ingestionId,traceId:e.analyticsTraceId});const l=await this.apiService.getIngestion(e.ingestionId);if(["finalizing","completed"].includes(l.status))return this.finalizationResult(e,l,n);const u=m2(e,r),h=l.metadata.transfer_owner_id!==e.transferOwnerId;if(h&&(e=ul({...e,restartRequired:!0}),!u.length||u.some(j=>!j.file)))throw new Error("Select all original files to restart the transfer in this browser. The same dataset and upload session will be kept.");const p=await this.apiService.resumeIngestion(e.ingestionId,void 0,e.items,e.transferOwnerId,h);if(p.items.length!==e.items.length)throw new Error("Upload file details are incomplete. Contact support with the dataset ID.");e=ul({...e,restartRequired:!1,items:e.items.map(j=>{var A;const C=p.items.find(I=>I.id===j.ingestionItemId);if(!C||C.dataset_item_id!==j.datasetItemId||C.file_name!==j.fileName||C.file_size_bytes!==j.fileSizeBytes||C.s3_key!==j.s3Key)throw new Error("The server upload identity changed. Contact support with the dataset ID.");if(C.upload_id===j.uploadId)return j;const R=(A=u.find(I=>I.item.ingestionItemId===j.ingestionItemId))==null?void 0:A.file;return{...j,uploadId:C.upload_id,status:"uploading",uploadedParts:{},...R?{lastModified:R.lastModified,identityUnverified:!1}:{}}})}),s&&(e=await s(e));const f=await this.apiService.listIngestionParts(e.ingestionId,e.items);if(["finalizing","completed"].includes(f.status))return this.recoverFinalization(e,n);if(["failed","aborted","expired"].includes(f.status))throw new Error(`Upload session is ${f.status}. Contact support with the dataset ID.`);if(!e.items.length||f.items.length!==e.items.length)throw new Error("Upload file details are incomplete. Contact support with the dataset ID.");if(u.some(j=>j.item.identityUnverified&&!j.file))throw new Error("Select a distinct original file for every legacy upload item. File names and sizes must identify each file unambiguously.");const g=new Map(f.items.map(j=>[j.ingestion_item_id,j])),v=e.items.map(j=>({fileName:j.fileName,status:j.status==="completed"?"completed":"pending",percentage:j.status==="completed"?100:0})),_=[],x=95/e.items.length;let w=5;const S=new Set,k=XS({heartbeat:()=>{this.recordUploadProgressFailOpen(e.ingestionId,{state:"active"})}});(i=n.onProgress)==null||i.call(n,{phase:"uploading",percentage:5,datasetId:e.datasetId,isResumed:!0,files:v,totalFiles:e.items.length});for(let j=0;j<e.items.length;j++){const C=e.items[j],R=g.get(C.ingestionItemId);if(!R||R.upload_id!==C.uploadId||R.s3_key!==C.s3Key||R.dataset_item_id!==C.datasetItemId||R.file_size_bytes!==C.fileSizeBytes||R.file_name!==C.fileName)throw new Error("The server upload identity changed. Contact support with the dataset ID.");const A=R.uploaded_parts.filter(M=>Number.isInteger(M.part_number)&&M.part_number>=1&&M.part_number<=C.totalParts&&!!M.e_tag&&M.size===Math.min(C.partSize,C.fileSizeBytes-(M.part_number-1)*C.partSize)),I=new Map(A.map(M=>[String(M.part_number),M.e_tag])),P=C.identityUnverified?{}:Object.fromEntries(I),T=!C.identityUnverified&&C.totalParts>0&&I.size===C.totalParts&&R.uploaded_size_bytes===C.fileSizeBytes;if((R==null?void 0:R.status)==="completed"){_.push({ingestion_item_id:C.ingestionItemId,use_uploaded_parts:!0,expected_part_count:C.totalParts}),v[j]={...v[j],status:"completed",percentage:100},w+=x,ek({progress:Math.round(w),emitted:S}
522);continue}if(T){_.push({ingestion_item_id:C.ingestionItemId,use_uploaded_parts:!0,expected_part_count:C.totalParts}),v[j]={...v[j],status:"completed",percentage:100},w+=x,ek({progress:Math.round(w),emitted:S});continue}const O=(a=u.find(M=>M.item.ingestionItemId===C.ingestionItemId))==null?void 0:a.file;if(!O)throw new Error(`Select the original ${C.fileName} file to resume this upload. Name, size, and last modified time must match.`);v[j]={...v[j],status:"uploading"};const G=await this.uploadFile(O,{partSize:C.partSize,uploadedParts:P,manifestId:e.id,onProgress:M=>{var H;k(),v[j]={...v[j],percentage:M.percentage};const U=M.percentage/100*x,V=Math.round(w+U);(H=n.onProgress)==null||H.call(n,{phase:"uploading",percentage:V,datasetId:e.datasetId,isResumed:!0,files:[...v],currentFileIndex:j,totalFiles:e.items.length}),M.isResumed&&ek({progress:V,emitted:S}),g2({datasetId:e.datasetId,uploadSessionId:e.ingestionId,traceId:e.analyticsTraceId,progress:V,emitted:S,onMilestone:Y=>{this.recordUploadProgressFailOpen(e.ingestionId,{state:"progressed",progress_milestone:Y})}})}},e.datasetId,e.ingestionId,C.ingestionItemId,C.s3Key);if(!G.success)throw v[j]={...v[j],status:"error"},new Error(`File upload failed for ${C.fileName}: ${G.error}`);_.push({ingestion_item_id:C.ingestionItemId,parts:G.uploadedParts||[]}),v[j]={...v[j],status:"completed",percentage:100},w+=x}return await this.submitFinalization(e,{items:_,auto_process:v2,workflow_name:e.workflowName,overwrite:!1,parameters:{source:"web",file_count:e.items.length,resumed:!0}},n)}catch(l){const u=l instanceof Error?l.message:"Upload resume failed";return this.interrupted(e,u,n)}}async recordUploadProgressFailOpen(e,r){var n;try{await this.apiService.recordIngestionProgress(e,r,(n=Wu().find(s=>s.ingestionId===e))==null?void 0:n.transferOwnerId)}catch(s){console.warn("Upload progress telemetry unavailable",s instanceof Error?s.name:"UnknownError")}}async uploadSupplementaryData(e,r,n,s={}){var i;try{if(!r.name.toLowerCase().endsWith(".zip"))throw new Error("Supplementary data must be a .zip file.");const a=1024*1024*1024;if(r.size>a)throw new Error("Supplementary ZIP exceeds the 1 GB limit.");if(r.size<=0)throw new Error("Supplementary ZIP must not be empty.");const l=await this.apiService.createSupplementaryUpload({dataset_id:e,file_name:r.name,file_size_bytes:r.size,content_type:r.type||"application/zip",description:(n==null?void 0:n.trim())||null},s.analyticsContext),u=1024*1024,h=A=>Math.ceil(A/u)*u,p=32*u,f=h(r.size/1e4),g=Math.max(p,f),v=Math.ceil(r.size/g),_=4,x=5,w=[],S=new Map;let k=0;const j=async A=>{const I=await this.apiService.presignSupplementaryParts(l.id,{part_numbers:A});return new Map(I.parts.map(P=>[P.part_number,P.url]))},C=async(A,I)=>{var M;const P=(A-1)*g,T=Math.min(r.size,P+g),O=r.slice(P,T);let G=0;for(;;)try{const U=await fetch(I,{method:"PUT",body:O});if(!U.ok)throw new Error(`${U.status} ${U.statusText}`);const V=U.headers.get("ETag")||U.headers.get("etag")||"";if(!V)throw new Error("missing ETag");S.set(A,V),k+=O.size,(M=s.onProgress)==null||M.call(s,Math.max(1,Math.min(99,Math.round(k/r.size*100))));return}catch(U){if(G+=1,G>x)throw U;await new Promise(V=>setTimeout(V,500*Math.pow(2,G-1)))}},R=Array.from({length:v},(A,I)=>I+1);for(let A=0;A<R.length;A+=_){const I=R.slice(A,A+_),P=await j(I);await Promise.all(I.map(T=>C(T,P.get(T))))}for(let A=1;A<=v;A++){const I=S.get(A);if(!I)throw new Error(`missing ETag after upload for part ${A}`);w.push({part_number:A,e_tag:I})}return await this.apiService.completeSupplementaryUpload(l.id,w),(i=s.onProgress)==null||i.call(s,100),{success:!0,supplementaryId:l.id,storageKey:l.s3_key}}catch(a){return{success:!1,error:a instanceof Error?a.message:"Supplementary upload failed"}}}async uploadViaIngestion(e,r,n,s,i,a){const{onProgress:l}=r,u=`ingestion-mpu:${s}:${i}:${e.name}:${e.size}:${e.lastModified}`,h=()=>{try{const V=localStorage.getItem(u);return V?JSON.parse(V):null}catch(V){return console.warn("resume: failed to load state",V),null}},p=V=>{try{localStorage.setItem(u,JSON.stringify(V))}catch(H){console.warn("resume: failed to save state",H)}},f=()=>{try{localStorage.removeItem(u)}catch(V){console.warn("resume: failed to clear state",V)}};let g=r.partSize||om(e.size);const v=new Map,_=r.uploadedParts!==void 0;for(const[V,H]of Object.entries(r.uploadedParts??{}))v.set(Number(V),H);const x=_?null:h();if(x){g=x.partSize||g;for(const[V,H]of Object.entries(x.uploadedParts||{}))v.set(Number(V),H)}if(v.size>0){const V=Math.round(Array.from(v.keys()).reduce((H,Y)=>H+Math.min(g,e.size-(Y-1)*g),0)/e.size*100);l==null||l({phase:"uploading",percentage:V,datasetId:n,isResumed:!0,resumedFromPercent:V})}const w=new AbortController;this.transferControllers.set(s,w);const S=Date.now(),k=Math.ceil(e.size/g),j=[],C=new Map(v);let R=Array.from(v.keys()).reduce((V,H)=>
522V+Math.min(g,e.size-(H-1)*g),0);const A=Math.max(1,Math.min(8,Math.floor(4)||4)),I=5,P=Number.isFinite(I)?Math.max(0,Math.min(5,Math.floor(I))):3,T=async V=>{var Y;const H=await this.apiService.presignIngestionParts(s,{ingestion_item_id:i,part_numbers:V},(Y=Wu().find(B=>B.ingestionId===s))==null?void 0:Y.transferOwnerId);return new Map(H.parts.map(B=>[B.part_number,B.url]))},O=XS({heartbeat:()=>{this.recordUploadProgressFailOpen(s,{state:"active"})}}),G=async(V,H)=>{const Y=(V-1)*g,B=e.slice(Y,Math.min(e.size,Y+g)),z=await Tge(B,async $=>{const te=(await($===0?H:T([V]))).get(V);if(!te)throw new Error("Could not obtain an upload URL.");return te},w.signal,P,O);w.signal.throwIfAborted(),C.set(V,z),R+=B.size,p({partSize:g,uploadedParts:Object.fromEntries(C),createdAt:Date.now()}),r.manifestId&&jge(r.manifestId,i,V,z);const ee=Math.max(1,Date.now()-S)/1e3,L=R/ee;l==null||l({percentage:Math.min(100,Math.round(R/e.size*100)),etaSeconds:L>0?Math.round((e.size-R)/L):void 0})},U=Array.from({length:k},(V,H)=>H+1).filter(V=>!C.has(V));try{for(let V=0;V<U.length;V+=A){const H=U.slice(V,V+A),Y=T(H),B=H.map(z=>G(z,Y));try{await Promise.all(B)}catch(z){throw w.abort(z),await Promise.allSettled(B),z}}}finally{w.abort(),this.transferControllers.delete(s)}for(let V=1;V<=k;V++){const H=C.get(V);if(!H)return{success:!1,error:`missing ETag after upload for part ${V}`};j.push({partNumber:V,eTag:H})}return f(),{success:!0,storageKey:a,uploadedParts:j.map(V=>({part_number:V.partNumber,e_tag:V.eTag}))}}async cancelActiveUpload(e){for(const[r,n]of this.transferControllers)(e===void 0||r===e)&&n.abort(new Error("Upload interrupted. Select the original files to resume."))}}const kl=new Dge,Oge=Rn({first_name:ht().min(1,"First name is required"),last_name:ht().min(1,"Last name is required"),organisation:ht().optional(),orcid:ht().optional()}),Mge=Rn({funderName:ht().min(1,"Funder name is required"),funderIdentifier:ht().optional(),awardNumber:ht().optional(),awardTitle:ht().optional()}),Lge=Rn({pointCloudFile:iU([CS(File,{message:"Point cloud file is required"}),as(CS(File)).min(1,"At least one point cloud file is required")]),acquisitionDate:sU({message:"Acquisition date is required"}).refine(t=>{const e=new Date;return e.setHours(23,59,59,999),t.getTime()<=e.getTime()},"Acquisition date cannot be in the future"),platform:li(["TLS","MLS","ULS"],{message:"Platform is required"}),authors:as(Oge).min(1,"At least one contributor is required"),coordinateAccuracy:li(["<1m","<10m",">10m","local"],{message:"Coordinate accuracy is required"}),visibility:li(["public","view_only","private"],{message:"Visibility is required"}),hideLocation:Gc().default(!1),licenseId:fa({message:"License is required"}),rightsWarranty:Gc().refine(t=>t===!0,{message:"You must confirm you hold the rights to license this dataset"}),requiresApproxLocation:Gc().default(!1),approxLocation:Rn({lat:fa().min(-90).max(90),lon:fa().min(-180).max(180),source:li(["map_click","geocoder","manual_coords","legacy_text","unknown"]),rawQuery:ht().optional()}).optional(),title:ht().optional(),sensor:ht().optional(),scanPattern:ht().optional(),preprocessingSteps:as(li(["noise_filtering","ground_classification","height_normalization","downsampling","co_registration","outlier_removal","compression"])).default([]),coordinateReference:ht().optional(),pointAttributesDescription:ht().optional(),hasLabelsOrPredictions:Gc().default(!1),labelMappingsText:ht().optional(),description:ht().optional(),fundingReferences:as(Mge).default([]),fundingAcknowledgment:ht().optional(),doi:ht().optional().refine(t=>!t||t.trim()===""?!0:qg(t).isValid,{message:"Invalid DOI format. Expected format: 10.XXXX/YYYY or https://doi.org/10.XXXX/YYYY"}),supplementaryFile:CS(File).optional(),supplementaryDescription:ht().optional()}).superRefine((t,e)=>{Array.isArray(t.pointCloudFile)&&t.pointCloudFile.length>1&&(!t.title||t.title.trim()==="")&&e.addIssue({code:Ah.custom,path:["title"],message:"Title is required for multi-file datasets"}),t.hasLabelsOrPredictions&&(!t.labelMappingsText||t.labelMappingsText.trim()==="")&&e.addIssue({code:Ah.custom,path:["labelMappingsText"],message:"Please provide value-to-label mappings when labels/predictions are indicated."}),t.requiresApproxLocation&&(t.coordinateAccuracy!=="local"&&e.addIssue({code:Ah.custom,path:["coordinateAccuracy"],message:'Please select "Local coordinate system" when CRS is missing.'}),t.approxLocation||e.addIssue({code:Ah.custom,path:["approxLocation"],message:"Please select an approximate location on the map."})),t.supplementaryFile&&(t.supplementaryFile.name.toLowerCase().endsWith(".zip")||e.addIssue({code:Ah.custom,path:["supplementaryFile"],message:"Supplementary data must be a .zip file."}),t.supplementaryFile.size>1024*1024*1024&&e.addIssue({code:Ah.custom,path:["supplementaryFile"],message:"Supplementary ZIP must be 1 GB or smaller."}))});function nf(t,e){return t.trim().slice(0,e)}function C_(t,e){return t.length<=e?t:`${t.slice(0,Math.max(0,e-3))}...`}const El=120,jl=320,y2=52,Fge=120,$ge=72;function E5(t){return t?t.map(e=>({...e})):[]}function j5(t){return t?t.map(e=>({...e})):[]}
522function zge(){return{title:void 0,description:void 0,doi:void 0,platform:void 0,sensor:void 0,scanPattern:void 0,visibility:"public",hideLocation:!1,preprocessingSteps:[],coordinateAccuracy:void 0,coordinateReference:void 0,pointAttributesDescription:void 0,hasLabelsOrPredictions:!1,labelMappingsText:void 0,authors:[],fundingReferences:[],fundingAcknowledgment:void 0,collectionId:null}}function Mb(t){const e=zge();return{title:t.title||void 0,description:t.description||void 0,doi:t.doi||void 0,platform:t.platform,sensor:t.sensor||void 0,scanPattern:t.scanPattern||void 0,visibility:t.visibility??e.visibility,hideLocation:t.hideLocation??e.hideLocation,preprocessingSteps:t.preprocessingSteps?[...t.preprocessingSteps]:e.preprocessingSteps,coordinateAccuracy:t.coordinateAccuracy,coordinateReference:t.coordinateAccuracy==="local"?void 0:t.coordinateReference||void 0,pointAttributesDescription:t.pointAttributesDescription||void 0,hasLabelsOrPredictions:t.hasLabelsOrPredictions,labelMappingsText:t.labelMappingsText||void 0,authors:E5(t.authors),fundingReferences:j5(t.fundingReferences),fundingAcknowledgment:t.fundingAcknowledgment||void 0,collectionId:t.collectionId??e.collectionId}}function _2(t,e){return Mb({title:t.title||void 0,description:t.description||void 0,doi:t.doi||void 0,platform:t.platform,sensor:t.sensor||void 0,scanPattern:t.scanPattern||void 0,visibility:t.visibility,hideLocation:t.hideLocation,preprocessingSteps:t.preprocessingSteps,coordinateAccuracy:t.coordinateAccuracy,coordinateReference:t.coordinateAccuracy==="local"?void 0:t.coordinateReference||void 0,pointAttributesDescription:t.pointAttributesDescription||void 0,hasLabelsOrPredictions:t.hasLabelsOrPredictions,labelMappingsText:t.labelMappingsText||void 0,authors:t.authors,fundingReferences:t.fundingReferences,fundingAcknowledgment:t.fundingAcknowledgment||void 0,collectionId:e})}function Uge(t,e){const r=Mb(e);return{...t,title:r.title??"",description:r.description??"",doi:r.doi??"",platform:r.platform,sensor:r.sensor??"",scanPattern:r.scanPattern??"",visibility:r.visibility??"public",hideLocation:r.hideLocation,preprocessingSteps:r.preprocessingSteps??[],coordinateAccuracy:r.coordinateAccuracy,coordinateReference:r.coordinateAccuracy==="local"?"":r.coordinateReference??"",pointAttributesDescription:r.pointAttributesDescription??"",hasLabelsOrPredictions:r.hasLabelsOrPredictions??!1,labelMappingsText:r.labelMappingsText??"",authors:E5(r.authors),fundingReferences:j5(r.fundingReferences),fundingAcknowledgment:r.fundingAcknowledgment??""}}let tk=null;const C5=async()=>{tk??(tk=Nn(()=>import("./index-B-KDUuqQ.js").then(t=>t.i),[]).then(t=>t.default??t));try{return await tk}catch(t){throw tk=null,t}},Va=(...t)=>{},Bge=new TextDecoder("ascii");async function N5(t,e,r){const s=await t.slice(e,e+r).arrayBuffer();return new DataView(s)}function b2(t,e,r){const n=new Uint8Array(t.buffer,e,r);return Bge.decode(n).replace(/[\0]+$/g,"").trim()}function Vge(t){if(!t)return;const e=t.match(/(?:Code|EPSG)[- :]*(\d{4,6})/i);if(!e)return;const r=Number(e[1]);return Number.isFinite(r)&&r>0?r:void 0}function Hge(t){if(!t||t.length<8)return;const e=t[3];for(let r=0;r<e;r++){const n=4+r*4;if(n+3>=t.length)break;const s=t[n];if(s===3072||s===2048){const i=t[n+3];if(i>0&&i!==32767)return i}}}function qge(t){if(!t)return;const e=[];for(const a of t.matchAll(/ID\["EPSG"\s*,\s*(\d{4,6})\]/g)){const l=Number(a[1]);Number.isFinite(l)&&l>0&&e.push(l)}for(const a of t.matchAll(/AUTHORITY\["EPSG"\s*,\s*"(\d{4,6})"\]/g)){const l=Number(a[1]);Number.isFinite(l)&&l>0&&e.push(l)}if(e.length===0)return;const r=new Set([0,32767,6326,7030,8901,9001,9102,9122,9807]),n=e.filter(a=>a>=2e3&&!r.has(a)),s=n.length>0?n:e,i=s[s.length-1];return i===32767?void 0:i}function Wge(t){return t.headerEpsg??t.headerEPSG??Vge(t.geoAsciiParams)??Hge(t.geoKeyDirectory)??qge(t.wkt)}async function Gge(t,e){const{HeaderSize:r,OffsetToPointData:n}=e,s=Math.max(0,n-r),i={hasLaszip:!1,extraByteNames:[]};if(s<=0)return i;const a=await N5(t,r,s);let l=0;const u=54;let h=0;for(;l+u<=a.byteLength&&h++<1e3;){a.getUint16(l,!0),l+=2;const p=b2(a,l,16);l+=16;const f=a.getUint16(l,!0);l+=2;const g=a.getUint16(l,!0);if(l+=2,b2(a,l,32),l+=32,l+g>a.byteLength)break;const v=new DataView(a.buffer,a.byteOffset+l,g);if(l+=g,p==="laszip encoded"&&f===22204&&(i.hasLaszip=!0),p==="LASF_Projection"){if(f===34735)i.geoKeyDirectory=new Uint16Array(v.buffer,v.byteOffset,Math.floor(v.byteLength/2));else if(f===34736)i.geoDoubleParams=new Float64Array(v.buffer,v.byteOffset,Math.floor(v.byteLength/8));else if(f===34737){const _=new Uint8Array(v.buffer,v.byteOffset,v.byteLength);i.geoAsciiParams=new TextDecoder("ascii").decode(_).replace(/[\0]+$/g,"").trim()}else if(f===2112){const _=new Uint8Array(v.buffer,v.byteOffset,v.byteLength);i.wkt=new TextDecoder("utf-8").decode(_).replace(/[\0]+$/g,"").trim()}}if(p==="LASF_Spec"&&f===4&&g>0){const _=new TextDecoder("ascii").decode(new Uint8Array(v.buffer,v.byteOffset,v.byteLength)),x=Array.from(_.split(/[\0\t\r\n]+/)).map(S=>S.trim()).filter(S=>S.length>=3&&S.length<=32&&/[A-Za-z0-9_]/.test(S)),w=[];for(const S of x)w.includes(S)||w.push(S);i.extraByteNames.push(...w.slice(0,16))}}return i}async function P5(t,e){if(e.VersionMajor===1&&Number(e.VersionMinor)>=4){const s=await N5(t,247,8);
522if(s.byteLength!==8)throw new Error("Truncated LAS extended point count");const i=s.getBigUint64(0,!0);if(i>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("LAS point count exceeds safe integer precision");return Number(i)}const r=[e==null?void 0:e.NumberOfPoints,e==null?void 0:e.ExtendedNumberOfPoints,e==null?void 0:e.LegacyNumberOfPoints,e==null?void 0:e.numberOfPoints,e==null?void 0:e.extendedNumberOfPoints,e==null?void 0:e.legacyNumberOfPoints,e==null?void 0:e.NumberOfPointRecords,e==null?void 0:e.numberOfPointRecords].filter(s=>typeof s=="number"&&Number.isFinite(s)&&s>0);if(r.length>0)return r[0];const n=[e==null?void 0:e.NumberOfPointsByReturn,e==null?void 0:e.numberOfPointsByReturn,e==null?void 0:e.NumberOfPointByReturn,e==null?void 0:e.numberOfPointByReturn];for(const s of n)if(Array.isArray(s)){const i=s.reduce((a,l)=>a+(typeof l=="number"?l:0),0);if(i>0)return i}else if(typeof s=="number"&&Number.isFinite(s)&&s>0)return s;return 0}function Kge(t){const e=t==null?void 0:t.PointDataFormatID;return typeof e!="number"||!Number.isFinite(e)?NaN:e&15}async function Yge(t){try{const e=t.name.toLowerCase();if(!e.endsWith(".las")&&!e.endsWith(".laz"))return{error:"File is not a LAS or LAZ file"};const r=await(await C5()).readFileObject({input:t}),n=r;if(r.FileSignature!=="LASF")return{error:"Invalid LAS file signature"};let s=await P5(t,n),i=!1;if(Va("PointCount: raw header fields",{NumberOfPoints:n.NumberOfPoints,ExtendedNumberOfPoints:n.ExtendedNumberOfPoints,LegacyNumberOfPoints:n.LegacyNumberOfPoints,NumberOfPointRecords:n.NumberOfPointRecords,NumberOfPointsByReturn:n.NumberOfPointsByReturn,numberOfPointsByReturn:n.numberOfPointsByReturn,NumberOfPointByReturn:n.NumberOfPointByReturn,numberOfPointByReturn:n.numberOfPointByReturn}),s===0&&!(r.VersionMajor===1&&r.VersionMinor>=4)){const l=Math.floor(t.size/25);t.size>1024*1024&&(s=l,i=!0)}Va("PointCount: summary",{version:`${r.VersionMajor}.${r.VersionMinor}`,fileSizeMB:Number((t.size/(1024*1024)).toFixed(2)),finalPoints:s,estimated:i});try{Va("PointCount: header JSON",JSON.stringify(r,null,2))}catch{Va("PointCount: JSON stringify failed")}return typeof s!="number"||s<0||!Number.isFinite(s)?{error:`Invalid point count in LAS header. NumberOfPoints: ${r.NumberOfPoints}, ExtendedNumberOfPoints: ${r.ExtendedNumberOfPoints}`}:{pointCount:s,headerInfo:{fileSignature:r.FileSignature,versionMajor:r.VersionMajor,versionMinor:r.VersionMinor,pointDataFormatID:r.PointDataFormatID},estimated:i}}catch(e){let r="Failed to parse LAS header";return e instanceof Error?r=`Failed to parse LAS header: ${e.message}`:typeof e=="string"&&(r=`Failed to parse LAS header: ${e}`),{error:r}}}async function w2(t){try{const e=t.name.toLowerCase();if(!e.endsWith(".las")&&!e.endsWith(".laz"))return{error:"File is not a LAS or LAZ file"};const r=await(await C5()).readFileObject({input:t}),n=r,s=r;Va("FullProps: raw header",r);try{Va("FullProps: header JSON",JSON.stringify(r,null,2))}catch{Va("FullProps: JSON stringify failed")}if(r.FileSignature!=="LASF")return{error:"Invalid LAS file signature"};const i=await P5(t,n);Va("FullProps: point count derived",{pointCount:i});const a=Kge(r);Va("FullProps: point format + std attributes",{pointFormatId:a});const l={xyz:!0,intensity:[1,2,3,5,7,8,9,10].includes(a),rgb:[2,3,5,7,8,10].includes(a),classification:[1,2,3,4,5,6,7,8,9,10].includes(a),gpsTime:[1,3,4,5,6,7,8,9,10].includes(a),nir:[8,10].includes(a),returnInfo:[1,2,3,4,5,6,7,8,9,10].includes(a)};let u=s.epsg??s.EPSG,h=[];try{const f=await Gge(t,{HeaderSize:s.HeaderSize,OffsetToPointData:s.OffsetToPointData,NumberOfVariableLengthRecords:n.NumberOfVariableLengthRecords});u=Wge({headerEpsg:u,geoAsciiParams:f.geoAsciiParams,geoKeyDirectory:f.geoKeyDirectory,wkt:f.wkt}),f.extraByteNames.length>0&&(h=f.extraByteNames.slice(0,12).map(g=>({name:g,dataType:"unknown",isStandard:!1}))),i===0&&f.hasLaszip&&Va("FullProps: point count 0 with LASzip present → treat as unknown for display")}catch(f){Va("VLR parsing failed",f)}const p=[];return l.intensity&&p.push({name:"Intensity",dataType:"uint16",isStandard:!0}),l.rgb&&p.push({name:"RGB",dataType:"uint16[3]",isStandard:!0}),l.classification&&p.push({name:"Classification",dataType:"uint8",isStandard:!0}),l.gpsTime&&p.push({name:"GPS Time",dataType:"float64",isStandard:!0}),l.nir&&p.push({name:"Near Infrared",dataType:"uint16",isStandard:!0}),l.returnInfo&&p.push({name:"Return Info",dataType:"uint8",isStandard:!0}),p.push(...h),{pointCount:i,version:`${s.VersionMajor}.${s.VersionMinor}`,bounds:{minX:s.MinX||0,maxX:s.MaxX||0,minY:s.MinY||0,maxY:s.MaxY||0,minZ:s.MinZ||0,maxZ:s.MaxZ||0},epsg:u,generatingSoftware:s.GeneratingSoftware||"Unknown",systemIdentifier:s.SystemIdentifier||"Unknown",creationDate:s.CreationDay&&s.CreationYear?`${s.CreationYear}-${String(s.CreationDay).padStart(3,"0")}`:s.FileCreationDayOfYear&&s.FileCreationYear?`${s.FileCreationYear}-${String(s.FileCreationDayOfYear).padStart(3,"0")}`:"Unknown",standardAttributes:l,customAttributes:h,nonObviousAttributes:p}}catch(e){let r="Failed to parse LAS header";return e instanceof Error?r=`Failed to parse LAS header: ${e.message}`:typeof e=="string"&&(r=`Failed to parse LAS header: ${e}`),{error:r}}}const R5={allowedExtensions:[".las",".laz"]},Zge={extractPointCount:Yge,readMagicHeader:async t=>{const r=await t.slice(0,4).arrayBuffer();return new TextDecoder("ascii").decode(new Uint8Array(r))}};function Jge(t,e=R5.allowedExtensions){const r=t.toLowerCase();return e.some(n=>r.endsWith(n))}function Qge(t){const e=t.toLowerCase();return e.endsWith(".las")||e.endsWith(".laz")}function Xge(t){return t%1073741824===0?`${t/1073741824} GiB`:xd(t)}async function x2(t,e={},r={}){const n={...R5,...e},s={...Zge,...r};if(!t)return{isValid:!1,error:"No file provided"};const i=t.name.toLowerCase();if(!Jge(i,n.allowedExtensions))return{isValid:!1,error:"Invalid file format"};if(n.maxFileSizeBytes!==void 0&&t.size>n.maxFileSizeBytes)return{isValid:!1,error:`File exceeds the ${Xge(n.maxFileSizeBytes)} upload limit.`};if(t.size===0)return{isValid:!1,error:"File appears to be empty."};if(/[<>:"/\\|?*]/.test(t.name))return{isValid:!1,error:"File name contains invali
522d characters. Please rename the file."};let u,h;if(Qge(i))try{if(await s.readMagicHeader(t)!=="LASF")return{isValid:!1,error:"Invalid LAS/LAZ magic header"};const g=await s.extractPointCount(t);g.pointCount!==void 0&&(u=g.pointCount,h=!0)}catch{}return{isValid:!0,pointCount:u,processingEligible:h??!0}}function xd(t){if(t===0)return"0 B";const e=1024,r=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(t)/Math.log(e));return`${parseFloat((t/Math.pow(e,n)).toFixed(2))} ${r[n]}`}function Ij(t,e,r){const n=new Date(t,e-1,r,12,0,0,0);return Number.isNaN(n.getTime())||n.getFullYear()!==t||n.getMonth()!==e-1||n.getDate()!==r?null:n}function eve(t){const e=new Date().getFullYear(),n=Math.floor(e/100)*100+t;return n<=e+1?n:n-100}function tve(t){const e=Number(t.slice(0,2)),r=Number(t.slice(2,4)),n=eve(Number(t.slice(4,6))),s=Ij(n,e,r);return s||Ij(n,r,e)}function rve(t){const e=[/(?:^|[^0-9])(20[0-9]{2})[-_](0[1-9]|1[0-2])[-_](0[1-9]|[12][0-9]|3[01])(?:[^0-9]|$)/,/(?:^|[^0-9])(20[0-9]{2})(0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])(?:[^0-9]|$)/];for(const n of e){const s=t.match(n);if(!s)continue;const i=Number(s[1]),a=Number(s[2]),l=Number(s[3]),u=Ij(i,a,l);if(u)return u}const r=t.match(/(?:^|[^A-Za-z0-9])(?:TLS|MLS|ULS)[-_ ]([0-9]{6})(?:[^0-9]|$)/i);return r?tve(r[1]):null}function nve(t){if(t.length===0)return null;const e=t[0];return t.every(n=>n.getFullYear()===e.getFullYear()&&n.getMonth()===e.getMonth()&&n.getDate()===e.getDate())?e:null}function sve(t){const e=t.fileNames.map(rve);if(t.fileNames.length===1&&e[0])return{date:e[0],source:"filename",confidence:"high",autoFill:!0,reason:"filename_date"};if(t.fileNames.length>1&&e.every(n=>n!==null)){const n=nve(e);if(n)return{date:n,source:"filename",confidence:"high",autoFill:!0,reason:"consistent_filename_dates"}}return null}function ive(t){return t.toLocaleDateString("en-GB",{year:"numeric",month:"short",day:"numeric"})}function ave(t){if(!t)return;const e=t.toLowerCase();return e.includes("magic header")||e.includes("invalid las")||e.includes("invalid laz")||e.includes("not las")||e.includes("not laz")||e.includes("not a valid las")||e.includes("not a valid laz")?"File validation failed. Please select a LAS or LAZ (.las, .laz) file.":t}function ove({isValidating:t,multiple:e,status:r}){return(r==null?void 0:r.variant)==="destructive"?o.jsx(_L,{className:"h-4 w-4"}):e?o.jsx(SL,{className:"h-4 w-4"}):(r==null?void 0:r.variant)==="warning"?o.jsx(Oo,{className:"h-4 w-4"}):(r==null?void 0:r.variant)==="success"?o.jsx(yL,{className:"h-4 w-4"}):t?o.jsx(Ds,{className:"h-4 w-4 animate-spin"}):o.jsx(R9,{className:"h-4 w-4"})}function lve({errorMessage:t,files:e,isValidating:r,multiple:n,onRemove:s,status:i,title:a}){var p,f;const l=ave(t),u=(i==null?void 0:i.variant)==="info"?"default":(i==null?void 0:i.variant)??"default",h=n?"Remove selected point cloud files":"Remove selected point cloud file";return o.jsxs(Bs,{className:"ph-mask",variant:n&&u!=="destructive"?"default":u,children:[o.jsx(ove,{isValidating:r,multiple:n,status:i}),o.jsxs(ha,{className:"flex items-center justify-between gap-2 text-sm",children:[o.jsx("span",{className:n?void 0:"truncate",children:n?`${e.length} file${e.length===1?"":"s"} selected`:a||((p=e[0])==null?void 0:p.name)}),o.jsxs(we,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:s,"aria-label":h,children:[o.jsx(cu,{className:"mr-1 h-3.5 w-3.5"}),"Remove"]})]}),o.jsxs(fi,{className:"text-xs",children:[n?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mt-2 space-y-1",children:[e.slice(0,5).map((g,v)=>o.jsxs("div",{className:"flex items-center justify-between text-xs",children:[o.jsx("span",{className:"max-w-[250px] truncate",children:g.name}),o.jsx("span",{className:"text-gray-500",children:xd(g.size)})]},`${g.name}:${g.lastModified}:${v}`)),e.length>5&&o.jsxs("div",{className:"text-xs text-gray-500",children:["... and ",e.length-5," more file",e.length-5===1?"":"s"]})]}),o.jsx("div",{className:"mt-2 border-t pt-2",children:o.jsxs("span",{className:"text-gray-700",children:["Total size: ",xd(e.reduce((g,v)=>g+v.size,0))]})})]}):o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{children:["Size: ",xd(((f=e[0])==null?void 0:f.size)||0)]}),i&&o.jsx(_n,{variant:"secondary",className:"text-[10px]",children:i.label})]}),l&&o.jsx("span",{className:"mt-2 block",children:l}),!n&&(i==null?void 0:i.type)==="info"&&o.jsx("span",{className:"mt-1 block",children:"We couldn't read the point count from the file header. You can still upload this file."})]})]})}function cve({control:t,onAcquisitionDateSuggestionChange:e}){var re;const{trigger:r,setValue:n,resetField:s}=Fw(),i=pa({control:t,name:"pointCloudFile"}),a=pa({control:t,name:"title"}),l=pa({control:t,name:"hasLabelsOrPredictions"}),[u,h]=K.useState("single"),[p,f]=K.useState(null),[g,v]=K.useState(null),[_,x]=K.useState(void 0),[w,S]=K.useState(void 0),[k,j]=K.useState(!1),[C,R]=K.useState(!1),[A,I]=K.useState([]),[P,T]=K.useState(null),[O,G]=K.useState(0),[M,U]=K.useState([]),V=fr({queryKey:Ht.ingestions.capabilities,queryFn:()=>Ba.getIngestionCapabilities(),staleTime:1/0}),H=(re=V.data)==null?void 0:re.max_file_size_bytes,Y=Array.isArray(i),B=Y?i:i?[i]:[];K.useEffect(()=>{i&&r("pointCloudFile")},[g,r,i]);const ee=i?k?{type:"info",label:"Analyzing...",variant:"info"}:g?{type:"error",label:"Validation failed",variant:"destructive"}:p&&_!==void 0&&!w?{type:"warning",label:"Large file - processing limited",variant:"warning"}:p?{type:"warning",label:"Large file",variant:"warning"}:_!==void 0&&!w?{type:"warning",label:"Processing limited (>250M points)",variant:"warning"}:_!==void 0&&w?{type:"success",label:"Processing available",variant:"success"}:{type:"info",label:"Point count unknown",variant:"info"}:null,L=se=>{const ye=["Example:","PredSemantic/prediction: 1=Tree, 2=Ground, 3=Shrub","TreeSpecies/label: 1=Oak, 2=Pine, 3=Birch"].join(`
523`);return!se||se.length===0?ye:[`Detected attributes: ${se.slice(0,3).join(", ")}`,ye].join(`
524`)},$=K.useCallback(se=>{e==null||e(se),se!=null&&se.autoFill&&n("acquisitionDate",se.date,{shouldValidate:!0,shouldDirty:!0})},[e,n]),F=K.useCallback(se=>{const ye=sve({fileNames:se});$(ye)},[$]),te=K.useCallback(()=>{f(null),v(null),x(void 0),S(void 0),U([]),R(!1),I([]),T(null),n("requiresApproxLocation",!1,{shouldValidate:!0}),n("approxLocation",void 0,{shouldValidate:!0}),$(null)},[$,n]),ue=K.useCallback(()=>{te(),s("pointCloudFile"),G(se=>se+1),r("pointCloudFile")},[s,te,r]);return o.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[o.jsxs("div",{className:"col-span-1",children:[o.jsx("h3",{className:"font-medium text-gray-900",children:"Point Cloud File"}),o.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Upload a single file or a multi-file dataset (e.g., tiled scans from the same site and acquisition). Multi-file uploads should be spatially contiguous and collected within the same time period."})]}),o.jsxs("div",{className:"col-span-2 space-y-6",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"pointCloudFile",children:"File Selection *"}),V.isError&&o.jsxs(Bs,{variant:"destructive",children:[o.jsx(Oo,{className:"h-4 w-4"}),o.jsx(ha,{children:"Upload configuration unavailable"}),o.jsxs(fi,{className:"flex items-center justify-between gap-3",children:[o.jsx("span",{children:"File selection is disabled until the upload limit can be loaded."}),o.jsx(we,{type:"button",variant:"outline",size:"sm",onClick:()=>void V.refetch(),children:"Retry"})]})]}),o.jsxs(Dg,{value:u,onValueChange:se=>h(se),children:[o.jsxs(Og,{className:"w-full",children:[o.jsxs(Is,{value:"single",className:"flex-1 gap-2",children:[o.jsx(b9,{className:"h-4 w-4"}),"Single File"]}),o.jsxs(Is,{value:"multiple",className:"flex-1 gap-2",children:[o.jsx(SL,{className:"h-4 w-4"}),"Multi-File Dataset"]})]}),o.jsx(Ti,{control:t,name:"pointCloudFile",rules:{validate:se=>!se||Array.isArray(se)&&se.length===0?"Point cloud file is required":g||!0},render:({field:se,fieldState:ye})=>{var de,pe;return o.jsxs(o.Fragment,{children:[o.jsx(Rf,{value:"single",className:"mt-2",children:o.jsx(Nt,{id:"pointCloudFile",type:"file",disabled:H===void 0,"aria-invalid":ye.invalid,className:"aria-invalid:border-red-800/60 aria-invalid:ring-red-900/10",accept:".las,.laz",onCh
524ange:async Ie=>{var He;const Ne=(He=Ie.target.files)==null?void 0:He[0];if(te(),!Ne){se.onChange(void 0);return}j(!0);try{const[We,at]=await Promise.all([x2(Ne,{maxFileSizeBytes:H}),w2(Ne)]);if(We.isValid?(se.onChange(Ne),We.warning&&f(We.warning),x(We.pointCount),S(We.processingEligible)):(v(We.error||"File validation failed"),se.onChange(Ne)),"error"in at)console.warn("Property extraction failed:",at.error),T("CRS metadata could not be read from the file header. Upload can continue, but please verify location metadata.");else{const Xt=at.nonObviousAttributes.filter(Ee=>!Ee.isStandard).map(Ee=>Ee.name);U(Xt.slice(0,12));const Rt=!at.epsg;R(Rt),I(Rt?[Ne.name]:[]),n("requiresApproxLocation",Rt,{shouldValidate:!0}),Rt||n("approxLocation",void 0,{shouldValidate:!0})}F([Ne.name])}catch(We){console.warn("File validation failed:",We),se.onChange(Ne),F([Ne.name])}finally{j(!1)}}},`single-${O}`)}),o.jsxs(Rf,{value:"multiple",className:"mt-2",children:[o.jsx(Nt,{id:"pointCloudFile",type:"file",disabled:H===void 0,"aria-invalid":ye.invalid,className:"aria-invalid:border-red-800/60 aria-invalid:ring-red-900/10",accept:".las,.laz",multiple:!0,onChange:async Ie=>{const Ne=Array.from(Ie.target.files||[]);if(te(),Ne.length===0){se.onChange(void 0);return}const He=Ne.filter(at=>at.name.toLowerCase().endsWith(".las")||at.name.toLowerCase().endsWith(".laz"));if(He.length===0){v("No valid LAS/LAZ files found in selection"),se.onChange(void 0);return}const We=He.map(at=>at.name);se.onChange(He),x(He.length),j(!0);try{const[at,Xt]=await Promise.all([Promise.all(He.map(ot=>x2(ot,{maxFileSizeBytes:H}))),Promise.all(He.map(ot=>w2(ot)))]),Rt=at.findIndex(ot=>!ot.isValid);Rt>=0&&v(`${He[Rt].name}: ${at[Rt].error||"File validation failed"}`);const Ee=Xt.map((ot,De)=>({properties:ot,fileName:He[De].name})).filter(ot=>!("error"in ot.properties)),Et=Ee.filter(ot=>!ot.properties.epsg).map(ot=>ot.fileName),Mt=Et.length>0;R(Mt),I(Et),n("requiresApproxLocation",Mt,{shouldValidate:!0}),Mt||n("approxLocation",void 0,{shouldValidate:!0}),Ee.length<He.length&&T("CRS metadata could not be read from every selected file. Upload can continue, but please verify location metadata."),F(We)}catch{T("CRS metadata could not be inspected. Upload can continue, but please verify location metadata."),F(We)}finally{j(!1)}}},`multiple-${O}`),o.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"All files will be part of one dataset. Select multiple .las or .laz files at once (Ctrl/Cmd+Click to select multiple). Please only group tiles from the same site and acquisition (no spatially distant plots or different dates)."})]}),i&&o.jsxs("div",{className:"space-y-2 mt-2",children:[o.jsx(lve,{errorMessage:g||((de=ye.error)==null?void 0:de.message),files:B,isValidating:k,multiple:Y,onRemove:ue,status:ee,title:(a==null?void 0:a.trim())||void 0}),C&&o.jsxs(Bs,{variant:"warning",children:[o.jsx(Oo,{className:"h-4 w-4"}),o.jsx(ha,{className:"text-sm",children:"No CRS found in file metadata"}),o.jsxs(fi,{className:"text-xs",children:["In the Location section, please choose an approximate point on the map or enter latitude/longitude manually. This is used as metadata and map fallback.",A.length>0&&o.jsxs("span",{className:"mt-1 block",children:["Missing CRS: ",A.slice(0,3).join(", "),A.length>3?` and ${A.length-3} more`:""]})]})]}),P&&o.jsxs(Bs,{variant:"warning",children:[o.jsx(Oo,{className:"h-4 w-4"}),o.jsx(ha,{className:"text-sm",children:"CRS check incomplete"}),o.jsx(fi,{className:"text-xs",children:P})]})]}),!i&&((pe=ye.error)==null?void 0:pe.message)&&o.jsx("p",{className:"mt-2 text-sm text-red-800",children:ye.error.message})]})}})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx(Ti,{control:t,name:"hasLabelsOrPredictions",render:({field:se})=>o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ya,{id:"hasLabelsPredictions",className:"cursor-pointer",checked:!!se.value,onCheckedChange:ye=>se.onChange(!!ye)}),o.jsx(ft,{htmlFor:"hasLabelsPredictions",className:"text-sm text-gray-800 cursor-pointer",children:"Contains labels/predictions (e.g., segmentation or species)"})]})})}),l&&o.jsx("div",{className:"space-y-4 p-3 rounded-md border bg-gray-50 border-gray-200",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{className:"text-sm text-gray-800",children:"Value-to-label mapping"}),o.jsx("p",{className:"text-xs text-gray-600",children:"Use simple lines: column/type mapping. You can also use key=value pairs on one line."}),o.jsx(Ti,{control:t,name:"labelMappingsText",render:({field:se,fieldState:ye})=>{var de;return o.jsxs(o.Fragment,{children:[o.jsx(Jl,{value:typeof se.value=="string"?se.value:"",onChange:se.onCh
524ange,onBlur:se.onBlur,name:se.name,"aria-invalid":ye.invalid,className:"aria-invalid:border-red-800/60 aria-invalid:ring-red-900/10",rows:6,placeholder:L(M)}),((de=ye.error)==null?void 0:de.message)&&o.jsx("p",{className:"text-sm text-red-800",children:ye.error.message})]})}})]})})]})]})]})}function gr(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function Ui(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function As(t,e){const r=gr(t);return isNaN(e)?Ui(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function Ja(t,e){const r=gr(t);if(isNaN(e))return Ui(t,NaN);if(!e)return r;const n=r.getDate(),s=Ui(t,r.getTime());s.setMonth(r.getMonth()+e+1,0);const i=s.getDate();return n>=i?s:(r.setFullYear(s.getFullYear(),s.getMonth(),n),r)}const vN=6048e5,uve=864e5;let dve={};function rv(){return dve}function Uo(t,e){var l,u,h,p;const r=rv(),n=(e==null?void 0:e.weekStartsOn)??((u=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:u.weekStartsOn)??r.weekStartsOn??((p=(h=r.locale)==null?void 0:h.options)==null?void 0:p.weekStartsOn)??0,s=gr(t),i=s.getDay(),a=(i<n?7:0)+i-n;return s.setDate(s.getDate()-a),s.setHours(0,0,0,0),s}function Td(t){return Uo(t,{weekStartsOn:1})}function A5(t){const e=gr(t),r=e.getFullYear(),n=Ui(t,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const s=Td(n),i=Ui(t,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const a=Td(i);return e.getTime()>=s.getTime()?r+1:e.getTime()>=a.getTime()?r:r-1}function Gf(t){const e=gr(t);return e.setHours(0,0,0,0),e}function Lb(t){const e=gr(t),r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),+t-+r}function Do(t,e){const r=Gf(t),n=Gf(e),s=+r-Lb(r),i=+n-Lb(n);return Math.round((s-i)/uve)}function hve(t){const e=A5(t),r=Ui(t,0);return r.setFullYear(e,0,4),r.setHours(0,0,0,0),Td(r)}function Dj(t,e){const r=e*7;return As(t,r)}function fve(t,e){return Ja(t,e*12)}function pve(t){let e;return t.forEach(function(r){const n=gr(r);(e===void 0||e<n||isNaN(Number(n)))&&(e=n)}),e||new Date(NaN)}function mve(t){let e;return t.forEach(r=>{const n=gr(r);(!e||e>n||isNaN(+n))&&(e=n)}),e||new Date(NaN)}function di(t,e){const r=Gf(t),n=Gf(e);return+r==+n}function yN(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function gve(t){if(!yN(t)&&typeof t!="number")return!1;const e=gr(t);return!isNaN(Number(e))}function gg(t,e){const r=gr(t),n=gr(e),s=r.getFullYear()-n.getFullYear(),i=r.getMonth()-n.getMonth();return s*12+i}function vve(t,e,r){const n=Uo(t,r),s=Uo(e,r),i=+n-Lb(n),a=+s-Lb(s);return Math.round((i-a)/vN)}function _N(t){const e=gr(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(23,59,59,999),e}function pi(t){const e=gr(t);return e.setDate(1),e.setHours(0,0,0,0),e}function T5(t){const e=gr(t),r=Ui(t,0);return r.setFullYear(e.getFullYear(),0,1),r.setHours(0,0,0,0),r}function bN(t,e){var l,u,h,p;const r=rv(),n=(e==null?void 0:e.weekStartsOn)??((u=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:u.weekStartsOn)??r.weekStartsOn??((p=(h=r.locale)==null?void 0:h.options)==null?void 0:p.weekStartsOn)??0,s=gr(t),i=s.getDay(),a=(i<n?-7:0)+6-(i-n);return s.setDate(s.getDate()+a),s.setHours(23,59,59,999),s}function I5(t){return bN(t,{weekStartsOn:1})}const yve={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},_ve=(t,e,r)=>{let n;const s=yve[t];return typeof s=="string"?n=s:e===1?n=s.one:n=s.other.replace("{{count}}",e.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function rk(t){return(e={})=>{const r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const bve={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},wve={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},xve={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"}
vendor: 12,248 bytes, line 524
524,Sve={date:rk({formats:bve,defaultWidth:"full"}),time:rk({formats:wve,defaultWidth:"full"}),dateTime:rk({formats:xve,defaultWidth:"full"})},kve={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Eve=(t,e,r,n)=>kve[t];function lm(t){return(e,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let s;if(n==="formatting"&&t.formattingValues){const a=t.defaultFormattingWidth||t.defaultWidth,l=r!=null&&r.width?String(r.width):a;s=t.formattingValues[l]||t.formattingValues[a]}else{const a=t.defaultWidth,l=r!=null&&r.width?String(r.width):t.defaultWidth;s=t.values[l]||t.values[a]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const jve={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Cve={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Nve={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Pve={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Rve={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Ave={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Tve=(t,e)=>{const r=Number(t),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},Ive={ordinalNumber:Tve,era:lm({values:jve,defaultWidth:"wide"}),quarter:lm({values:Cve,defaultWidth:"wide",argumentCallback:t=>t-1}),month:lm({values:Nve,defaultWidth:"wide"}),day:lm({values:Pve,defaultWidth:"wide"}),dayPeriod:lm({values:Rve,defaultWidth:"wide",formattingValues:Ave,defaultFormattingWidth:"wide"})};function cm(t){return(e,r={})=>{const n=r.width,s=n&&t.matchPatterns[n]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const a=i[0],l=n&&t.parsePatterns[n]||t.parsePatterns[t.defaultParseWidth],u=Array.isArray(l)?Ove(l,f=>f.test(a)):Dve(l,f=>f.test(a));let h;h=t.valueCallback?t.valueCallback(u):u,h=r.valueCallback?r.valueCallback(h):h;const p=e.slice(a.length);return{value:h,rest:p}}}function Dve(t,e){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function Ove(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function Mve(t){return(e,r={})=>{const n=e.match(t.matchPattern);if(!n)return null;const s=n[0],i=e.match(t.parsePattern);if(!i)return null;let a=t.valueCallback?t.valueCallback(i[0]):i[0];a=r.valueCallback?r.valueCallback(a):a;const l=e.slice(s.length);return{value:a,rest:l}}}const Lve=/^(\d+)(th|st|nd|rd)?/i,Fve=/\d+/i,$ve={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},zve={any:[/^b/i,/^(a|c)/i]},Uve={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Bve={any:[/1/i,/2/i,/3/i,/4/i]},Vve={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Hve={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},qve={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Wve={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Gve={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Kve={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Yve={ordinalNumber:Mve({matchPattern:Lve,parsePattern:Fve,valueCallback:t=>parseInt(t,10)}),era:cm({matchPatterns:$ve,defaultMatchWidth:"wide",parsePatterns:zve,defaultParseWidth:"any"}),quarter:cm({matchPatterns:Uve,defaultMatchWidth:"wide",parsePatterns:Bve,defaultParseWidth:"any",valueCallback:t=>t+1}),month:cm({matchPatterns:Vve,defaultMatchWidth:"wide",parsePatterns:Hve,defaultParseWidth:"any"}),day:cm({matchPatterns:qve,defaultMatchWidth:"wide",parsePatterns:Wve,defaultParseWidth:"any"}),dayPeriod:cm({matchPatterns:Gve,defaultMatchWidth:"any",parsePatterns:Kve,defaultParseWidth:"any"})},D5={code:"en-US",formatDistance:_ve,formatLong:Sve,formatRelative:Eve,localize:Ive,match:Yve,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Zve(t){const e=gr(t);return Do(e,T5(e))+1}function O5(t){const e=gr(t),r=+Td(e)-+hve(e);return Math.round(r/vN)+1}function M5(t,e){var p,f,g,v;const r=gr(t),n=r.getFullYear(),s=rv(),i=(e==null?void 0:e.firstWeekContainsDate)??((f=(p=e==null?void 0:e.locale)==null?void 0:p.options)==null?void 0:f.firstWeekContainsDate)??s.firstWeekContainsDate??((v=(g=s.locale)==null?void 0:g.options)==null?void 0:v.firstWeekContainsDate)??1,a=Ui(t,0);a.setFullYear(n+1,0,i),a.setHours(0,0,0,0);const l=Uo(a,e),u=Ui(t,0);u.setFullYear(n,0,i),u.setHours(0,0,0,0);const h=Uo(u,e);return r.getTime()>=l.getTime()?n+1:r.getTime()>=h.getTime()?n:n-1}function Jve(t,e){var l,u,h,p;const r=rv(),n=(e==null?void 0:e.firstWeekContainsDate)??((u=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:u.firstWeekContainsDate)??r.firstWeekContainsDate??((p=(h=r.locale)==null?void 0:h.options)==null?void 0:p.firstWeekContainsDate)??1,s=M5(t,e),i=Ui(t,0);return i.setFullYear(s,0,n),i.setHours(0,0,0,0),Uo(i,e)}function L5(t,e){const r=gr(t),n=+Uo(r,e)-+Jve(r,e);return Math.round(n/vN)+1}function Ar(t,e){const r=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return r+n}const Cc={y(t,e){const r=t.getFullYear(),n=r>0?r:1-r;return Ar(e==="yy"?n%100:n,e.length)},M(t,e){const r=t.getMonth();return e==="M"?String(r+1):Ar(r+1,2)},d(t,e){return Ar(t.getDate(),e.length)},a(t,e){const r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(t,e){return Ar(t.getHours()%12||12,e.length)},H(t,e){return Ar(t.getHours(),e.length)},m(t,e){return Ar(t.getMinutes(),e.length)},s(t,e){return Ar(t.getSeconds(),e.length)},S(t,e){const r=e.length,n=t.getMilliseconds(),s=Math.trunc(n*Math.pow(10,r-3));return Ar(s,e.length)}},Oh={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},S2={G:function(t,e,r){const n=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(t,e,r){if(e==="yo"){const n=t.getFullYear(),s=n>0?n:1-n;return r.ordinalNumber(s,{unit:"year"})}return Cc.y(t,e)},Y:function(t,e,r,n){const s=M5(t,n),i=s>0?s:1-s;if(e==="YY"){const a=i%100;return Ar(a,2)}return e==="Yo"?r.ordinalNumber(i,{unit:"year"}):Ar(i,e.length)},R:function(t,e){const r=A5(t);return Ar(r,e.length)},u:function(t,e){const r=t.getFullYear();return Ar(r,e.length)},Q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return Ar(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return Ar(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,r){const n=t.getMonth();switch(e){case"M":case"MM":return Cc.M(t,e);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,r){const n=t.getMonth();switch(e){case"L":return String(n+1);case"LL":return Ar(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(t,e,r,n){const s=L5(t,n);return e==="wo"?r.ordinalNumber(s,{unit:"week"}):Ar(s,e.length)},I:function(t,e,r){const n=O5(t);return e==="Io"?r.ordinalNumber(n,{unit:"week"}):Ar(n,e.length)},d:function(t,e,r){return e==="do"?r.ordinalNumber(t.getDate(),{unit:"date"}):Cc.d(t,e)},D:function(t,e,r){const n=Zve(t);return e==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):Ar(n,e.length)},E:function(t,e,r){const n=t.getDay();switch(e){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,r,n){const s=t.getDay(),i=(s-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return Ar(i,2);case"eo":return r.ordinalNumber(i,{unit:"day"});case"eee":return r.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(s,{width:"short",context:"formatting"});case"eeee":default:return r.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,r,n){const s=t.getDay(),i=(s-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return Ar(i,e.length);case"co":return r.ordinalNumber(i,{unit:"day"});case"ccc":return r.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(s,{width:"narrow",context:"standalone"});case"cccccc":return r.day(s,{width:"short",context:"standalone"});case"cccc":default:return r.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,r){const n=t.getDay(),s=n===0?7:n;switch(e){case"i":return String(s);case"ii":return Ar(s,e.length);case"io":return r.ordinalNumber(s,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(t,e,r){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,r){const n=t.getHours();let s;switch(n===12?s=Oh.noon:n===0?s=Oh.midnight:s=n/12>
vendor: 4,717 bytes, line 524
524=1?"pm":"am",e){case"b":case"bb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,r){const n=t.getHours();let s;switch(n>=17?s=Oh.evening:n>=12?s=Oh.afternoon:n>=4?s=Oh.morning:s=Oh.night,e){case"B":case"BB":case"BBB":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,r){if(e==="ho"){let n=t.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return Cc.h(t,e)},H:function(t,e,r){return e==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):Cc.H(t,e)},K:function(t,e,r){const n=t.getHours()%12;return e==="Ko"?r.ordinalNumber(n,{unit:"hour"}):Ar(n,e.length)},k:function(t,e,r){let n=t.getHours();return n===0&&(n=24),e==="ko"?r.ordinalNumber(n,{unit:"hour"}):Ar(n,e.length)},m:function(t,e,r){return e==="mo"?r.ordinalNumber(t.getMinutes(),{unit:"minute"}):Cc.m(t,e)},s:function(t,e,r){return e==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):Cc.s(t,e)},S:function(t,e){return Cc.S(t,e)},X:function(t,e,r){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return E2(n);case"XXXX":case"XX":return td(n);case"XXXXX":case"XXX":default:return td(n,":")}},x:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"x":return E2(n);case"xxxx":case"xx":return td(n);case"xxxxx":case"xxx":default:return td(n,":")}},O:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+k2(n,":");case"OOOO":default:return"GMT"+td(n,":")}},z:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+k2(n,":");case"zzzz":default:return"GMT"+td(n,":")}},t:function(t,e,r){const n=Math.trunc(t.getTime()/1e3);return Ar(n,e.length)},T:function(t,e,r){const n=t.getTime();return Ar(n,e.length)}};function k2(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),s=Math.trunc(n/60),i=n%60;return i===0?r+String(s):r+String(s)+e+Ar(i,2)}function E2(t,e){return t%60===0?(t>0?"-":"+")+Ar(Math.abs(t)/60,2):td(t,e)}function td(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),s=Ar(Math.trunc(n/60),2),i=Ar(n%60,2);return r+s+e+i}const j2=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},F5=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Qve=(t,e)=>{const r=t.match(/(P+)(p+)?/)||[],n=r[1],s=r[2];if(!s)return j2(t,e);let i;switch(n){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",j2(n,e)).replace("{{time}}",F5(s,e))},Xve={p:F5,P:Qve},eye=/^D+$/,tye=/^Y+$/,rye=["D","DD","YY","YYYY"];function nye(t){return eye.test(t)}function sye(t){return tye.test(t)}function iye(t,e,r){const n=aye(t,e,r);if(console.warn(n),rye.includes(t))throw new RangeError(n)}function aye(t,e,r){const n=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const oye=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,lye=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,cye=/^'([^]*?)'?$/,uye=/''/g,dye=/[a-zA-Z]/;function Fo(t,e,r){var p,f,g,v,_,x,w,S;const n=rv(),s=(r==null?void 0:r.locale)??n.locale??D5,i=(r==null?void 0:r.firstWeekContainsDate)??((f=(p=r==null?void 0:r.locale)==null?void 0:p.options)==null?void 0:f.firstWeekContainsDate)??n.firstWeekContainsDate??((v=(g=n.locale)==null?void 0:g.options)==null?void 0:v.firstWeekContainsDate)??1,a=(r==null?void 0:r.weekStartsOn)??((x=(_=r==null?void 0:r.locale)==null?void 0:_.options)==null?void 0:x.weekStartsOn)??n.weekStartsOn??((S=(w=n.locale)==null?void 0:w.options)==null?void 0:S.weekStartsOn)??0,l=gr(t);if(!gve(l))throw new RangeError("Invalid time value");let u=e.match(lye).map(k=>{const j=k[0];if(j==="p"||j==="P"){const C=Xve[j];return C(k,s.formatLong)}return k}).join("").match(oye).map(k=>{if(k==="''")return{isToken:!1,value:"'"};const j=k[0];if(j==="'")return{isToken:!1,value:hye(k)};if(S2[j])return{isToken:!0,value:k};
524if(j.match(dye))throw new RangeError("Format string contains an unescaped latin alphabet character `"+j+"`");return{isToken:!1,value:k}});s.localize.preprocessor&&(u=s.localize.preprocessor(l,u));const h={firstWeekContainsDate:i,weekStartsOn:a,locale:s};return u.map(k=>{if(!k.isToken)return k.value;const j=k.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&sye(j)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&nye(j))&&iye(j,e,String(t));const C=S2[j[0]];return C(l,j,s.localize,h)}).join("")}function hye(t){const e=t.match(cye);return e?e[1].replace(uye,"'"):t}function fye(t){const e=gr(t),r=e.getFullYear(),n=e.getMonth(),s=Ui(t,0);return s.setFullYear(r,n+1,0),s.setHours(0,0,0,0),s.getDate()}function pye(t){return Math.trunc(+gr(t)/1e3)}function mye(t){const e=gr(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(0,0,0,0),e}function gye(t,e){return vve(mye(t),pi(t),e)+1}function Oj(t,e){const r=gr(t),n=gr(e);return r.getTime()>n.getTime()}function $5(t,e){const r=gr(t),n=gr(e);return+r<+n}function wN(t,e){const r=gr(t),n=gr(e);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()}function vye(t,e){const r=gr(t),n=gr(e);return r.getFullYear()===n.getFullYear()}function nk(t,e){return As(t,-e)}function sk(t,e){const r=gr(t),n=r.getFullYear(),s=r.getDate(),i=Ui(t,0);i.setFullYear(n,e,15),i.setHours(0,0,0,0);const a=fye(i);return r.setMonth(e,Math.min(s,a)),r}function C2(t,e){const r=gr(t);return isNaN(+r)?Ui(t,NaN):(r.setFullYear(e),r)}var $t=function(){return $t=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},$t.apply(this,arguments)};function yye(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function z5(t,e,r){for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function nv(t){return t.mode==="multiple"}function sv(t){return t.mode==="range"}function Uw(t){return t.mode==="single"}var _ye={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function bye(t,e){return Fo(t,"LLLL y",e)}function wye(t,e){return Fo(t,"d",e)}function xye(t,e){return Fo(t,"LLLL",e)}function Sye(t){return"".concat(t)}function kye(t,e){return Fo(t,"cccccc",e)}function Eye(t,e){return Fo(t,"yyyy",e)}var jye=Object.freeze({__proto__:null,formatCaption:bye,formatDay:wye,formatMonthCaption:xye,formatWeekNumber:Sye,formatWeekdayName:kye,formatYearCaption:Eye}),Cye=function(t,e,r){return Fo(t,"do MMMM (EEEE)",r)},Nye=function(){return"Month: "},Pye=function(){return"Go to next month"},Rye=function(){return"Go to previous month"},Aye=function(t,e){return Fo(t,"cccc",e)},Tye=function(t){return"Week n. ".concat(t)},Iye=function(){return"Year: "},Dye=Object.freeze({__proto__:null,labelDay:Cye,labelMonthDropdown:Nye,labelNext:Pye,labelPrevious:Rye,labelWeekNumber:Tye,labelWeekday:Aye,labelYearDropdown:Iye});function Oye(){var t="buttons",e=_ye,r=D5,n={},s={},i=1,a={},l=new Date;return{captionLayout:t,classNames:e,formatters:jye,labels:Dye,locale:r,modifiersClassNames:n,modifiers:s,numberOfMonths:i,styles:a,today:l,mode:"default"}}function Mye(t){var e=t.fromYear,r=t.toYear,n=t.fromMonth,s=t.toMonth,i=t.fromDate,a=t.toDate;
524return n?i=pi(n):e&&(i=new Date(e,0,1)),s?a=_N(s):r&&(a=new Date(r,11,31)),{fromDate:i?Gf(i):void 0,toDate:a?Gf(a):void 0}}var U5=y.createContext(void 0);function Lye(t){var e,r=t.initialProps,n=Oye(),s=Mye(r),i=s.fromDate,a=s.toDate,l=(e=r.captionLayout)!==null&&e!==void 0?e:n.captionLayout;l!=="buttons"&&(!i||!a)&&(l="buttons");var u;(Uw(r)||nv(r)||sv(r))&&(u=r.onSelect);var h=$t($t($t({},n),r),{captionLayout:l,classNames:$t($t({},n.classNames),r.classNames),components:$t({},r.components),formatters:$t($t({},n.formatters),r.formatters),fromDate:i,labels:$t($t({},n.labels),r.labels),mode:r.mode||n.mode,modifiers:$t($t({},n.modifiers),r.modifiers),modifiersClassNames:$t($t({},n.modifiersClassNames),r.modifiersClassNames),onSelect:u,styles:$t($t({},n.styles),r.styles),toDate:a});return o.jsx(U5.Provider,{value:h,children:t.children})}function qr(){var t=y.useContext(U5);if(!t)throw new Error("useDayPicker must be used within a DayPickerProvider.");return t}function B5(t){var e=qr(),r=e.locale,n=e.classNames,s=e.styles,i=e.formatters.formatCaption;return o.jsx("div",{className:n.caption_label,style:s.caption_label,"aria-live":"polite",role:"presentation",id:t.id,children:i(t.displayMonth,{locale:r})})}function Fye(t){return o.jsx("svg",$t({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},t,{children:o.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function V5(t){var e,r,n=t.onChange,s=t.value,i=t.children,a=t.caption,l=t.className,u=t.style,h=qr(),p=(r=(e=h.components)===null||e===void 0?void 0:e.IconDropdown)!==null&&r!==void 0?r:Fye;return o.jsxs("div",{className:l,style:u,children:[o.jsx("span",{className:h.classNames.vhidden,children:t["aria-label"]}),o.jsx("select",{name:t.name,"aria-label":t["aria-label"],className:h.classNames.dropdown,style:h.styles.dropdown,value:s,onChange:n,children:i}),o.jsxs("div",{className:h.classNames.caption_label,style:h.styles.caption_label,"aria-hidden":"true",children:[a,o.jsx(p,{className:h.classNames.dropdown_icon,style:h.styles.dropdown_icon})]})]})}function $ye(t){var e,r=qr(),n=r.fromDate,s=r.toDate,i=r.styles,a=r.locale,l=r.formatters.formatMonthCaption,u=r.classNames,h=r.components,p=r.labels.labelMonthDropdown;if(!n)return o.jsx(o.Fragment,{});if(!s)return o.jsx(o.Fragment,{});var f=[];if(vye(n,s))for(var g=pi(n),v=n.getMonth();v<=s.getMonth();v++)f.push(sk(g,v));else for(var g=pi(new Date),v=0;v<=11;v++)f.push(sk(g,v));var _=function(w){var S=Number(w.target.value),k=sk(pi(t.displayMonth),S);t.onChange(k)},x=(e=h==null?void 0:h.Dropdown)!==null&&e!==void 0?e:V5;return o.jsx(x,{name:"months","aria-label":p(),className:u.dropdown_month,style:i.dropdown_month,onChange:_,value:t.displayMonth.getMonth(),caption:l(t.displayMonth,{locale:a}),children:f.map(function(w){return o.jsx("option",{value:w.getMonth(),children:l(w,{locale:a})},w.getMonth())})})}function zye(t){var e,r=t.displayMonth,n=qr(),s=n.fromDate,i=n.toDate,a=n.locale,l=n.styles,u=n.classNames,h=n.components,p=n.formatters.formatYearCaption,f=n.labels.labelYearDropdown,g=[];if(!s)return o.jsx(o.Fragment,{});if(!i)return o.jsx(o.Fragment,{});for(var v=s.getFullYear(),_=i.getFullYear(),x=v;x<=_;x++)g.push(C2(T5(new Date),x));var w=function(k){var j=C2(pi(r),Number(k.target.value));t.onChange(j)},S=(e=h==null?void 0:h.Dropdown)!==null&&e!==void 0?e:V5;return o.jsx(S,{name:"years","aria-label":f(),className:u.dropdown_year,style:l.dropdown_year,onChange:w,value:r.getFullYear(),caption:p(r,{locale:a}),children:g.map(function(k){return o.jsx("option",{value:k.getFullYear(),children:p(k,{locale:a})},k.getFullYear())})})}function Uye(t,e){var r=y.useState(t),n=r[0],s=r[1],i=e===void 0?n:e;return[i,s]}function Bye(t){var e=t.month,r=t.defaultMonth,n=t.today,s=e||r||n||new Date,i=t.toDate,a=t.fromDate,l=t.numberOfMonths,u=l===void 0?1:l;if(i&&gg(i,s)<0){var h=-1*(u-1);s=Ja(i,h)}return a&&gg(s,a)<0&&(s=a),pi(s)}function Vye(){var t=qr(),e=Bye(t),r=Uye(e,t.month),n=r[0],s=r[1],i=function(a){var l;if(!t.disableNavigation){var u=pi(a);s(u),(l=t.onMonthChange)===null||l===void 0||l.call(t,u)}};return[n,i]}function Hye(t,e){for(var r=e.reverseMonths,n=e.numberOfMonths,s=pi(t),i=pi(Ja(s,n)),a=gg(i,s),l=[],u=0;u<a;u++){var h=Ja(s,u);l.push(h)}return r&&(l=l.reverse()),l}function qye(t,e){if(!e.disableNavigation){var r=e.toDate,n=e.pagedNavigation,s=e.numberOfMonths,i=s===void 0?1:s,a=n?i:1,l=pi(t);if(!r)return Ja(l,a);var u=gg(r,t);if(!(u<i))return Ja(l,a)}}function Wye(t,e){if(!e.disableNavigation){var r=e.fromDate,n=e.pagedNavigation,s=e.numberOfMonths,i=s===void 0?1:s,a=n?i:1,l=pi(t);if(!r)return Ja(l,-a);var u=gg(l,r);if(!(u<=0))return Ja(l,-a)}}var H5=y.createContext(void 0);function Gye(t){var e=qr(),r=Vye(),n=r[0],s=r[1],i=Hye(n,e),a=qye(n,e),l=Wye(n,e),u=function(f){return i.some(function(g){return wN(f,g)})},h=function(f,g){u(f)||(g&&$5(f,g)?s(Ja(f,1+e.numberOfMonths*-1)):s(f))},p={currentMonth:n,displayMonths:i,goToMonth:s,goToDate:h,previousMonth:l,nextMonth:a,isDateDisplayed:u};return o.jsx(H5.Provider,{value:p,children:t.children})}function iv(){var t=y.useContext(H5);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t}function N2(t){var e,r=qr(),n=r.classNames,s=r.styles,i=r.components,a=iv().goToMonth,l=function(p){a(Ja(p,t.dis
524playIndex?-t.displayIndex:0))},u=(e=i==null?void 0:i.CaptionLabel)!==null&&e!==void 0?e:B5,h=o.jsx(u,{id:t.id,displayMonth:t.displayMonth});return o.jsxs("div",{className:n.caption_dropdowns,style:s.caption_dropdowns,children:[o.jsx("div",{className:n.vhidden,children:h}),o.jsx($ye,{onChange:l,displayMonth:t.displayMonth}),o.jsx(zye,{onChange:l,displayMonth:t.displayMonth})]})}function Kye(t){return o.jsx("svg",$t({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:o.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Yye(t){return o.jsx("svg",$t({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:o.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Fb=y.forwardRef(function(t,e){var r=qr(),n=r.classNames,s=r.styles,i=[n.button_reset,n.button];t.className&&i.push(t.className);var a=i.join(" "),l=$t($t({},s.button_reset),s.button);return t.style&&Object.assign(l,t.style),o.jsx("button",$t({},t,{ref:e,type:"button",className:a,style:l}))});function Zye(t){var e,r,n=qr(),s=n.dir,i=n.locale,a=n.classNames,l=n.styles,u=n.labels,h=u.labelPrevious,p=u.labelNext,f=n.components;if(!t.nextMonth&&!t.previousMonth)return o.jsx(o.Fragment,{});var g=h(t.previousMonth,{locale:i}),v=[a.nav_button,a.nav_button_previous].join(" "),_=p(t.nextMonth,{locale:i}),x=[a.nav_button,a.nav_button_next].join(" "),w=(e=f==null?void 0:f.IconRight)!==null&&e!==void 0?e:Yye,S=(r=f==null?void 0:f.IconLeft)!==null&&r!==void 0?r:Kye;return o.jsxs("div",{className:a.nav,style:l.nav,children:[!t.hidePrevious&&o.jsx(Fb,{name:"previous-month","aria-label":g,className:v,style:l.nav_button_previous,disabled:!t.previousMonth,onClick:t.onPreviousClick,children:s==="rtl"?o.jsx(w,{className:a.nav_icon,style:l.nav_icon}):o.jsx(S,{className:a.nav_icon,style:l.nav_icon})}),!t.hideNext&&o.jsx(Fb,{name:"next-month","aria-label":_,className:x,style:l.nav_button_next,disabled:!t.nextMonth,onClick:t.onNextClick,children:s==="rtl"?o.jsx(S,{className:a.nav_icon,style:l.nav_icon}):o.jsx(w,{className:a.nav_icon,style:l.nav_icon})})]})}function P2(t){var e=qr().numberOfMonths,r=iv(),n=r.previousMonth,s=r.nextMonth,i=r.goToMonth,a=r.displayMonths,l=a.findIndex(function(_){return wN(t.displayMonth,_)}),u=l===0,h=l===a.length-1,p=e>1&&(u||!h),f=e>1&&(h||!u),g=function(){n&&i(n)},v=function(){s&&i(s)};return o.jsx(Zye,{displayMonth:t.displayMonth,hideNext:p,hidePrevious:f,nextMonth:s,previousMonth:n,onPreviousClick:g,onNextClick:v})}function Jye(t){var e,r=qr(),n=r.classNames,s=r.disableNavigation,i=r.styles,a=r.captionLayout,l=r.components,u=(e=l==null?void 0:l.CaptionLabel)!==null&&e!==void 0?e:B5,h;return s?h=o.jsx(u,{id:t.id,displayMonth:t.displayMonth}):a==="dropdown"?h=o.jsx(N2,{displayMonth:t.displayMonth,id:t.id}):a==="dropdown-buttons"?h=o.jsxs(o.Fragment,{children:[o.jsx(N2,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id}),o.jsx(P2,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id})]}):h=o.jsxs(o.Fragment,{children:[o.jsx(u,{id:t.id,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),o.jsx(P2,{displayMonth:t.displayMonth,id:t.id})]}),o.jsx("div",{className:n.caption,style:i.caption,children:h})}function Qye(t){var e=qr(),r=e.footer,n=e.styles,s=e.classNames.tfoot;return r?o.jsx("tfoot",{className:s,style:n.tfoot,children:o.jsx("tr",{children:o.jsx("td",{colSpan:8,children:r})})}):o.jsx(o.Fragment,{})}function Xye(t,e,r){for(var n=r?Td(new Date):Uo(new Date,{locale:t,weekStartsOn:e}),s=[],i=0;i<7;i++){var a=As(n,i);s.push(a)}return s}function e_e(){var t=qr(),e=t.classNames,r=t.styles,n=t.showWeekNumber,s=t.locale,i=t.weekStartsOn,a=t.ISOWeek,l=t.formatters.formatWeekdayName,u=t.labels.labelWeekday,h=Xye(s,i,a);return o.jsxs("tr",{style:r.head_row,className:e.head_row,children:[n&&o.jsx("td",{style:r.head_cell,className:e.head_cell}),h.map(function(p,f){return o.jsx("th",{scope:"col",className:e.head_cell,style:r.head_cell,"aria-label":u(p,{locale:s}),children:l(p,{locale:s})},f)})]})}function t_e(){var t,e=qr(),r=e.classNames,n=e.styles,s=e.components,i=(t=s==null?void 0:s.HeadRow)!==null&&t!==void 0?t:e_e;return o.jsx("thead",{style:n.head,className:r.head,children:o.jsx(i,{})})}function r_e(t){var e=qr(),r=e.locale,n=e.formatters.formatDay;return o.jsx(o.Fragment,{children:n(t.date,{locale:r})})}var xN=y.createContext(void 0);function n_e(t){if(!nv(t.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return o.jsx(xN.Provider,{value:e,children:t.children})}return o.jsx(s_e,{initialProps:t.initialProps,children:t.children})}function s_e(t){var e=t.initialProps,r=t.children,n=e.selected,s=e.min,i=e.max,a=function(h,p,f){var g,v;(g=e.onDayClick)===null||g===void 0||g.call(e,h,p,f);var _=!!(p.selected&&s&&(n==null?void 0:n.length)===s);if(!_){var x=!!(!p.selected&&i&&(n==null?void 0:n.length)===i);if(!x){var w=n?z5([],n):[];if(p.selected){var S=w.findIndex(function(k){return di(h,k)});w.splice(S,1)}else w.push(h);(v=e.onSelect)===null||v===void 0||v.call(e,w,h,p,f)}}},l={disabled:[]};n&&l.disabled.push(function(h){var p=i&&n.length>i-1,f=n.some(function(g){return di(g,h)});return!!(p&&!f)});
524var u={selected:n,onDayClick:a,modifiers:l};return o.jsx(xN.Provider,{value:u,children:r})}function SN(){var t=y.useContext(xN);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}function i_e(t,e){var r=e||{},n=r.from,s=r.to;return n&&s?di(s,t)&&di(n,t)?void 0:di(s,t)?{from:s,to:void 0}:di(n,t)?void 0:Oj(n,t)?{from:t,to:s}:{from:n,to:t}:s?Oj(t,s)?{from:s,to:t}:{from:t,to:s}:n?$5(t,n)?{from:t,to:n}:{from:n,to:t}:{from:t,to:void 0}}var kN=y.createContext(void 0);function a_e(t){if(!sv(t.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return o.jsx(kN.Provider,{value:e,children:t.children})}return o.jsx(o_e,{initialProps:t.initialProps,children:t.children})}function o_e(t){var e=t.initialProps,r=t.children,n=e.selected,s=n||{},i=s.from,a=s.to,l=e.min,u=e.max,h=function(v,_,x){var w,S;(w=e.onDayClick)===null||w===void 0||w.call(e,v,_,x);var k=i_e(v,n);(S=e.onSelect)===null||S===void 0||S.call(e,k,v,_,x)},p={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(p.range_start=[i],a?(p.range_end=[a],di(i,a)||(p.range_middle=[{after:i,before:a}])):p.range_end=[i]):a&&(p.range_start=[a],p.range_end=[a]),l&&(i&&!a&&p.disabled.push({after:nk(i,l-1),before:As(i,l-1)}),i&&a&&p.disabled.push({after:i,before:As(i,l-1)}),!i&&a&&p.disabled.push({after:nk(a,l-1),before:As(a,l-1)})),u){if(i&&!a&&(p.disabled.push({before:As(i,-u+1)}),p.disabled.push({after:As(i,u-1)})),i&&a){var f=Do(a,i)+1,g=u-f;p.disabled.push({before:nk(i,g)}),p.disabled.push({after:As(a,g)})}!i&&a&&(p.disabled.push({before:As(a,-u+1)}),p.disabled.push({after:As(a,u-1)}))}return o.jsx(kN.Provider,{value:{selected:n,onDayClick:h,modifiers:p},children:r})}function EN(){var t=y.useContext(kN);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function N_(t){return Array.isArray(t)?z5([],t):t!==void 0?[t]:[]}function l_e(t){var e={};return Object.entries(t).forEach(function(r){var n=r[0],s=r[1];e[n]=N_(s)}),e}var Qa;(function(t){t.Outside="outside",t.Disabled="disabled",t.Selected="selected",t.Hidden="hidden",t.Today="today",t.RangeStart="range_start",t.RangeEnd="range_end",t.RangeMiddle="range_middle"})(Qa||(Qa={}));var c_e=Qa.Selected,dl=Qa.Disabled,u_e=Qa.Hidden,d_e=Qa.Today,ik=Qa.RangeEnd,ak=Qa.RangeMiddle,ok=Qa.RangeStart,h_e=Qa.Outside;function f_e(t,e,r){var n,s=(n={},n[c_e]=N_(t.selected),n[dl]=N_(t.disabled),n[u_e]=N_(t.hidden),n[d_e]=[t.today],n[ik]=[],n[ak]=[],n[ok]=[],n[h_e]=[],n);return t.fromDate&&s[dl].push({before:t.fromDate}),t.toDate&&s[dl].push({after:t.toDate}),nv(t)?s[dl]=s[dl].concat(e.modifiers[dl]):sv(t)&&(s[dl]=s[dl].concat(r.modifiers[dl]),s[ok]=r.modifiers[ok],s[ak]=r.modifiers[ak],s[ik]=r.modifiers[ik]),s}var q5=y.createContext(void 0);function p_e(t){var e=qr(),r=SN(),n=EN(),s=f_e(e,r,n),i=l_e(e.modifiers),a=$t($t({},s),i);return o.jsx(q5.Provider,{value:a,children:t.children})}function W5(){var t=y.useContext(q5);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function m_e(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function g_e(t){return!!(t&&typeof t=="object"&&"from"in t)}function v_e(t){return!!(t&&typeof t=="object"&&"after"in t)}function y_e(t){return!!(t&&typeof t=="object"&&"before"in t)}function __e(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function b_e(t,e){var r,n=e.from,s=e.to;if(n&&s){var i=Do(s,n)<0;i&&(r=[s,n],n=r[0],s=r[1]);var a=Do(t,n)>=0&&Do(s,t)>=0;return a}return s?di(s,t):n?di(n,t):!1}function w_e(t){return yN(t)}function x_e(t){return Array.isArray(t)&&t.every(yN)}function S_e(t,e){return e.some(function(r){if(typeof r=="boolean")return r;if(w_e(r))return di(t,r);if(x_e(r))return r.includes(t);if(g_e(r))return b_e(t,r);if(__e(r))return r.dayOfWeek.includes(t.getDay());if(m_e(r)){var n=Do(r.before,t),s=Do(r.after,t),i=n>0,a=s<0,l=Oj(r.before,r.after);return l?a&&i:i||a}return v_e(r)?Do(t,r.after)>0:y_e(r)?Do(r.before,t)>0:typeof r=="function"?r(t):!1})}function jN(t,e,r){var n=Object.keys(e).reduce(function(i,a){var l=e[a];return S_e(t,l)&&i.push(a),i},[]),s={};
524return n.forEach(function(i){return s[i]=!0}),r&&!wN(t,r)&&(s.outside=!0),s}function k_e(t,e){for(var r=pi(t[0]),n=_N(t[t.length-1]),s,i,a=r;a<=n;){var l=jN(a,e),u=!l.disabled&&!l.hidden;if(!u){a=As(a,1);continue}if(l.selected)return a;l.today&&!i&&(i=a),s||(s=a),a=As(a,1)}return i||s}var E_e=365;function G5(t,e){var r=e.moveBy,n=e.direction,s=e.context,i=e.modifiers,a=e.retry,l=a===void 0?{count:0,lastFocused:t}:a,u=s.weekStartsOn,h=s.fromDate,p=s.toDate,f=s.locale,g={day:As,week:Dj,month:Ja,year:fve,startOfWeek:function(w){return s.ISOWeek?Td(w):Uo(w,{locale:f,weekStartsOn:u})},endOfWeek:function(w){return s.ISOWeek?I5(w):bN(w,{locale:f,weekStartsOn:u})}},v=g[r](t,n==="after"?1:-1);n==="before"&&h?v=pve([h,v]):n==="after"&&p&&(v=mve([p,v]));var _=!0;if(i){var x=jN(v,i);_=!x.disabled&&!x.hidden}return _?v:l.count>E_e?l.lastFocused:G5(v,{moveBy:r,direction:n,context:s,modifiers:i,retry:$t($t({},l),{count:l.count+1})})}var K5=y.createContext(void 0);function j_e(t){var e=iv(),r=W5(),n=y.useState(),s=n[0],i=n[1],a=y.useState(),l=a[0],u=a[1],h=k_e(e.displayMonths,r),p=s??(l&&e.isDateDisplayed(l))?l:h,f=function(){u(s),i(void 0)},g=function(w){i(w)},v=qr(),_=function(w,S){if(s){var k=G5(s,{moveBy:w,direction:S,context:v,modifiers:r});di(s,k)||(e.goToDate(k,s),g(k))}},x={focusedDay:s,focusTarget:p,blur:f,focus:g,focusDayAfter:function(){return _("day","after")},focusDayBefore:function(){return _("day","before")},focusWeekAfter:function(){return _("week","after")},focusWeekBefore:function(){return _("week","before")},focusMonthBefore:function(){return _("month","before")},focusMonthAfter:function(){return _("month","after")},focusYearBefore:function(){return _("year","before")},focusYearAfter:function(){return _("year","after")},focusStartOfWeek:function(){return _("startOfWeek","before")},focusEndOfWeek:function(){return _("endOfWeek","after")}};return o.jsx(K5.Provider,{value:x,children:t.children})}function CN(){var t=y.useContext(K5);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function C_e(t,e){var r=W5(),n=jN(t,r,e);return n}var NN=y.createContext(void 0);function N_e(t){if(!Uw(t.initialProps)){var e={selected:void 0};return o.jsx(NN.Provider,{value:e,children:t.children})}return o.jsx(P_e,{initialProps:t.initialProps,children:t.children})}function P_e(t){var e=t.initialProps,r=t.children,n=function(i,a,l){var u,h,p;if((u=e.onDayClick)===null||u===void 0||u.call(e,i,a,l),a.selected&&!e.required){(h=e.onSelect)===null||h===void 0||h.call(e,void 0,i,a,l);return}(p=e.onSelect)===null||p===void 0||p.call(e,i,i,a,l)},s={selected:e.selected,onDayClick:n};return o.jsx(NN.Provider,{value:s,children:r})}function Y5(){var t=y.useContext(NN);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function R_e(t,e){var r=qr(),n=Y5(),s=SN(),i=EN(),a=CN(),l=a.focusDayAfter,u=a.focusDayBefore,h=a.focusWeekAfter,p=a.focusWeekBefore,f=a.blur,g=a.focus,v=a.focusMonthBefore,_=a.focusMonthAfter,x=a.focusYearBefore,w=a.focusYearAfter,S=a.focusStartOfWeek,k=a.focusEndOfWeek,j=function(B){var z,ee,L,$;Uw(r)?(z=n.onDayClick)===null||z===void 0||z.call(n,t,e,B):nv(r)?(ee=s.onDayClick)===null||ee===void 0||ee.call(s,t,e,B):sv(r)?(L=i.onDayClick)===null||L===void 0||L.call(i,t,e,B):($=r.onDayClick)===null||$===void 0||$.call(r,t,e,B)},C=function(B){var z;g(t),(z=r.onDayFocus)===null||z===void 0||z.call(r,t,e,B)},R=function(B){var z;f(),(z=r.onDayBlur)===null||z===void 0||z.call(r,t,e,B)},A=function(B){var z;(z=r.onDayMouseEnter)===null||z===void 0||z.call(r,t,e,B)},I=function(B){var z;(z=r.onDayMouseLeave)===null||z===void 0||z.call(r,t,e,B)},P=function(B){var z;(z=r.onDayPointerEnter)===null||z===void 0||z.call(r,t,e,B)},T=function(B){var z;(z=r.onDayPointerLeave)===null||z===void 0||z.call(r,t,e,B)},O=function(B){var z;(z=r.onDayTouchCancel)===null||z===void 0||z.call(r,t,e,B)},G=function(B){var z;(z=r.onDayTouchEnd)===null||z===void 0||z.call(r,t,e,B)},M=function(B){var z;(z=r.onDayTouchMove)===null||z===void 0||z.call(r,t,e,B)},U=function(B){var z;(z=r.onDayTouchStart)===null||z===void 0||z.call(r,t,e,B)},V=function(B){var z;(z=r.onDayKeyUp)===null||z===void 0||z.call(r,t,e,B)},H=function(B){var z;switch(B.key){case"ArrowLeft":B.preventDefault(),B.stopPropagation(),r.dir==="rtl"?l(
524):u();break;case"ArrowRight":B.preventDefault(),B.stopPropagation(),r.dir==="rtl"?u():l();break;case"ArrowDown":B.preventDefault(),B.stopPropagation(),h();break;case"ArrowUp":B.preventDefault(),B.stopPropagation(),p();break;case"PageUp":B.preventDefault(),B.stopPropagation(),B.shiftKey?x():v();break;case"PageDown":B.preventDefault(),B.stopPropagation(),B.shiftKey?w():_();break;case"Home":B.preventDefault(),B.stopPropagation(),S();break;case"End":B.preventDefault(),B.stopPropagation(),k();break}(z=r.onDayKeyDown)===null||z===void 0||z.call(r,t,e,B)},Y={onClick:j,onFocus:C,onBlur:R,onKeyDown:H,onKeyUp:V,onMouseEnter:A,onMouseLeave:I,onPointerEnter:P,onPointerLeave:T,onTouchCancel:O,onTouchEnd:G,onTouchMove:M,onTouchStart:U};return Y}function A_e(){var t=qr(),e=Y5(),r=SN(),n=EN(),s=Uw(t)?e.selected:nv(t)?r.selected:sv(t)?n.selected:void 0;return s}function T_e(t){return Object.values(Qa).includes(t)}function I_e(t,e){var r=[t.classNames.day];return Object.keys(e).forEach(function(n){var s=t.modifiersClassNames[n];if(s)r.push(s);else if(T_e(n)){var i=t.classNames["day_".concat(n)];i&&r.push(i)}}),r}function D_e(t,e){var r=$t({},t.styles.day);return Object.keys(e).forEach(function(n){var s;r=$t($t({},r),(s=t.modifiersStyles)===null||s===void 0?void 0:s[n])}),r}function O_e(t,e,r){var n,s,i,a=qr(),l=CN(),u=C_e(t,e),h=R_e(t,u),p=A_e(),f=!!(a.onDayCl
524ick||a.mode!=="default");y.useEffect(function(){var A;u.outside||l.focusedDay&&f&&di(l.focusedDay,t)&&((A=r.current)===null||A===void 0||A.focus())},[l.focusedDay,t,r,f,u.outside]);var g=I_e(a,u).join(" "),v=D_e(a,u),_=!!(u.outside&&!a.showOutsideDays||u.hidden),x=(i=(s=a.components)===null||s===void 0?void 0:s.DayContent)!==null&&i!==void 0?i:r_e,w=o.jsx(x,{date:t,displayMonth:e,activeModifiers:u}),S={style:v,className:g,children:w,role:"gridcell"},k=l.focusTarget&&di(l.focusTarget,t)&&!u.outside,j=l.focusedDay&&di(l.focusedDay,t),C=$t($t($t({},S),(n={disabled:u.disabled,role:"gridcell"},n["aria-selected"]=u.selected,n.tabIndex=j||k?0:-1,n)),h),R={isButton:f,isHidden:_,activeModifiers:u,selectedDays:p,buttonProps:C,divProps:S};return R}function M_e(t){var e=y.useRef(null),r=O_e(t.date,t.displayMonth,e);return r.isHidden?o.jsx("div",{role:"gridcell"}):r.isButton?o.jsx(Fb,$t({name:"day",ref:e},r.buttonProps)):o.jsx("div",$t({},r.divProps))}function L_e(t){var e=t.number,r=t.dates,n=qr(),s=n.onWeekNumberClick,i=n.styles,a=n.classNames,l=n.locale,u=n.labels.labelWeekNumber,h=n.formatters.formatWeekNumber,p=h(Number(e),{locale:l});if(!s)return o.jsx("span",{className:a.weeknumber,style:i.weeknumber,children:p});var f=u(Number(e),{locale:l}),g=function(v){s(e,r,v)};return o.jsx(Fb,{name:"week-number","aria-label":f,className:a.weeknumber,style:i.weeknumber,onClick:g,children:p})}function F_e(t){var e,r,n=qr(),s=n.styles,i=n.classNames,a=n.showWeekNumber,l=n.components,u=(e=l==null?void 0:l.Day)!==null&&e!==void 0?e:M_e,h=(r=l==null?void 0:l.WeekNumber)!==null&&r!==void 0?r:L_e,p;return a&&(p=o.jsx("td",{className:i.cell,style:s.cell,children:o.jsx(h,{number:t.weekNumber,dates:t.dates})})),o.jsxs("tr",{className:i.row,style:s.row,children:[p,t.dates.map(function(f){return o.jsx("td",{className:i.cell,style:s.cell,role:"presentation",children:o.jsx(u,{displayMonth:t.displayMonth,date:f})},pye(f))})]})}function R2(t,e,r){for(var n=r!=null&&r.ISOWeek?I5(e):bN(e,r),s=r!=null&&r.ISOWeek?Td(t):Uo(t,r),i=Do(n,s),a=[],l=0;l<=i;l++)a.push(As(s,l));var u=a.reduce(function(h,p){var f=r!=null&&r.ISOWeek?O5(p):L5(p,r),g=h.find(function(v){return v.weekNumber===f});return g?(g.dates.push(p),h):(h.push({weekNumber:f,dates:[p]}),h)},[]);return u}function $_e(t,e){var r=R2(pi(t),_N(t),e);if(e!=null&&e.useFixedWeeks){var n=gye(t,e);if(n<6){var s=r[r.length-1],i=s.dates[s.dates.length-1],a=Dj(i,6-n),l=R2(Dj(i,1),a,e);r.push.apply(r,l)}}return r}function z_e(t){var e,r,n,s=qr(),i=s.locale,a=s.classNames,l=s.styles,u=s.hideHead,h=s.fixedWeeks,p=s.components,f=s.weekStartsOn,g=s.firstWeekContainsDate,v=s.ISOWeek,_=$_e(t.displayMonth,{useFixedWeeks:!!h,ISOWeek:v,locale:i,weekStartsOn:f,firstWeekContainsDate:g}),x=(e=p==null?void 0:p.Head)!==null&&e!==void 0?e:t_e,w=(r=p==null?void 0:p.Row)!==null&&r!==void 0?r:F_e,S=(n=p==null?void 0:p.Footer)!==null&&n!==void 0?n:Qye;return o.jsxs("table",{id:t.id,className:a.table,style:l.table,role:"grid","aria-labelledby":t["aria-labelledby"],children:[!u&&o.jsx(x,{}),o.jsx("tbody",{className:a.tbody,style:l.tbody,children:_.map(function(k){return o.jsx(w,{displayMonth:t.displayMonth,dates:k.dates,weekNumber:k.weekNumber},k.weekNumber)})}),o.jsx(S,{displayMonth:t.displayMonth})]})}function U_e(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var B_e=U_e()?y.useLayoutEffect:y.useEffect,lk=!1,V_e=0;function A2(){return"react-day-picker-".concat(++V_e)}function H_e(t){var e,r=t??(lk?A2():null),n=y.useState(r),s=n[0],i=n[1];return B_e(function(){s===null&&i(A2())},[]),y.useEffect(function(){lk===!1&&(lk=!0)},[]),(e=t??s)!==null&&e!==void 0?e:void 0}function q_e(t){var e,r,n=qr(),s=n.dir,i=n.classNames,a=n.styles,l=n.components,u=iv().displayMonths,h=H_e(n.id?"".concat(n.id,"-").concat(t.displayIndex):void 0),p=n.id?"".concat(n.id,"-grid-").concat(t.displayIndex):void 0,f=[i.month],g=a.month,v=t.displayIndex===0,_=t.displayIndex===u.length-1,x=!v&&!_;s==="rtl"&&(e=[v,_],_=e[0],v=e[1]),v&&(f.push(i.caption_start),g=$t($t({},g),a.caption_start)),_&&(f.push(i.caption_end),g=$t($t({},g),a.caption_end)),x&&(f.push(i.caption_between),g=$t($t({},g),a.caption_between));var w=(r=l==null?void 0:l.Caption)!==null&&r!==void 0?r:Jye;return o.jsxs("div",{className:f.join(" "),style:g,children:[o.jsx(w,{id:h,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),o.jsx(z_e,{id:p,"aria-labelledby":h,displayMonth:t.displayMonth})]},t.displayIndex)}function W_e(t){var e=qr(),r=e.classNames,n=e.styles;return o.jsx("div",{className:r.months,style:n.months,children:t.children})}function G_e(t){var e,r,n=t.initialProps,s=qr(),i=CN(),a=iv(),l=y.useState(!1),u=l[0],h=l[1];y.useEffect(function(){s.initialFocus&&i.focusTarget&&(u||(i.focus(i.focusTarget),h(!0)))},[s.initialFocus,u,i.focus,i.focusTarget,i]);var p=[s.classNames.root,s.className];s.numberOfMonths>1&&p.push(s.classNames.multiple_months),s.showWeekNumber&&p.push(s.classNames.with_weeknumber);var f=$t($t({},s.styles.root),s.style),g=Object.keys(n).filter(function(_){return _.startsWith("data-")}).reduce(function(_,x){var w;return $t($t({},_),(w={},w[x]=n[x],w))},{}),v=(r=(e=n.components)===null||e===void 0?void 0:e.Months)!==null&&r!==void 0?r:W_e;return o.jsx("div",$t({className:p.join(" "),style:f,dir:s.dir,id:s.id,nonce:n.nonce,title:n.title,lang:n.lang},g,{children:o.jsx(v,{children:a.displayMonths.map(function(_,x){return o.jsx(q_e,{displayIndex:x,displayMonth:_},x)})})}))}function K_e(t){var e=t.children,r=yye(t,["children"]);return o.jsx(Lye,{initialProps:r,children:o.jsx(Gye,{children:o.jsx(N_e,{initialProps:r,children:o.jsx(n_e,{initialProps:r,children:o.jsx(a_e,{initialProps:r,children:o.jsx(p_e,{children:o.jsx(j_e,{children:e})})})})})})})}function Y_e(t){return o.jsx(K_e,$t({},t,{children:o.jsx(G_e,{initialProps:t})}))}
524function Z_e({className:t,classNames:e,showOutsideDays:r=!0,captionLayout:n,...s}){const i=()=>n==="dropdown"?{months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full gap-2",caption_label:"text-sm font-medium",caption_dropdowns:"flex gap-2",dropdown_month:ke(zh({variant:"outline"}),"text-sm font-medium h-8 px-3"),dropdown_year:ke(zh({variant:"outline"}),"text-sm font-medium h-8 px-3"),table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:ke("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",s.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:ke(zh({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...e}:{months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:ke(zh({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:ke("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",s.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:ke(zh({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...e};return o.jsx(Y_e,{showOutsideDays:r,className:ke("p-3",t),classNames:i(),captionLayout:n,components:{IconLeft:({className:a,...l})=>o.jsx(gL,{className:ke("size-4",a),...l}),IconRight:({className:a,...l})=>o.jsx(hC,{className:ke("size-4",a),...l})},...s})}function T2(t,e){const r=t.replace(/\D/g,"");if(r.length>=2){const l=Number(r.slice(0,2));if(l<1||l>31)return{error:"Day must be between 01 and 31"}}if(r.length>=4){const l=Number(r.slice(2,4));if(l<1||l>12)return{error:"Month must be between 01 and 12"}}if(!/^\d{8}$/.test(r))return{};const n=Number(r.slice(0,2)),s=Number(r.slice(2,4)),i=Number(r.slice(4,8)),a=new Date(i,s-1,n,12,0,0);if(a.getFullYear()!==i||a.getMonth()!==s-1||a.getDate()!==n)return{error:"Enter a valid calendar date"};if(e){const l=new Date;if(l.setHours(23,59,59,999),a>l)return{error:"Acquisition date cannot be in the future"}}return{date:a}}function J_e(t){const e=t.replace(/\D/g,"").slice(0,8),r=t.endsWith(".");if(e.length<=2)return e.length===2&&r?`${e}.`:e;if(e.length<=4){const n=`${e.slice(0,2)}.${e.slice(2)}`;return e.length===4&&r?`${n}.`:n}return`${e.slice(0,2)}.${e.slice(2,4)}.${e.slice(4)}`}
524function Q_e({id:t,value:e,onChange:r,placeholder:n="DD.MM.YYYY",disabled:s,className:i,disableFuture:a,"aria-invalid":l}){const[u,h]=y.useState(!1),[p,f]=y.useState(e||new Date),[g,v]=y.useState(e?Fo(e,"dd.MM.yyyy"):""),[_,x]=y.useState(null),w=y.useRef(!1),S=y.useId(),k=e?`${e.getFullYear()}-${e.getMonth()}`:"";y.useEffect(()=>{w.current||(v(e?Fo(e,"dd.MM.yyyy"):""),x(null))},[e]),y.useEffect(()=>{if(!e)return;const M=e.getFullYear(),U=e.getMonth();f(V=>V.getFullYear()===M&&V.getMonth()===U?V:new Date(M,U,1))},[k,e]);const j=M=>{h(M),M&&f(e?new Date(e.getFullYear(),e.getMonth(),1):new Date)},C=new Date().getFullYear(),R=C-50,A=a?C:C+10,I=Array.from({length:A-R+1},(M,U)=>R+U),P=["January","February","March","April","May","June","July","August","September","October","November","December"],T=M=>{const U=new Date(p);U.setFullYear(parseInt(M)),f(U)},O=M=>{const U=new Date(p);U.setMonth(parseInt(M)),f(U)},G=M=>{if(M){const U=new Date(M.getFullYear(),M.getMonth(),M.getDate(),12,0,0);v(Fo(U,"dd.MM.yyyy")),x(null),r==null||r(U)}else v(""),x(null),r==null||r(M);h(!1)};return o.jsxs(Ib,{open:u,onOpenChange:j,children:[o.jsxs("div",{className:"relative",children:[o.jsx(Nt,{id:t,"aria-label":"Acquisition date (DD.MM.YYYY)","aria-describedby":_?S:void 0,"aria-invalid":l||!!_,inputMode:"numeric",autoComplete:"off",maxLength:10,placeholder:n,value:g,disabled:s,className:ke("pr-10 font-normal",i),onFocus:()=>{w.current=!0},onBlur:()=>{w.current=!1;const M=T2(g,a);x(M.error??null),g&&!M.date&&(r==null||r(void 0))},onChange:M=>{const U=J_e(M.target.value);v(U);const V=T2(U,a);x(V.error??null),V.date?(f(new Date(V.date.getFullYear(),V.date.getMonth(),1)),r==null||r(V.date)):r==null||r(void 0)}}),o.jsx(Db,{asChild:!0,children:o.jsx(we,{type:"button",variant:"ghost",size:"icon","aria-label":"Open acquisition date calendar",disabled:s,className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:bg-transparent",children:o.jsx(Wq,{className:"h-4 w-4"})})})]}),_&&o.jsx("p",{id:S,className:"mt-1 text-sm text-red-800",role:"alert",children:_}),o.jsxs(Ob,{className:"w-auto p-0",align:"start",children:[o.jsx("div",{className:"p-3 border-b",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(Bf,{value:p.getMonth().toString(),onValueChange:O,children:[o.jsx(Hf,{className:"w-[140px]",children:o.jsx(Vf,{})}),o.jsx(qf,{children:P.map((M,U)=>o.jsx(Ul,{value:U.toString(),children:M},M))})]}),o.jsxs(Bf,{value:p.getFullYear().toString(),onValueChange:T,children:[o.jsx(Hf,{className:"w-[100px]",children:o.jsx(Vf,{})}),o.jsx(qf,{children:I.map(M=>o.jsx(Ul,{value:M.toString(),children:M},M))})]})]})}),o.jsx(Z_e,{mode:"single",selected:e,onSelect:G,month:p,onMonthChange:f,initialFocus:!0,...a?{disabled:{after:(()=>{const M=new Date;return M.setHours(23,59,59,999),M})()}}:{}})]})]})}const X_e=[{value:"noise_filtering",label:"Noise Filtering"},{value:"ground_classification",label:"Ground Classification"},{value:"height_normalization",label:"Height Normalization"},{value:"downsampling",label:"Downsampling"},{value:"co_registration",label:"Co-registration"},{value:"outlier_removal",label:"Outlier Removal"},{value:"compression",label:"Compression"}];function ebe({control:t,className:e}){return o.jsxs("div",{className:`space-y-3 ${e||""}`,children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{className:"text-sm font-medium",children:"Data Processing Applied (optional)"}),o.jsx("p",{className:"text-sm text-gray-600",children:"Select any preprocessing or processing steps that have been applied to this dataset"})]}),o.jsx(ui,{control:t,name:"preprocessingSteps",render:({field:r})=>o.jsx(Ls,{children:o.jsx("div",{className:"grid grid-cols-2 gap-3",children:X_e.map(n=>{var s;return o.jsxs(Ls,{className:"flex items-center space-x-2 space-y-0",children:[o.jsx(Di,{children:o.jsx(ya,{checked:((s=r.value)==null?void 0:s.includes(n.value))||!1,onCheckedChange:i=>{const a=r.value||[];i?r.onChange([...a,n.value]):r.onChange(a.filter(l=>l!==n.value))}})}),o.jsx(ft,{className:"text-sm font-normal cursor-pointer",onClick:()=>{const i=r.value||[];i.includes(n.value)?r.onChange(i.filter(l=>l!==n.value)):r.onChange([...i,n.value])},children:n.label})]},n.value)})})})})]})}const tbe=["Z+F FlexScan 22","Z+F IMAGER 5024S","Z+F IMAGER 5024A","Z+F IMAGER 5024E","Z+F IMAGER 5006EX","Z+F IMAGER 5016","Z+F IMAGER 5016A","DJI L1","DJI L2","Leica BLK360","Leica BLK2GO","Leica BLK2FLY","Leica RTC 360","Leica P30","Leica P40","Leica P50","FARO Focus S 350","FARO Focus 120","FARO Focus Premium Max","Trimble TX8","RIEGL VZ-400i","RIEGL VZ-400","RIEGL VZ-600i","RIEGL VZ-2000","RIEGL VZ-2000i","RIEGL MiniVUX","RIEGL VUX-120","RIEGL VUX-240","RIEGL VUX-180","Velodyne HDL-64E","Ouster OS1-128"];function Z5(t){return Array.from(new Set(Array.from(t).map(e=>e==null?void 0:e.trim()).filter(e=>!!e))).sort()}function rbe(t){return Z5([...tbe,...t])}function nbe(){const[t,e]=y.useState([]),[r,n]=y.useState(!0),[s,i]=y.useState(null),a=async()=>{try{n(!0),i(null);const{data:h,error:p}=await Ye.from("datasets").select("sensor").not("sensor","is",null).neq("sensor","");if(p)throw p;e(Z5(h.map(f=>f.sensor)))}catch(h){console.error("Error fetching sensors:",h),i(h instanceof Error?h.message:"Failed to fetch sensors")}finally{n(!1)}},l=async()=>{await a()};return y.useEffect(()=>{a()},[]),{sensors:y.useMemo(()=>rbe(t),[t]),loading:r,error:s,refetch:l}}const sbe=["TLS","MLS","ULS"];function J5({control:t,acquisitionDateSuggestion:e}){const[r,n]=K.useState(!1),[s,i]=K.useState(!1),[a,l]=K.useState(""),{setValue:u}=Fw(),h=pa({control:t,name:"acquisitionDate"}),{sensors:p,loading:f}=nbe(),g=!!e&&!!h&&h.getFullYear()===e.date.getFullYear()&&h.getMonth()===e.date.getMonth()&&h.getDate()===e.date.getDate(),v=!!(e!=null&&e.autoFill)&&g;return o.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[o.jsxs("div",{className:"col-span-1",children:[o.jsx("h3",{className:"font-medium text-gray-900",children:"Technical Details"}),o.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Specify acquisition date, platform type, sensor information, and any preprocessing steps applied to the data."})]}),o.jsxs("div",{className:"col-span-2 space-y-6",children:[o.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[o.jsxs("div",{className:"space-y-2 md:col-span-2",children:[o.jsx(Ti,{control:t,name:"acquisitionDate",render:({field:_,fieldState:x})=>{var w;return o.jsxs(o.Fragment,{children:[o.jsx(ft,{htmlFor:"acquisitionDate",children:"Acquisition Date *"}),o.jsx(Q_e,{id:"acquisitionDate",value:_.value,onChange:_.onChange,placeholder:"DD.MM.YYYY",disableFuture:!0,"aria-invalid":x.invalid,className:"aria-invalid:border-red-800/60 aria-invalid:ring-red-900/10"}),((w=x.error)==null?void 0:w.message)&&o.jsx("p",{className:"text-sm text-red-800",children:x.error.message})]})}}),e&&o.jsx("div",{className:ke("rounded-md border px-3 py-2 text-xs","border-emerald-200 bg-emerald-50/50 text-emerald-900"),children:o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"font-medium",children:[v?"Pre-filled date":g?"Using suggested date":"Suggested date",": ",ive(e.date)]}),o.jsx("div",{className:"mt-0.5 text-[11px] opacity-80",children:"Parsed from the filename pattern."})]}),!g&&o.jsx(we,{type:"button",variant:"outline",size:"sm",className:"h-6 px-2 text-[11px] shrink-0",onClick:()=>u("acquisitionDate",e.date,{shouldValidate:!0,shouldDirty:!0}),children:"Use suggestion"})]})})]}),o.jsx("div",{className:"space-y-2",children:o.jsx(Ti,{control:t,name:"platform",render:({field:_,fieldState:x})=>{var w;return o.jsxs(o.Fragment,{children:[o.jsx(ft,{htmlFor:"platform",children:"Platform *"}),o.jsxs(Ib,{open:r,onOpenChange:n,children:[o.jsx(Db,{asChild:!0,children:o.jsxs(we,{variant:"outline",role:"combobox","aria-expanded":r,"aria-invalid":x.invalid,className:"w-full justify-between aria-invalid:border-red-800/60 aria-invalid:ring-red-900/10",children:[_.value||"Select platform...",o.jsx(I_,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(Ob,{className:"w-[200px] p-0",children:o.jsxs(Nj,{children:[o.jsx(Pj,{placeholder:"Search platform..."}),o.jsxs(Rj,{children:[o.jsx(x_,{children:"No platform found."}),o.jsx(S_,{children:sbe.map(S=>o.jsxs(k_,{onSelect:()=>{_.onChange(S),n(!1)},children:[o.jsx(Vl,{className:ke("mr-2 h-4 w-4",_.value===S?"opacity-100":"opacity-0")}),S]},S))})]})]})})]}),((w=x.error)==null?void 0:w.message)&&o.jsx("p",{className:"text-sm text-red-800",children:x.error.message})]})}})})]}),o.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"sensor",children:"Sensor (
524optional)"}),o.jsx(Ti,{control:t,name:"sensor",render:({field:_})=>o.jsxs(Ib,{open:s,onOpenChange:i,children:[o.jsx(Db,{asChild:!0,children:o.jsxs(we,{variant:"outline",role:"combobox","aria-expanded":s,className:"w-full justify-between",children:[_.value||"Select or type sensor...",o.jsx(I_,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(Ob,{className:"w-[400px] p-0",children:o.jsxs(Nj,{shouldFilter:!1,children:[o.jsx(Pj,{placeholder:"Search or type sensor name...",value:a,onValueChange:l}),o.jsx(Rj,{children:f?o.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading sensors..."}):o.jsxs(o.Fragment,{children:[o.jsx(S_,{children:p.filter(x=>x.toLowerCase().includes(a.toLowerCase())).map(x=>o.jsxs(k_,{value:x,onSelect:()=>{_.onChange(x),i(!1),l("")},children:[o.jsx(Vl,{className:ke("mr-2 h-4 w-4",_.value===x?"opacity-100":"opacity-0")}),x]},x))}),a&&a.trim()!==""&&!p.some(x=>x.toLowerCase()===a.toLowerCase())&&o.jsx(S_,{children:o.jsxs(k_,{onSelect:()=>{_.onChange(a.trim()),i(!1),l("")},children:[o.jsx(Zc,{className:"mr-2 h-4 w-4"}),'Add "',a.trim(),'" as new sensor']})}),!a&&p.length===0&&o.jsx(x_,{children:"No sensors found. Start typing to add a new one."}),a&&p.filter(x=>x.toLowerCase().includes(a.toLowerCase())).length===0&&p.length>0&&o.jsx(x_,{children:"No matching sensors found."})]})})]})})]})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"scanPattern",children:"Scan Pattern (optional)"}),o.jsx(Ti,{control:t,name:"scanPattern",render:({field:_})=>o.jsx(Nt,{..._,placeholder:"e.g. grid 10×10 m, systematic 5×5 m, random transects, circle"})})]})]}),o.jsx(ebe,{control:t})]})]})}var ibe=Object.defineProperty,ws=(t,e)=>ibe(t,"name",{value:e,configurable:!0}),Q5="Radio",[abe,X5]=Vn(Q5),[obe,Bw]=abe(Q5);function eB(t){const{__scopeRadio:e,checked:r=!1,children:n,disabled:s,form:i,name:a,onCheck:l,required:u,value:h="on",internal_do_not_use_render:p}=t,[f,g]=y.useState(null),[v,_]=y.useState(null),x=y.useRef(!1),[w,S]=y.useReducer(C=>C+1,0),k=f?!!i||!!f.closest("form"):!0,j={checked:r,disabled:s,required:u,name:a,form:i,value:h,control:f,setControl:g,hasConsumerStoppedPropagationRef:x,userInteractionCount:w,onUserInteraction:S,isFormControl:k,bubbleInput:v,setBubbleInput:_,onCheck:ws(()=>l==null?void 0:l(),"onCheck")};return o.jsx(obe,{scope:e,...j,children:tB(p)?p(j):n})}ws(eB,"RadioProvider");var lbe="RadioTrigger",cbe=y.forwardRef(ws(function({__scopeRadio:e,onClick:r,...n},s){const{checked:i,disabled:a,value:l,setControl:u,onCheck:h,hasConsumerStoppedPropagationRef:p,onUserInteraction:f,isFormControl:g,bubbleInput:v}=Bw(lbe,e),_=Vt(s,u);return o.jsx(it.button,{type:"button",role:"radio","aria-checked":i,"data-state":PN(i),"data-disabled":a?"":void 0,disabled:a,value:l,...n,ref:_,onClick:Xe(r,x=>{i||(f(),h()),v&&g&&(p.current=x.isPropagationStopped(),p.current||x.stopPropagation())})})},"RadioTrigger")),ube="RadioIndicator",dbe=y.forwardRef(ws(function(e,r){const{__scopeRadio:n,forceMount:s,...i}=e,a=Bw(ube,n);return o.jsx(os,{present:s||a.checked,children:o.jsx(it.span,{"data-state":PN(a.checked),"data-disabled":a.disabled?"":void 0,...i,ref:r})})},"RadioIndicator")),hbe="RadioBubbleInput",fbe=y.forwardRef(ws(function({__scopeRadio:e,onClick:r,...n},s){const{control:i,checked:a,required:l,disabled:u,name:h,value:p,form:f,bubbleInput:g,setBubbleInput:v,hasConsumerStoppedPropagationRef:_,userInteractionCount:x}=Bw(hbe,e),w=Vt(s,v),S=mw(i),k=y.useRef(!1),j=y.useRef(a),C=y.useRef(x);y.useEffect(()=>{const A=g;if(!A)return;const I=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(I,"checked").set,O=x!==C.current;C.current=x;const G=j.current!==a;j.current=a;const M=!(O&&_.current);if(G&&T){k.current=!O;const U=new Event("click",{bubbles:M});T.call(A,a),A.dispatchEvent(U),k.current=!1}},[g,a,_,x]);const R=y.useRef(a);return o.jsx(it.input,{type:"radio","aria-hidden":!0,defaultChecked:R.current,required:l,disabled:u,name:h,value:p,form:f,...n,tabIndex:-1,ref:w,onClick:Xe(r,A=>{k.current&&A.stopPropagation()}),style:{...n.style,...S,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function tB(t){return typeof t=="function"}ws(tB,"isFunction");function PN(t){return t?"checked":"unchecked"}ws(PN,"getState");var pbe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],RN="RadioGroup",[mbe,yke]=Vn(RN,[Qf,X5]),rB=Qf(),Vw=X5(),[gbe,vbe]=mbe(RN),ybe=y.forwardRef(ws(function(e,r){const{__scopeRadioGroup:n,name:s,form:i,defaultValue:a,value:l,required:u=!1,disabled:h=!1,orientation:p,dir:f,loop:g=!0,onValueChange:v,..._}=e,x=rB(n),w=du(f),[S,k]=$i({prop:l,defaultProp:a??null,onChange:v,caller:RN}),[j,C]=y.useState(null),R=Vt(r,C),A=y.useRef(S);return y.useEffect(()=>{const I=i?j==null?void 0:j.ownerDocument.getElementById(i):j==null?void 0:j.closest("form");if(I instanceof HTMLFormElement){const P=ws(()=>k(A.current),"reset");return I.addEventListener("reset",P),()=>I.removeEventListener("reset",P)}},[j,i,k]),o.jsx(gbe,{scope:n,name:s,form:i,required:u,disabled:h,value:S,onValueChange:k,children:o.jsx(EC,{asChild:!0,...x,orientation:p,dir:w,loop:g,children:o.jsx(it.div,{role:"radiogroup","aria-required":u,"aria-orientation":p,"data-disabled":h?"":void 0,dir:w,..._,ref:R})})})},"RadioGroup")),_be="RadioGroupItemProvider",bbe="RadioGroupItemTrigger";function nB(t){const{__scopeRadioGroup:e,value:r,disabled:n,children:s,internal_do_not_use_render:i}=t,a=vbe(_be,e),l=Vw(e),u=a.disabled||n;return o.jsx(eB,{...l,checked:a.value===r,disabled:u,required:a.required,name:a.name,form:a.form,value:r,onCheck:()=>a.onValueChange(r),internal_do_not_use_render:i,children:s})}ws(nB,"RadioGroupItemProvider");var wbe=y.forwardRef(ws(function(e,r){const{__scopeRadioGroup:n,...s}=e,i=rB(n),a=Vw(n),{checked:l,disabled:u}=Bw(bbe,a.__scopeRadio),h=y.useRef(null),p=Vt(r,h),f=y.useRef(!1);return y.useEffect(()=>{const g=ws(_=>
524{pbe.includes(_.key)&&(f.current=!0)},"handleKeyDown"),v=ws(()=>f.current=!1,"handleKeyUp");return document.addEventListener("keydown",g),document.addEventListener("keyup",v),()=>{document.removeEventListener("keydown",g),document.removeEventListener("keyup",v)}},[]),o.jsx(jC,{asChild:!0,...i,focusable:!u,active:l,children:o.jsx(cbe,{...a,...s,ref:p,onKeyDown:Xe(s.onKeyDown,g=>{g.key==="Enter"&&g.preventDefault()}),onFocus:Xe(s.onFocus,()=>{var g;f.current&&((g=h.current)==null||g.click())})})})},"RadioGroupItemTrigger")),xbe=y.forwardRef(ws(function(e,r){const{__scopeRadioGroup:n,value:s,disabled:i,...a}=e;return o.jsx(nB,{__scopeRadioGroup:n,value:s,disabled:i,internal_do_not_use_render:({isFormControl:l})=>o.jsxs(o.Fragment,{children:[o.jsx(wbe,{...a,ref:r,__scopeRadioGroup:n}),l&&o.jsx(Sbe,{__scopeRadioGroup:n})]})})},"RadioGroupItem")),Sbe=y.forwardRef(ws(function(e,r){const{__scopeRadioGroup:n,...s}=e,i=Vw(n);return o.jsx(fbe,{...i,...s,ref:r})},"RadioGroupItemBubbleInput")),kbe=y.forwardRef(ws(function(e,r){const{__scopeRadioGroup:n,...s}=e,i=Vw(n);return o.jsx(dbe,{...i,...s,ref:r})},"RadioGroupIndicator"));function Ebe({className:t,...e}){return o.jsx(ybe,{"data-slot":"radio-group",className:ke("grid gap-3",t),...e})}function jbe({className:t,...e}){return o.jsx(xbe,{"data-slot":"radio-group-item",className:ke("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:o.jsx(kbe,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:o.jsx(bL,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}function Cbe({value:t,onChange:e,invalid:r=!1}){const n=K.useRef(null),s=K.useRef(null),i=K.useRef(t),[a,l]=K.useState(t?String(t.lat):""),[u,h]=K.useState(t?String(t.lon):""),[p,f]=K.useState(null);return K.useEffect(()=>{i.current=t},[t]),K.useEffect(()=>{let g=!1,v;return(async()=>{if(!n.current)return;const x=await Nn(()=>import("./index-LpbdmFwp.js"),__vite__mapDeps([2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]));await Nn(()=>Promise.resolve({}),__vite__mapDeps([51]));const w=(await Nn(async()=>{const{default:ee}=await import("./View-BUGfi4XF.js").then(L=>L.b);return{default:ee}},__vite__mapDeps([31,4,6,10,9,8,23,7,11,12,13,14,15,16,26,32]))).default,S=(await Nn(async()=>{const{default:ee}=await import("./Tile-DodoNKp-.js").then(L=>L.b);return{default:ee}},__vite__mapDeps([52,21,17,18,4,19,22,23,24,8,9,10,53,54,12,6,38,39,36,33,31,7,11,13,14,15,16,26,32,34]))).default,k=(await Nn(async()=>{const{default:ee}=await import("./OSM-DPw64vuj.js");return{default:ee}},__vite__mapDeps([55,56,57,21,17,18,4,19,22,23,24,9,8,10,53,54,12,6,38,14,15,32,58,44]))).default,j=(await Nn(async()=>{const{default:ee}=await import("./Vector-CPi4KwxY.js").then(L=>L.a);return{default:ee}},__vite__mapDeps([43,3,4,6,8,9,10,28,16,15,13,12,42,44]))).default,C=(await Nn(async()=>{const{default:ee}=await import("./Vector-Vfi6tvCu.js").then(L=>L.a);return{default:ee}},__vite__mapDeps([30,31,4,6,10,9,8,23,7,11,12,13,14,15,16,26,32,24,19,33,34,35,18,36,17,37,38,29,39,40,41,42]))).default,R=(await Nn(async()=>{const{default:ee}=await import("./Feature-DeEn3Pe0.js");return{default:ee}},__vite__mapDeps([5,4,6]))).default,A=(await Nn(async()=>{const{default:ee}=await import("./Point-CvQYgt85.js").then(L=>L.c);return{default:ee}},__vite__mapDeps([11,8,10,4,9,12,6,13]))).default,{fromLonLat:I,toLonLat:P}=await Nn(async()=>{const{fromLonLat:ee,toLonLat:L}=await import("./proj-DaVmBXpc.js").then($=>$.C);return{fromLonLat:ee,toLonLat:L}},__vite__mapDeps([9,8,10])),{Fill:T,Stroke:O,Style:G}=await Nn(async()=>{const{Fill:ee,Stroke:L,Style:$}=await import("./style-qTuj3e24.js").then(F=>F.s);return{Fill:ee,Stroke:L,Style:$}},__vite__mapDeps([40,35,18,36,24,19,10,17,4,37,38,6])),M=(await Nn(async()=>{const{default:ee}=await import("./Circle-CvYakwZ-.js").then(L=>L.w);return{default:ee}},__vite__mapDeps([35,18,36,24,19,10,17,4,37,38]))).default,{GeocodingControl:U}=await Nn(async()=>{const{GeocodingControl:ee}=await import("./openlayers-CQpjlEde.js");return{GeocodingControl:ee}},__vite__mapDeps([59,4,30,31,6,10,9,8,23,7,11,12,13,14,15,16,26,32,24,19,33,34,35,18,36,17,37,38,29,39,40,41,42,43,3,28,44,48,46,5,60,27]));if(g||!n.current)return;
524const V=new j,H=new C({source:V,style:new G({image:new M({radius:7,fill:new T({color:"rgba(220, 38, 38, 0.9)"}),stroke:new O({color:"white",width:2})})})}),Y=new x.Map({target:n.current,layers:[new S({source:new k}),H],view:new w({center:I([7.85,48]),zoom:4,maxZoom:18})}),B=(ee,L)=>{V.clear();const $=new R({geometry:new A(I([ee,L]))});V.addFeature($)};s.current=B,i.current&&B(i.current.lon,i.current.lat);const z="pApwrARQQsVkSFNnJiYQ";{const ee=new U({apiKey:z,placeholder:"Search address, municipality, or coordinates",markerOnSelected:!1,clearListOnPick:!0,debounceSearch:250,minLength:2});ee.on("select",L=>{var ue,re;const $=(ue=L.feature)==null?void 0:ue.center;if(!$||$.length<2)return;const F=Number($[0]),te=Number($[1]);!Number.isFinite(te)||!Number.isFinite(F)||(e({lat:Number(te.toFixed(6)),lon:Number(F.toFixed(6)),source:"geocoder",rawQuery:((re=L.feature)==null?void 0:re.place_name)||void 0}),B(F,te))}),Y.addControl(ee)}return Y.on("singleclick",ee=>{const L=ee,[$,F]=P(L.coordinate);e({lat:Number(F.toFixed(6)),lon:Number($.toFixed(6)),source:"map_click"}),B($,F)}),()=>{s.current=null,Y.setTarget(void 0)}})().then(x=>{if(g){x==null||x();return}v=x}),()=>{g=!0,v&&v()}},[e]),K.useEffect(()=>{t&&s.current&&s.current(t.lon,t.lat)},[t]),K.useEffect(()=>{t&&(l(String(t.lat)),h(String(t.lon)))},[t]),K.useEffect(()=>{const g=lle(a,u);if(g.status==="empty"||g.status==="incomplete"){f(null);return}if(g.status!=="valid"){f("Enter a latitude from -90 to 90 and longitude from -180 to 180.");return}const v=g.roundedLat,_=g.roundedLon,x=window.setTimeout(()=>{var S;f(null);const w=i.current;w&&w.lat===v&&w.lon===_&&w.source==="manual_coords"||(e({lat:v,lon:_,source:"manual_coords",rawQuery:`${v}, ${_}`}),(S=s.current)==null||S.call(s,_,v))},350);return()=>window.clearTimeout(x)},[a,u,e]),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(Bs,{children:[o.jsx($9,{className:"h-4 w-4"}),o.jsx(ha,{children:"CRS missing: select approximate location"}),o.jsx(fi,{children:"Use the map search bar (e.g., Freiburg im Breisgau or 47.996090, 7.849400) or click on the map to place a rough location."})]}),o.jsx("div",{ref:n,className:ke("approx-location-map relative h-56 w-full rounded-md border bg-gray-50",r&&"border-red-800/60")}),o.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[o.jsx(Nt,{type:"number",inputMode:"decimal",step:"any",min:-90,max:90,value:a,onChange:g=>l(g.target.value),placeholder:"Latitude","aria-label":"Approximate latitude","aria-invalid":r,className:"aria-invalid:border-red-800/60 aria-invalid:ring-red-900/10"}),o.jsx(Nt,{type:"number",inputMode:"decimal",step:"any",min:-180,max:180,value:u,onChange:g=>h(g.target.value),placeholder:"Longitude","aria-label":"Approximate longitude","aria-invalid":r,className:"aria-invalid:border-red-800/60 aria-invalid:ring-red-900/10"})]}),p&&o.jsx("p",{className:"text-xs text-destructive",children:p}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-sm text-gray-600",children:"Selected"}),o.jsx(_n,{variant:"secondary",className:"text-sm font-medium px-2.5 py-1",children:t?`${t.lat.toFixed(6)}, ${t.lon.toFixed(6)}`:"-"})]})]})}const Nbe=[{value:"<1m",label:"<1m"},{value:"<10m",label:"<10m"},{value:">10m",label:">10m"},{value:"local",label:"Local coordinate system"}];function Pbe({control:t,className:e}){const{setValue:r}=Fw(),n=pa({control:t,name:"coordinateAccuracy"}),s=pa({control:t,name:"requiresApproxLocation"});return K.useEffect(()=>{s&&n!=="local"&&r("coordinateAccuracy","local",{shouldValidate:!0})},[n,s,r]),o.jsxs("div",{className:`space-y-4 ${e||""}`,children:[o.jsx(ui,{control:t,name:"coordinateAccuracy",render:({field:i,fieldState:a})=>o.jsxs(Ls,{children:[o.jsx(ft,{className:"text-sm font-medium",children:"Coordinate Accuracy *"}),o.jsx(Di,{children:o.jsx(Ebe,{value:i.value??"",onValueChange:i.onChange,className:"grid grid-cols-2 gap-4",children:Nbe.map(l=>o.jsxs("div",{className:"flex items-start space-x-3",children:[o.jsx(jbe,{value:l.value,id:l.value,"aria-invalid":a.invalid,className:"mt-1 aria-invalid:border-red-800/60 aria-invalid:ring-red-900/10",disabled:s&&l.value!=="local"}),o.jsx(ft,{htmlFor:l.value,className:"text-sm font-medium cursor-pointer",children:l.label})]},l.value))})}),o.jsx(Pd,{className:"text-red-800"})]})}),n==="local"&&o.jsx(ui,{control:t,name:"approxLocation",render:({field:i,fieldState:a})=>o.jsxs(Ls,{children:[o.jsx(Cbe,{value:i.value,onChange:i.onChange,invali
524d:a.invalid}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["This is an approximate placement used for map visualization (examples: ",o.jsx("span",{className:"font-mono",children:"47.996090, 7.849400"})," or ",o.jsx("span",{className:"font-mono",children:"Freiburg im Breisgau"}),")."]}),o.jsx(Pd,{className:"text-red-800"})]})})]})}function Rbe({control:t}){const e=pa({control:t,name:"visibility"});return o.jsx(ui,{control:t,name:"hideLocation",render:({field:r})=>{const n=r.value===!0;return o.jsx(Ls,{className:"rounded-md border p-3",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Di,{children:o.jsx(ya,{id:"hide-location",checked:n,onCheckedChange:s=>r.onChange(s===!0),className:"mt-0.5"})}),o.jsxs("div",{className:"min-w-0 space-y-1",children:[o.jsx(ft,{htmlFor:"hide-location",className:"cursor-pointer text-sm font-medium",children:"Hide location"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"People without access see that the location is hidden: no map, footprint or coordinates on the dataset page, the map or in the 3D viewer. You and people you give access still see the exact location."}),n&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"Viewer files of older datasets can still contain the real coordinates."}),n&&e==="public"&&o.jsx("p",{className:"text-xs text-amber-700","data-testid":"hide-location-public-warning",children:"Public datasets can be downloaded by any signed-in user, and the downloaded point files contain the real coordinates. Choose View only to limit downloads to people you give access."})]})]})})}})}function sB({control:t,canEditHideLocation:e=!0}){return o.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[o.jsxs("div",{className:"col-span-1",children:[o.jsx("h3",{className:"font-medium text-gray-900",children:"Location"}),o.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Specify the coordinate accuracy of your dataset and who sees its exact location."})]}),o.jsxs("div",{className:"col-span-2 space-y-4",children:[o.jsx(Pbe,{control:t}),e&&o.jsx(Rbe,{control:t})]})]})}function iB({control:t,titlePlaceholder:e,canEditVisibility:r=!0}){const n=pa({control:t,name:"pointCloudFile"}),s=Array.isArray(n)&&n.length>1;return o.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[o.jsxs("div",{className:"col-span-1",children:[o.jsx("h3",{className:"font-medium text-gray-900",children:"Description"}),o.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Provide context about your research project."})]}),o.jsxs("div",{className:"col-span-2 space-y-6",children:[o.jsx(ui,{control:t,name:"title",render:({field:i})=>o.jsxs(Ls,{children:[o.jsxs(Io,{className:"data-[error=true]:text-foreground",children:["Title ",s?"*":"(optional)"]}),o.jsx(Di,{children:o.jsx(Nt,{...i,placeholder:s?"Enter a descriptive name for this dataset":`Defaults to ${e} (title will be public)`,className:"aria-invalid:border-red-800/60 aria-invalid:ring-red-900/10"})}),o.jsx(Pd,{className:"text-red-800"})]})}),o.jsx(ui,{control:t,name:"description",render:({field:i})=>o.jsxs(Ls,{children:[o.jsx(Io,{children:"Project Description (optional)"}),o.jsx(Di,{children:o.jsx(Jl,{...i,placeholder:"e.g., Forest inventory data for biodiversity assessment in temperate mixed forest.",rows:3})})]})}),r&&o.jsx(ui,{control:t,name:"visibility",render:({field:i})=>o.jsxs(Ls,{children:[o.jsx(Io,{className:"data-[error=true]:text-foreground",children:"Visibility *"}),o.jsxs(Bf,{value:i.value,onValueChange:i.onChange,children:[o.jsx(Di,{children:o.jsx(Hf,{className:"w-full aria-invalid:border-red-800/60 aria-invalid:ring-red-900/10",children:o.jsx(Vf,{placeholder:"Select visibility"})})}),o.jsxs(qf,{children:[o.jsx(Ul,{value:"public",children:"Public - visible and downloadable by everyone"}),o.jsx(Ul,{value:"view_only",children:"View only - visible to everyone, downloads limited to owner"}),o.jsx(Ul,{value:"private",children:"Private - only owner can view and download"})]})]}),o.jsx(Pd,{className:"text-red-800"})]})})]})]})}function aB({control:t,licenses:e,onLicenseChange:r}){return o.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[o.jsxs("div",{className:"col-span-1",children:[o.jsx("h3",{className:"font-medium text-gray-900",children:"License"}),o.jsxs("p",{className:"text-sm text-gray-600 mt-1",children:["3Dtrees.earth promotes open, FAIR data, so every dataset requires a license."," ",o.jsx("strong",{children:"Choosing a license does not make a private dataset accessible to other users."})]})]}),o.jsxs("div",{className:"col-span-2 space-y-6",children:[o.jsx(ui,{control:t,name:"licenseId",render:({field:n})=>o.jsxs(Ls,{children:[o.jsx(Io,{className:"data-[error=true]:text-foreground",children:"License Type *"}),o.jsxs(Bf,{value:n.value!=null?String(n.value):void 0,onValueChange:s=>{const i=Number(s);i!==n.value&&(r==null||r(i)),n.onChange(i)},children:[o.jsx(Di,{children:o.jsx(Hf,{className:"w-full aria-invalid:border-red-800/60 aria-invalid:ring-red-900/10",children:o.jsx(Vf,{placeholder:"Select a license"})})}),o.jsx(qf,{children:e.map(s=>o.jsx(Ul,{value:String(s.id),children:s.name},s.id))})]}),o.jsxs(dme,{children:["Point clouds default to CC BY 4.0 unless you select another license. Need another license type?"," ",o.jsx("a",{href:"mailto:[email protected]",className:"text-blue-600 hover:text-blue-800 hover:underline",children:"Contact us"}),"."]}),o.jsx(Pd,{className:"text-red-800"})]})}),o.jsx(ui,{control:t,name:"rightsWarranty",render:({field:n})=>o.jsxs(Ls,{className:"flex flex-row items-start gap-2 space-y-0",children:[o.jsx(Di,{children:o.jsx(ya,{className:"aria-invalid:border-red-800/60 aria-invalid:ring-red-900/10",checked:n.value===!0,onCheckedChange:s=>n.onChange(s===!0)})}),o.jsxs("div",{className:"space-y-1 leading-none",children:[o.jsx(Io,{className:"data-[error=true]:text-foreground",children:"I confirm I hold the rights to license this dataset under the selected license. *"}),o.jsx(Pd,{className:"text-red-800"})]})]})})]})]})}async function Abe(){const{data:t,error:e}=await Ye.from("licenses").select("id, spdx_id, name, is_default").eq("is_active",!0).order("sort_order",{ascending:!0}).order("name",{ascending:!0});if(e)throw e;return(t??[]).map(n=>({id:n.id,spdxId:n.spdx_id,name:n.name,isDefault:n.is_default}))}const oB=()=>({queryKey:["licenses","catalog"],queryFn:Abe,staleTime:3600*1e3});class I2{static async verifyAndLinkOrcid(e,r){const n=Kg(r);if(!n.isValid)throw new Error(n.error||"Invalid ORCID format");const s=await this.fetchOrcidData(n.cleanORCID),{error:i}=await Ye.auth.updateUser({data:{orcid:n.cleanORCID,orcid_verified:!0,orcid_name:`${s.firstName} ${s.lastName}`}});if(i)throw new Error("Failed to update user profile with ORCID");return s}static async fetchOrcidData(e){var u,h,p,f,g,v,_,x,w;const r=await fetch(`https://pub.orcid.org/v3.0/${e}`,{headers:{Accept:"application/json"}});if(!r.ok)throw r.status===404?new Error("ORCID iD not found. Please verify the ORCID iD is correct."):r.status===429?new Error("Too many requests. Please wait a moment and try again."):new Error(`Failed to fetch ORCID information (Error ${r.status}). Please try again.`);const n=await r.json(),s=((p=(h=(u=n.person)==null?void 0:u.name)==null?void 0:h["given-names"])==null?void 0:p.value)||"",i=((v=(g=(f=n.person)==null?void 0:f.name)==null?void 0:g["fam
524ily-name"])==null?void 0:v.value)||"";let a="";const l=((x=(_=n["activities-summary"])==null?void 0:_.employments)==null?void 0:x["affiliation-group"])||[];if(l.length>0&&((w=l[0].summaries)==null?void 0:w.length)>0){const S=l[0].summaries[0]["employment-summary"];S&&S.organization&&(a=S.organization.name||"")}return{firstName:s,lastName:i,organisation:a,orcidId:e}}static getUserAsContributor(e){if(!e)return{first_name:"",last_name:"",organisation:"",orcid:""};const r=e.user_metadata||{};return{first_name:r.first_name||"",last_name:r.last_name||"",organisation:r.affiliation||"",orcid:r.orcid||""}}static hasCompleteProfile(e){if(!e)return!1;const r=e.user_metadata||{};return!!(r.first_name&&r.last_name&&r.orcid)}}function lB({control:t}){const{errors:e}=nN({control:t,name:"authors"}),r=e.authors,{fields:n,append:s,remove:i,move:a}=$3({control:t,name:"authors"}),{user:l}=Ql(),[u,h]=K.useState(""),[p,f]=K.useState(!1),[g,v]=K.useState(null),_=async()=>{var C,R,A,I,P,T,O,G,M;if(u){v(null),f(!0);try{const U=Kg(u);if(!U.isValid){v(U.error||"Invalid ORCID format");return}const V=U.cleanORCID,H=await fetch(`https://pub.orcid.org/v3.0/${V}`,{headers:{Accept:"application/json"}});if(!H.ok){H.status===404?v("ORCID iD not found. Please verify the ORCID iD is correct."):H.status===429?v("Too many requests. Please wait a moment and try again."):v(`Failed to fetch ORCID information (Error ${H.status}). Please try again or add manually.`);return}const Y=await H.json(),B=((A=(R=(C=Y.person)==null?void 0:C.name)==null?void 0:R["given-names"])==null?void 0:A.value)||"",z=((T=(P=(I=Y.person)==null?void 0:I.name)==null?void 0:P["family-name"])==null?void 0:T.value)||"";let ee="";const L=((G=(O=Y["activities-summary"])==null?void 0:O.employments)==null?void 0:G["affiliation-group"])||[];if(L.length>0&&((M=L[0].summaries)==null?void 0:M.length)>0){const F=L[0].summaries[0]["employment-summary"];F&&F.organization&&(ee=F.organization.name||"")}s({first_name:B,last_name:z,organisation:ee||void 0,orcid:V}),h(""),v(null)}catch(U){console.error("Error fetching ORCID data:",U),v("Network error. Please check your connection and try again.")}finally{f(!1)}}},x=()=>{s({first_name:"",last_name:"",organisation:"",orcid:""})},w=()=>{const C=I2.getUserAsContributor(l);s(C)},S=I2.hasCompleteProfile(l),k=C=>(C||"").trim().replace(/^https?:\/\/orcid\.org\//i,"").toUpperCase(),j=K.useMemo(()=>{var R;const C=k((R=l==null?void 0:l.user_metadata)==null?void 0:R.orcid);return C?n.some(A=>k(A.orcid)===C):!1},[n,l]);return o.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[o.jsxs("div",{className:"col-span-1",children:[o.jsx("h3",{className:"font-medium text-gray-900",children:"Contributors"}),o.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Add dataset contributors. Use ORCID lookup or add manually."})]}),o.jsxs("div",{className:"col-span-2 space-y-4",children:[o.jsxs("div",{className:"space-y-4",children:[o.jsx(ft,{children:"Contributors *"}),S&&!j&&o.jsx("div",{className:"border rounded-lg p-4 bg-blue-50/50 border-blue-200",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex-shrink-0",children:o.jsx("div",{className:"w-10 h-10 bg-blue-100 rounded-full flex items-center justify-center",children:o.jsx(gC,{className:"h-5 w-5 text-blue-600"})})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("h4",{className:"font-medium text-sm",children:"Add yourself as contributor"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Use your profile information"})]}),o.jsx(we,{type:"button",onClick:w,variant:"outline",size:"sm",className:"border-blue-300 text-blue-700 hover:bg-blue-100",children:"Add Me"})]})}),o.jsx("div",{className:ke("border rounded-lg p-4",r&&n.length===0&&"border-red-800/60"),children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex-shrink-0",children:o.jsx("div",{className:"w-10 h-10 bg-gray-100 rounded-full flex items-center justify-center",children:o.jsx("span",{className:"text-lg font-medium text-gray-600",children:"+"})})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("h4",{className:"font-medium text-sm",children:"Add Contributor"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Search by ORCID or add manually"})]})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Nt,{placeholder:"Enter ORCID ID or URL",value:u,onChange:C=>{h(C.target.value),g&&v(null)},className:"flex-1"}),o.jsx(we,{type:"button",onClick:_,disabled:!u||p,size:"sm",variant:"outline",children:p?"Searching...":"Search"}),o.jsx(we,{type:"button",onClick:x,variant:"outline",size:"sm",children:"Manual"})]}),g&&o.jsx("p",{className:"text-sm text-red-600 mt-2",children:g}),n.length===0&&r&&o.jsx("p",{className:"text-sm text-red-800",children:String(r.message||"At least one contributor is required")})]})})]}),n.length>0&&o.jsx("div",{className:"space-y-2",children:n.map((C,R)=>{const A=r==null?void 0:r[R];return o.jsxs("div",{className:ke("border rounded-lg p-3 bg-gray-50",A&&"border-red-800/60"),children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"text-xs font-medium text-gray-600",children:["Author ",R+1]}),C.orcid&&o.jsx("a",{href:`https://orcid.org/${C.orcid}`,target:"_blank",rel:"noopener noreferrer",className:"text-xs bg-green-100 text-green-800 px-1.5 py-0.5 rounded text-[10px]",children:C.orcid})]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx(we,{type:"button",variant:"ghost",size:"sm",onClick:()=>a(R,R-1),disabled:R===0,className:"h-5 w-5 p-0 text-gray-400 hover:text-gray-600",title:"Move up",children:"↑"}),o.jsx(we,{type:"button",variant:"ghost",size:"sm",onClick:()=>a(R,R+1),disabled:R===n.length-1,className:"h-5 w-5 p-0 text-gray-400 hover:text-gray-600",title:"Move down",children:"↓"}),o.jsx(we,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(R),className:"text-red-400 hover:text-red-600 h-5 w-5 p-0",title:"Remove",children:"×"})]})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[o.jsx(Ti,{control:t,name:`authors.${R}.first_name`,render:({field:I,fieldState:P})=>
524o.jsx(Nt,{...I,"aria-invalid":P.invalid,placeholder:"First Name",className:"text-sm bg-white aria-invalid:border-red-800/60 aria-invalid:ring-red-900/10"})}),o.jsx(Ti,{control:t,name:`authors.${R}.last_name`,render:({field:I,fieldState:P})=>o.jsx(Nt,{...I,"aria-invalid":P.invalid,placeholder:"Last Name",className:"text-sm bg-white aria-invalid:border-red-800/60 aria-invalid:ring-red-900/10"})}),o.jsx(Ti,{control:t,name:`authors.${R}.organisation`,render:({field:I})=>o.jsx(Nt,{...I,placeholder:"Organisation",className:"text-sm bg-white"})})]})]},C.id)})})]})]})}function cB({control:t}){const{fields:e,append:r,remove:n}=$3({control:t,name:"fundingReferences"}),s=()=>{r({funderName:"",funderIdentifier:"",awardNumber:"",awardTitle:""})};return o.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[o.jsxs("div",{className:"col-span-1",children:[o.jsx("h3",{className:"font-medium text-gray-900",children:"Funding"}),o.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Add funding sources, grants, or institutional support for this research."})]}),o.jsxs("div",{className:"col-span-2 space-y-4",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Funding Sources (optional)"}),o.jsx(we,{type:"button",onClick:s,variant:"outline",size:"sm",children:"+ Add Funding"})]}),e.length>0&&o.jsx("div",{className:"space-y-6",children:e.map((i,a)=>o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsxs("span",{className:"text-sm font-medium text-gray-700",children:["Funding Source ",a+1]}),o.jsx(we,{type:"button",onClick:()=>n(a),variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-gray-400 hover:text-red-500",children:o.jsx(cu,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(ui,{control:t,name:`fundingReferences.${a}.funderName`,render:({field:l})=>o.jsxs(Ls,{children:[o.jsx(Io,{children:"Funder Name *"}),o.jsx(Di,{children:o.jsx(Nt,{...l,placeholder:"e.g., National Science Foundation"})})]})}),o.jsx(ui,{control:t,name:`fundingReferences.${a}.funderIdentifier`,render:({field:l})=>o.jsxs(Ls,{children:[o.jsx(Io,{children:"Funder Identifier"}),o.jsx(Di,{children:o.jsx(Nt,{...l,placeholder:"e.g., https://ror.org/021nxhr62"})})]})}),o.jsx(ui,{control:t,name:`fundingReferences.${a}.awardNumber`,render:({field:l})=>o.jsxs(Ls,{children:[o.jsx(Io,{children:"Award Number"}),o.jsx(Di,{children:o.jsx(Nt,{...l,placeholder:"e.g., DEB-1234567"})})]})}),o.jsx(ui,{control:t,name:`fundingReferences.${a}.awardTitle`,render:({field:l})=>o.jsxs(Ls,{children:[o.jsx(Io,{children:"Award Title"}),o.jsx(Di,{children:o.jsx(Nt,{...l,placeholder:"e.g., Forest Dynamics Research Project"})})]})})]})]},i.id))})]})]})}const D2={title:!1,description:!1,authors:!1,fundingReferences:!1};function Mj({control:t,metadataLookup:e,variant:r=e?"lookup":"manual"}){const n=pa({control:t,name:"doi"}),s=K.useRef(0),[i,a]=K.useState(!1),[l,u]=K.useState(null),[h,p]=K.useState(null),[f,g]=K.useState(D2),[v,_]=K.useState(null),x=wd(n),w=h&&ck(x,h.metadata.doi)?h:null,S=v&&ck(x,v.doi)?v:null,k=r==="lookup"&&e,j=k?"Autofill metadata":"DOI",C=k?"Start with a dataset or publication DOI to import reusable metadata before choosing a template or filling fields manually.":"Link to a published paper or dataset DOI associated with this data.",R=k?"Dataset or publication DOI":"DOI or URL (optional)",A="e.g., 10.5281/zenodo.20069134 or https://doi.org/10.5281/zenodo.20069134",I=M=>!M||!M.trim()?!0:qg(M).isValid||"Please enter a valid DOI",P=async()=>{if(!e)return;const M=wd(n);if(!M){u("Enter a valid DOI before fetching metadata."),p(null),_(null);return}const U=s.current+1;s.current=U,a(!0),u(null),p(null),_(null);try{e.setValue("doi",M,{shouldDirty:!0,shouldValidate:!0});const V=await Tde(M),H=Mde(V,e.getValues()),Y=!!(H.title||H.description||H.authors.length>0||H.fundingReferences.length>0);if(s.current!==U||!ck(wd(e.getValues("doi")),M))return;if(!Y){u("Metadata was found, but it did not contain fields that can be applied to this upload form.");return}p(H),g(H.defaultSelected)}catch(V){if(s.current!==U)return;u(V instanceof Error?V.message:"Could not fetch DOI metadata.")}finally{s.current===U&&a(!1)}},T=()=>{if(!e||!w)return;const M=Dbe(f,w),U=Lde(e.getValues(),w,f);U.title!==void 0&&e.setValue("title",U.title,{shouldDirty:!0,shouldValidate:!0}),U.description!==void 0&&e.setValue("description",U.description,{shouldDirty:!0,shouldValidate:!0}),U.authors!==void 0&&e.setValue("authors",U.authors,{shouldDirty:!0,shouldValidate:!0}),U.fundingReferences!==void 0&&e.setValue("fundingReferences",U.fundingReferences,{shouldDirty:!0,shouldValidate:!0}),p(null),g(D2),u(null),_({doi:w.metadata.doi,sourceAgency:w.metadata.sourceAgency,fields:M})},O=(M,U)=>{g(V=>({...V,[M]:U}))}
524,G=w?Object.values(f).filter(Boolean).length:0;return o.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[o.jsxs("div",{className:"col-span-1",children:[o.jsx("h3",{className:"font-medium text-gray-900",children:j}),o.jsx("p",{className:"text-sm text-gray-600 mt-1",children:C})]}),o.jsxs("div",{className:"col-span-2 space-y-3",children:[k?o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{className:"text-sm font-medium",children:R}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Nt,{value:n??"",onChange:M=>e.setValue("doi",M.target.value,{shouldDirty:!0,shouldValidate:!0}),placeholder:A}),o.jsxs(we,{type:"button",variant:"outline",onClick:()=>void P(),disabled:!x||i,children:[i?o.jsx(Y9,{className:"h-4 w-4 animate-spin"}):o.jsx(EL,{className:"h-4 w-4"}),i?"Fetching":"Fetch metadata"]})]})]}):o.jsx(ui,{control:t,name:"doi",rules:{validate:I},render:({field:M,fieldState:U})=>o.jsxs(Ls,{children:[o.jsx(Io,{className:"text-sm font-medium",children:R}),o.jsx(Di,{children:o.jsx(Nt,{...M,placeholder:A,className:U.error?"border-red-500":""})}),o.jsx(Pd,{})]})}),e&&l&&o.jsx("p",{className:"text-sm text-red-600",children:l}),e&&S&&o.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-green-200 bg-green-50 p-3 text-sm text-green-800",children:[o.jsx(Vl,{className:"mt-0.5 h-4 w-4 shrink-0"}),o.jsxs("div",{children:[o.jsxs("p",{className:"font-medium",children:["Metadata applied from ",S.sourceAgency,"."]}),S.fields.length>0&&o.jsxs("p",{className:"text-green-700",children:["Applied ",Obe(S.fields),"."]})]})]}),e&&w&&o.jsxs("div",{className:"space-y-3 rounded-md border bg-gray-50 p-3",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(_n,{variant:"outline",children:w.metadata.sourceAgency}),w.metadata.resourceType&&o.jsx(_n,{variant:"secondary",children:w.metadata.resourceType}),w.metadata.publicationYear&&o.jsx("span",{className:"text-xs text-muted-foreground",children:w.metadata.publicationYear}),w.metadata.publisher&&o.jsx("span",{className:"text-xs text-muted-foreground",children:w.metadata.publisher})]}),o.jsxs("div",{className:"space-y-2",children:[w.title&&o.jsx(Zy,{id:"doi-title-suggestion",checked:f.title,onCheckedChange:M=>O("title",M),label:"Title",value:w.title,note:w.metadata.resourceKind==="dataset"?void 0:"Publication titles require explicit confirmation."}),w.description&&o.jsx(Zy,{id:"doi-description-suggestion",checked:f.description,onCheckedChange:M=>O("description",M),label:"Description",value:w.description}),w.authors.length>0&&o.jsx(Zy,{id:"doi-authors-suggestion",checked:f.authors,onCheckedChange:M=>O("authors",M),label:`Contributors (${w.authors.length})`,value:Tbe(w.authors)}),w.fundingReferences.length>0&&o.jsx(Zy,{id:"doi-funding-suggestion",checked:f.fundingReferences,onCheckedChange:M=>O("fundingReferences",M),label:`Funding (${w.fundingReferences.length})`,value:Ibe(w.fundingReferences)})]}),o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Checked fields will be applied. Existing contributors and funding are extended, not replaced."}),o.jsxs(we,{type:"button",size:"sm",onClick:T,disabled:G===0,children:[o.jsx(Vl,{className:"h-4 w-4"}),"Apply selected"]})]})]})]})]})}function Zy({id:t,checked:e,onCheckedChange:r,label:n,value:s,note:i}){return o.jsxs("div",{className:"flex items-start gap-3 rounded-md bg-white p-2",children:[o.jsx(ya,{id:t,checked:e,onCheckedChange:a=>r(a===!0),className:"mt-0.5"}),o.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[o.jsx(ft,{htmlFor:t,className:"text-sm font-medium",children:n}),o.jsx("p",{className:"line-clamp-2 text-sm text-gray-700",children:s}),i&&o.jsx("p",{className:"text-xs text-muted-foreground",children:i})]})]})}function Tbe(t){const e=t.map(r=>`${r.first_name} ${r.last_name}`.trim()).filter(Boolean);return uB(e)}function Ibe(t){return uB(t.map(e=>e.funderName).filter(Boolean))}function uB(t){const e=t.slice(0,2).join(", "),r=t.length-2;return r>0?`${e} and ${r} more`:e}function ck(t,e){const r=wd(t),n=wd(e);return!!(r&&n&&r.toLowerCase()===n.toLowerCase())}function Dbe(t,e){return[t.title&&e.title?"title":null,t.description&&e.description?"de
524scription":null,t.authors&&e.authors.length>0?"contributors":null,t.fundingReferences&&e.fundingReferences.length>0?"funding":null].filter(r=>!!r)}function Obe(t){return t.length<=1?t[0]??"selected fields":t.length===2?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(", ")}, and ${t[t.length-1]}`}function Mbe({control:t}){const[e,r]=K.useState(0);return o.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[o.jsxs("div",{className:"col-span-1",children:[o.jsx("h3",{className:"font-medium text-gray-900",children:"Supplementary Data"}),o.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Optionally attach one ZIP archive with additional data such as CSV tables, trajectories, GIS files, documentation, or scripts."})]}),o.jsxs("div",{className:"col-span-2 space-y-4",children:[o.jsx(Ti,{control:t,name:"supplementaryFile",render:({field:n,fieldState:s})=>{var i;return o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"supplementaryFile",children:"Supplementary ZIP"}),o.jsx(Nt,{id:"supplementaryFile",type:"file",accept:".zip,application/zip,application/x-zip-compressed",onChange:a=>{var l;return n.onChange((l=a.target.files)==null?void 0:l[0])}},e),n.value instanceof File&&o.jsxs(Bs,{className:"ph-mask",children:[o.jsx(Yb,{className:"h-4 w-4"}),o.jsxs(ha,{className:"flex items-center justify-between gap-2 text-sm",children:[o.jsx("span",{className:"truncate",children:n.value.name}),o.jsxs(we,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{n.onChange(void 0),r(a=>a+1)},"aria-label":"Remove selected supplementary ZIP",children:[o.jsx(cu,{className:"mr-1 h-3.5 w-3.5"}),"Remove"]})]}),o.jsxs(fi,{className:"text-xs",children:["Size: ",xd(n.value.size)]})]}),((i=s.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:s.error.message}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"ZIP only, maximum 1 GB. File names and extensions inside the ZIP are recorded for display and monitoring."})]})}}),o.jsx(Ti,{control:t,name:"supplementaryDescription",render:({field:n})=>o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"supplementaryDescription",children:"Supplementary description"}),o.jsx(Jl,{id:"supplementaryDescription",value:n.value||"",onChange:n.onChange,placeholder:"Describe what is included in the supplementary ZIP",rows:3})]})})]})]})}const O2=[{key:"pointCloudFile",label:"Point cloud file",sectionId:"upload-section-file"},{key:"labelMappingsText",label:"Label mappings",sectionId:"upload-section-file"},{key:"acquisitionDate",label:"Acquisition date",sectionId:"upload-section-technical"},{key:"platform",label:"Platform",sectionId:"upload-section-technical"},{key:"coordinateAccuracy",label:"Coordinate accuracy",sectionId:"upload-section-location"},{key:"approxLocation",label:"Approximate location",sectionId:"upload-section-location"},{key:"authors",label:"Contributors",sectionId:"upload-section-contributors"},{key:"title",label:"Title",sectionId:"upload-section-description"},{key:"visibility",label:"Visibility",sectionId:"upload-section-description"},{key:"licenseId",label:"License",sectionId:"upload-section-license"},{key:"rightsWarranty",label:"Rights confirmation",sectionId:"upload-section-license"},{key:"doi",label:"DOI",sectionId:"upload-section-doi"},{key:"fundingReferences",label:"Funding",sectionId:"upload-section-funding"}];function dB(t,e){if(!t||typeof t!="object")return e;const r=t;if("message"in r||"type"in r)return e;for(const[n,s]of Object.entries(r))if(n!=="ref"&&n!=="types"&&s)return dB(s,`${e}.${n}`);return e}const Gu="__new__",Nc="__new_template__",Lbe=500;function Fbe(t){return(Array.isArray(t)?t:t?[t]:[]).map(r=>r.name).filter(Boolean)}function $be(t,e,r){var s;const n=Fbe(t.pointCloudFile);return{title:((s=t.title)==null?void 0:s.trim())||n[0]||"Untitled upload",fileNames:n,collectionLabel:e,datasetId:r}}function zbe(t){const e=t.slice(0,3),r=t.length-e.length;return r>0?`${e.join(", ")} +${r} more`:e.join(", ")}function M2(t){const e={sensor:"",scanPattern:"",coordinateReference:"",visibility:"public",hideL
524ocation:!1,rightsWarranty:!1,requiresApproxLocation:!1,pointAttributesDescription:"",preprocessingSteps:[],authors:[],description:"",doi:"",title:"",fundingReferences:[],fundingAcknowledgment:"",supplementaryDescription:""};return t!=null&&(e.licenseId=t),e}function Ube({open:t,onOpenChange:e,onUploadComplete:r}){var Oe;const n=lu(),{user:s,loading:i}=Ql(),[a,l]=K.useState(!1),[u,h]=K.useState(null),[p,f]=K.useState(!1),[g,v]=K.useState(null),[_,x]=K.useState(!1),[w,S]=K.useState(null),[k,j]=K.useState(!1),[C,R]=K.useState("none"),[A,I]=K.useState(""),[P,T]=K.useState(""),[O,G]=K.useState(!1),[M,U]=K.useState(!1),[V,H]=K.useState("none"),[Y,B]=K.useState(""),[z,ee]=K.useState("none"),L=K.useRef(!1),$=K.useRef(!1),F=K.useRef(null),te=K.useRef(t),ue=K.useRef([]);K.useEffect(()=>{te.current=t},[t]),K.useEffect(()=>{t&&F.current===null?(F.current=j_(),Fm.interfaceOpened("account")):t||(F.current=null)},[t]);const{setUploadProgress:re,removeUploadProgress:se}=t1(),ye=fr({queryKey:[...Ht.collections.mine(t?(s==null?void 0:s.id)??null:null),"upload-picker"],enabled:t&&!i,queryFn:async()=>Ba.listAllCollections()}),de=K.useMemo(()=>{if(C==="none")return"No collection";if(C===Gu)return"Create new collection...";const ae=(ye.data??[]).find(Ge=>String(Ge.id)===C);return(ae==null?void 0:ae.name)??"Select collection"},[ye.data,C]),pe=fr({queryKey:Ht.uploadTemplates.mine(t?"upload-modal":null),enabled:t,queryFn:async()=>{const ae=await Rs.listUploadTemplates(Lbe);if(!ae.success)throw new Error(ae.error||"Failed to list upload templates");return ae.data??[]}}),Ie=K.useMemo(()=>{if(V==="none")return"No template";if(V===Nc)return"Create new template...";const ae=(pe.data??[]).find(Ge=>String(Ge.id)===V);return(ae==null?void 0:ae.name)??"Select template"},[V,pe.data]),Ne=K.useMemo(()=>V==="none"||V===Nc?void 0:(pe.data??[]).find(ae=>String(ae.id)===V),[V,pe.data]),He=K.useMemo(()=>Mb((Ne==null?void 0:Ne.defaults_jsonb)??{}),[Ne]),We=K.useMemo(()=>[{value:"none",label:"No template",group:"options"},...(pe.data??[]).map(ae=>({value:String(ae.id),label:ae.name,searchText:ae.name,group:"options"})),{value:Nc,label:"Create new template...",group:"actions",icon:o.jsx(Zc,{className:"mr-2 h-4 w-4"})}],[pe.data]),at=K.useMemo(()=>[{value:"none",label:"No collection",group:"options"},...(ye.data??[]).map(ae=>({value:String(ae.id),label:ae.name,searchText:`${ae.name} ${ae.description??""}`,group:"options"})),{value:Gu,label:"Create new collection...",group:"actions",icon:o.jsx(Zc,{className:"mr-2 h-4 w-4"})}],[ye.data]),Xt=fr(oB()),Rt=K.useMemo(()=>Xt.data??[],[Xt.data]),Ee=K.useMemo(()=>{var ae,Ge;return((ae=Rt.find(Ft=>Ft.isDefault))==null?void 0:ae.id)??((Ge=Rt[0])==null?void 0:Ge.id)},[Rt]),Et=Y3({resolver:Z3(Lge),mode:"onSubmit",defaultValues:M2(Ee)}),{handleSubmit:Mt,reset:ot,control:De,setFocus:St,getValues:jt}=Et;K.useEffect(()=>{Ee!=null&&Et.getValues("licenseId")==null&&Et.setValue("licenseId",Ee)},[Ee,Et]);const Cr=pa({control:De}),Or=K.useMemo(()=>C==="none"||C===Gu?null:Number(C),[C]),Nr=K.useMemo(()=>_2(Cr,Or),[Or,Cr]),rr=K.useMemo(()=>Ne?C===Gu?!0:JSON.stringify(Nr)!==JSON.stringify(He):!1,[Nr,C,Ne,He]);K.useEffect(()=>{V!=="none"&&!rr&&z!=="none"&&ee("none")},[rr,V,z]);const Pr=()=>{ot(M2(Ee)),h(null),f(!1),v(null),l(!1),x(!1),S(null),j(!1),R("none"),I(""),T(""),G(!1),U(!1),H("none"),B(""),ee("none"),$.current=!1},At=K.useCallback(ae=>{ot(ae.formValues,{keepDefaultValues:!0}),R(ae.selectedCollectionOption),I(ae.newCollectionName),T(ae.newCollectionDescription),H(ae.selectedTemplateId),B(ae.templateName),ee(ae.templateSaveMode),j(!1),G(!1),U(!1)},[ot]);K.useEffect(()=>{if(V==="none"||V===Nc||!Ne)return;const ae=Mb(Ne.defaults_jsonb??{}),Ge=Uge(jt(),ae);ot(Ge,{keepDefaultValues:!0,keepErrors:!0,keepTouched:!0,keepSubmitCount:!0,keepIsSubmitted:!0}),R(ae.collectionId===null?"none":String(ae.collectionId)),I(""),T(""),Y.trim()||B(Ne.name),ee("none"),qt.success(`Applied template "${Ne.n
524ame}"`)},[jt,ot,V,Ne,Y]);const ar=ae=>{te.current=!0,ae.draft&&(At(ae.draft),v(ae.draft.failureDetails)),h(ae.message),f(!0),e(!0)},wn=()=>{const ae=ue.current.shift();ae&&ar(ae)},W=async ae=>{var Kt,zr,ur;const Ge=p?g==null?void 0:g.datasetId:void 0,Ft=Array.isArray(ae.pointCloudFile)?ae.pointCloudFile:[ae.pointCloudFile],or=F.current??j_();F.current=or,Fm.submissionAttempted({fileName:((Kt=Ft[0])==null?void 0:Kt.name)??"",fileSizeBytes:Ft.reduce((Tt,xn)=>Tt+((xn==null?void 0:xn.size)??0),0),traceId:or.traceId}),h(null),f(!1),v(null),l(!0),L.current=!1,$.current=!1;let Ze={formValues:ae,selectedCollectionOption:C,newCollectionName:A,newCollectionDescription:P,selectedTemplateId:V,templateName:Y,templateSaveMode:z,failureDetails:$be(ae,C===Gu?A.trim():C==="none"?void 0:de,Ge)},Gt=!1,_t=!1;try{let Tt=null;if(C===Gu){const Re=nf(A,El);if(!Re)throw new Error("Collection name is required when creating a new collection");const Ke=await Ba.createCollection({name:Re,description:nf(P,jl)||null});Tt=Ke.id,Ze={...Ze,selectedCollectionOption:String(Ke.id),newCollectionName:"",newCollectionDescription:"",failureDetails:{...Ze.failureDetails,collectionLabel:Ke.name}}}else C!=="none"&&(Tt=Number(C));const xn=ae.hasLabelsOrPredictions&&((zr=ae.labelMappingsText)!=null&&zr.trim())?`Value-to-label mapping:
525${ae.labelMappingsText.trim()}`:"",Ur=[(ur=ae.pointAttributesDescription)==null?void 0:ur.trim(),xn].filter(Boolean).join(`
526
527`)||void 0,Z=ae.approxLocation&&ae.coordinateAccuracy==="local"?{type:"approx_point",lat:ae.approxLocation.lat,lon:ae.approxLocation.lon,source:ae.approxLocation.source,raw_query:ae.approxLocation.rawQuery||void 0,version:1}:null,J={file:ae.pointCloudFile,title:ae.title&&ae.title.trim()!==""?ae.title:void 0,description:ae.description||void 0,platform:ae.platform,sensor:ae.sensor||void 0,scanPattern:ae.scanPattern||void 0,preprocessingSteps:ae.preprocessingSteps,coordinateAccuracy:ae.coordinateAccuracy,coordinateReference:Z?bU(Z):ae.coordinateReference||void 0,pointAttributesDescription:Ur,acquisitionDate:ae.acquisitionDate,visibility:ae.visibility,hideLocation:ae.hideLocation,licenseId:ae.licenseId,rightsWarranty:ae.rightsWarranty,collectionId:Tt,authors:ae.authors.map(Re=>({firstName:Re.first_name,lastName:Re.last_name,organisation:Re.organisation||void 0,orcid:Re.orcid||void 0})),funding:ae.fundingReferences.map(Re=>({funderName:Re.funderName,funderIdentifier:Re.funderIdentifier||void 0,awardNumber:Re.awardNumber||void 0,awardTitle:Re.awardTitle||void 0})),fundingAcknowledgment:ae.fundingAcknowledgment||void 0,doi:ae.doi||void 0,retryDatasetId:Ge,analyticsContext:or},ce=V===Nc;if(ce||!!Ne&&rr&&z!=="none")try{const Re=_2(ae,Tt);if(!ce&&V!=="none"&&z==="update"){const Ke=await Rs.updateUploadTemplate(Number(V),{defaults_jsonb:Re});if(!Ke.success)throw new Error(Ke.error||"Failed to update upload template");Ze={...Ze,templateSaveMode:"none"},ee("none"),qt.success("Upload template updated")}else{const Ke=Y.trim();if(!Ke)throw new Error("Template name is required when saving as a template");const Ct=await Rs.createUploadTemplate(Ke,Re);if(!Ct.success)throw new Error(Ct.error||"Failed to create upload template");const qe=Ct.data?String(Ct.data.id):"none";Ze={...Ze,selectedTemplateId:qe,templateName:Ke,templateSaveMode:"none"},H(qe),B(Ke),ee("none"),qt.success("Upload template saved")}await n.invalidateQueries({queryKey:Ht.uploadTemplates.mine("upload-modal")})}catch(Re){const Ke=Re instanceof Error?Re.message:"Failed to save upload template";throw new Error(Ke)}qt.message("Upload started",{description:"Your dataset is uploading in the background."}),_t=!0,te.current=!1,e(!1),Pr(),wn();const _e=await kl.completeUpload(J,{onProgress:Re=>{Re.datasetId&&(re(Re.datasetId,Re),Re.isResumed&&!Ge&&!Gt&&(Gt=!0,qt.message("Continuing your earlier upload",{description:"These files match an unfinished upload, so its dataset is kept and updated with this form."})),Ze={...Ze,failureDetails:{...Ze.failureDetails,datasetId:Re.datasetId}},$.current||($.current=!0,r())),Re.phase==="processing"&&!L.current&&(L.current=!0,qt.success("Upload complete, processing started",{description:"You can track status updates in your dataset table."}))}});if(!_e.success)throw new Error(_e.error||"Upload failed");if(s!=null&&s.id&&await n.invalidateQueries({queryKey:Ht.datasets.hasUploaded(s.id)}),ae.supplementaryFile){const Re=qt.loading("Uploading supplementary data",{description:ae.supplementaryFile.name}),Ke=await kl.uploadSupplementaryData(_e.datasetId,ae.supplementaryFile,ae.supplementaryDescription,{analyticsContext:or,onProgress:Ct=>{var qe;qt.loading("Uploading supplementary data",{id:Re,description:`${((qe=ae.supplementaryFile)==null?void 0:qe.name)??"supplementary.zip"} (${Ct}%)`})}});Ke.success?qt.success("Supplementary data uploaded",{id:Re}):qt.warning("Dataset uploaded, but supplementary data failed",{id:Re,description:Ke.error})}if(_e.completionState&&_e.completionState!=="completed"){r(),qt.message(_e.completionState==="unknown"?"Checking upload status":"Finishing upload",{description:"Your existing dataset will update when finalization is confirmed."});return}_e.warnings&&_e.warnings.length>0&&qt.warning("Dataset uploaded, but some metadata was not saved",{description:_e.warnings.join(" ")}),_e.datasetId&&setTimeout(()=>{se(_e.datasetId)},2e3),!L.current&&(!_e.warnings||_e.warnings.length===0)&&qt.success("Upload completed",{description:"Your dataset was uploaded successfully."})}catch(Tt){console.error("Upload error:",Tt);const xn=Tt instanceof Error?Tt.message:"Upload failed";qt.error("Upload failed",{description:xn});const Ur={draft:Ze,message:xn};_t&&te.current?ue.current.push(Ur):ar(Ur)}finally{_t||l(!1)}},ie=ae=>{var Gt;x(!0);const Ge=jt("pointCloudFile"),Ft=Array.isArray(Ge)?Ge:Ge?[Ge]:[],or=F.current??j_();F.current=or,Fm.validationFailed({fileName:(Gt=Ft[0])==null?void 0:Gt.name,fileSizeBytes:Ft.length>0?Ft.reduce((_t,Kt)=>_t+Kt.size,0):void 0,traceId:or.traceId});const Ze=O2.find(({key:_t})=>ae[_t]);Ze&&window.requestAnimationFrame(()=>{var zr,ur;try{const Tt=dB(ae[Ze.key],String(Ze.key));St(Tt)}catch{}const _t=document.getElementById(Ze.sectionId);(ur=(zr=(_t==null?void 0:_t.querySelector('[aria-invalid="true"]'))??_t)==null?void 0:zr.scrollIntoView)==null||ur.call(zr,{behavior:"smooth",block:"center"})})},le=async()=>
527{if(!Ne)return;const ae=await Rs.deleteUploadTemplate(Ne.id);if(!ae.success){qt.error(ae.error||"Failed to delete upload template");return}U(!1),H("none"),B(""),ee("none"),await n.invalidateQueries({queryKey:Ht.uploadTemplates.mine("upload-modal")}),qt.success(`Deleted template "${Ne.name}"`)},be=ae=>{if(ae){e(!0);return}p&&(g!=null&&g.datasetId)&&se(g.datasetId),v(null),Pr(),te.current=!1,e(!1),wn()},je=ae=>{var or;if(((or=ae.target.tagName)==null?void 0:or.toLowerCase())!=="textarea"&&ae.key==="Enter"&&ae.target!==ae.currentTarget){ae.preventDefault();const Gt=ae.currentTarget.querySelectorAll("input, select, textarea, button:not([disabled])"),_t=Array.from(Gt).indexOf(ae.target);_t>=0&&_t<Gt.length-1?Gt[_t+1].focus():ae.target.blur()}},Be=pa({control:De,name:"pointCloudFile"}),Te=Array.isArray(Be)?(Oe=Be[0])==null?void 0:Oe.name:Be==null?void 0:Be.name;return o.jsx(hi,{open:t,onOpenChange:be,children:o.jsxs($s,{className:"max-w-5xl sm:max-w-5xl w-full overflow-x-visible",children:[o.jsxs(zs,{children:[o.jsxs(Us,{className:"flex items-center gap-2",children:[o.jsx(Tk,{className:"h-5 w-5"}),"Point Cloud Upload and Metadata"]}),o.jsx(Mi,{children:"Upload your LiDAR dataset and provide comprehensive metadata"})]}),o.jsx(J3,{...Et,children:o.jsxs("form",{onSubmit:Mt(W,ie),onKeyDown:je,className:"space-y-4 py-2 overflow-visible",children:[_&&Object.keys(Et.formState.errors).length>0&&o.jsxs(Bs,{variant:"destructive",className:"border-red-900/30 bg-red-950/[0.03] text-red-900 [&>svg]:text-red-800",children:[o.jsx(Pf,{className:"h-4 w-4"}),o.jsxs(fi,{children:["Please complete the required fields:",o.jsx("div",{className:"mt-2 flex flex-wrap gap-2 text-xs",children:O2.filter(ae=>Et.formState.errors[ae.key]).map(ae=>o.jsx("a",{href:`#${ae.sectionId}`,onClick:Ge=>{Ge.preventDefault();const Ft=document.getElementById(ae.sectionId);Ft&&Ft.scrollIntoView({behavior:"smooth",block:"center"})},className:"!text-black underline underline-offset-2 visited:!text-black hover:!text-black",children:ae.label},String(ae.key)))})]})]}),o.jsx(Dme,{className:"h-[70vh] pr-3",children:o.jsxs("div",{className:"space-y-8 pr-2",children:[o.jsx(Mj,{control:De,metadataLookup:Et,variant:"lookup"}),o.jsx(gl,{}),o.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[o.jsxs("div",{className:"col-span-1",children:[o.jsx("h3",{className:"font-medium text-gray-900",children:"Templates & Collections"}),o.jsxs("div",{className:"mt-1 space-y-2 text-sm text-gray-600",children:[o.jsxs("p",{children:[o.jsx("span",{className:"font-medium text-gray-900",children:"Templates"})," help you speed up repeated uploads by reusing metadata defaults."]}),o.jsxs("p",{children:[o.jsx("span",{className:"font-medium text-gray-900",children:"Collections"})," help you group related datasets together in your dataset table."]})]})]}),o.jsxs("div",{className:"col-span-2 space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{children:"Template"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Aj,{open:O,onOpenChange:G,value:V,onValueChange:ae=>{H(ae),ee("none"),U(!1)},triggerLabel:Ie,searchPlaceholder:"Search templates...",emptyText:"No templates found.",loading:pe.isLoading,loadingText:"Loading templates...",options:We,className:"flex-1"}),Ne&&(M?o.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Delete?"}),o.jsx(we,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>void le(),children:o.jsx(Vl,{className:"h-4 w-4"})}),o.jsx(we,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>U(!1),children:o.jsx(cu,{className:"h-4 w-4"})})]}):o.jsx(we,{type:"button",size:"icon",variant:"ghost",className:"shrink-0 text-destructive hover:text-destructive",onClick:()=>U(!0),children:o.jsx(pC,{className:"h-4 w-4"})}))]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Use a template to prefill metadata for repeated uploads."})]}),V===Nc&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"new-template-name",children:"New template name"}),o.jsx(Nt,{id:"new-template-name",value:Y,onChange:ae=>B(ae.target.value),placeholder:"Template name"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Templates include reusable metadata defaults, including title, DOI, funding, and collection selection, but exclude acquisition date and local/manual coordinate references."}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{children:"Collection assignment"}),o.jsx(Aj,{open:k,onOpenChange:j,value:C,onValueChange:R,triggerLabel:de,searchPlaceholder:"Search collections...",emptyText:"No collections foun
527d.",loading:ye.isLoading,loadingText:"Loading collections...",options:at}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Add this dataset to a collection to keep related uploads grouped together."})]}),C===Gu&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"new-collection-name",children:"New collection name"}),o.jsx(Nt,{id:"new-collection-name",autoFocus:!0,value:A,onChange:ae=>I(ae.target.value.slice(0,El)),maxLength:El,placeholder:"e.g. Black Forest Spring 2026"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"new-collection-description",children:"Collection description (optional)"}),o.jsx(Jl,{id:"new-collection-description",value:P,onChange:ae=>T(ae.target.value.slice(0,jl)),maxLength:jl,placeholder:"Describe this collection and the datasets it groups together"})]})]})]})]}),o.jsx(gl,{}),o.jsx("div",{id:"upload-section-file",children:o.jsx(cve,{control:De,onAcquisitionDateSuggestionChange:S})}),o.jsx(gl,{}),o.jsx("div",{id:"upload-section-technical",children:o.jsx(J5,{control:De,acquisitionDateSuggestion:w})}),o.jsx(gl,{}),o.jsx("div",{id:"upload-section-location",children:o.jsx(sB,{control:De})}),o.jsx(gl,{}),o.jsx(Mbe,{control:De}),o.jsx(gl,{}),o.jsxs("div",{id:"upload-section-contributors",className:"space-y-8",children:[o.jsx(lB,{control:De}),o.jsx(iB,{control:De,titlePlaceholder:Te||"Defaults to filename"}),o.jsx(aB,{control:De,licenses:Rt,onLicenseChange:()=>{Et.setValue("rightsWarranty",!1,{shouldDirty:!0,shouldValidate:!0})}}),o.jsx(Mj,{control:De}),o.jsx(cB,{control:De})]}),(V===Nc||Ne&&rr)&&o.jsxs(o.Fragment,{children:[o.jsx(gl,{}),o.jsx("div",{className:"space-y-3 rounded-md border p-3",children:V===Nc?o.jsx("p",{className:"text-sm text-muted-foreground",children:"This upload will also be saved as a new template."}):o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-sm text-muted-foreground",children:['You changed metadata from "',Ne==null?void 0:Ne.name,'".']}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ya,{id:"template-save-update",checked:z==="update",onCheckedChange:ae=>ee(ae?"update":"none")}),o.jsx(ft,{htmlFor:"template-save-update",children:"Update selected template"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ya,{id:"template-save-new",checked:z==="new",onCheckedChange:ae=>ee(ae?"new":"none")}),o.jsx(ft,{htmlFor:"template-save-new",children:"Save as new template"})]})]}),z==="new"&&o.jsx(Nt,{value:Y,onChange:ae=>B(ae.target.value),placeholder:"Template name"})]})})]}),u&&o.jsxs(Bs,{className:"ph-mask",variant:"destructive",children:[o.jsx(Pf,{className:"h-4 w-4"}),o.jsxs(fi,{children:[u,p&&o.jsxs("span",{className:"mt-2 block space-y-1 text-xs",children:[g&&o.jsxs("span",{className:"block rounded-md border border-destructive/30 bg-destructive/5 p-2",children:[o.jsxs("span",{className:"block font-medium",children:["Failed upload: ",g.title]}),g.fileNames.length>0&&o.jsxs("span",{className:"block",children:["Files:"," ",zbe(g.fileNames)]}),g.datasetId&&o.jsxs("span",{className:"block",children:["Dataset ID: ",g.datasetId]}),g.collectionLabel&&o.jsxs("span",{className:"block",children:["Collection: ",g.collectionLabel]})]}),o.jsx("span",{className:"block",children:'Your form data has been preserved. Click "Retry Upload" to try again.'})]})]})]})]})}),o.jsx(gl,{}),o.jsxs(Mo,{children:[o.jsx(we,{variant:"outline",type:"button",onClick:()=>be(!1),disabled:a,children:"Cancel"}),o.jsx(we,{type:"submit",disabled:a,children:a?"Starting Upload...":p?"Retry Upload":"Upload Dataset"})]})]})})]})})}var Bbe=Object.defineProperty,tc=(t,e)=>Bbe(t,"name",{value:e,configurable:!0}),hB="Progress",AN=100,[Vbe,_ke]=Vn(hB),[Hbe,qbe]=Vbe(hB),Wbe=y.forwardRef(tc(function(e,r){const{__scopeProgress:n,value:s=null,max:i,getValueLabel:a=fB,...l}=e;(i||i===0)&&!Lj(i)&&console.error(pB(`${i}`,"Progress"));const u=Lj(i)?i:AN;s!==null&&!Fj(s,u)&&console.error(mB(`${s}`,"Progress"));const h=Fj(s,u)?s:null,p=vg(h)?a(h,u):void 0;return o.jsx(Hbe,{scope:n,value:h,max:u,children:o.jsx(it.div,{"aria-valuemax":u,"aria-valuemin":0,"aria-valuenow":vg(h)?h:void 0,"aria-valuetext":p,role:"progressbar","data-state":TN(h,u),"data-value":h??void 0,"data-max":u,...l,ref:r})})},"Progress")),Gbe="ProgressIndicator",Kbe=y.forwardRef(tc(function(e,r){const{__scopeProgress:n,...s}=e,i=qbe(Gbe,n);return o.jsx(it.div,{"data-state":TN(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...s,ref:r})},"ProgressIndicator"));function fB(t,e){return`${Math.round(t/e*100)}%`}tc(fB,"defaultGetValueLabel");function TN(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}tc(TN,"getProgressState");function vg(t){return typeof t=="number"}tc(vg,"isNumber");function Lj(t){return vg(t)&&!isNaN(t)&&t>0}tc(Lj,"isValidMaxNumber");function Fj(t,e){return vg(t)&&!isNaN(t)&&t<=e&&t>=0}tc(Fj,"isValidValueNumber");function pB(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${AN}\`.`}tc(pB,"getInvalidMaxError");function mB(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
528  - a positive number
529  - less than the value passed to \`max\` (or ${AN} if no \`max\` prop is set)
530  - \`null\` or \`undefined\` if the progress is indeterminate.
531
532Defaulting to \`null\`.`}tc(mB,"getInvalidValueError");var gB=Wbe,Ybe=Kbe;const yg=y.forwardRef(({className:t,value:e,...r},n)=>o.jsx(gB,{ref:n,className:ke("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...r,children:o.jsx(Ybe,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));yg.displayName=gB.displayName;const vB=async t=>{const e=[];for await(const r of t.values())r.kind==="file"?e.push(await r.getFile()):r.kind==="directory"&&e.push(...await vB(r));return e};function Zbe({currentUserId:t,onRecovered:e}){const[r,n]=y.useState(()=>E_(t)),[s,i]=y.useState(null),[a,l]=y.useState(!1),u=y.useRef(null),{uploads:h,setUploadProgress:p}=t1(),{uploadBlocked:f,openReconsent:g}=gw(),v=y.useRef({onRecovered:e,setUploadProgress:p});v.current={onRecovered:e,setUploadProgress:p};const _=y.useCallback(()=>{n(E_(t))},[t]);y.useEffect(()=>{if(_(),!t)return;let k=!1,j=!1;const C=async(P=!1)=>{var T,O;if(!(j||k)){j=!0;try{P&&await Promise.allSettled([kl.discoverFinalizations(t),kl.discoverTransfers(t)]);for(const G of E_(t)){if(k)break;if(G.status!=="finalizing")continue;const M=await kl.recoverFinalization(G,{onProgress:U=>{k||v.current.setUploadProgress(G.datasetId,U)}});!k&&M.completionState==="completed"&&((O=(T=v.current).onRecovered)==null||O.call(T))}}finally{j=!1,k||_()}}},R=()=>{C(!0)},A=()=>_();C(!0);const I=window.setInterval(()=>{C()},3e3);return window.addEventListener("focus",R),window.addEventListener("storage",R),window.addEventListener("upload-manifests-changed",A),()=>{k=!0,window.clearInterval(I),window.removeEventListener("focus",R),window.removeEventListener("storage",R),window.removeEventListener("upload-manifests-changed",A)}},[t,_]);const x=y.useCallback(async(k,j=[])=>{l(!0),i(k);try{const C=await kl.resumeUploadFromManifest(k,j,{onProgress:R=>{R.datasetId&&p(R.datasetId,R)}});if(!C.success)throw new Error(C.error||"Failed to resume upload");(!C.completionState||C.completionState==="completed")&&qt.success("Upload complete"),_(),e==null||e()}catch(C){qt.error(C instanceof Error?C.message:"Failed to resume upload")}finally{l(!1),i(null)}},[e,_,p]),w=y.useCallback(async k=>{var C,R,A,I,P;const j=k.items.length>1?window.showDirectoryPicker:void 0;if(j)try{const T=await j(),O=await vB(T);await x(k,O);return}catch(T){if((T==null?void 0:T.name)==="AbortError")return;console.warn("Directory picker failed, falling back to file input",T)}i(k),k.items.length>1?((C=u.current)==null||C.setAttribute("webkitdirectory",""),(R=u.current)==null||R.setAttribute("directory","")):((A=u.current)==null||A.removeAttribute("webkitdirectory"),(I=u.current)==null||I.removeAttribute("directory")),(P=u.current)==null||P.click()},[x]),S=y.useCallback(async k=>
532{l(!0),i(k);try{await kl.discardUploadManifest(k),_(),qt.message("Upload recovery dismissed")}catch(j){qt.error(j instanceof Error?j.message:"Failed to dismiss upload recovery")}finally{l(!1),i(null)}},[_]);return r.length===0?null:o.jsxs("div",{className:"ph-no-capture mb-4 space-y-2",children:[o.jsx("input",{ref:u,type:"file",multiple:!0,className:"hidden",onChange:k=>{const j=Array.from(k.currentTarget.files??[]),C=s;k.currentTarget.value="",C&&x(C,j)}}),r.map(k=>{var G,M,U;const j=((G=h[k.datasetId])==null?void 0:G.percentage)??0,C=kl.isTransferActive(k.ingestionId),R=C||a&&(s==null?void 0:s.id)===k.id,A=k.status==="finalizing",I=!!k.dismissAfter&&Date.parse(k.dismissAfter)>Date.now(),P=((M=k.finalization)==null?void 0:M.attention_required)||!!k.finalizationError,T=k.completionUnknown,O=P?"Upload needs attention":T?"Checking upload status":A?"Finishing upload":C?"Uploading":"Incomplete upload";return o.jsxs(Bs,{variant:"warning",className:"p-3 sm:p-4",children:[A&&!P?o.jsx(Ds,{className:"h-4 w-4 animate-spin"}):o.jsx(Oo,{className:"h-4 w-4"}),o.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs(ha,{className:"truncate",children:[O,": ",k.title]}),o.jsx(fi,{children:k.finalizationError||k.transferError||(((U=k.finalization)==null?void 0:U.processing_status)==="unknown"?"Your files are uploaded. Processing could not be confirmed and will not be started again automatically.":P?"The server could not verify this upload. Contact support with the dataset ID.":T?"Waiting for the server to confirm completion. Your existing dataset has been kept.":A?"Your upload is saved and finishing on the server. You can leave this page.":C?"Keep this tab open while your files are uploading.":k.restartRequired||!k.transferOwnerId?"Select all original files to restart the file transfer in this browser. Your dataset and upload session stay the same; all bytes will be sent again.":k.items.some(V=>V.identityUnverified)?"Select the original files to resume this existing dataset. Older uploads replace saved parts because file matching details were not recorded.":`${k.items.length} file${k.items.length===1?"":"s"} waiting to resume. Select the original files to continue from saved parts.`)}),A&&o.jsxs(Sr,{className:"mt-1 inline-block text-xs underline",to:`/datasets/${k.datasetId}`,children:["Dataset ",k.datasetId]}),f&&o.jsxs("p",{className:"mt-1 text-xs text-amber-800",children:["Accept the updated terms to resume this upload."," ",o.jsx("button",{type:"button",onClick:g,className:"font-medium underline underline-offset-2 hover:no-underline",children:"Review and accept"})]}),R&&o.jsx(yg,{value:j,className:"mt-2 h-1.5 max-w-sm"}),!R&&!A&&I&&o.jsx("p",{className:"mt-1 text-xs text-amber-800",children:"You can resume now. Dismissal becomes available after 15 minutes without upload activity."})]}),o.jsxs("div",{className:"flex shrink-0 flex-wrap gap-2",children:[o.jsxs(we,{size:"sm",variant:"outline",className:"gap-2",onClick:()=>void x(k),disabled:R||a||!A&&(f||k.restartRequired||!k.transferOwnerId),children:[R?o.jsx(Ds,{className:"h-4 w-4 animate-spin"}):o.jsx(kL,{className:"h-4 w-4"}
532),A?"Check status":"Finalize"]}),!A&&o.jsxs(we,{size:"sm",className:"gap-2",onClick:()=>void w(k),disabled:R||a||f,children:[o.jsx(x9,{className:"h-4 w-4"}),k.restartRequired||!k.transferOwnerId?"Restart transfer":"Resume"]}),!A&&o.jsx(we,{size:"icon",variant:"ghost","aria-label":`Forget interrupted upload ${k.title}`,onClick:()=>void S(k),disabled:R||a||I,children:o.jsx(cu,{className:"h-4 w-4"})})]})]})]},k.id)})]})}function L2(t){return t.replace(/\\/g,"/").replace(/^\/+/,"").replace(/\/+$/,"")}function Jbe(t){const e=t.map(s=>L2(s.path)).filter(Boolean),r=e.map(s=>{const i=s.indexOf("/");return i>0?s.slice(0,i):e.some(a=>a!==s&&a.startsWith(`${s}/`))?s:null}).filter(s=>!!s),n=r.length===e.length&&new Set(r).size===1?r[0]:null;return t.map(s=>{const i=L2(s.path),a=n&&i.startsWith(`${n}/`)?i.slice(n.length+1):i;return{entry:s,displayPath:a||s.filename||s.path,fullPath:i||s.path||s.filename}})}function Qbe(t,e){const r=e.split(/[\\/]/).pop()||"",n=t.extension||(r.includes(".")?r.split(".").pop():"")||"";return n?n.replace(/^\./,"").toUpperCase():"(none)"}function Xbe({datasetId:t,supplementary:e,canManage:r=!1,onChanged:n}){const[s,i]=y.useState(null),[a,l]=y.useState(""),[u,h]=y.useState(!1),[p,f]=y.useState(0),[g,v]=y.useState(0),_=(e==null?void 0:e.zip_entries)??[],x=Jbe(_),w=async()=>{if(!s)return;h(!0),f(0);const S=await kl.uploadSupplementaryData(t,s,a,{onProgress:f,analyticsContext:j_()});if(h(!1),!S.success){qt.error(S.error||"Supplementary upload failed");return}qt.success("Supplementary data uploaded"),i(null),l(""),f(0),v(k=>k+1),n==null||n()};return o.jsxs("div",{className:"ph-mask rounded-md bg-muted/30 p-3 space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between gap-3",children:o.jsx("div",{className:"flex items-center gap-2 min-w-0",children:o.jsx("div",{className:"text-xs font-medium uppercase text-muted-foreground",children:"Supplementary Data"})})}),e?o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("span",{className:"text-muted-foreground",children:"ZIP"}),o.jsx(cg,{content:e.original_filename,side:"bottom",className:"min-w-0 flex-1 justify-end",children:o.jsx("span",{className:"block max-w-full truncate text-right",children:e.original_filename})})]}),o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("span",{className:"text-muted-foreground",children:"Size"}),o.jsx("span",{children:xd(e.file_size_bytes)})]}),e.description&&o.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:e.description}),_.length>0&&o.jsxs("details",{className:"rounded-md border bg-background/60 p-2",children:[o.jsxs("summary",{className:"cursor-pointer text-xs text-muted-foreground",children:[_.length," file",_.length===1?"":"s"," in ZIP"]}),o.jsx("div",{className:"mt-2 max-h-40 space-y-1 overflow-y-auto text-xs",children:x.map(({entry:S,displayPath:k,fullPath:j})=>o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx(cg,{content:j,side:"bottom",className:"min-w-0 flex-1",children:o.jsx("span",{className:"block max-w-full truncate",children:k})}),o.jsx("span",{className:"text-muted-foreground shrink-0",children:Qbe(S,k)})]},S.path))})]})]}):o.jsx("p",{className:"text-sm text-muted-foreground",children:"No supplementary ZIP has been uploaded for this dataset."}),r&&o.jsxs("div",{className:"space-y-3 border-t pt-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:`supplementary-file-${t}`,children:e?"Replace supplementary ZIP":"Upload supplementary ZIP"}),o.jsx(Nt,{id:`supplementary-file-${t}`,type:"file",accept:".zip,application/zip,application/x-zip-compressed",disabled:u,onChange:S=>{var k;return i(((k=S.target.files)==null?void 0:k[0])??null)}},g),s&&o.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[o.jsx(Yb,{className:"h-3.5 w-3.5"}),o.jsx("span",{className:"truncate",children:s.name}),o.jsx("span",{children:xd(s.size)})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:`supplementary-description-${t}`,children:"Description"}),o.jsx(Jl,{id:`supplementary-description-${t}`,value:a,disabled:u,rows:3,placeholder:"Describe what is included in the supplementary ZIP",onChange:S=>l(S.target.value)})]}),u&&o.jsx(yg,{value:p}),o.jsxs(we,{type:"button",size:"sm",disabled:!s||u,onClick:()=>void w(),children:[u?o.jsx(Ds,{className:"mr-2 h-4 w-4 animate-spin"}):o.jsx(mC,{className:"mr-2 h-4 w-4"}),e?"Replace ZIP":"Upload ZIP"]})]})]})}const ewe=Rn({acquisitionDate:sU({message:"Acquisition date is required"}).refine(t=>{const e=new Date;return e.setHours(23,59,59,999),t.getTime()<=e.getTime()},"Acquisition date cannot be in the future"),platform:li(["TLS","MLS","ULS"],{message:"Platform is required"}),authors:as(Rn({first_name:ht().min(1,"First name is required"),last_name:ht().min(1,"Last name is required"),organisation:ht().optional(),orcid:ht().optional()})).min(1,"At least one contributor is required"),sensor:ht().optional(),scanPattern:ht().optional(),preprocessingSteps:as(li(["noise_filtering","ground_classification","height_normalization","downsampling","co_registration","outlier_removal","compression"])).default([]),coordinateAccuracy:li(["<1m","<10m",">10m","local"],{message:"Choose a coordinate accuracy before saving."}),visibility:li(["public","view_only","private"]),hideLocation:Gc().default(!1),coordinateReference:ht().optional(),requiresApproxLocation:Gc().default(!1),approxLocation:Rn({lat:fa().min(-90).max(90),lon:fa().min(-180).max(180),source:li(["map_click","geocoder","manual_coords","legacy_text","unknown"]),rawQuery:ht().optional()}).optional(),pointAttributesDescription:ht().optional(),description:ht().optional(),fundingReferences:as(Rn({funderName:ht().min(1,"Funder name is required"),funderIdentifier:ht().optional(),awardNumber:ht().optional(),awardTitle:ht().optional()})).default([]),fundingAcknowledgment:ht().optional(),doi:ht().optional().refine(t=>!t||t.trim()===""?!0:qg(t).isValid,{message:"Invalid DOI format. Expected format: 10.XXXX/YYYY or https://doi.org/10.XXXX/YYYY"}),title:ht().optional(),licenseId:fa().int().nullable().optional(),rightsWarranty:Gc().default(!1)});function yB(t){if(!t||typeof t!="object")return[];const e=t,r=[];typeof e.message=="string"&&e.message.trim()&&r.push(e.message);for(const[n,s]of Object.entries(t))n!=="ref"&&s&&typeof s=="object"&&r.push(...yB(s));return Array.from(new Set(r))}function twe(t){return new Date(t).toLocaleDateString()}function rwe(t,e){return t!==e}function nwe({dataset:t}){var e,r;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(E9,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),o.jsx("span",{className:"font-medium text-sm truncate",title:((e=t.file_names)==null?void 0:e.join(", "))||"",children:t.item_count>1?`${t.item_count} files`:((r=t.file_names)==null?void 0:r[0])||"Unknown"})]}),o.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[o.jsx("span",{children:t.point_count?`${t.point_count.toLocaleStr
532ing()} points`:"Unknown size"}),o.jsx("span",{children:"•"}),o.jsxs("span",{children:["Uploaded ",twe(t.created_at)]}),o.jsx("span",{children:"•"}),o.jsx("span",{children:"File cannot be changed after upload"})]})]})}function swe(t){return t.open?o.jsx(iwe,{...t},t.dataset.id):null}function iwe({open:t,onOpenChange:e,dataset:r,onEditComplete:n,auditMetadataUpdater:s,canManageResource:i}){var Rt;const[a]=K.useState(r),[l,u]=K.useState(!i),h=i&&!s,[p,f]=K.useState(null),[g,v]=K.useState(0),[_,x]=K.useState(!1),[w,S]=K.useState(null),[k,j]=K.useState(!1),[C,R]=K.useState(""),[A,I]=K.useState(null),[P,T]=K.useState(null),O=K.useRef(null),G=fr(oB()),M=K.useMemo(()=>G.data??[],[G.data]),U=K.useMemo(()=>a.authors??[],[a.authors]),V=K.useMemo(()=>a.funding??[],[a.funding]),H=K.useCallback((Ee,Et)=>{var ot;const Mt=_U(a.coordinate_reference);return{acquisitionDate:a.acquisition_date?new Date(a.acquisition_date):new Date,platform:a.platform||"TLS",authors:U.map(De=>({first_name:De.first_name,last_name:De.last_name,organisation:De.organisation||"",orcid:De.orcid||""})),sensor:a.sensor||"",scanPattern:a.scan_pattern||"",preprocessingSteps:a.preprocessing_steps||[],coordinateAccuracy:a.coordinate_accuracy??void 0,visibility:a.visibility||"private",hideLocation:a.hide_location===!0,coordinateReference:Mt.rawText??(a.coordinate_reference||""),requiresApproxLocation:a.coordinate_accuracy==="local",approxLocation:Mt.point?{lat:Mt.point.lat,lon:Mt.point.lon,source:Mt.point.source,rawQuery:Mt.point.raw_query}:void 0,pointAttributesDescription:a.point_attributes_description||"",description:a.description||"",fundingReferences:V.map(De=>({funderName:De.funder_name,funderIdentifier:De.funder_identifier||"",awardNumber:De.award_number||"",awardTitle:De.award_title||""})),fundingAcknowledgment:"",doi:Ee,title:a.title||((ot=a.file_names)==null?void 0:ot[0])||"",licenseId:(Et==null?void 0:Et.license_id)??null,rightsWarranty:!1}},[U,a,V]),Y=Y3({resolver:Z3(ewe),mode:"onChange",reValidateMode:"onChange",defaultValues:H("")}),{handleSubmit:B,reset:z,resetField:ee,register:L,getFieldState:$,formState:F,trigger:te,setError:ue}=Y,{errors:re,isDirty:se,isValid:ye}=F,de=K.useMemo(()=>yB(re),[re]);K.useEffect(()=>{if(!t){O.current=null;return}O.current!==a.id&&(Qte(a.id),O.current=a.id)},[a.id,t]),K.useEffect(()=>{let Ee=!1;if(te(),!i){u(!0),f(null);return}return L("doi"),u(!1),f(null),Rs.getActiveSupplementaryData(a.id).then(Et=>{Ee||T(Et.success?Et.data??null:null)}).catch(()=>{Ee||T(null)}),Promise.all([Rs.getDatasetDOI(a.id),Rs.getDatasetLicenseInfo(a.id)]).then(([Et,Mt])=>{var St,jt;if(Ee)return;if(!Et.success||!Mt.success)throw new Error("Metadata read failed");const ot=((St=Et.data)==null?void 0:St.doi)??"",De=((jt=Mt.data)==null?void 0:jt.license_id)??null;R(ot),I(De),$("doi").isDirty||ee("doi",{defaultValue:ot}),$("licenseId").isDirty||ee("licenseId",{defaultValue:De}),u(!0),te()}).catch(()=>{Ee||f("Could not load existing DOI and license. Retry before saving.")}),()=>{Ee=!0}},[a.id,i,g,$,L,ee,te]);const pe=K.useCallback(async()=>{const Ee=await Rs.getActiveSupplementaryData(a.id);T(Ee.success?Ee.data??null:null),n()},[a.id,n]),Ie=async Ee=>{var Mt;if(!l)return;S(null),x(!0);const Et=Lm();try{let ot=Ee.coordinateReference||null;Ee.coordinateAccuracy==="local"&&Ee.approxLocation&&(ot=bU({type:"approx_point",lat:Ee.approxLocation.lat,lon:Ee.approxLocation.lon,source:Ee.approxLocation.source,raw_query:Ee.approxLocation.rawQuery||void 0,version:1}));const De={description:Ee.description||null,acquisition_date:`${Ee.acquisitionDate.getFullYear()}-${String(Ee.acquisitionDate.getMonth()+1).padStart(2,"0")}-${String(Ee.acquisitionDate.getDate()).padStart(2,"0")}`,title:Ee.title&&Ee.title.trim()?Ee.title:((Mt=a.file_names)==null?void 0:Mt[0])||"Untitled",platform:Ee.platform,sensor:Ee.sensor||null,scan_pattern:Ee.scanPattern||null,preprocessing_steps:Ee.preprocessingSteps,coordinate_accuracy:Ee.coordinateAccuracy,coordinate_reference:ot,point_attributes_description:Ee.pointAttributesDescription||null};i&&(De.visibility=Ee.visibility),h&&Ee.hideLocation!==(a.hide_location===!0)&&(De.hide_location=Ee.hideLocation);const St=i&&(Ee.licenseId??null)!==(A??null),jt=i&&rwe(a.visibility,Ee.visibility),Cr=i&&(Ee.doi??"").trim()!==C.trim(),Or=St||jt||Cr;if(Or&&Ee.rightsWarranty!==!0){const At="Please confirm you hold the rights for this publication or licensing change.";ue("rightsWarranty",{type:"manual",message:At}),S(At);return}St&&(De.license_id=Ee.licenseId??null),Or&&(De.rights_warranty_at=new Date().toISOString());const Nr=Ee.authors.map(At=>({dataset_id:a.id,first_name:At.first_name,last_name:At.last_name,organisation:At.organisation||null,orcid:At.orcid||null})),rr=Ee.fundingReferences.map(At=>({dataset_id:a.id,funder_name:At.funderName,funder_identifier:At.funderIdentifier||null,award_number:At.awardNumber||null,award_title:At.awardTitle||null})),Pr=ope(De,i);if(s)await s({updates:Pr,authors:Nr,funding:rr});else{const At=await Rs.updateDatasetMetadata(a.id,Pr,Nr,rr,"Dataset metadata updated via edit modal",Et);if(!At.success)throw new Error(At.error||"Failed to update dataset")}if(i&&Cr)try{if(Ee.doi&&Ee.doi.trim()){const At=await Rs.upsertDatasetDOI(a.id,Ee.doi.trim());if(!At.success)throw new Error(At.error||"Failed to save DOI")}else{const At=await Rs.getDatasetDOI(a.id);if(At.success&&At.data){const ar=await Rs.deleteDatasetDOI(a.id);if(!ar.success)throw new Error(ar.error||"Failed to delete DOI")}else if(!At.success)throw new Error(At.error||"Failed to load existing DOI")}}
532catch(At){throw console.warn("DOI operation failed:",At),At}e(!1),n()}catch(ot){console.error("Save error:",ot);const De=ot instanceof Error?ot.message:"Failed to save changes";S(De)}finally{x(!1)}},Ne=Ee=>{if(!Ee&&se&&!_){j(!0);return}e(Ee)},He=async()=>{j(!1),await B(Ie)()},We=()=>{j(!1),S(null),z(H(C)),e(!1)},at=()=>{j(!1)},Xt=Ee=>{if(Ee.key==="Enter"&&Ee.target!==Ee.currentTarget){Ee.preventDefault();const Mt=Ee.currentTarget.querySelectorAll("input, select, textarea, button:not([disabled])"),ot=Array.from(Mt).indexOf(Ee.target);ot>=0&&ot<Mt.length-1?Mt[ot+1].focus():Ee.target.blur()}};return o.jsxs(o.Fragment,{children:[o.jsx(hi,{open:t,onOpenChange:Ne,children:o.jsxs($s,{className:"ph-mask max-w-5xl sm:max-w-5xl w-full max-h-[90vh] overflow-y-auto overflow-x-visible",onPointerDownOutside:Ee=>{const Et=Ee.target;(Et.closest("[data-radix-popper-content-wrapper]")||Et.closest("[data-radix-portal]")||Et.closest("[cmdk-root]"))&&Ee.preventDefault()},children:[o.jsxs(zs,{children:[o.jsxs(Us,{className:"flex items-center gap-2",children:[o.jsx(Zb,{className:"h-5 w-5"}),"Edit Dataset Metadata"]}),o.jsx(Mi,{children:"Update the metadata properties for this dataset"})]}),i&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mb-4",children:o.jsx(nwe,{dataset:a})}),o.jsx("div",{className:"mb-4",children:o.jsx(Xbe,{datasetId:a.id,supplementary:P,canManage:!0,onChanged:()=>void pe()})})]}),o.jsx(J3,{...Y,children:o.jsxs("form",{onSubmit:B(Ie),onKeyDown:Xt,className:"space-y-8 py-4 overflow-visible",children:[o.jsx(J5,{control:Y.control}),o.jsx("div",{className:"border-t border-gray-200"}),o.jsx(sB,{control:Y.control,canEditHideLocation:h}),o.jsx("div",{className:"border-t border-gray-200"}),o.jsxs("div",{className:"space-y-8",children:[o.jsx(lB,{control:Y.control}),o.jsx(iB,{control:Y.control,titlePlaceholder:((Rt=a.file_names)==null?void 0:Rt[0])||"Untitled",canEditVisibility:i}),i&&o.jsxs(o.Fragment,{children:[o.jsx(aB,{control:Y.control,licenses:M,onLicenseChange:()=>{Y.setValue("rightsWarranty",!1,{shouldDirty:!0,shouldValidate:!0})}}),o.jsx(Mj,{control:Y.control,metadataLookup:Y,variant:"lookup"})]}),o.jsx(cB,{control:Y.control})]}),de.length>0&&o.jsx("div",{children:o.jsxs("div",{className:"flex items-start gap-2 p-3 bg-amber-50 border border-amber-200 rounded-md",children:[o.jsx("div",{className:"w-4 h-4 rounded-full bg-amber-400 flex-shrink-0 mt-0.5",children:o.jsx("span",{className:"block w-2 h-1 bg-white rounded-full mx-auto mt-1.5"})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"text-sm text-amber-700 font-medium",children:"Please fix the following errors:"}),o.jsx("ul",{className:"text-xs text-amber-600 mt-1 space-y-0.5",children:de.map(Ee=>o.jsxs("li",{children:["• ",Ee]},Ee))})]})]})}),!l&&o.jsxs("div",{role:"status",className:"text-sm text-muted-foreground",children:[p??"Loading existing DOI and license. You can keep editing.",p&&o.jsx(we,{type:"button",variant:"outline",className:"ml-2",onClick:()=>v(Ee=>Ee+1),children:"Retry metadata load"})]}),w&&o.jsx("div",{children:o.jsxs("div",{className:"flex items-start gap-2 p-3 bg-red-50 border border-red-200 rounded-md",children:[o.jsx("div",{className:"w-4 h-4 rounded-full bg-red-400 flex-shrink-0 mt-0.5",children:o.jsx("span",{className:"block w-2 h-1 bg-white rounded-full mx-auto mt-1.5"})}),o.jsx("div",{className:"flex-1",children:o.jsx("p",{className:"text-sm text-red-700",children:w})})]})}),o.jsxs("div",{className:"flex justify-end gap-2 border-t pt-4 mt-6",children:[o.jsx(we,{variant:"outline",type:"button",onClick:()=>Ne(!1),disabled:_,children:"Cancel"}),o.jsx(we,{type:"submit",disabled:_||!l||!se||!ye,children:_?"Saving Changes...":"Save Changes"})]})]})})]})}),o.jsx(hi,{open:k,onOpenChange:j,children:o.jsxs($s,{className:"ph-mask sm:max-w-lg",children:[o.jsxs(zs,{children:[o.jsx(Us,{children:"You have unsaved changes"}),o.jsx(Mi,{children:"You've modified the dataset properties but haven't saved them yet. Choose what you'd like to do:"})]}),o.jsxs("div",{className:"flex flex-col gap-3 mt-6",children:[o.jsx(we,{onClick:He,disabled:_||!l||!ye,children:"Update Dataset"}),o.jsx(we,{variant:"outline",onClick:We,disabled:_,children:"Discard Changes"}),o.jsx(we,{variant:"ghost",onClick:at,disabled:_,children:"Continue Editing"})]})]})})]})}function awe({open:t,onOpenChange:e,dataset:r,onDeleteComplete:n}){var _;const[s,i]=K.useState(!1),[a,l]=K.useState(null),u=r,h=r,p=u.item_count??((_=h.dataset_items)==null?void 0:_.length)??null,f=r.title.trim()||`Dataset ${r.id}`,g=async()=>
532{l(null),i(!0);try{const x=await Rs.archiveDataset(r.id,"Dataset archived via account page",Lm());if(!x.success)throw new Error(x.error||"Failed to archive Dataset");e(!1),n()}catch(x){console.error("Delete error:",x);const w=x instanceof Error?x.message:"Failed to archive Dataset";l(w)}finally{i(!1)}},v=x=>{!x&&!s&&l(null),e(x)};return o.jsx(hi,{open:t,onOpenChange:v,children:o.jsxs($s,{className:"ph-mask max-w-md",children:[o.jsxs(zs,{children:[o.jsxs(Us,{className:"flex items-center gap-2",children:[o.jsx(Oo,{className:"h-5 w-5 text-red-500"}),"Archive Dataset"]}),o.jsx(Mi,{children:"Archive this Dataset? It will leave active listings and downloads, but a Resource Admin can restore it later."})]}),o.jsx("div",{className:"py-4",children:o.jsxs("div",{className:"rounded-md bg-muted p-3",children:[o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(T_,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"font-medium",children:f}),p!==null&&p>0&&o.jsx("p",{className:"text-xs text-muted-foreground",children:p===1?"1 file":`${p} files`})]})]}),o.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:r.description||"No description provided"})]})}),a&&o.jsxs("div",{className:"flex items-start gap-2 p-3 bg-red-50 border border-red-200 rounded-md",children:[o.jsx("div",{className:"w-4 h-4 rounded-full bg-red-400 flex-shrink-0 mt-0.5",children:o.jsx("span",{className:"block w-2 h-1 bg-white rounded-full mx-auto mt-1.5"})}),o.jsx("div",{className:"flex-1",children:o.jsx("p",{className:"text-sm text-red-700",children:a})})]}),o.jsxs(Mo,{children:[o.jsx(we,{variant:"outline",onClick:()=>e(!1),disabled:s,children:"Cancel"}),o.jsx(we,{variant:"destructive",onClick:g,disabled:s,children:s?"Archiving...":"Archive Dataset"})]})]})})}const F2=t=>{const e=(t==null?void 0:t.user_metadata)||{};return{firstName:e.first_name||"",lastName:e.last_name||"",affiliation:e.affiliation||"",orcid:e.orcid||"",profilePictureUrl:e.profile_picture_url||""}};function owe({open:t,onOpenChange:e,user:r,onProfileUpdate:n}){const s=y.useRef(null),i=y.useRef(null),[a,l]=y.useState(!1),[u,h]=y.useState(!1),[p,f]=y.useState(!1),[g,v]=y.useState(null),[_,x]=y.useState(null),[w,S]=y.useState(null),[k,j]=y.useState(!1),[C,R]=y.useState(()=>F2(r));K.useEffect(()=>{t&&(S(null),j(!1),v(null),x(null),R(F2(r)),i.current&&(URL.revokeObjectURL(i.current),i.current=null))},[t]),K.useEffect(()=>()=>{i.current&&URL.revokeObjectURL(i.current)},[]);const A=(U,V)=>{R(H=>({...H,[U]:V})),U==="orcid"&&(g&&v(null),k&&j(!1))},I=async U=>{var H;const V=(H=U.target.files)==null?void 0:H[0];if(V){if(!["image/jpeg","image/jpg","image/png","image/webp"].includes(V.type)){alert("Please select a valid image file (JPEG, PNG, or WebP)");return}if(V.size>5*1024*1024){alert("Image must be smaller than 5MB");return}h(!0);try{const Y=URL.createObjectURL(V);i.current&&URL.revokeObjectURL(i.current),i.current=Y,x(Y);const B=V.name.split(".").pop(),z=`${r.id}/avatar.${B}`,{error:ee}=await Ye.storage.from("profile-pictures").upload(z,V,{cacheControl:"3600",upsert:!0});if(ee){console.error("Upload error:",ee),alert("Failed to upload image. Please try again.");return}const{data:{publicUrl:L}}=Ye.storage.from("profile-pictures").getPublicUrl(z),{error:$}=await Ye.auth.updateUser({data:{profile_picture_url:L}});if($){console.error("Profile picture update error:",$),alert("Failed to save profile picture. Please try again.");return}R(F=>({...F,profilePictureUrl:L})),await n()}catch(Y){console.error("Image upload error:",Y),alert("Failed to upload image. Please try again.")}finally{h(!1)}}},P=async()=>{var U,V,H,Y,B,z,ee,L,$;if(C.orcid){v(null),f(!0);try{const F=Kg(C.orcid);if(!F.isValid){v(F.error||"Invalid ORCID format"),j(!1);return}const te=F.cleanORCID,ue=await fetch(`https://pub.orcid.org/v3.0/${te}`,{headers:{Accept:"application/json"}});if(!ue.ok){ue.status===404?v("ORCID iD not found. Please verify the ORCID iD is correct."):v("Failed to verify ORCID. Please try again."),j(!1);return}const re=await ue.json(),se=((H=(V=(U=re.person)==null?void 0:U.name)==null?void 0:V["given-names"])==null?void 0:H.value)||"",ye=((z=(B=(Y=re.person)==null?void 0:Y.name)==null?void 0:B["family-name"])==null?void 0:z.value)||"";let de="";
532const pe=((L=(ee=re["activities-summary"])==null?void 0:ee.employments)==null?void 0:L["affiliation-group"])||[];if(pe.length>0&&(($=pe[0].summaries)==null?void 0:$.length)>0){const Ie=pe[0].summaries[0]["employment-summary"];Ie&&Ie.organization&&(de=Ie.organization.name||"")}R(Ie=>({...Ie,orcid:te,firstName:se||Ie.firstName,lastName:ye||Ie.lastName,affiliation:de||Ie.affiliation})),j(!0)}catch(F){console.error("ORCID lookup error:",F),v("Network error. Please check your connection and try again."),j(!1)}finally{f(!1)}}},T=async U=>{U.preventDefault(),l(!0);try{const{error:V}=await Ye.auth.updateUser({data:{first_name:C.firstName,last_name:C.lastName,affiliation:C.affiliation,orcid:C.orcid,profile_picture_url:C.profilePictureUrl}});if(V){console.error("Profile update error:",V),alert("Failed to update profile. Please try again.");return}await n(),e(!1)}catch(V){console.error("Profile update error:",V),alert("Failed to update profile. Please try again.")}finally{l(!1)}},O=_||C.profilePictureUrl,M=(()=>{if(C.firstName&&C.lastName)return`${C.firstName.charAt(0)}${C.lastName.charAt(0)}`.toUpperCase();if(C.firstName)return C.firstName.charAt(0).toUpperCase();if(r!=null&&r.email){const U=r.email.split("@")[0];return U.length>=2?U.substring(0,2).toUpperCase():U.charAt(0).toUpperCase()}return"U"})();return o.jsx(hi,{open:t,onOpenChange:e,children:o.jsxs($s,{className:"ph-no-capture max-w-2xl max-h-[90vh] overflow-y-auto",children:[o.jsx(zs,{children:o.jsx(Us,{children:"Edit Profile"})}),o.jsxs("div",{className:"text-center space-y-4",children:[o.jsxs("div",{className:"relative inline-block",children:[o.jsx(L1,{className:"h-32 w-32 ring-4 ring-white shadow-lg",children:O&&O.trim()!==""?o.jsxs(o.Fragment,{children:[o.jsx(e3,{src:O,alt:"Profile",className:"object-cover",onError:U=>{U.currentTarget.style.display="none"}}),o.jsx(kb,{className:"bg-gradient-to-br from-blue-500 to-indigo-600 text-white text-4xl",children:M})]}):o.jsx(kb,{className:"bg-gradient-to-br from-blue-500 to-indigo-600 text-white text-4xl",children:M})}),o.jsx(we,{type:"button",size:"icon",className:"absolute bottom-0 right-0 rounded-full shadow-lg",onClick:()=>{var U;return(U=s.current)==null?void 0:U.click()},disabled:u,children:u?o.jsx(Ds,{className:"h-4 w-4 animate-spin"}):o.jsx(mL,{className:"h-4 w-4"})})]}),o.jsx("input",{ref:s,type:"file",accept:"image/*",className:"hidden",onChange:I}),o.jsx("p",{className:"text-sm text-gray-600",children:"Click the camera icon to upload a profile picture (max 5MB)"})]}),!w&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("p",{className:"text-sm text-gray-600 text-center",children:"Choose how you'd like to set up your profile"}),o.jsx("div",{className:"border rounded-lg p-4 bg-green-50/50 border-green-200 hover:bg-green-50 transition-colors cursor-pointer",onClick:()=>S("orcid"),children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex-shrink-0",children:o.jsx("div",{className:"w-10 h-10 bg-green-100 rounded-full flex items-center justify-center",children:o.jsx(n_,{className:"h-5 w-5 text-green-600"})})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("h4",{className:"font-medium text-sm",children:"Import from ORCID"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Auto-fill your profile from your ORCID record"})]}),o.jsx(we,{type:"button",onClick:()=>S("orcid"),variant:"outline",size:"sm",className:"border-green-300 text-green-700 hover:bg-green-100",children:"Use ORCID"})]})}),o.jsx("div",{className:"border rounded-lg p-4 bg-gray-50/50 border-gray-200 hover:bg-gray-50 transition-colors cursor-pointer",onClick:()=>S("manual"),children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex-shrink-0",children:o.jsx("div",{className:"w-10 h-10 bg-gray-100 rounded-full flex items-center justify-center",children:o.jsx(gC,{className:"h-5 w-5 text-gray-600"})})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("h4",{className:"font-medium text-sm",children:"Manual Entry"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Fill in your details manually"})]}),o.jsx(we,{type:"button",onClick:()=>S("manual"),variant:"outline",size:"sm",className:"border-gray-300 text-gray-700 hover:bg-gray-100",children:"Manual"})]})})]}),w==="orcid"&&o.jsxs("form",{onSubmit:T,className:"space-y-6",children:[o.jsx(we,{type:"button",variant:"ghost",size:"sm",onClick:()=>{S(null),j(!1)},className:"text-gray-600 hover:text-gray-800",children:"← Back to options"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"text-center",children:[o.jsx("h3",{className:"font-medium text-lg",children:"Import from ORCID"}),o.jsx("p",{className:"text-sm text-gray-600",children:"Enter your ORCID to auto-fill your profile"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"orcid",children:"ORCID iD"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Nt,{id:"orcid",value:C.orcid,onChange:U=>A("orcid",U.target.value),placeholder:"0000-0000-0000-0000 or ORCID URL",className:"flex-1"}),o.jsx(we,{type:"button",variant:"outline",onClick:P,disabled:!C.orcid||p,children:p?o.jsx(Ds,{className:"h-4 w-4 animate-spin"}):"Import"})]}),g&&o.jsx("p",{className:"text-sm text-red-600",children:g})]})]}),k&&o.jsx("div",{className:"space-y-4",children:o.jsxs("div",{className:"border-t pt-4",children:[o.jsx("h4",{className:"font-medium text-green-700 mb-3",children:"✓ ORCID Data Imported - Review and Edit"}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"firstName",children:"First Name"}),o.jsx(Nt,{id:"firstName",value:C.firstName,onChange:U=>A("firstName",U.target.value),placeholder:"Enter your first name"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"lastName",children:"Last Name"}),o.jsx(Nt,{id:"lastName",value:C.lastName,onChange:U=>A("lastName",U.target.value),placeholder:"Enter your last name"})]})]}),o.jsxs("div",{className:"space-y-2 mt-4",children:[o.jsx(ft,{htmlFor:"affiliation",children:"Affiliation"}),o.jsx(Nt,{id:"affiliation",value:C.affiliation,onChange:U=>A("affiliation",U.target.value),placeholder:"University, Organization, or Company"})]})]})}),C.orcid&&!g&&o.jsxs("p",{className:"text-sm text-green-600 flex items-center gap-1",children:[o.jsx(n_,{className:"h-3 w-3"}),o.jsx("a",{href:`https://orcid.org/${C.orcid}`,target:"_blank",rel:"noopener noreferrer",className:"underline",children:"View ORCID Profile"})]})]}),w==="manual"&&o.jsxs("form",{onSubmit:T,className:"space-y-6",children:[o.jsx(we,{type:"button",variant:"ghost",size:"sm",onClick:()=>S(null),className:"text-gray-600 hover:text-gray-800",children:"← Back to options"}),o.jsxs("div",{className:"text-center",children:[o.jsx("h3",{className:"font-medium text-lg",children:"Manual Entry"}),o.jsx("p",{className:"text-sm text-gray-600",children:"Fill in your profile details manually"})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"firstName",children:"First Name"}),o.jsx(Nt,{id:"firstName",value:C.firstName,onChange:U=>A("firstName",U.target.value),placeholder:"Enter your first name"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"lastName",children:"Last Name"}),o.jsx(Nt,{id:"lastName",value:C.lastName,onChange:U=>A("lastName",U.target.value),placeholder:"Enter your last name"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"affiliation",children:"Affiliation"}),o.jsx(Nt,{id:"affiliation",value:C.affiliation,onChange:U=>A("affiliation",U.target.value),placeholder:"University, Organization, or Company"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"orcid",children:"ORCID iD (optional)"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Nt,{id:"orcid",value:C.orcid,onChange:U=>A("orcid",U.target.value),placeholder:"0000-0000-0000-0000 or ORCID URL",className:"flex-1"}),o.jsx(we,{type:"button",variant:"outline",onClick:P,disabled:!C.orcid||p,children:p?o.jsx(Ds,{className:"h-4 w-4 animate-spin"}):"Verify"})]}),g&&o.jsx("p",{className:"text-sm text-red-600",children:g}),C.orcid&&!g&&o.jsxs("p",{className:"text-sm text-green-600 flex items-center gap-1",children:[o.jsx(n_,{className:"h-3 w-3"}),o.jsx("a",{href:`https://orcid.org/${C.orcid}`,target:"_blank",rel:"noopener noreferrer",className:"underline",children:"View ORCID Profile"})]})]})]}),w&&o.jsxs(Mo,{children:[o.jsx(we,{variant:"outline",onClick:()=>e(!1),disabled:a,children:"Cancel"}),o.jsxs(we,{onClick:T,disabled:a,children:[a?o.jsx(Ds,{className:"h-4 w-4 animate-spin mr-2"}):null,"Save Changes"]})]})]})})}const lwe=({isOpen:t,onOpenChange:e,feature:r="This feature",description:n="We're working hard to bring you this functionality. Stay tuned!"})=>o.jsx(hi,{open:t,onOpenChange:e,children:o.jsxs($s,{className:"sm:max-w-md",children:[o.jsx(zs,{children:o.jsxs(Us,{className:"flex items-center gap-2",children:[o.jsx(lW,{className:"h-5 w-5 text-amber-500"}),"Coming Soon"]})}),o.jsxs("div",{className:"flex flex-col items-center space-y-4 py-4",children:[o.jsx("div",{className:"rounded-full bg-amber-50 p-3",children:o.jsx(wL,{className:"h-8 w-8 text-amber-500"})}),o.jsxs("div",{className:"text-center space-y-2",children:[o.jsxs("p",{className:"font-medium",children:[r," is coming soon!"]}),o.jsx("p",{className:"text-sm text-muted-foreground",children:n})]}),o.jsx(we,{onClick:()=>e(!1),className:"w-full",children:"Got it"})]})]})});var cwe=Object.defineProperty,wr=(t,e)=>cwe(t,"name",{value:e,configurable:!0}),uwe=["Enter"," "],dwe=["ArrowDown","PageUp","Home"],_B=["ArrowUp","PageDown","End"],hwe=[...dwe,..._B],Hw="Menu",[$j,fwe,pwe]=Tg(Hw),[Ud,bB]=Vn(Hw,[pwe,ap,Qf]),IN=ap(),wB=Qf(),[mwe,av]=Ud(Hw),[gwe,DN]=Ud(Hw),vwe=wr(t=>{const{__scopeMenu:e,open:r=!1,children:n,dir:s,onOpenChange:i,modal:
vendor: 7,083 bytes, line 532
532a=!0}=t,l=IN(e),[u,h]=y.useState(null),p=y.useRef(!1),f=Pn(i),g=du(s);return y.useEffect(()=>{const v=wr(()=>{p.current=!0,document.addEventListener("pointerdown",_,{capture:!0,once:!0}),document.addEventListener("pointermove",_,{capture:!0,once:!0})},"handleKeyDown"),_=wr(()=>p.current=!1,"handlePointer");return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",_,{capture:!0}),document.removeEventListener("pointermove",_,{capture:!0})}},[]),y.useEffect(()=>{if(!r)return;const v=wr(()=>f(!1),"handleBlur");return window.addEventListener("blur",v),()=>window.removeEventListener("blur",v)},[r,f]),o.jsx(W1,{...l,children:o.jsx(mwe,{scope:e,open:r,onOpenChange:f,content:u,onContentChange:h,children:o.jsx(gwe,{scope:e,onClose:y.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:p,dir:g,modal:a,children:n})})})},"Menu"),ywe=y.forwardRef(wr(function(e,r){const{__scopeMenu:n,...s}=e,i=IN(n);return o.jsx(G1,{...i,...s,ref:r})},"MenuAnchor")),xB="MenuPortal",[_we,bwe]=Ud(xB,{forceMount:void 0}),wwe=wr(t=>{const{__scopeMenu:e,forceMount:r,children:n,container:s}=t,i=av(xB,e);return o.jsx(_we,{scope:e,forceMount:r,children:o.jsx(os,{present:r||i.open,children:o.jsx(uw,{asChild:!0,container:s,children:n})})})},"MenuPortal"),Qc="MenuContent",[xwe,SB]=Ud(Qc),Swe=y.forwardRef(wr(function(e,r){const n=bwe(Qc,e.__scopeMenu),{forceMount:s=n.forceMount,...i}=e,a=av(Qc,e.__scopeMenu),l=DN(Qc,e.__scopeMenu);return o.jsx($j.Provider,{scope:e.__scopeMenu,children:o.jsx(os,{present:s||a.open,children:o.jsx($j.Slot,{scope:e.__scopeMenu,children:l.modal?o.jsx(kwe,{...i,ref:r}):o.jsx(Ewe,{...i,ref:r})})})})},"MenuContent")),kwe=y.forwardRef(wr(function(e,r){const n=av(Qc,e.__scopeMenu),s=y.useRef(null),i=Vt(r,s);return y.useEffect(()=>{const a=s.current;if(a)return hw(a)},[]),o.jsx(kB,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Xe(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},"MenuRootContentModal")),Ewe=y.forwardRef(wr(function(e,r){const n=av(Qc,e.__scopeMenu);return o.jsx(kB,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},"MenuRootContentNonModal")),jwe=Ga("MenuContent.ScrollLock"),kB=y.forwardRef(wr(function(e,r){const{__scopeMenu:n,loop:s=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEntryFocus:h,onEscapeKeyDown:p,onPointerDownOutside:f,onFocusOutside:g,onInteractOutside:v,onDismiss:_,disableOutsideScroll:x,...w}=e,S=av(Qc,n),k=DN(Qc,n),j=IN(n),C=wB(n),R=fwe(n),[A,I]=y.useState(null),P=y.useRef(null),T=Vt(r,P,S.onContentChange),O=y.useRef(0),G=y.useRef(""),M=y.useRef(0),U=y.useRef(null),V=y.useRef("right"),H=y.useRef(0),Y=x?zg:y.Fragment,B=x?{as:jwe,allowPinchZoom:!0}:void 0,z=wr(L=>{var de,pe;const $=G.current+L,F=R().filter(Ie=>!Ie.disabled),te=document.activeElement,ue=(de=F.find(Ie=>Ie.ref.current===te))==null?void 0:de.textValue,re=F.map(Ie=>Ie.textValue),se=RB(re,$,ue),ye=(pe=F.find(Ie=>Ie.textValue===se))==null?void 0:pe.ref.current;wr((function Ie(Ne){G.current=Ne,window.clearTimeout(O.current),Ne!==""&&(O.current=window.setTimeout(()=>Ie(""),1e3))}),"updateSearch")($),ye&&setTimeout(()=>ye.focus())},"handleTypeaheadSearch");y.useEffect(()=>()=>window.clearTimeout(O.current),[]),rp();const ee=y.useCallback(L=>{var F,te;return V.current===((F=U.current)==null?void 0:F.side)&&TB(L,(te=U.current)==null?void 0:te.area)},[]);return o.jsx(xwe,{scope:n,searchRef:G,onItemEnter:y.useCallback(L=>{ee(L)&&L.preventDefault()},[ee]),onItemLeave:y.useCallback(L=>{var $;ee(L)||(($=P.current)==null||$.focus(),I(null))},[ee]),onTriggerLeave:y.useCallback(L=>{ee(L)&&L.preventDefault()},[ee]),pointerGraceTimerRef:M,onPointerGraceIntentChange:y.useCallback(L=>{U.current=L},[]),children:o.jsx(Y,{...B,children:o.jsx(cw,{asChild:!0,trapped:i,onMountAutoFocus:Xe(a,L=>{var $;L.preventDefault(),($=P.current)==null||$.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:o.jsx(lw,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:p,onPointerDownOutside:f,onFocusOutside:g,onInteractOutside:v,onDismiss:_,children:o.jsx(EC,{asChild:!0,...C,dir:k.dir,orientation:"vertical",loop:s,currentTabStopId:A,onCurrentTabStopIdChange:I,onEntryFocus:Xe(h,L=>{k.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(K1,{role:"menu","aria-orientation":"vertical","data-state":CB(S.open),"data-radix-menu-content":"",dir:k.dir,...j,...w,ref:T,style:{outline:"none",...w.style},onKeyDown:Xe(w.onKeyDown,L=>{const F=L.target.closest("[data-radix-menu-content]")===L.currentTarget,te=L.ctrlKey||L.altKey||L.metaKey,ue=L.key.length===1;F&&(L.key==="Tab"&&L.preventDefault(),!te&&ue&&z(L.key));const re=P.current;if(L.target!==re||!hwe.includes(L.key))return;L.preventDefault();const ye=R().filter(de=>!de.disabled).map(de=>de.ref.current);_B.includes(L.key)&&ye.reverse(),NB(ye)}),onBlur:Xe(e.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(O.current),G.current="")}),onPointerMove:Xe(e.onPointerMove,$b(L=>{const $=L.target,F=H.current!==L.clientX;if(L.currentTarget.contains($)&&F){const te=L.clientX>H.current?"right":"left";V.current=te,H.current=L.clientX}}))})})})})})})},"MenuContentImpl")),Cwe=y.forwardRef(wr(function(e,r){const{__scopeMenu:n,...s}=e;return o.jsx(it.div,{role:"group",...s,ref:r})},"MenuGroup")),Nwe=y.forwardRef(wr(function(e,r){const{__scopeMenu:n,...s}=e;return o.jsx(it.div,{...s,ref:r})},"MenuLabel")),zj="MenuItem",$2="menu.itemSelect",ON=y.forwardRef(wr(function(e,r){const{disabled:n=!1,onSelect:s,...i}=e,a=y.useRef(null),l=DN(zj,e.__scopeMenu),u=SB(zj,e.__scopeMenu),h=Vt(r,a),p=y.useRef(!1),f=wr(()=>{const g=a.current;if(!n&&g){const v=new CustomEvent($2,{bubbles:!0,cancelable:!0});g.addEventListener($2,_=>s==null?void 0:s(_),{once:!0}),xC(g,v),v.defaultPrevented?p.current=!1:l.onClose()}},"handleSelect");return o.jsx(Pwe,{...i,ref:h,disabled:n,onClick:Xe(e.onClick,f),onPointerDown:g=>{var v;(v=e.onPointerDown)==null||v.call(e,g),p.current=!0},onPointerUp:Xe(e.onPointerUp,g=>{var v;p.current||(v=g.currentTarget)==null||v.click()}),onKeyDown:Xe(e.onKeyDown,g=>{n||g.target!==g.currentTarget||u.searchRef.current!==""&&g.key===" "||uwe.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})},"MenuItem")),Pwe=y.forwardRef(wr(function(e,r){const{__scopeMenu:n,disabled:s=!1,textValue:i,...a}=e,l=SB(zj,n),u=wB(n),h=y.useRef(null),p=Vt(r,h),[f,g]=y.useState(!1),[v,_]=y.useState("");return y.useEffect(()=>{const x=h.current;x&&_((x.textContent??"").trim())},[a.children]),o.jsx($j.ItemSlot,{scope:n,disabled:s,textValue:i??v,children:o.jsx(jC,{asChild:!0,...u,focusable:!s,children:o.jsx(it.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...a,ref:p,onPointerMove:Xe(e.onPointerMove,$b(x=>{s?l.onItemLeave(x):(l.onItemEnter(x),x.defaultPrevented||x.currentTarget.focu
532s({preventScroll:!0}))})),onPointerLeave:Xe(e.onPointerLeave,$b(x=>l.onItemLeave(x))),onFocus:Xe(e.onFocus,()=>g(!0)),onBlur:Xe(e.onBlur,()=>g(!1))})})})},"MenuItemImpl")),Rwe=y.forwardRef(wr(function(e,r){const{checked:n=!1,onCheckedChange:s,...i}=e;return o.jsx(jB,{scope:e.__scopeMenu,checked:n,children:o.jsx(ON,{role:"menuitemcheckbox","aria-checked":_g(n)?"mixed":n,...i,ref:r,"data-state":qw(n),onSelect:Xe(i.onSelect,()=>s==null?void 0:s(_g(n)?!0:!n),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),Awe="MenuRadioGroup",[Twe,Iwe]=Ud(Awe,{value:void 0,onValueChange:wr(()=>{},"onValueChange")}),Dwe=y.forwardRef(wr(function(e,r){const{value:n,onValueChange:s,...i}=e,a=Pn(s);return o.jsx(Twe,{scope:e.__scopeMenu,value:n,onValueChange:a,children:o.jsx(Cwe,{...i,ref:r})})},"MenuRadioGroup")),Owe="MenuRadioItem",Mwe=y.forwardRef(wr(function(e,r){const{value:n,...s}=e,i=Iwe(Owe,e.__scopeMenu),a=n===i.value;return o.jsx(jB,{scope:e.__scopeMenu,checked:a,children:o.jsx(ON,{role:"menuitemradio","aria-checked":a,...s,ref:r,"data-state":qw(a),onSelect:Xe(s.onSelect,()=>{var l;return(l=i.onValueChange)==null?void 0:l.call(i,n)},{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),EB="MenuItemIndicator",[jB,Lwe]=Ud(EB,{checked:!1}),Fwe=y.forwardRef(wr(function(e,r){const{__scopeMenu:n,forceMount:s,...i}=e,a=Lwe(EB,n);return o.jsx(os,{present:s||_g(a.checked)||a.checked===!0,children:o.jsx(it.span,{...i,ref:r,"data-state":qw(a.checked)})})},"MenuItemIndicator")),$we=y.forwardRef(wr(function(e,r){const{__scopeMenu:n,...s}=e;return o.jsx(it.div,{role:"separator","aria-orientation":"horizontal",...s,ref:r})},"MenuSeparator")),zwe="MenuSub",[bke,wke]=Ud(zwe);function CB(t){return t?"open":"closed"}wr(CB,"getOpenState");function _g(t){return t==="indeterminate"}wr(_g,"isIndeterminate");function qw(t){return _g(t)?"indeterminate":t?"checked":"unchecked"}wr(qw,"getCheckedState");function NB(t){const e=document.activeElement;for(const r of t)if(r===e||(r.focus(),document.activeElement!==e))return}wr(NB,"focusFirst");function PB(t,e){return t.map((r,n)=>t[(e+n)%t.length])}wr(PB,"wrapArray");function RB(t,e,r){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=r?t.indexOf(r):-1;let a=PB(t,Math.max(i,0));s.length===1&&(a=a.filter(h=>h!==r));const u=a.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return u!==r?u:void 0}wr(RB,"getNextMatch");function AB(t,e){const{x:r,y:n}=t;let s=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){const l=e[i],u=e[a],h=l.x,p=l.y,f=u.x,g=u.y;p>n!=g>n&&r<(f-h)*(n-p)/(g-p)+h&&(s=!s)}return s}wr(AB,"isPointInPolygon");function TB(t,e){if(!e)return!1;const r={x:t.clientX,y:t.clientY};return AB(r,e)}wr(TB,"isPointerInGraceArea");function $b(t){return e=>e.pointerType==="mouse"?t(e):void 0}wr($b,"whenMouse");var Uwe=vwe,Bwe=ywe,Vwe=wwe,Hwe=Swe,qwe=Nwe,Wwe=ON,Gwe=Rwe,Kwe=Dwe,Ywe=Mwe,Zwe=Fwe,Jwe=$we,Qwe=Object.defineProperty,ro=(t,e)=>Qwe(t,"name",{value:e,configurable:!0}),MN="DropdownMenu",[Xwe,xke]=Vn(MN,[bB]),no=bB(),[e0e,IB]=Xwe(MN),t0e=ro(t=>{const{__scopeDropdownMenu:e,children:r,dir:n,open:s,defaultOpen:i,onOpenChange:a,modal:l=!0}=t,u=no(e),h=y.useRef(null),[p,f]=$i({prop:s,defaultProp:i??!1,onChange:a,caller:MN});return o.jsx(e0e,{scope:e,triggerId:Bn(),triggerRef:h,contentId:Bn(),open:p,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(g=>!g),[f]),modal:l,children:o.jsx(Uwe,{...u,open:p,onOpenChange:f,dir:n,modal:l,children:r})})},"DropdownMenu"),r0e="DropdownMenuTrigger",n0e=y.forwardRef(ro(function(e,r){const{__scopeDropdownMenu:n,disabled:s=!1,...i}=e,a=IB(r0e,n),l=no(n),u=Vt(r,a.triggerRef);return o.jsx(Bwe,{asChild:!0,...l,children:o.jsx(it.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...i,ref:u,onPointerDown:Xe(e.onPointerDown,h=>{!s&&h.button===0&&h.ctrlKey===!1&&(a.onOpenToggle(),a.open||h.preventDefault())}),onKeyDown:Xe(e.onKeyDown,h=>{s||(["Enter"," "].includes(h.key)&&a.onOpenToggle(),h.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(h.key)&&h.preventDefault())})})})},"DropdownMenuTrigger")),s0e=ro(t=>{const{__scopeDropdownMenu:e,...r}=t,n=no(e);return o.jsx(Vwe,{...n,...r})},"DropdownMenuPortal"),i0e="DropdownMenuContent",a0e=y.forwardRef(ro(function(e,r){const{__scopeDropdownMenu:n,...s}=e,i=IB(i0e,n),a=no(n),l=y.useRef(!1);return o.jsx(Hwe,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...s,ref:r,onCloseAutoFocus:Xe(e.onCloseAutoFocus,u=>{var h;l.current||(h=i.triggerRef.current)==null||h.focus(),l.current=!1,u.preventDefault()}),onInteractOutside:Xe(e.onInteractOutside,u=>{const h=u.detail.originalEvent,p=h.button===0&&h.ctrlKey===!0,f=h.button===2||p;(!i.modal||f)&&(l.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),o0e=y.forwardRef(ro(function(e,r){const{__scopeDropdownMenu:n,...s}=e,i=no(n);return o.jsx(qwe,{...i,...s,ref:r})},"DropdownMenuLabel")),l0e=y.forwardRef(ro(function(e,r){const{__scopeDropdownMenu:n,...s}=e,i=no(n);return o.jsx(Wwe,{...i,...s,ref:r})},"DropdownMenuItem")),c0e=y.forwardRef(ro(function(e,r){const{__scopeDropdownMenu:n,...s}=e,i=no(n);return o.jsx(Gwe,{...i,...s,ref:r})},"DropdownMenuCheckboxItem")),u0e=y.forwardRef(ro(function(e,r){const{__scopeDropdownMenu:n,...s}=e,i=no(n);return o.jsx(Kwe,{...i,...s,ref:r})},"DropdownMenuRadioGroup")),d0e=y.forwardRef(ro(function(e,r){const{__scopeDropdownMenu:n,...s}=e,i=no(n);return o.jsx(Ywe,{...i,...s,ref:r})},"DropdownMenuRadioItem")),h0e=y.forwardRef(ro(function(e,r){const{__scopeDropdownMenu:n,...s}=e,i=no(n);return o.jsx(Zwe,{...i,...s,ref:r})},"DropdownMenuItemIndicator")),f0e=y.forwardRef(ro(function(e,r){const{__scopeDropdownMenu:n,...s}=e,i=no(n);return o.jsx(Jwe,{...i,...s,ref:r})},"DropdownMenuSeparator")),p0e=t0e,m0e=n0e,g0e=s0e,v0e=a0e,y0e=o0e,_0e=l0e,b0e=c0e,w0e
532=u0e,x0e=d0e,DB=h0e,S0e=f0e;function LN({...t}){return o.jsx(p0e,{"data-slot":"dropdown-menu",...t})}function FN({...t}){return o.jsx(m0e,{"data-slot":"dropdown-menu-trigger",...t})}function $N({className:t,sideOffset:e=4,...r}){return o.jsx(g0e,{children:o.jsx(v0e,{"data-slot":"dropdown-menu-content",sideOffset:e,className:ke("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),...r})})}function ko({className:t,inset:e,variant:r="default",...n}){return o.jsx(_0e,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":r,className:ke("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n})}function k0e({className:t,children:e,checked:r,...n}){return o.jsxs(b0e,{"data-slot":"dropdown-menu-checkbox-item",className:ke("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),checked:r,...n,children:[o.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:o.jsx(DB,{children:o.jsx(Vl,{className:"size-4"})})}),e]})}function Ske({...t}){return o.jsx(w0e,{"data-slot":"dropdown-menu-radio-group",...t})}function kke({className:t,children:e,...r}){return o.jsxs(x0e,{"data-slot":"dropdown-menu-radio-item",className:ke("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r,children:[o.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:o.jsx(DB,{children:o.jsx(bL,{className:"size-2 fill-current"})})}),e]})}function E0e({className:t,inset:e,...r}){return o.jsx(y0e,{"data-slot":"dropdown-menu-label","data-inset":e,className:ke("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...r})}function zb({className:t,...e}){return o.jsx(S0e,{"data-slot":"dropdown-menu-separator",className:ke("bg-border -mx-1 my-1 h-px",t),...e})}async function j0e(){const{data:{user:t},error:e}=await Ye.auth.getUser();if(e||!t)throw ga("/login");return{user:t}}const ta=({column:t,currentSort:e,onSort:r,children:n,className:s,sortable:i=!0})=>{const a=e.column===t,l=()=>{i&&r(t)},u=()=>i?a?e.direction==="asc"?o.jsx(vL,{className:"h-4 w-4"}):o.jsx(Od,{className:"h-4 w-4"}):o.jsx(I_,{className:"h-4 w-4 opacity-50"}):null;return o.jsx(ml,{className:ke(i&&"cursor-pointer hover:bg-muted/50 select-none","transition-colors",s),onClick:l,children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{children:n}),u()]})})},C0e=(t,e,r="asc")=>{if(t==null&&e==null)return 0;if(t==null)return r==="asc"?-1:1;if(e==null)return r==="asc"?1:-1;if(t instanceof Date||e instanceof Date||typeof t=="string"&&!isNaN(Date.parse(t))||typeof e=="string"&&!isNaN(Date.parse(e))){const a=new Date(t),l=new Date(e),u=a.getTime()-l.getTime();return r==="asc"?u:-u}if(typeof t=="number"&&typeof e=="number"){const a=t-e;return r==="asc"?a:-a}const n=String(t).toLowerCase(),s=String(e).toLowerCase(),i=n.localeCompare(s);return r==="asc"?i:-i},Ww=[{key:"id",label:"Dataset ID",default:!0,required:!0,sortable:!0,width:"w-20"},{key:"filename",label:"Name",default:!0,required:!0,sortable:!0},{key:"status",label:"Status",default:!0,required:!0,sortable:!0,width:"w-32"},{key:"acquisition_date",label:"Acquisition Date",default:!0,sortable:!0,width:"w-36"},{key:"platform",label:"Platform",default:!0,sortable:!0,width:"w-32"},{key:"size",label:"Size",default:!0,sortable:!0,width:"w-24"},{key:"visibility",label:"Visibility",default:!0,sortable:!0,width:"w-28"},{key:"sensor",label:"Sensor",default:!1,sortable:!0,width:"w-32"},{key:"point_count",label:"Point Count",default:!1,sortable:!0,width:"w-32"},{key:"license",label:"License",default:!1,sortable:!0,width:"w-32"},{key:"created_at",label:"Uploaded Date",default:!1,sortable:!0,width:"w-36"},{key:"description",label:"Description",default:!1,sortable:!0},{key:"actions",label:"Actions",default:!0,required:!0,sortable:!1,width:"w-24"}],Kf=8,z2=()=>Ww.filter(t=>t.default).map(t=>t.key),OB=()=>Ww.filter(t=>t.required).map(t=>t.key),U2=t=>t.length<Kf,N0e=({visibleColumns:t,onColumnVisibilityChange:e,canAddMoreColumns:r,requiredColumns:n})=>{const s=Ww.filter(a=>!n.includes(a.key)),i=(a,l)=>{const u=t.includes(a);if(l&&!u){if(!r){qt.warning(`Maximum ${Kf} columns can be visible at once. Deselect one before adding another.`);return}e([...t,a]);return}!l&&u&&e(t.filter(h=>h!==a))};return o.jsxs(LN,{children:[o.jsx(FN,{asChild:!0,children:o.jsxs(we,{variant:"outline",className:"gap-2",children:["Columns",o.jsx(Od,{className:"h-4 w-4"})]})}),o.jsxs($N,{align:"end",className:"w-56",children:[o.jsxs(E0e,{className:"flex items-center justify-between",children:[o.jsx("span",{children:"Visible columns"}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.length,"/",Kf]})]}),o.jsx(zb,{}),o.jsx("div",{className:"max-h-64 overflow-y-auto",children:s.map(a=>{const l=t.includes(a.key);return o.jsx(k0e,{checked:l,onCheckedChange:u=>i(a.key,u===!0),children:a.label},a.key)})}),!r&&o.jsxs(o.Fragment,{children:[o.jsx(zb,{}),o.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"Column limit reached. Remove one to add another."})]})]})]})}
532,P0e=({visibleColumns:t,onColumnVisibilityChange:e,filterText:r,onFilterTextChange:n,onAddDataset:s,canAddMoreColumns:i,requiredColumns:a,showAddDatasetButton:l=!0,filterPlaceholder:u="Filter by filename, title, or ID...",viewControls:h})=>{const{uploadBlocked:p}=gw(),f=p,g=p?"Accept the updated terms to enable uploads (read-only mode).":"Add a new point cloud dataset";return o.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 lg:flex-nowrap",children:[o.jsx(Nt,{value:r,onChange:v=>n(v.target.value),placeholder:u,className:"min-w-40 flex-1 xl:w-48 xl:flex-none"}),h,o.jsx(N0e,{visibleColumns:t,onColumnVisibilityChange:e,canAddMoreColumns:i,requiredColumns:a}),l&&s&&o.jsx(cg,{content:g,disabled:!1,children:o.jsxs(we,{onClick:s,className:"gap-2",disabled:f,children:[o.jsx(Zc,{className:"h-4 w-4"}),"Add Dataset"]})})]})};function um(t){if(t==null||t===""||typeof t=="string"&&(t=t.trim(),t===""))return null;const e=Number(t);return Number.isFinite(e)?e:null}function uk(t){return Math.max(0,Math.min(100,Math.round(t)))}function R0e(t){const e=um(t.progress);if(e!==null)return uk(e);const r=um(t.total_steps)??0,n=um(t.completed_steps)??0;if(r>0){const a=uk(n/r*100);if(a>0)return a}const s=um(t.total_jobs)??0,i=um(t.completed_jobs)??0;return s>0?uk(i/s*100):0}function A0e({dataset:t,isColumnVisible:e,licenseLabel:r,adminEmails:n=[],showAdminEmails:s=!1,getPlatformColor:i,formatFileSize:a,formatDate:l,indented:u=!1,uploads:h,canViewDatasetDetails:p,onEdit:f,onArchive:g,onRestore:v,onAssignCollection:_,onRemoveFromCollection:x,onManageAccess:w,capabilities:S,publications:k=[]}){const j=Vo(),C=S.editMetadata,R=S.manageLifecycle,A=S.manageLifecycle,I=S.manageMembership,P=t,T=P.file_names||[],O=P.item_count||0,G=t.title||T[0]||"Untitled",M=C_(G,$ge),V=t.dataset_items||[],H=O>1||V.length>1,Y=h[t.id],B=!!Y;return o.jsxs(Cm,{children:[e("id")&&o.jsx(Cn,{className:"w-24 font-mono text-xs text-muted-foreground",children:t.id}),e("filename")&&o.jsxs(Cn,{className:`font-medium ${u?"pl-10":""}`,children:[o.jsx("div",{className:"max-w-[22rem] truncate",title:G,children:M}),o.jsx(fde,{items:k,compact:!0}),H&&o.jsxs("div",{className:"text-xs text-muted-foreground",children:[O||V.length," files"]})]}),e("status")&&o.jsx(Cn,{children:(()=>{var L;const z=t;if((Y==null?void 0:Y.phase)==="finalizing")return o.jsxs(_n,{variant:"outline",className:"gap-1.5 text-xs",children:[o.jsx(Ds,{className:"h-3 w-3 animate-spin"}),"Finishing upload"]});if(B&&(Y==null?void 0:Y.phase)==="uploading"){let $=Y.percentage||0;if(Y.files&&Y.files.length>0){const F=Y.files.reduce((te,ue)=>te+ue.percentage,0);$=Math.round(F/Y.files.length)}return o.jsxs("div",{className:"inline-flex items-center gap-2 px-2.5 py-1 rounded-md border bg-blue-50 border-blue-200",children:[o.jsx(mC,{className:"h-3 w-3 text-blue-600 flex-shrink-0"}),o.jsx("span",{className:"text-xs text-blue-700 whitespace-nowrap",children:"Uploading"}),o.jsx(yg,{value:$,className:"h-1.5 w-24 flex-shrink-0 bg-blue-100 [&>*]:bg-blue-500"}),o.jsxs("span",{className:"text-xs text-blue-700 font-medium w-8 text-right",children:[$,"%"]})]})}
532const ee=(L=t.bucket_paths)==null?void 0:L.filter(Boolean).length;if((Y==null?void 0:Y.phase)==="incomplete"||z.status==="uploaded"&&typeof ee=="number"&&O>ee)return o.jsx(_n,{variant:"outline",className:"text-xs text-amber-800 border-amber-300",children:"Upload incomplete"});if(z.status==="queued"||z.status==="uploaded")return o.jsxs(_n,{variant:"outline",className:"text-xs flex items-center gap-1.5 bg-yellow-50 text-yellow-700 border-yellow-200",children:[o.jsx(wL,{className:"h-3 w-3"}),"Pending"]});if(z.status==="processing"||B&&(Y==null?void 0:Y.phase)==="processing"){const $=R0e(t),F=z.status==="processing"&&$>=100?99:$;return o.jsxs("div",{className:"inline-flex items-center gap-2 px-2.5 py-1 rounded-md border bg-purple-50 border-purple-200",children:[o.jsx(Ds,{className:"h-3 w-3 text-purple-600 animate-spin flex-shrink-0"}),o.jsx("span",{className:"text-xs text-purple-700 whitespace-nowrap",children:"Processing"}),o.jsx(yg,{value:F,className:"h-1.5 w-24 flex-shrink-0 bg-purple-100 [&>*]:bg-purple-500"}),o.jsxs("span",{className:"text-xs text-purple-700 font-medium w-8 text-right",children:[F,"%"]})]})}return z.status==="completed"?o.jsxs(_n,{variant:"outline",className:"text-xs flex items-center gap-1.5 bg-green-50 text-green-700 border-green-200",children:[o.jsx(r9,{className:"h-3 w-3"}),"Completed"]}):z.status==="partial"?o.jsxs(_n,{variant:"outline",className:"text-xs flex items-center gap-1.5 bg-amber-50 text-amber-800 border-amber-200",children:[o.jsx(Oo,{className:"h-3 w-3"}),"Partial"]}):z.status==="failed"?o.jsxs(_n,{variant:"outline",className:"text-xs flex items-center gap-1.5 bg-red-50 text-red-700 border-red-200",children:[o.jsx(_L,{className:"h-3 w-3"}),"Failed"]}):o.jsx(_n,{variant:"outline",className:"text-xs flex items-center gap-1.5 bg-gray-50 text-gray-700 border-gray-200",children:"Unknown"})})()}),e("acquisition_date")&&o.jsx(Cn,{className:"text-muted-foreground",children:t.acquisition_date?l(t.acquisition_date):l(t.created_at)}),e("platform")&&o.jsx(Cn,{children:t.platform&&o.jsx(_n,{className:i(t.platform),children:t.platform})}),e("size")&&o.jsx(Cn,{className:"text-muted-foreground",children:a(P.file_size_mb??void 0)}),e("visibility")&&o.jsx(Cn,{children:o.jsx(_n,{variant:"outline",className:"text-xs capitalize",children:t.visibility})}),e("sensor")&&o.jsx(Cn,{className:"text-muted-foreground",children:t.sensor||"Not specified"}),e("point_count")&&o.jsx(Cn,{className:"text-muted-foreground",children:H?V.reduce((z,ee)=>{var L,$;return z+((($=(L=ee.las)==null?void 0:L[0])==null?void 0:$.point_count)||0)},0).toLocaleString():t.point_count?t.point_count.toLocaleString():"-"}),e("license")&&o.jsx(Cn,{className:"text-muted-foreground",children:r?o.jsx("span",{className:"font-mono text-xs",children:r}):"Not specified"}),e("created_at")&&o.jsx(Cn,{className:"text-muted-foreground",children:l(t.created_at)}),e("description")&&o.jsx(Cn,{className:"text-muted-foreground max-w-xs truncate",children:t.description||"-"}),s&&o.jsx(Cn,{className:"ph-mask text-muted-foreground",children:n.length>0?n.join(", "):"-"}),e("actions")&&o.jsx(Cn,{className:"w-[50px]",children:o.jsx("div",{className:"flex justify-end",children:o.jsxs(LN,{children:[o.jsx(FN,{asChild:!0,children:o.jsx(we,{variant:"ghost",size:"icon","aria-label":"More options",children:o.jsx(xL,{className:"h-4 w-4"})})}),o.jsxs($N,{align:"end",children:[!t.archived&&(()=>{const z=!p(t),ee=z?"Details become available once processing has produced a usable result.":void 0;return o.jsxs(ko,{className:"gap-2","aria-disabled":z,disabled:z,title:ee,onClick:()=>{z||j(`/datasets/${t.id}`)},children:[o.jsx(p9,{className:"h-4 w-4"}),"View Details"]})})(),!t.archived&&C&&o.jsxs(ko,{className:"gap-2",onClick:()=>f(t),children:[o.jsx(Zb,{className:"h-4 w-4"}),"Edit"]}),!t.archived&&I&&o.jsxs(ko,{className:"gap-2",onClick:()=>_(t),children:[o.jsx(Tk,{className:"h-4 w-4"}),"Assign to Collection"]}),!t.archived&&I&&P.collection_id!=null&&o.jsxs(ko,{className:"gap-2",onClick:()=>x(t),children:[o.jsx(Tk,{className:"h-4 w-4"}),"Remove from Collection"]}),S.manageAccess&&w&&o.jsxs(ko,{className:"gap-2",onClick:()=>w(t),children:[o.jsx(jL,{className:"h-4 w-4"}),"Manage access"]}),!t.archived&&R&&o.jsxs(o.Fragment,{children:[o.jsx(zb,{}),o.jsxs(ko,{variant:"destructive",onClick:()=>g(t),children:[o.jsx(T_,{className:"h-4 w-4"}),"Archive"]})]}),t.archived&&A&&o.jsxs(ko,{className:"gap-2",onClick:()=>v(t),children:[o.jsx(kL,{className:"h-4 w-4"}),"Restore"]})]})]})})})]},t.id)}function T0e(t){if("details_available"in t&&typeof t.details_available=="boolean")return t.details_available;const e="status"in t?t.status:void 0;return e==="completed"||e==="partial"}function B2({message:t="Loading...",className:e,overlay:r=!1}){return r?o.jsx("div",{className:ke("absolute inset-0 z-40 flex items-center justify-center bg-background/70 backdrop-blur-sm",e),children:o.jsx(Vs,{className:"w-[260px]",children:o.jsxs(zi,{className:"flex items-center gap-3 p-4",children:[o.jsx(Ds,{className:"h-5 w-5 animate-spin text-muted-foreground"}),o.jsx("div",{className:"text-sm",children:t})]})})}):o.jsxs("div",{className:ke("flex items-center justify-center gap-2 py-8 text-sm text-muted-foreground",e),children:[o.jsx(Ds,{className:"h-4 w-4 animate-spin"}),o.jsx("span",{children:t})]})}const I0e=(t,e="asc")=>{const[r,n]=y.useState({column:t,direction:e}),s=y.useCallback(a=>{n(l=>l.column===a?{column:a,direction:l.direction==="asc"?"desc":"asc"}:{column:a,direction:"asc"})},[]),i=y.useCallback(()=>{n({column:t,direction:e})},[t,e]);return{sortConfig:r,handleSort:s,resetSort:i}},dm=t=>{const e=OB(),r=Ww.map(a=>a.key),n=[...e];for(const a of r)!e.includes(a)&&t.includes(a)&&n.push(a);const s=e.length;if(n.length<=Kf)return n;const i=Math.max(0,Kf-s);return[...e,...n.slice(s,s+i)]},D0e=()=>{const[t,e]=y.useState(()=>dm(z2())),r=OB(),n=y.useCallback(u=>{e(dm(u))},[]),s=y.useCallback(u=>t.includes(u),[t]),i=y.useCallback(u=>{e(h=>h.includes(u)?r.includes(u)?h:dm(h.filter(p=>p!==u)):U2(h)?dm([...h,u]):h)},[r]),a=y.useCallback(()=>{e(dm(z2()))},[]),l=U2(t);return{visibleColumns:t,setVisibleColumns:n,isColumnVisible:s,toggleColumn:i,resetToDefault:a,canAddMoreColumns:l,maxColumns:Kf,requiredColumns:r}};function MB(t,e=200){const[r,n]=y.useState(t);return y.useEffect(()=>{const s=window.setTimeout(()=>n(t),e);return()=>window.clearTimeout(s)},[t,e]),r}function O0e(t){const[e,r]=y.useState(!1);return y.useEffect(()=>{if(typeof window>"u")return;const n=window.matchMedia(t),s=()=>r(n.matches);return s(),typeof n.addEventListener=="function"?(n.addEventListener("change",s),(
532)=>n.removeEventListener("change",s)):(n.addListener(s),()=>n.removeListener(s))},[t]),e}const M0e=t=>t.isUploader&&t.includeSegmentation?"contributor_processed_result":"dataset_reuse",L0e=(t={})=>{const{traceId:e,posthogSessionId:r}=vw(t);return{traceId:e,...r?{posthogSessionId:r}:{}}},Eke={intentExpressed(t){es("download_intent_expressed",{dataset_id:String(t),origin_surface:"dataset_detail"})},configurationSubmitted(t){es("download_configuration_submitted",{dataset_id:String(t.datasetId),download_context:M0e({isUploader:t.isUploader,includeSegmentation:t.includeSegmentation}),trace_id:t.traceId})}};async function LB(t){const{data:e,error:r}=await Ye.rpc("has_platform_dataset_admin",{uid:t});if(r)throw r;return!!e}async function jke(t,e){const[r,n]=await Promise.all([LB(t),Zg([e],[])]),s=n.find(i=>i.resource_kind==="dataset"&&i.resource_id===e);return{effectiveDatasetRole:(s==null?void 0:s.effective_role)??null,hasPlatformAdmin:r}}function F0e(t){const e=!!t,r=fr({queryKey:["platform-dataset-admin-access",t],queryFn:()=>LB(t),enabled:e,retry:!1,staleTime:0,refetchOnMount:"always",refetchOnWindowFocus:"always",refetchInterval:Yg,refetchIntervalInBackground:!1});return{hasPlatformDatasetAdmin:e&&r.isSuccess&&r.isFetchedAfterMount?r.data:!1,platformAdminLookupLoading:e&&!r.isFetchedAfterMount&&!r.isError}}function $0e(t,e,{accessManagementEnabled:r,hasPlatformDatasetAdmin:n,showingArchivedResources:s}){return!r||!s?[]:t.filter(i=>i.archived&&(n||e.get(i.id)==="admin"))}function z0e(t){const e=fr({...XC(t),enabled:!!t});return e.isSuccess&&e.data.is_core_team===!0}
532class si extends Error{constructor(r,n,s,i={}){super(n);En(this,"code");En(this,"status");En(this,"details");this.name="AccessApiError",this.code=r,this.status=s,this.details=i}}class U0e{constructor(e){En(this,"baseUrl");this.baseUrl=(e??"https://api.3dtrees.earth"??"http://localhost:8001").replace(/\/+$/,"")}async request(e,r,n){var l,u,h,p;const{data:{session:s}}=await Ye.auth.getSession();if(!(s!=null&&s.access_token))throw new si("authentication_required","Sign in to manage access.",401);if(n&&((l=s.user)==null?void 0:l.id)!==n)throw new si("invalid_session","The signed-in account changed. Reopen access management.",401);const i=await fetch(`${this.baseUrl}${e}`,{...r,signal:(r==null?void 0:r.signal)??AbortSignal.timeout(3e4),headers:{Accept:"application/json",Authorization:`Bearer ${s.access_token}`,...r!=null&&r.body?{"Content-Type":"application/json"}:{},...r==null?void 0:r.headers}}),a=await i.json().catch(()=>({}));if(!i.ok)throw new si(((u=a.error)==null?void 0:u.code)??"request_failed",((h=a.error)==null?void 0:h.message)??"The access request failed.",i.status,(p=a.error)==null?void 0:p.details);return a}async listRoster(e){const r=[];let n=null;const s=new Set;do{const i=new URLSearchParams({limit:"100"});n&&i.set("cursor",n);const a=await this.request(`/v1/access/resources/${e.kind}/${e.uuid}/roster?${i}`);if(r.push(...a.items),n=a.next_cursor,n&&s.has(n))throw new si("invalid_roster_cursor","The access roster could not be loaded completely.",500);n&&s.add(n)}while(n);return r}searchUsers(e,r){const n=new URLSearchParams({q:r,limit:"20"});return this.request(`/v1/access/resources/${e.kind}/${e.uuid}/user-options?${n}`)}getAvailability(){return this.request("/v1/access/availability")}previewRoleBatch(e,r){return this.request("/v1/access/role-batches/preview",{method:"POST",body:JSON.stringify(e)},r)}applyRoleBatch(e,r,n){return this.request("/v1/access/role-batches",{method:"POST",body:JSON.stringify({...e,expected_preview_hash:r})},n)}}const hm=new U0e;function B0e(t,e){return{request_id:crypto.randomUUID(),groups:[{resource_kind:t.kind,resource_ids:[t.uuid],changes:e}]}}const bg={admin:"Admin",editor:"Editor",reader:"Reader"},FB=["admin","editor","reader"],Ub={admin:3,editor:2,reader:1},dk=new Set(["admin_access_required","batch_authorization_failed"]),V0e=new Set(["direct_admin_required","concurrent_change","preview_mismatch","idempotency_conflict","self_admin_change_forbidden"]);function H0e(t){return t?bg[t]:"No access"}function Xc(t){return t==="dataset"?"Dataset":"Collection"}function q0e(t){return t.reduce((e,r)=>!e||Ub[r.role]>Ub[e]?r.role:e,null)}function $B(t,e){return e!==null&&Ub[t]<Ub[e]}function zB(t,e){var a;const r=q0e(t);if(!r)return{role:null,disabledRoleExplanations:void 0};const n=t.find(l=>{var u;return l.role===r&&((u=e==null?void 0:e[l.source_resource_id])==null?void 0:u.name)}),s=n?(a=e==null?void 0:e[n.source_resource_id])==null?void 0:a.name:void 0,i=`inherited ${bg[r]} access from ${s??"a Collection"} is stronger`;return{role:r,disabledRoleExplanations:Object.fromEntries(FB.filter(l=>$B(l,r)).map(l=>[l,i]))}}function W0e(t){var n,s;const r=(t.display_name??t.email).split(/[\s._@-]+/).filter(Boolean);return(((n=r[0])==null?void 0:n[0])??"?").concat(((s=r[1])==null?void 0:s[0])??"").toUpperCase()}function Uj(t,e){return t instanceof si?t.code==="direct_admin_required"?`At least one ${Xc(e??"dataset")} Admin is required`:t.code==="concurrent_change"?"Access changed while you were working. The current roster has been refreshed.":t.code==="preview_mismatch"?"Access changed while you were working. The current roster has been refreshed. Check your changes and apply again.":t.code==="idempotency_conflict"?"This access request conflicts with an earlier request. The current roster has been refreshed. Check your changes and apply again.":t.code==="self_admin_change_forbidden"?"Another Resource Admin or Platform Admin must change your direct Admin access.":t.code==="feature_disabled"?"Access changes are not available yet.":t.code==="reauthentication_required"?"Sign in again before changing access.":t.message:"The access request failed. Try again."}function G0e(t,e,r,n){const s={...t};return r===n?delete s[e.user_id]:s[e.user_id]={userId:e.user_id,email:e.email,displayName:e.display_name,originalRole:n,desiredRole:r},s}function K0e(t,e,r){const n={...t};return r===null?delete n[e.user_id]:n[e.user_id]={userId:e.user_id,email:e.email,displayName:e.display_name,originalRole:r,desiredRole:null},n}function Y0e(t,e){const r={...t};return delete r[e],r}function Z0e(t,e){var s;const r=new Map(e.map(i=>[i.user_id,i])),n={};for(const i of Object.values(t)){const a=r.get(i.userId),l=((s=a==null?void 0:a.direct_grant)==null?void 0:s.role)??null;i.desiredRole!==l&&(n[i.userId]={...i,email:(a==null?void 0:a.email)??i.email,displayName:(a==null?void 0:a.display_name)??i.displayName,originalRole:l})}return n}function J0e(t,e){const r=t.map(i=>{var l,u;const a=e[i.user_id];return{user_id:i.user_id,is_current_user:!!i.is_current_user,email:i.email,display_name:i.display_name,inherited_grants:i.inherited_grants,original_direct_role:((l=i.direct_grant)==null?void 0:l.role)??null,desired_direct_role:a?a.desiredRole:((u=i.direct_grant)==null?void 0:u.role)??null,has_draft:!!a}}),n=new Set(t.map(i=>
532i.user_id)),s=Object.values(e).filter(i=>!n.has(i.userId)&&i.desiredRole!==null).map(i=>({user_id:i.userId,is_current_user:!1,email:i.email,display_name:i.displayName,inherited_grants:[],original_direct_role:null,desired_direct_role:i.desiredRole,has_draft:!0}));return[...r,...s]}function Q0e(t){return Object.values(t).map(e=>e.desiredRole?{subject_email:e.email,action:"set_role",role:e.desiredRole}:{subject_email:e.email,action:"revoke"})}const X0e=DU,exe=AU,txe=IU;function UB({value:t,onChange:e,disabled:r,disabledRoleExplanations:n,label:s,id:i,descriptionId:a,title:l}){return o.jsxs(Bf,{value:t,onValueChange:u=>e(u),disabled:r,children:[o.jsx(Hf,{id:i,"aria-label":s,"aria-describedby":a,title:l,className:"h-9 w-[7.5rem]",children:o.jsx(Vf,{children:bg[t]})}),o.jsx(qf,{align:"end",children:FB.map(u=>{const h=n==null?void 0:n[u];return o.jsxs(Ul,{value:u,disabled:!!h,children:[bg[u],h&&o.jsxs("span",{className:"sr-only",children:[", unavailable: ",h]})]},u)})})]})}function rxe({items:t,rosterCount:e,resourceKind:r,resourceNoun:n,collections:s,loading:i,loadError:a,applying:l,rowErrors:u,rowRef:h,onRetry:p,onRoleChange:f,onRevoke:g,onUndo:v,onOpenCollection:_}){const x=t.filter(S=>S.original_direct_role!==null||S.desired_direct_role!==null),w=t.filter(S=>S.inherited_grants.length>0);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"px-4 pb-1 pt-4 sm:px-6",children:o.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:["Direct access on this ",n]})}),i?o.jsx("div",{"aria-label":"Loading access roster",className:"space-y-2 px-4 py-2 sm:px-6",children:[0,1,2].map(S=>o.jsx(Xu,{className:"h-12 w-full"},S))}):a?o.jsx("div",{className:"px-4 sm:px-6",children:o.jsxs(Bs,{variant:"destructive",children:[o.jsx(Pf,{}),o.jsx(ha,{children:"Access roster could not be loaded"}),o.jsxs(fi,{children:[Uj(a),o.jsx(we,{type:"button",size:"sm",variant:"outline",className:"mt-3 block cursor-pointer",onClick:p,children:"Try again"})]})]})}):e===0?o.jsx("div",{className:"px-4 sm:px-6",children:o.jsxs(Bs,{variant:"destructive",children:[o.jsx(Pf,{}),o.jsx(ha,{children:"No access roster was returned"}),o.jsxs(fi,{children:["Refresh the ",n," before making an access change."]})]})}):o.jsx("ul",{className:"divide-y border-y",children:x.map(S=>o.jsx(sxe,{item:S,resourceKind:r,collections:s,disabled:l,error:u[S.user_id],rowRef:k=>h(S.user_id,k),onRoleChange:k=>f(S,k),onRevoke:()=>g(S),onUndo:()=>v(S.user_id)},S.user_id))}),w.length>0&&o.jsxs(X0e,{className:"mt-6",children:[o.jsxs(exe,{className:"group flex w-full cursor-pointer items-center gap-1.5 px-4 pb-3 text-left sm:px-6",children:[o.jsx(Od,{className:"size-3.5 text-muted-foreground transition-transform group-data-[state=closed]:-rotate-90"}),o.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Inherited from Collections"}),o.jsx(_n,{variant:"secondary",className:"ml-1 h-5 font-normal",children:w.length})]}),o.jsx(txe,{children:o.jsx("ul",{className:"divide-y border-y bg-muted/20",children:w.map(S=>o.jsxs("li",{className:"flex items-center gap-3 px-4 py-2.5 sm:px-6",children:[o.jsx(BB,{item:S}),o.jsx("div",{className:"flex w-[10rem] shrink-0 flex-col sm:w-[17rem]",children:S.inherited_grants.map(k=>o.jsx(nxe,{role:k.role,collection:s==null?void 0:s[k.source_resource_id],fallbackLabel:`Collection ${k.source_resource_id}`,onOpen:()=>_(k.source_resource_id)},`${k.source_resource_id}-${k.role}`))})]},S.user_id))})})]}),o.jsx("div",{className:"h-4"})]})}function BB({item:t}){return o.jsxs(o.Fragment,{children:[o.jsx(L1,{className:"size-8 shrink-0",children:o.jsx(kb,{className:"ph-mask bg-muted text-xs font-medium text-muted-foreground",children:W0e(t)})}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"ph-mask truncate text-sm font-medium",title:t.display_name??void 0,children:t.display_name??t.email}),t.display_name&&o.jsx("span",{className:"ph-mask truncate text-xs text-muted-foreground",title:t.email,children:t.email})]})]})}function nxe({role:t,collection:e,fallbackLabel:r,onOpen:n}){const s=(e==null?void 0:e.name)??r,i=o.jsxs(o.Fragment,{children:[o.jsx(fC,{className:"size-3.5 shrink-0 text-muted-foreground"}),o.jsx("span",{className:"w-[4.5rem] shrink-0 font-medium text-foreground",children:bg[t]}),o.jsx("span",{className:"truncate text-muted-foreground",children:s})]});return e!=null&&e.canManageAccess?o.jsx("button",{type:"button",onClick:n,title:`Manage access for ${s}`,className:"flex cursor-pointer items-center gap-2 rounded-sm py-0.5 text-left text-xs hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&>span:last-child]:text-foreground",children:i}):o.jsx("span",{className:"flex items-center gap-2 py-0.5 text-xs",title:s,children:i})}function sxe({item:t,resourceKind:e,collections:r,disabled:n,error:s,rowRef:i,onRoleChange:a,onRevoke:l,onUndo:u}){const h=t.has_draft&&t.desired_direct_role===null,p=t.is_current_user&&t.original_direct_role==="admin",f=`own-admin-${e}-${t.user_id}`,g="Another Resource Admin or Platform Admin must change your direct Admin access.",{disabledRoleExplanations:v}=e==="dataset"?zB(t.inherited_grants,r):{disabledRoleExplanations:void 0};
532return o.jsxs("li",{children:[o.jsxs("div",{ref:i,tabIndex:-1,className:`flex items-center gap-3 border-l-2 px-4 py-2.5 outline-none focus-visible:ring-2 focus-visible:ring-ring sm:px-6 ${t.has_draft?"border-l-amber-400 bg-amber-50/60 dark:bg-amber-950/20":"border-l-transparent"}`,children:[o.jsx(BB,{item:t}),t.has_draft&&o.jsxs("span",{className:"hidden shrink-0 items-center gap-1.5 text-xs text-muted-foreground sm:flex",children:[o.jsx("span",{className:"line-through",children:H0e(t.original_direct_role)}),o.jsx(eu,{className:"size-3"})]}),h&&o.jsx(_n,{variant:"outline",className:"shrink-0 border-destructive/40 text-destructive",children:"Will be removed"}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[p&&o.jsx("span",{id:f,className:"sr-only",children:g}),h?o.jsx(we,{type:"button",size:"sm",variant:"outline",className:"h-9 cursor-pointer",disabled:n,onClick:u,children:"Undo"}):o.jsxs(o.Fragment,{children:[o.jsx(UB,{value:t.desired_direct_role??t.original_direct_role??"reader",label:`${Xc(e)} role for ${t.email}`,disabled:n||p,descriptionId:p?f:void 0,title:p?g:void 0,disabledRoleExplanations:v,onChange:a}),o.jsx(we,{type:"button",size:"icon",variant:"ghost",className:"size-9 cursor-pointer text-muted-foreground hover:bg-destructive/10 hover:text-destructive","aria-label":t.original_direct_role?`Remove ${Xc(e)} access for ${t.email}`:`Remove pending ${Xc(e)} access for ${t.email}`,disabled:n||p,"aria-describedby":p?f:void 0,title:p?g:void 0,onClick:l,children:o.jsx(pC,{className:"size-4"})})]})]})]}),s&&o.jsx("p",{className:"px-4 pb-2 text-sm text-destructive sm:px-6",children:s})]})}function ixe({emailQuery:t,selectedUser:e,userOptions:r,activeUserOptionIndex:n,optionsLoading:s,optionsError:i,disabled:a,newRole:l,disabledRoleExplanations:u,onNewRoleChange:h,onDismissOptions:p,onEmailQueryChange:f,onSelectUser:g,onActiveOptionChange:v,onAdd:_}){var w;const x=s||r.length>0;return o.jsxs("div",{className:"shrink-0 border-b px-4 py-3 sm:px-6",children:[o.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-end",children:[o.jsxs("div",{className:"relative min-w-0 flex-1 space-y-1.5",children:[o.jsx(ft,{htmlFor:"access-user-email",className:"text-xs text-muted-foreground",children:"Add a registered User"}),o.jsx(Nt,{id:"access-user-email",className:"ph-mask h-9",placeholder:"Search registered accounts…",autoComplete:"off",role:"combobox","aria-autocomplete":"list","aria-expanded":x,"aria-controls":"access-user-options","aria-activedescendant":n>=0?`access-user-option-${(w=r[n])==null?void 0:w.user_id}`:void 0,value:t,disabled:a,onChange:S=>f(S.target.value),onKeyDown:S=>{if(S.key==="Escape"&&x){S.preventDefault(),p();return}r.length!==0&&(S.key==="ArrowDown"?(S.preventDefault(),v((n+1)%r.length)):S.key==="ArrowUp"?(S.preventDefault(),v(n<=0?r.length-1:n-1)):S.key==="Enter"&&n>=0&&(S.preventDefault(),g(r[n])))},"aria-describedby":"access-user-search-status"}),x&&o.jsx("div",{id:"access-user-options",role:"listbox","aria-label":"Registered Users",className:"absolute z-20 mt-1 max-h-48 w-full overflow-y-auto rounded-md border bg-popover p-1 shadow-md",children:s?o.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"Searching..."}):r.map((S,k)=>o.jsx("button",{id:`access-user-option-${S.user_id}`,type:"button",role:"option","aria-label":S.display_name?`${S.display_name} ${S.email}`:S.email,"aria-selected":n===k,className:"ph-mask block w-full cursor-pointer rounded-sm px-3 py-2 text-left text-sm hover:bg-accent focus:bg-accent focus:outline-none",onClick:()=>g(S),onMouseEnter:()=>v(k),children:S.display_name?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"block font-medium",children:S.display_name}),o.jsx("span",{className:"block text-xs text-muted-foreground",children:S.email})]}):S.email},S.user_id))})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(UB,{value:l,label:"Role for new access",id:"new-access-role",disabled:a,disabledRoleExplanations:u,onChange:h}),o.jsxs(we,{type:"button",className:"h-9 flex-1 cursor-pointer sm:flex-none",disabled:!e||a,onClick:_,children:[o.jsx(sW,{className:"size-4"}),"Add access"]})]})]}),o.jsx("div",{id:"access-user-search-status","aria-live":"polite",className:"min-h-5 pt-1 text-sm text-muted-foreground",children:t.trim().length>0&&t.trim().length<3?"Enter at least three characters.":i})]})}const V2="The result could not be confirmed. Apply again to safely check the same change before editing it.";function axe({open:t,resource:e,onOpenChange:r,onPermissionLost:n,onExistingDirectUser:s,onApplied:i}){var ot;const a=lu(),{user:l}=Fg(),u=l==null?void 0:l.id,[h,p]=y.useState(""),[f,g]=y.useState(null),[v,_]=y.useState([]),[x,w]=y.useState(-1),[S,k]=y.useState(!1),[j,C]=y.useState(null),[R,A]=y.useState({}),[I,P]=y.useState(!1),[T,O]=y.useState(null),[G,M]=y.useState({}),U=y.useRef(0),V=MB(h.trim().toLowerCase(),250),H=y.useMemo(()=>["access-attempt",u,e==null?void 0:e.kind,e==null?void 0:e.uuid],[u,e==null?void 0:e.kind,e==null?void 0:e.uuid]),B=fr({queryKey:H,queryFn:()=>null,enabled:!1,initialData:null,gcTime:1/0}).data,z=JSON.stringify([t,u,e==null?void 0:e.kind,e==null?void 0:e.uuid]),ee=y.useRef({scope:z,generation:0});ee.current.scope!==z&&(ee.current={scope:z,generation:ee.current.generation+1});const L=y.useRef(new Set),$=fr({queryKey:["access-availability",u],queryFn:()=>hm.getAvailability(),enabled:t&&!!u,retry:!1,refetchInterval:Yg}),F=((ot=$.data)==null?void 0:ot.mutations_enabled)===!0&&!$.isError,te=I||!!B||!F,ue=y.useMemo(()=>["access-roster",u,e==null?void 0:e.kind,e==null?void 0:e.uuid],[u,e==null?void 0:e.kind,e==null?void 0:e.uuid]),re=fr({queryKey:ue,enabled:t&&!!e&&!!u,queryFn:()=>hm.listRoster(e),retry:!1}),se=y.useMemo(()=>re.data??[],[re.data]),ye=y.useMemo(()=>J0e(se,R),[R,se]),de=()=>{U.current+=1,k(!1),_([]),w(-1)}
532,pe=()=>{p(""),g(null),U.current+=1,_([]),w(-1),k(!1),C(null)},Ie=async()=>(await a.invalidateQueries({queryKey:ue,refetchType:"none"}),(await re.refetch({throwOnError:!0})).data??[]);y.useEffect(()=>{!re.error||!(re.error instanceof si)||dk.has(re.error.code)&&(qt.error("You no longer have permission to manage this resource."),r(!1),n==null||n())},[r,n,re.error]),y.useEffect(()=>{if(!t)return;pe();const De=a.getQueryData(H);A((De==null?void 0:De.drafts)??{}),O(De?V2:null),P(L.current.has(JSON.stringify(H))),M({})},[u,t,e==null?void 0:e.kind,e==null?void 0:e.uuid]),y.useEffect(()=>{if(!t||!e||V.length<3||f){_([]),w(-1),k(!1),V.length<3&&C(null);return}let De=!1;const St=++U.current;return k(!0),C(null),hm.searchUsers(e,V).then(jt=>{De||St!==U.current||(_(jt.items),w(-1),jt.items.length===0&&C("No registered User was found. Access cannot be granted by invitation."))}).catch(jt=>{if(!(De||St!==U.current)){if(jt instanceof si&&dk.has(jt.code)){qt.error("You no longer have permission to manage this resource."),r(!1),n==null||n();return}C(Uj(jt))}}).finally(()=>{!De&&St===U.current&&k(!1)}),()=>{De=!0}},[u,V,r,n,t,e,f]);const Ne=De=>{p(De),g(null),C(null),w(-1)},He=De=>{if(se.find(jt=>jt.user_id===De.user_id&&jt.direct_grant!==null)){g(null),p(De.email),_([]),w(-1);const jt=Xc((e==null?void 0:e.kind)??"dataset");C(`This User already has ${jt} access. Change their ${jt} role in the list below.`),s(De.user_id);return}g(De),p(De.email),_([]),w(-1),C(null)},We=De=>{M(St=>{const jt={...St};return delete jt[De],jt})},at=(De,St,jt)=>{te||(O(null),We(De.user_id),A(Cr=>G0e(Cr,De,St,jt)))},Xt=(De,St)=>{te||(O(null),A(jt=>K0e(jt,De,St)))},Rt=De=>{te||(O(null),A(St=>Y0e(St,De)))},Ee=async(De,St)=>{if(De instanceof si&&V0e.has(De.code)){const jt=await Ie();if(!St())return;A(Cr=>Z0e(Cr,jt))}O(Uj(De,e==null?void 0:e.kind)),De instanceof si&&dk.has(De.code)&&(qt.error("You no longer have permission to manage this resource."),r(!1),await(n==null?void 0:n()))};return{rosterQuery:re,roster:se,editableRoster:ye,drafts:R,applying:I,pendingAttempt:B,editingBlocked:te,mutationsAvailable:F,availabilityQuery:$,mutationError:T,rowErrors:G,emailQuery:h,selectedUser:f,userOptions:v,activeUserOptionIndex:x,optionsLoading:S,optionsError:j,dismissUserOptions:de,resetSelection:pe,selectUser:He,setActiveUserOptionIndex:w,updateEmailQuery:Ne,stageRole:at,stageRevoke:Xt,undoChange:Rt,applyDraft:async()=>{var Or,Nr;if(!e||!u||Object.keys(R).length===0)return;const De=JSON.stringify(H);if(L.current.has(De))return;L.current.add(De);const St=ee.current.generation,jt=()=>St===ee.current.generation,Cr=()=>ee.current.scope===z;P(!0);try{let rr=a.getQueryData(H);if(!rr){const Pr=await $.refetch({throwOnError:!0});if(!jt())return;if(!((Or=Pr.data)!=null&&Or.mutations_enabled))throw new si("feature_disabled","Access changes are not available yet.",503);const At=B0e(e,Q0e(R)),ar=await hm.previewRoleBatch(At,u);if(!jt())return;if((Nr=ar.resources)!=null&&Nr.some(wn=>wn.operations.some(W=>{const ie=R[W.subject_user_id];return!ie||ie.email.trim().toLowerCase()!==W.subject_email.trim().toLowerCase()||ie.originalRole!==W.old_direct_role})))throw new si("concurrent_change","Access changed while you were working.",409);rr={request:At,previewHash:ar.normalized_payload_hash,drafts:R},a.setQueryData(H,rr)}if(await hm.applyRoleBatch(rr.request,rr.previewHash,u),a.setQueryData(H,null),!Cr())return;pe(),i(),A({}),O(null),M({}),qt.success("Access updated.");try{await Ie()}catch{Cr()&&O("Access was updated, but the roster could not be refreshed. Reopen this dialog to load current access.")}}catch(rr){const Pr=!(rr instanceof si)||rr.code==="request_failed"||[401,408,429].includes(rr.status)||rr.status>=500&&rr.code!=="feature_disabled";if(Pr||a.setQueryData(H,null),!Cr())return;if(Pr&&a.getQueryData(H))O(rr instanceof si&&rr.status===401?"The result could not be confirmed. Sign in again with the same account, then apply again to safely check this change.":V2);else try{await Ee(rr,Cr)}catch{if(!Cr())return;O("Current access could not be refreshed. Reopen this dialog before trying again.")}rr instanceof si&&rr.code==="feature_disabled"&&a.setQueryData(["access-availability",u],{mutations_enabled:!1})}finally{L.current.delete(De),Cr()&&P(!1)}},discardDraft:()=>{B||I||(A({}),O(null),M({}))}}}function oxe({open:t,onOpenChange:e,resource:r,hasPlatformAdminAuthority:n=!1,onPermissionLost:s}){var V;const[i,a]=y.useState("reader"),[l,u]=y.useState(null),[h,p]=y.useState(!1),f=y.useRef({}),g=y.useRef(r),v=l??r,_=y.useRef(v);r&&(g.current=r),t&&v&&(_.current=v);const x=r??(t?null:g.current),w=v??(t?x:_.current);y.useEffect(()=>{u(null),p(!1)},[t,r==null?void 0:r.kind,r==null?void 0:r.uuid]);const S=axe({open:t,resource:w,onOpenChange:e,onPermissionLost:s,onExistingDirectUser:H=>{var B;const Y=f.current[H];(B=Y==null?void 0:Y.scrollIntoView)==null||B.call(Y,{block:"nearest"}),Y==null||Y.focus()},onApplied:()=>a("reader")});y.useEffect(()=>{t&&a("reader")},[t,w==null?void 0:w.kind,w==null?void 0:w.uuid]);const k=Object.keys(S.drafts).length,j=k>0,C=!S.rosterQuery.isLoading&&!S.rosterQuery.isError&&S.roster.length>0,R=S.optionsLoading||S.userOptions.length>0,A=y.useRef(R);y.useLayoutEffect(()=>{A.current=R},[R]);const I=(w==null?void 0:w.kind)??"dataset",P=(w==null?void 0:w.kind)??"resource",T=H=>{var B;const Y=(B=x==null?void 0:x.collections)==null?void 0:B[H];if(Y!=null&&Y.canManageAccess){if(j){p(!0);return}p(!1),u({kind:"collection",uuid:H,name:Y.name})}},O=S.selectedUser?S.roster.find(H=>{var Y;return H.user_id===((Y=S.selectedUser)==null?void 0:Y.user_id)}):void 0,G=I==="dataset"&&O?zB(O.inherited_grants,x==null?void 0:x.collections):{role:null,disabledRoleExplanations:void 0};y.useEffect(()=>{G.role&&$B(i,G.role)&&a(G.role)},[i,G.role]);const M=(V=S.roster.find(H=>H.is_current_user))==null?void 0:V.effective_role,U=n&&!S.rosterQuery.isLoading&&!S.rosterQuery.isFetching&&!S.rosterQuery.isError&&S.roster.length>0&&M!=="admin";return o.jsx(hi,{open:t,onOpenChange:H=>!S.applying&&e(H),children:o.jsxs($s,{className:"ph-mask flex h-[min(40rem,calc(100dvh-2rem))] w-[min(44rem,calc(100%-2rem))] max-w-none flex-col overflow-hidden p-0",onEscapeKeyDown:H=>{A.current&&(H.preventDefault(),S.dismissUserOptions())},children:[o.jsxs(zs,{className:"shrink-0 space-y-1 border-b px-4 py-4 pr-12 text-left sm:px-6",children:[o.jsxs(Us,{className:"sr-only",children:["Manage access",w?` for ${w.name}`:""]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l&&o.jsxs(we,{type:"button",variant:"ghost",size:"sm",className:"-ml-2 h-6 cursor-pointer gap-1 px-2 text-xs text-muted-foreground",onClick:()=>u(null),children:[o.jsx(fL,{className:"size-3"}),"Back to ",(x==null?void 0:x.kind)??"resource"]}),o.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Manage access"}),w&&o.jsx(_n,{variant:"secondary",className:"h-5 font-normal",children:Xc(w.kind)}),U&&o.jsx(_n,{variant:"outline",className:"h-5 font-normal",children:"Managing as Platform Admin"})]}),o.jsx(Mi,{asChild:!0,children:o.jsx("p",{className:"ph-mask truncate text-lg font-semibold text-foreground",title:w==null?void 0:w.name,children:w==null?void 0:w.name})})]}),o.jsx(ixe,{emailQuery:S.emailQuery,selectedUser:S.selectedUser,userOptions:S.userOptions,activeUserOptionIndex:S.activeUserOptionIndex,optionsLoading:S.optionsLoading,optionsError:S.optionsError,disabled:S.editingBlocked||!C,newRole:i,disabledRoleExplanations:G.disabledRoleExplanations,onNewRoleChange:a,onDismissOptions:S.dismissUserOptions,onEmailQueryChange:S.updateEmailQuery,onSelectUser:S.selectUser,onActiveOptionChange:S.setActiveUserOptionIndex,onAdd:()=>{S.selectedUser&&(S.stageRole(S.selectedUser,i,null),S.resetSelection(),a("reader"))}}),o.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden",children:[!S.mutationsAvailable&&o.jsx("div",{className:"px-4 pt-4 sm:px-6",role:"status",children:o.jsxs(Bs,{children:[o.jsx(Pf,{}),o.jsx(ha,{children:S.availabilityQuery.isLoading?"Checking whether access changes are available…":S.availabilityQuery.isError?"Access availability could not be checked.":"Access changes are not available yet."}),o.jsxs(fi,{children:["You can view current access. Editing is paused until access changes are available.",S.availabilityQuery.isError&&o.jsx(we,{variant:"link",onClick:()=>void S.availabilityQuery.refetch(),children:"Check again"})]})]})}),S.mutationError&&o.jsx("div",{className:"px-4 pt-4 sm:px-6",children:o.jsxs(Bs,{variant:"destructive",children:[o.jsx(Pf,{}),o.jsx(ha,{children:S.mutationError}),S.mutationError===`At least one ${Xc(I)} Admin is required`&&o.jsxs(fi,{children:["Add another ",Xc(I)," Admin first.",(w==null?void 0:w.kind)==="dataset"&&" A Collection Admin does not satisfy the Dataset requirement."]})]})}),o.jsx(rxe,{items:S.editableRoster,rosterCount:S.roster.length,resourceKind:I,resourceNoun:P,collections:x==null?void 0:x.collections,loading:S.rosterQuery.isLoading,loadError:S.rosterQuery.error,applying:S.editingBlocked,rowErrors:S.rowErrors,rowRef:(H,Y)=>{f.current[H]=Y},onRetry:()=>void S.rosterQuery.refetch(),onRoleChange:(H,Y)=>S.stageRole(H,Y,H.original_direct_role),onRevoke:H=>S.stageRevoke(H,H.original_direct_role),onUndo:S.undoChange,onOpenCollection:T})]}),o.jsxs(Mo,{className:"shrink-0 flex-col items-center gap-2 border-t bg-background px-4 py-3 sm:flex-row sm:justify-between sm:px-6",children:[o.jsx("span",{className:"text-sm text-muted-foreground","aria-live":"polite",children:h?"Apply or discard your changes before opening a Collection.":j?nT(k,"pending change"):"No pending changes"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{type:"button",variant:"ghost",className:"cursor-pointer",disabled:S.applying||j&&!!S.pendingAttempt,onClick:j?S.discardDraft:()=>e(!1),children:j?"Discard":"Cancel"}),o.jsxs(we,{type:"button",className:"cursor-pointer",disabled:!j||S.applying||!S.mutationsAvailable&&!S.pendingAttempt,onClick:()=>void S.applyDraft(),children:[S.applying&&o.jsx(Ds,{className:"animate-spin"}),j?`Apply ${nT(k,"change")}`:"Apply changes"]})]})]})]})})}const lxe=new Set(["queued","processing"]),cxe=100,H2=15e3,q2=5e3,uxe=12e4,dxe=3e4,hxe=600*1e3;function fxe(t,e=cxe){const r=Math.max(1,e),n=[];for(let s=0;s<t.length;s+=r)n.push(t.slice(s,s+r));return n}function pxe({rows:t,hasActiveUpload:e,isDocumentVisible:r,hasRealtimeConnection:n,activeRowsUnchangedSinceMs:s,nowMs:i=Date.now()}){return r?e?n?H2:q2:t.filter(h=>lxe.has(String(h.status??""))).length===0?Yg:(s==null?0:Math.max(0,i-s))<hxe?n?H2:q2:n?uxe:dxe:!1}function mxe(t,e){return{name:t,description:e}}const Jy="__new_collection__",W2=1e3;function VB(t){if(t.status==="expired")return!0;const e=t.expires_at??t.signed_url_expires_at;if(!e)return!1;const r=Date.parse(e);return Number.isFinite(r)&&r<=Date.now()}function gxe(t){return(t.status==="completed"||t.status==="failed_email")&&!VB(t)}async function vxe(){const t=[];let e=0;for(;e!==null;){const r=await hg.list(e);t.push(...r.items),e=r.next_offset}return t}function yxe(){var ac,dv,Jd,Qd;const t=qM(),e=Hs(),r=lu(),[n,s]=y.useState(t.user),[i,a]=y.useState(()=>{const q=new URLSearchParams(e.search).get("tab");return q==="downloads"?"downloads":q==="publications"?"publications":q==="core-team"?"core-team":"datasets"}),[l,u]=y.useState(!1),[h,p]=y.useState(null),[f,g]=y.useState(!1),[v,_]=y.useState("active"),[x,w]=y.useState(0),[S,k]=y.useState([]),[j,C]=y.useState(!1),R=y.useRef(null),A=y.useRef(null),I=y.useRef(null),{uploadBlocked:P}=gw(),T=P;y.useEffect(()=>
532{const q=document.getElementById("account-controls");if(!q)return;const ve=()=>w(Math.ceil(q.getBoundingClientRect().height));if(ve(),typeof ResizeObserver>"u")return;const ut=new ResizeObserver(ve);return ut.observe(q),()=>ut.disconnect()},[]);const[O,G]=y.useState(!1),[M,U]=y.useState(null),[V,H]=y.useState(!1),[Y,B]=y.useState(null),[z,ee]=y.useState(!1),[L,$]=y.useState(!1),F=y.useRef({}),[te,ue]=y.useState(!1),[re,se]=y.useState(null),[ye,de]=y.useState(!1),[pe,Ie]=y.useState("none"),[Ne,He]=y.useState(""),[We,at]=y.useState(""),[Xt,Rt]=y.useState(""),[Ee,Et]=y.useState({}),[Mt,ot]=y.useState(!1),[De,St]=y.useState(null),[jt,Cr]=y.useState(""),[Or,Nr]=y.useState(""),[rr,Pr]=y.useState(null),At=MB(Xt,150),{uploads:ar,removeUploadProgress:wn}=t1(),{requests:W,refreshDownloads:ie}=VX(),{loading:le}=Ql(),[be,je]=y.useState(null),[Be,Te]=y.useState(()=>typeof document>"u"?!0:!document.hidden),Oe=y.useRef(null),[ae,Ge]=y.useState(null),[Ft,or]=y.useState(!1),[Ze,Gt]=y.useState(!1),{sortConfig:_t,handleSort:Kt}=I0e("created_at","desc"),{visibleColumns:zr,setVisibleColumns:ur,isColumnVisible:Tt,canAddMoreColumns:xn,requiredColumns:Ur}=D0e(),Z=n??t.user,J=Z.id,{hasPlatformDatasetAdmin:ce,platformAdminLookupLoading:Se}=F0e(J),_e=z0e(J),Re=(Z==null?void 0:Z.user_metadata)||{},Ke=Re.first_name&&Re.last_name?`${Re.first_name} ${Re.last_name}`:null,Ct=Re.first_name&&Re.last_name?`${Re.first_name.charAt(0)}${Re.last_name.charAt(0)}`.toUpperCase():((ac=Z==null?void 0:Z.email)==null?void 0:ac.charAt(0).toUpperCase())||"U",qe=Re.profile_picture_url,pt=Object.values(ar).some(q=>q.phase==="uploading"||q.phase==="processing"||q.percentage<100),et=i==="core-team"&&ce,kt=v==="archived"&&(i==="datasets"||i==="core-team"),mt=Ze&&Ft,er=et?kt?Ht.datasets.platformAdminArchived(J):Ht.datasets.platformAdmin(J):kt?Ht.datasets.mineArchived(J):Ht.datasets.mine(J),Wr=fr({queryKey:er,enabled:!!J&&(!i||i!=="core-team"||ce),queryFn:et?kt?Nle:Cle:kt?jle:oO,refetchInterval:q=>{const ve=q.state.data??[];return pxe({rows:ve.map(ut=>({id:ut.id,status:ut.status,progress:ut.progress})),hasActiveUpload:pt,isDocumentVisible:Be,hasRealtimeConnection:mt,activeRowsUnchangedSinceMs:ae})},refetchIntervalInBackground:!1}),Bt=y.useMemo(()=>Wr.data??[],[Wr.data]),lr=y.useMemo(()=>Bt.map(q=>q.id),[Bt]),Jt=BU(lr,J),Hn=y.useMemo(()=>{const q=new Map;for(const ve of Jt.data??[])q.set(ve.dataset_id,[...q.get(ve.dataset_id)??[],ve]);return q},[Jt.data]),qs=y.useMemo(()=>lr.join(","),[lr]),cs=y.useMemo(()=>qs?fxe(qs.split(",").map(q=>Number(q))):[],[qs]),vi=qs,Vi=Tt("license"),us=fr({queryKey:["account-dataset-license-map",lr],enabled:Vi&&lr.length>0,queryFn:async()=>{const{data:q,error:ve}=await Ye.from("datasets").select("id, license:licenses(spdx_id)").in("id",lr);if(ve)throw ve;const ut={};for(const sr of q??[]){const Ot=Array.isArray(sr.license)?sr.license[0]:sr.license;Ot!=null&&Ot.spdx_id&&(ut[sr.id]=Ot.spdx_id)}return ut}}),Hi=y.useMemo(()=>us.data??{},[us.data]),ln=fr({queryKey:et?Ht.collections.allForPlatformAdmin(J):Ht.collections.mine(J),enabled:!!J&&!le,queryFn:async()=>et?Ba.listAllCollections({scope:"all",includeArchived:!0}):Ba.listAllCollections({includeArchived:!0}),refetchInterval:Yg,refetchIntervalInBackground:!1}),Sa=Wr.isLoading,tn=fr({queryKey:Ht.datasets.mine(J),enabled:!!J,queryFn:oO}),Ko=y.useMemo(()=>(tn.data??[]).map(q=>q.id),[tn.data]),Yt=fr({queryKey:["account-admin-roles",J,Ko],enabled:tn.isSuccess,queryFn:()=>Zg(Ko,[])}),Sn=y.useMemo(()=>{const q=new Set((Yt.data??[]).filter(ve=>ve.resource_kind==="dataset"&&ve.effective_role==="admin").map(ve=>ve.resource_id));return(tn.data??[]).filter(ve=>q.has(ve.id))},[Yt.data,tn.data]),ts=fr({queryKey:["account-dataset-reach",J],enabled:!!J,queryFn:Yde,staleTime:300*1e3}),pn=fr({queryKey:["publications",J,"all"],enabled:!!J,queryFn:vxe,refetchInterval:15e3,refetchIntervalInBackground:!1}),yi=y.useMemo(()=>Sn.map(q=>q.id),[Sn]),xs=fr({queryKey:["account-upload-dois",yi],enabled:Yt.isSuccess,queryFn:()=>Zde(yi),staleTime:300*1e3}),Rr=y.useMemo(()=>{const q=new Set(yi);return[...new Set([...(pn.data??[]).filter(ve=>ve.doi&&ve.dataset_ids.some(ut=>q.has(ut))).map(ve=>ve.doi.toLowerCase()),...(xs.data??[]).map(ve=>ve.doi.toLowerCase())])].sort()},[yi,pn.data,xs.data]),ka=fr({queryKey:["account-doi-citations",Rr],enabled:pn.isSuccess&&Yt.isSuccess&&xs.isSuccess,queryFn:()=>Jde(Rr),staleTime:3600*1e3}),rc=(pn.data??[]).filter(q=>q.can_retry).length,Bd=W.filter(gxe).length,qi=y.useMemo(()=>ln.data??[],[ln.data]),nc=fr({queryKey:Ht.datasets.adminEmails(J,Bt.map(q=>q.id)),enabled:et&&Bt.length>0,queryFn:()=>dpe(Bt.map(q=>q.id))}),cp=y.useMemo(()=>{const q=new Map;for(const ve of nc.data??[])q.set(ve.dataset_id,ve.admin_emails);return q},[nc.data]),sc=y.useMemo(()=>new Map(qi.map(q=>
532[q.id,q.name])),[qi]),nr=y.useMemo(()=>new Map(qi.map(q=>[q.id,q])),[qi]),{datasetAccessRoleById:Vd,collectionAccessRoleById:gu,manageAccessCollections:up,selectableCollections:vu}=fpe({userId:J,datasetIds:lr,collections:qi,hasPlatformDatasetAdmin:ce,showingPlatformAdminDatasets:et}),dp=fr({queryKey:["publication-capabilities",J],queryFn:hg.capabilities,enabled:!!J&&h!==null}),_i=fr({queryKey:["account-publication-selection",J,h,et,ce],enabled:h!==null,queryFn:()=>{if(!h)throw new Error("Select datasets to prepare publication.");const q=et&&ce;return"collectionId"in h?ppe(h.collectionId,sc,q):R3(h.datasetIds,sc,q)},staleTime:0,gcTime:0,retry:!1,refetchOnWindowFocus:!1});y.useEffect(()=>{u(!1),p(null)},[J,i,v]);const Yo=O0e("(min-width: 1024px)"),Hd=y.useMemo(()=>{if(pe==="none")return"No collection";if(pe===Jy)return"Create new collection...";const q=vu.find(ve=>String(ve.id)===pe);return(q==null?void 0:q.name)??"Select collection"},[pe,vu]),so=y.useMemo(()=>[{value:"none",label:"No collection",group:"options"},...vu.map(q=>({value:String(q.id),label:q.name,searchText:`${q.name} ${q.description??""}`,group:"options"})),{value:Jy,label:"Create new collection...",group:"actions",icon:o.jsx(Zc,{className:"mr-2 h-4 w-4"})}],[vu]),Wi=y.useMemo(()=>{const q=At.trim().toLowerCase();return q?Bt.filter(ve=>{const ut=ve,sr=ve,Ot=[...ut.file_names??[],sr.file_name??"",...(sr.dataset_items??[]).map(bi=>bi.file_name??"")].join(" ").toLowerCase(),Gr=(ve.title??"").toLowerCase(),yr=String(ve.id),Ln=(cp.get(ve.id)??[]).join(" ").toLowerCase();return Gr.includes(q)||Ot.includes(q)||yr.includes(q)||Ln.includes(q)}):Bt},[Bt,At,cp]),Ea=y.useMemo(()=>{if(!_t.column)return Wi;const q=(ve,ut)=>{var Ot;const sr=ve;switch(ut){case"filename":return ve.title||((Ot=sr.file_names)==null?void 0:Ot[0])||"";case"status":return sr.status||"";case"acquisition_date":return ve.acquisition_date||ve.created_at;case"platform":return ve.platform||"";case"size":return sr.file_size_mb??null;case"visibility":return ve.visibility||"";case"sensor":return ve.sensor||"";case"point_count":return ve.point_count??null;case"license":return Hi[ve.id]??"";case"created_at":return ve.created_at;case"id":return ve.id;case"description":return ve.description||"";default:return null}};return[...Wi].sort((ve,ut)=>{const sr=C0e(q(ve,_t.column),q(ut,_t.column),_t.direction);return sr!==0?sr:ve.id-ut.id})},[Wi,_t,Hi]),ja=y.useMemo(()=>{const q=new Map;for(const Ot of Ea){const yr=Ot.collection_id??null,Ln=yr==null?"unassigned":`collection-${yr}`;if(!q.has(Ln)){const bi=yr==null?"Single datasets":sc.get(yr)??`Collection #${yr}`;q.set(Ln,{label:C_(bi,y2),fullLabel:bi,collectionId:yr,datasets:[]})}q.get(Ln).datasets.push(Ot)}const ve=$0e(qi,gu,{accessManagementEnabled:_e,hasPlatformDatasetAdmin:ce,showingArchivedResources:kt});for(const Ot of ve){const Gr=`collection-${Ot.id}`;q.has(Gr)||q.set(Gr,{label:C_(Ot.name,y2),fullLabel:Ot.name,collectionId:Ot.id,datasets:[]})}const ut=Array.from(q.values()).filter(Ot=>Ot.collectionId!=null),sr=q.get("unassigned");return[...ut,...sr?[sr]:[]]},[_e,gu,sc,qi,ce,kt,Ea]),yu=y.useCallback(q=>{Et(ve=>({...ve,[q]:!ve[q]}))},[]),io=y.useMemo(()=>["filename","status","acquisition_date","platform","size","visibility","sensor","point_count","license","created_at","id","description","actions"].filter(ve=>Tt(ve)).length+(et?1:0),[Tt,et]);y.useLayoutEffect(()=>{const q=document.querySelector('[data-testid="datasets-table"]'),ve=q==null?void 0:q.parentElement;if(!q||!ve)return;const ut=Array.from(q.querySelectorAll("thead th")),sr=()=>{I.current&&(I.current.style.transform=`translateX(-${ve.scrollLeft}px)`)},Ot=()=>{const yr=ut.map(Ln=>Ln.getBoundingClientRect().width);k(Ln=>Ln.length===yr.length&&Ln.every((bi,oc)=>bi===yr[oc])?Ln:yr),sr()};Ot();const Gr=new ResizeObserver(Ot);return Gr.observe(q),ut.forEach(yr=>Gr.observe(yr)),ve.addEventListener("scroll",sr,{passive:!0}),()=>{Gr.disconnect(),ve.removeEventListener("scroll",sr)}},[i,ja.length,Sa,zr]),y.useLayoutEffect(()=>{const q=R.current,ve=A.current;if(!q||!ve){C(!1);return}const ut=()=>{const sr=parseFloat(getComputedStyle(ve).top),Ot=q.getBoundingClientRect().top<=sr+.5;C(Gr=>Gr===Ot?Gr:Ot)};return ut(),window.addEventListener("scroll",ut,{passive:!0}),window.addEventListener("resize",ut),()=>{window.removeEventListener("scroll",ut),window.removeEventListener("resize",ut)}},[i,ja.length,Sa,x,Yo]);const ao=y.useCallback(async()=>{await Promise.all([r.invalidateQueries({queryKey:Ht.datasets.mine(J)}),r.invalidateQueries({queryKey:Ht.datasets.mineArchived(J)}),r.invalidateQueries({queryKey:Ht.datasets.platformAdmin(J)}),r.invalidateQueries({queryKey:Ht.datasets.platformAdminArchived(J)}),r.invalidateQueries({queryKey:["datasets","admin-emails"]}),r.invalidateQueries({queryKey:["account-dataset-license-map"]})])},[r,J]),oo=y.useCallback(async()=>{await Promise.all([r.invalidateQueries({queryKey:Ht.datasets.mine(J)}),r.invalidateQueries({queryKey:Ht.datasets.mineArchived(J)}),r.invalidateQueries({queryKey:Ht.datasets.platformAdmin(J)}),r.invalidateQueries({queryKey:Ht.datasets.platformAdminArchived(J)}),r.invalidateQueries({queryKey:Ht.collections.mine(J)}),r.invalidateQueries({queryKey:Ht.collections.allForPlatformAdmin(J)}),r.invalidateQueries({queryKey:["datasets","admin-emails"]}),r.invalidateQueries({queryKey:["account-resource-roles"]})])},[r,J]);y.useEffect(()=>{if(typeof document>"u")return;const q=()=>{Te(!document.hidden)};return document.addEventListener("visibilitychange",q),()=>{document.removeEventListener("visibilitychange",q)}},[]),y.useEffect(()=>{let q=!0;const ve=[],ut=cs.flatMap(()=>[!1,!1]);if(!J)return or(!1),Gt(!1),()=>{q=!1};or(cs.length===0),Gt(!1),cs.forEach((Ot,Gr)=>{const yr=[{table:"galaxy_workflow_invocations",name:"workflow_invocation_changes"},{table:"dataset_read_revisions",name:"dataset_read_revisions"}];yr.forEach((Ln,bi)=>{const oc=Gr*yr.length+bi,Zw=Ye.channel(`${Ln.name}_${et?"platform_admin":J}_${Gr}`).on("postgres_changes",{event:"*",schema:"public",table:Ln.table,filter:`dataset_id=in.(${Ot.join(",")})`},()=>{q&&ao()});ve.push(FE(Zw,()=>{q&&ut.every(Boolean)&&ao()},Jw=>{q&&(ut[oc]=Jw,or(ut.every(Boolean)))}))})});const sr=Ye.channel(et?"datasets_platform_admin":`datasets_${J}`).on("postgres_changes",{event:"*",schema:"public",table:"datasets"},()=>{q&&ao()});return ve.push(FE(sr,()=>{q&&ao()},Ot=>{q&&Gt(Ot)})),()=>{q=!1,ve.forEach(Ot=>Ot())}},[ao,et,J,cs,vi]),y.useEffect(()=>{const q=Bt.map(ut=>ut).filter(ut=>ut.status==="queued"||ut.status==="processing").sort((ut,sr)=>ut.id-sr.id);if(q.length===0){Oe.current=null,Ge(null);return}const ve=q.map(ut=>`${ut.id}:${ut.status}:${ut.progress??""}`).join("|");Oe.current!==ve&&(Oe.current=ve,Ge(Date.now()))},[Bt]),y.useEffect(()=>{for(const q of Bt){const ve=q;ar[q.id]&&(ve.status==="completed"||ve.status==="partial"||ve.status==="failed")&&wn(q.id)}},[Bt,ar,wn]),y.useEffect(()=>{var ve;const q=F.current;for(const ut of Bt){const sr=ut,Ot=sr.status??null,Gr=q[ut.id];if(Gr&&Gr!==Ot){const yr=((ve=sr.title)==null?void 0:ve.trim())||`Dataset ${ut.id}`;Ot==="processing"?qt.message(`Processing started: ${yr}`):Ot==="completed"?qt.success(`Processing completed: ${yr}`):Ot==="partial"?qt.warning(`Processing finished with partial results: ${yr}`):Ot==="failed"&&qt.error(`Processing failed: ${yr}`)}q[ut.id]=Ot}},[Bt]);const _u=q=>q?q<1024?`${q} MB`:`${(q/1024).toFixed(1)}
532 GB`:"Unknown",ov=q=>new Date(q).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),hp=q=>q?new Date(q).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-",qd=q=>{const ve=[];return q.include_raw&&ve.push("raw"),q.include_segmentation&&ve.push("segmentation"),q.include_supplementary&&ve.push("supplementary"),ve.length>0?ve.join(" + "):"archive"},lv=q=>{switch(q){case"completed":return"bg-green-50 text-green-700 border-green-200";case"failed":case"failed_email":return"bg-red-50 text-red-700 border-red-200";case"processing":return"bg-blue-50 text-blue-700 border-blue-200";case"pending":return"bg-yellow-50 text-yellow-700 border-yellow-200";case"expired":return"bg-gray-100 text-gray-700 border-gray-200";default:return""}},Gw=async q=>{je(q.id);try{const ve=L0e(),{redirect_url:ut}=await ow.startDownload(q.id,"account",ve);window.open(ut,"_blank","noopener,noreferrer")}catch(ve){qt.error(T3(ve,"Failed to open download archive"))}finally{je(null)}};y.useEffect(()=>{const q=new URLSearchParams(e.search).get("tab");if(q==="publications"){a("publications");return}if(q==="downloads"){a("downloads");return}if(q==="core-team"){a("core-team");return}if(e.hash==="#downloads"){a("downloads");return}a("datasets")},[e.hash,e.search]),y.useEffect(()=>{i==="downloads"&&ie()},[i,ie]),y.useEffect(()=>{i==="core-team"&&!Se&&!ce&&a("datasets")},[i,Se,ce]);const bu=q=>{switch(q){case"TLS":return"bg-blue-100 text-blue-800";case"MLS":return"bg-green-100 text-green-800";case"ULS":return"bg-purple-100 text-purple-800";default:return"bg-gray-100 text-gray-800"}},wu=q=>{"authors"in q&&"funding"in q||console.warn("Legacy dataset format passed to edit, may be missing authors/funding"),U(q),G(!0)},ic=q=>{B(q),H(!0)},Wd=async q=>{const ve=await Rs.restoreDataset(q.id);if(!ve.success){qt.error(ve.error||"Failed to restore Dataset");return}qt.success("Dataset restored"),await ao()},Kw=q=>{se(q);const ve=q.collection_id;ve==null?Ie("none"):Ie(String(ve)),de(!1),He(""),at(""),ue(!0)},Yw=async q=>{try{await Ba.assignDatasetToCollection(q.id,null,Lm()),qt.success("Dataset removed from collection"),await oo()}catch(ve){qt.error(ve instanceof Error?ve.message:"Failed to remove dataset from collection")}},fp=async()=>{if(re)try{let q=null;if(pe===Jy){const ve=nf(Ne,El);if(!ve)throw new Error("Collection name is required");q=(await Ba.createCollection(mxe(ve,nf(We,jl)||null))).id}else pe!=="none"&&(q=Number(pe));await Ba.assignDatasetToCollection(re.id,q,Lm()),qt.success(q?"Dataset assigned to collection":"Dataset unassigned"),ue(!1),se(null),await oo()}catch(q){qt.error(q instanceof Error?q.message:"Failed to update collection assignment")}},Gd=y.useCallback(q=>{const ve=nr.get(q);ve&&(St(q),Cr(ve.name),Nr(ve.description??""),ot(!0))},[nr]),pp=async()=>{if(De==null)return;const q=nf(jt,El);if(!q){qt.error("Collection name is required");return}try{await Ba.updateCollection(De,{name:q,description:nf(Or,jl)||null}),qt.success("Collection updated"),ot(!1),await oo()}catch(ve){qt.error(ve instanceof Error?ve.message:"Failed to update collection")}},cv=async(q,ve)=>{if(window.confirm(`Archive collection "${ve}"? Datasets will be unassigned.`))try{await Ba.archiveCollection(q,Lm()),qt.success("Collection archived"),await oo()}catch(sr){qt.error(sr instanceof Error?sr.message:"Failed to archive collection")}},lo=q=>{var ut;const ve=q.uuid;if(!ve){qt.error("This Dataset cannot be identified for access management.");return}Pr({kind:"dataset",uuid:ve,name:((ut=q.title)==null?void 0:ut.trim())||`Dataset ${q.id}`,collections:up})},mp=q=>{const ve=nr.get(q);if(!ve){qt.error("This Collection cannot be identified for access management.");return}Pr({kind:"collection",uuid:ve.uuid,name:ve.name})},Zo=q=>P3(q,{hasPlatformDatasetAdmin:ce,showingPlatformAdminDatasets:et}),uv=new Set(Bt.filter(q=>!q.archived&&Zo(Vd.get(q.id)??null).managePublication).map(q=>q.id)),Kd=new Set(Bt.filter(q=>!q.archived).map(q=>q.collection_id).filter(q=>q!=null)),Yd=q=>{const ve=nr.get(q);return ve!==void 0&&!ve.archived&&Kd.has(q)&&Zo(gu.get(q)??null).managePublication},gp=Bt.filter(q=>uv.has(q.id)).map(q=>{var ve;return{id:q.id,title:((ve=q.title)==null?void 0:ve.trim())||`Dataset ${q.id}`,collectionId:q.collection_id??null}}),Ss=qi.filter(q=>!q.archived).map(q=>({id:q.id,name:q.name,publishable:Yd(q.id),activeDatasetCount:Bt.length>=W2?null:Bt.filter(ve=>!ve.archived&&ve.collection_id===q.id).length})),Jo=()=>u(!0),Zd=o.jsxs(Cm,{children:[Tt("id")&&o.jsx(ta,{column:"id",currentSort:_t,onSort:Kt,className:"w-24",children:"Dataset ID"}),Tt("filename")&&o.jsx(ta,{column:"filename",currentSort:_t,onSort:Kt,children:"Name"}),Tt("status")&&o.jsx(ta,{column:"status",currentSort:_t,onSort:Kt,className:"w-32",children:"Status"}),Tt("acquisition_date")&&o.jsx(ta,{column:"acquisition_date",currentSort:_t,onSort:Kt,className:"w-36",children:"Acquisition Date"}),Tt("platform")&&o.jsx(ta,{column:"platform",currentSort:_t,onSort:Kt,className:"w-32",children:"Platform"}),Tt("size")&&o.jsx(ta,{column:"size",currentSort:_t,onSort:Kt,className:"w-24",children:"Size"}),Tt("visibility")&&o.jsx(ta,{column:"visibility",currentSort:_t,onSort:Kt,className:"w-28",children:"Visibility"}),Tt("sensor")&&o.jsx(ta,{column:"sensor",currentSort:_t,onSort:Kt,className:"w-32",children:"Sensor"}),Tt("point_count")&&o.jsx(ta,{column:"point_count",currentSort:_t,onSort:Kt,className:"w-32",children:"Point Count"}),Tt("license")&&o.jsx(ta,{column:"license",currentSort:_t,onSort:Kt,className:"w-32",children:"License"}),Tt("created_at")&&o.jsx(ta,{column:"created_at",currentSort:_t,onSort:Kt,className:"w-36",children:"Uploaded Date"}),Tt("description")&&o.jsx(ta,{column:"description",currentSort:_t,onSort:Kt,className:"w-[24rem]",children:"Description"}),et&&o.jsx(ml,{className:"w-64",children:"Resource Admin Emails"}),Tt("actions")&&o.jsx(ml,{className:"w-[50px]",children:"Actions"})]});return o.jsxs(zU,{maxWidth:"full",children:[l&&o.jsx(ipe,{open:!0,datasets:gp,collections:Ss,onCancel:()=>u(!1),onContinue:q=>{u(!1),p(q)}}),h&&(_i.data?o.jsx(upe,{datasets:_i.data.datasets,initialAuthors:_
532i.data.authors,initialDescription:_i.data.description,capabilities:dp.data,availabilityError:(dv=dp.error)==null?void 0:dv.message,onSubmit:async(q,ve)=>{await hg.create(ve,_i.data.datasets,q),p(null),a("publications"),await r.invalidateQueries({queryKey:["publications",J]})},onClose:()=>p(null)},JSON.stringify(h)):o.jsx(hi,{open:!0,onOpenChange:q=>{q||p(null)},children:o.jsxs($s,{children:[o.jsxs(zs,{children:[o.jsx(Us,{children:"Prepare publication"}),o.jsx(Mi,{children:_i.isError?"Could not prepare the selected datasets.":"Loading raw-file metadata, authors, licenses and your current access."})]}),_i.isError?o.jsx("p",{role:"alert",className:"text-sm text-destructive",children:_i.error.message}):o.jsx(B2,{message:"Loading publication details…"}),o.jsxs(Mo,{children:[o.jsx(we,{variant:"outline",onClick:()=>p(null),children:"Close"}),_i.isError&&o.jsx(we,{onClick:()=>void _i.refetch(),children:"Try again"})]})]})})),o.jsxs("div",{className:"pt-4 pb-8",children:[o.jsx(Cde,{name:Ke||((Jd=Z==null?void 0:Z.email)==null?void 0:Jd.split("@")[0])||"Your account",email:Z==null?void 0:Z.email,initials:Ct,pictureUrl:qe,affiliation:Re.affiliation,orcid:Re.orcid,memberSince:ov(Z==null?void 0:Z.created_at),journey:Yt.isSuccess&&pn.isSuccess&&xs.isSuccess?Ade(Sn,pn.data,(((Qd=tn.data)==null?void 0:Qd.length)??0)>=W2,ts.data,ka.data,xs.data):null,journeyFailed:tn.isError||Yt.isError||pn.isError||xs.isError,isNewContributor:Yt.isSuccess&&Sn.length===0,uploadsAvailable:!T,onEditProfile:()=>$(!0)}),o.jsxs(Vs,{className:"gap-0 py-0",children:[o.jsxs(va,{id:"account-controls",className:`z-30 gap-3 rounded-t-xl border-b bg-card px-4 py-4 sm:px-6 ${Yo?"sticky":""}`,style:Yo?{top:"var(--app-header-height, 57px)"}:void 0,children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ka,{className:"text-base sm:text-lg",children:i==="datasets"?"My Datasets":i==="core-team"?"Core Team Datasets":i==="publications"?"Publications":"Downloads"}),i!=="publications"&&o.jsx(_n,{variant:"secondary",children:i==="downloads"?W.length:Bt.length})]}),o.jsxs("div",{className:"flex flex-col gap-3 xl:flex-row xl:items-center xl:justify-between",children:[o.jsx(Dg,{value:i,onValueChange:q=>a(q),children:o.jsxs(Og,{children:[o.jsx(Is,{value:"datasets",children:"My Datasets"}),ce&&o.jsx(Is,{value:"core-team",children:"Core Team"}),o.jsxs(Is,{value:"downloads",className:"gap-1.5",children:["Downloads",o.jsx(G2,{count:Bd,label:"ready to download"})]}),o.jsxs(Is,{value:"publications",className:"gap-1.5",children:["Publications",o.jsx(G2,{count:rc,label:"need attention"})]})]})}),(i==="datasets"||i==="core-team")&&o.jsx(P0e,{visibleColumns:zr,onColumnVisibilityChange:ur,filterText:Xt,onFilterTextChange:Rt,onAddDataset:i==="datasets"&&!kt?()=>g(!0):void 0,canAddMoreColumns:xn,requiredColumns:Ur,showAddDatasetButton:i==="datasets"&&!kt,filterPlaceholder:i==="core-team"?"Filter by filename, title, ID, or Resource Admin email...":void 0,viewControls:o.jsxs(Bf,{value:v,onValueChange:q=>_(q),children:[o.jsx(Hf,{"aria-label":"Dataset lifecycle",className:"w-28",children:o.jsx(Vf,{})}),o.jsxs(qf,{children:[o.jsx(Ul,{value:"active",children:"Active"}),o.jsx(Ul,{value:"archived",children:"Archived"})]})]})}),i==="publications"&&gp.length>0&&o.jsxs(we,{className:"gap-2 self-start xl:self-auto",onClick:()=>Jo(),children:[o.jsx(Zc,{className:"size-4"}),"New publication"]})]})]}),o.jsxs(zi,{className:"px-2 py-4 sm:px-6",children:[Jt.isError&&(i==="datasets"||i==="core-team")&&o.jsxs("p",{role:"alert",className:"mb-4 text-sm",children:["Publication citations could not be loaded."," ",o.jsx("button",{className:"underline",onClick:()=>void Jt.refetch(),children:"Try again"})]}),i==="datasets"&&!kt&&o.jsx(Zbe,{currentUserId:J,onRecovered:()=>void oo()}),(i==="datasets"||i==="core-team")&&!Sa&&ja.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:R,"aria-hidden":"true",className:"h-0"}),o.jsx("div",{ref:A,"data-testid":"sticky-datasets-header","data-docked":j,"aria-hidden":"true",className:`${Yo?"sticky":"relative"} z-20 -mb-10 h-12 overflow-hidden bg-card pt-2 transition-[width,margin,padding,border-radius,box-shadow] duration-300 ease-out after:pointer-events-none after:absolute after:inset-x-0 after:bottom-0 after:top-2 after:rounded-xl after:border after:border-border after:content-[''] after:transition-opacity after:duration-300 after:ease-out motion-reduce:transition-none motion-reduce:after:transition-none ${j?"-mx-2 w-[calc(100%+1rem)] pl-2 shadow-[0_6px_8px_-6px_rgb(0_0_0/0.15)] after:opacity-0":"mx-0 w-full rounded-lg pl-0 shadow-none after:opacity-0"}`,style:Yo?{top:`calc(var(--app-header-height, 57px) + ${x}px)`}:void 0,children:o.jsxs("table",{ref:I,className:"border-separate border-spacing-0 text-sm",style:{width:S.length?S.reduce((q,ve)=>q+ve,0):"100%",tableLayout:"fixed"},children:[o.jsx("colgroup",{children:S.map((q,ve)=>o.jsx("col",{style:{width:q}},ve))}
532),o.jsx(FS,{className:"[&_th]:bg-card [&_th]:shadow-[inset_0_-1px_0_0_var(--border),0_8px_0_0_var(--card)]",children:Zd})]})})]}),i==="datasets"||i==="core-team"?Sa?o.jsx(B2,{message:"Loading datasets..."}):ja.length===0?o.jsx(lj,{icon:kt?o.jsx(T_,{className:"size-5"}):o.jsx(mC,{className:"size-5"}),title:kt?"Nothing archived":i==="core-team"?"No datasets found":"Share your first point cloud",description:kt?"Archived Datasets and Collections that you can manage will appear here.":i==="core-team"?"No datasets are currently visible to the core team.":"Upload a forest point cloud. 3Dtrees processes it into individual trees you can view, download and cite.",action:i==="datasets"&&!kt?o.jsx(cg,{content:P?"Accept the updated terms to enable uploads (read-only mode).":"Add a new point cloud dataset",children:o.jsxs(we,{onClick:()=>g(!0),className:"gap-2",disabled:T,children:[o.jsx(Zc,{className:"size-4"}),"Add Dataset"]})}):void 0}):o.jsxs(WO,{"data-testid":"datasets-table",className:"ph-mask border-separate border-spacing-0 [&_tbody_td]:border-b [&_tbody_td]:border-border",children:[o.jsx(FS,{className:"opacity-0",children:Zd}),o.jsx(GO,{className:"[&>tr:first-child>td]:pt-4",children:ja.map(q=>{var ve,ut,sr;return o.jsxs(y.Fragment,{children:[o.jsx(Cm,{className:"bg-muted/30",children:o.jsx(Cn,{colSpan:io,className:"py-2",children:o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("button",{type:"button",className:"flex min-w-0 max-w-[24rem] flex-1 items-start gap-2 text-left",onClick:()=>yu(`group-${q.collectionId??"unassigned"}`),children:[o.jsx("span",{className:"pt-0.5",children:Ee[`group-${q.collectionId??"unassigned"}`]?o.jsx(hC,{className:"h-4 w-4"}):o.jsx(Od,{className:"h-4 w-4"})}),o.jsx(fC,{className:"mt-0.5 h-4 w-4 shrink-0"}),o.jsxs("div",{className:"min-w-0 overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[o.jsx("span",{className:"block truncate",title:q.fullLabel,children:q.label}),o.jsx(_n,{variant:"secondary",children:q.datasets.length})]}),q.collectionId!=null&&((ve=nr.get(q.collectionId))==null?void 0:ve.description)&&o.jsx("div",{className:"mt-0.5 truncate text-xs text-muted-foreground",title:((ut=nr.get(q.collectionId))==null?void 0:ut.description)??void 0,children:C_(((sr=nr.get(q.collectionId))==null?void 0:sr.description)??"",Fge)})]})]}),q.collectionId!=null&&(()=>{const Ot=nr.get(q.collectionId),Gr=(Ot==null?void 0:Ot.archived)===!0,yr=Zo(gu.get(q.collectionId)??null),Ln=!Gr&&yr.editMetadata,bi=_e&&yr.manageAccess,oc=!Gr&&yr.manageLifecycle;return!Ln&&!bi&&!oc?null:o.jsxs(LN,{children:[o.jsx(FN,{asChild:!0,children:o.jsx(we,{variant:"ghost",size:"icon",className:"shrink-0","aria-label":`More options for ${q.fullLabel}`,children:o.jsx(xL,{className:"h-4 w-4"})})}),o.jsxs($N,{align:"end",children:[Ln&&o.jsxs(ko,{onClick:()=>Gd(q.collectionId),children:[o.jsx(Zb,{className:"h-4 w-4"}),"Edit collection"]}),bi&&o.jsxs(ko,{onClick:()=>mp(q.collectionId),children:[o.jsx(jL,{className:"h-4 w-4"}),"Manage access"]}),oc&&o.jsxs(o.Fragment,{children:[o.jsx(zb,{}),o.jsxs(ko,{variant:"destructive",onClick:()=>void cv(q.collectionId,q.fullLabel),children:[o.jsx(T_,{className:"h-4 w-4"}),"Archive"]})]})]})]})})()]})})}),!Ee[`group-${q.collectionId??"unassigned"}`]&&q.datasets.map(Ot=>{const Gr=Zo(Vd.get(Ot.id)??null);return o.jsx(A0e,{dataset:Ot,publications:Hn.get(Ot.id),isColumnVisible:Tt,licenseLabel:Hi[Ot.id]??null,adminEmails:cp.get(Ot.id)??[],showAdminEmails:et,getPlatformColor:bu,formatFileSize:_u,formatDate:ov,indented:q.collectionId!=null,uploads:ar,canViewDatasetDetails:T0e,onEdit:wu,onArchive:ic,onRestore:yr=>void Wd(yr),onAssignCollection:Kw,onRemoveFromCollection:Yw,onManageAccess:_e?lo:void 0,capabilities:Gr},Ot.id)})]},`group-${q.collectionId??"unassigned"}`)})})]}):i==="publications"?o.jsx(rpe,{userId:J,onChoose:()=>Jo()},J):W.length===0?o.jsx(lj,{icon:o.jsx(KA,{className:"size-5"}),title:"Download forest data for your research",description:"Find a dataset on the map and request a download. Your prepared downloads a
532ppear here while their links are valid.",action:o.jsx(we,{asChild:!0,children:o.jsx(Sr,{to:"/map",children:"Explore the map"})})}):o.jsxs(WO,{"data-testid":"downloads-table",className:"ph-mask table-fixed w-full",children:[o.jsx(FS,{children:o.jsxs(Cm,{children:[o.jsx(ml,{className:"w-[4rem] px-2",children:"Dataset"}),o.jsx(ml,{className:"px-2 text-right",children:"Requested"}),o.jsx(ml,{className:"px-2 text-right",children:"Type"}),o.jsx(ml,{className:"px-2 text-right",children:"Status"}),o.jsx(ml,{className:"px-2 text-right",children:"Download URL"}),o.jsx(ml,{className:"px-2 text-right",children:"Email Sent"})]})}),o.jsx(GO,{children:W.map(q=>o.jsxs(Cm,{children:[o.jsx(Cn,{className:"px-2",children:q.dataset_id}),o.jsx(Cn,{className:"px-2 text-right",children:hp(q.created_at)}),o.jsx(Cn,{className:"px-2 capitalize text-right",children:qd(q)}),o.jsx(Cn,{className:"px-2 text-right",children:o.jsx("div",{className:"flex justify-end",children:o.jsx(_n,{variant:"outline",className:`capitalize ${lv(q.status)}`,children:q.status.replace("_"," ")})})}),o.jsx(Cn,{className:"px-2 text-right",children:o.jsx("div",{className:"flex justify-end",children:VB(q)?o.jsx(_n,{variant:"outline",className:"bg-gray-100 text-gray-700 border-gray-200",children:"Expired"}):q.status==="completed"||q.status==="failed_email"?o.jsxs(we,{size:"sm",variant:"outline",onClick:()=>void Gw(q),disabled:be===q.id,children:[be===q.id?o.jsx(Ds,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):o.jsx(KA,{className:"mr-1.5 h-3.5 w-3.5"}),q.archive_filename||"Download archive"]}):q.status==="pending"||q.status==="processing"?o.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground",children:[o.jsx(Ds,{className:"h-3.5 w-3.5 animate-spin"}),"Preparing..."]}):"-"})}),o.jsx(Cn,{className:"px-2 text-right",children:q.email_sent_at?hp(q.email_sent_at):"-"})]},q.id))})]})]})]})]}),o.jsx(hi,{open:te,onOpenChange:q=>{ue(q),q||(se(null),de(!1),at(""))},children:o.jsxs($s,{className:"ph-mask sm:max-w-lg",children:[o.jsxs(zs,{children:[o.jsx(Us,{children:"Assign Collection"}),o.jsx(Mi,{children:re?`Set collection for "${re.title||`Dataset ${re.id}`}".`:"Set collection assignment."})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{children:"Collection"}),o.jsx(Aj,{open:ye,onOpenChange:de,value:pe,onValueChange:Ie,triggerLabel:Hd,searchPlaceholder:"Search collections...",emptyText:"No collections found.",loading:ln.isLoading,loadingText:"Loading collections...",options:so})]}),pe===Jy&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"new-assign-collection",children:"New collection name"}),o.jsx(Nt,{id:"new-assign-collection",value:Ne,onChange:q=>He(q.target.value.slice(0,El)),maxLength:El,placeholder:"Collection name"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"new-assign-collection-description",children:"Collection description (optional)"}),o.jsx(Jl,{id:"new-assign-collection-description",value:We,onChange:q=>at(q.target.value.slice(0,jl)),maxLength:jl,placeholder:"Describe this collection and the datasets it groups together"})]}),et&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"You will initially manage this Collection. Access can be changed afterward."})]})]}),o.jsxs(Mo,{children:[o.jsx(we,{variant:"outline",onClick:()=>ue(!1),children:"Cancel"}),o.jsx(we,{onClick:()=>void fp(),children:"Save"})]})]})}),o.jsx(hi,{open:Mt,onOpenChange:q=>{ot(q),q||(St(null),Cr(""),Nr(""))},children:o.jsxs($s,{className:"ph-mask sm:max-w-lg",children:[o.jsxs(zs,{children:[o.jsx(Us,{children:"Edit Collection"}),o.jsx(Mi,{children:"Update the collection name and optional description."})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"edit-collection-name",children:"Name"}),o.jsx(Nt,{id:"edit-collection-name",value:jt,onChange:q=>Cr(q.target.value.slice(0,El)),maxLength:El,placeholder:"Collection name"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ft,{htmlFor:"edit-collection-description",children:"Description"}),o.jsx(Jl,{id:"edit-collection-description",value:Or,onChange:q=>Nr(q.target.value.slice(0,jl)),maxLength:jl,placeholder:"Optional description"})]})]}),o.jsxs(Mo,{children:[o.jsx(we,{variant:"outline",onClick:()=>ot(!1),children:"Cancel"}),o.jsx(we,{onClick:()=>void pp(),children:"Save"})]})]})}),o.jsx(oxe,{open:_e&&rr!==null,onOpenChange:q=>{q||Pr(null)},resource:rr,hasPlatformAdminAuthority:ce,onPermissionLost:oo}),o.jsx(Ube,{open:f,onOpenChange:g,onUploadComplete:()=>void oo()}),M&&o.jsx(swe,{open:O,onOpenChange:G,dataset:M,canManageResource:et||Vd.get(M.id)==="admin",onEditComplete:()=>void ao()}),Y&&o.jsx(awe,{open:V,onOpenChange:H,dataset:Y,onDeleteComplete:()=>void ao()}),o.jsx(owe,{open:L,onOpenChange:$,user:Z,onProfileUpdate:async()=>{const{data:q,error:ve}=await Ye.auth.getUser();if(ve){console.error("Failed to refresh user profile after update:",ve);return}q.user&&s(q.user)}}),o.jsx(lwe,{isOpen:z,onOpenChange:ee,feature:"Dataset detailed view",description:"We're building a comprehensive view to explore your dataset's metadata, visualization, and analysis tools."})]})}function G2({count:t,label:e}){return t===0?null:o.jsx("span",{"aria-label":`${t} ${e}`,className:"inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-red-600 px-1 text-[10px] font-medium text-white",children:t})}function Mh(t){return ga(`/auth/error?reason=${t}`)}function _xe(t){return!t||!t.startsWith("/")||t.startsWith("//")?"/":t}async function bxe({request:t}){const e=new URL(t.url),r=e.searchParams.get("token_hash"),n=e.searchParams.get("type"),s=_xe(e.searchParams.get("next"));if(r&&n)try{const{data:i,error:a}=await Ye.auth.verifyOtp({type:n,token_hash:r});if(!a&&i.user)return ga(s);{const l=a==null?void 0:a.message.toLowerCase().includes("expired");return Mh(l?"expired_link":"verification_failed")}}catch{return Mh("verification_failed")}try{const{error:i}=await Ye.auth.initialize();if(i){const u=i.message.toLowerCase().includes("expired");return Mh(u?"expired_link":"verification_failed")}const{data:{session:a},error:l}=await Ye.auth.getSession();return l?Mh("verification_failed"):a!=null&&a.user?ga(s):Mh("invalid_link")}catch{return Mh("verification_failed")}}async function wxe(){const{error:t}=await Ye.auth.signOut();return t?(console.error(t),{success:!1,error:t.message}):ga("/")}const xxe={VITE_PUBLIC_POSTHOG_ENABLED:"true",VITE_PUBLIC_POSTHOG_ENVIRONMENT:"production",VITE_PUBLIC_POSTHOG_HOST:"https://canopy.3dtrees.earth",VITE_PUBLIC_POSTHOG_KEY:"phc_x6VTLIMGNNccCbnvkWLj8K2aAr9LiIUNadEECXqsZv1",VITE_PUBLIC_POSTHOG_RELEASE:"be93fd5adde5bee951c16bee082c50e2f7a7cdf3",VITE_PUBLIC_POSTHOG_UI_HOST:"https://eu.posthog.com"},HB=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Sxe=[/^failed to fetch$/i,/^load failed$/i,/^networkerror(?: when attempting to fetch resource\.)?$/i,/^network request failed$/i],kxe=new Set(["about","account","audit","auth","confirm","datenschutzerklaerung","datasets","download","downloads","error","forgot-password","impressum","
532ingestions","legal","login","logout","map","privacy","privacy-policy","profile","protected","sign-up","signup","terms","terms-of-service","update-password","upload","verify-code","viewer","visualization"]),K2=new WeakSet,qB=t=>{let e=t;try{e=decodeURIComponent(t)}catch{}return/^\d+$/.test(t)||HB.test(t)||e.includes("@")},Exe=t=>kxe.has(t)&&!qB(t),WB=t=>{let e=t;try{e=new URL(t,"https://3dtrees.earth").pathname}catch{e=t.split(/[?#]/,1)[0]}const r=e.split("/").filter(Boolean).map(n=>Exe(n)?n:":id");return r.length>0?`/${r.join("/")}`:"/"},jxe=t=>{const e=WB(t);return/^\/(?:auth|account|profile)(?:\/|$)/.test(e)?"account":/^\/audit(?:\/|$)/.test(e)?"audit":/^\/downloads?(?:\/|$)/.test(e)?"download":/^\/(?:upload|ingestions?)(?:\/|$)/.test(e)?"upload":/^\/(?:viewer|visualization)(?:\/|$)/.test(e)?"viewer":/^\/datasets?(?:\/|$)/.test(e)?"dataset":"unknown"},GB=t=>{if(t&&typeof t=="object"&&"name"in t&&typeof t.name=="string")return t.name},Y2=t=>t.split("/").map(e=>qB(e)?":id":e).join("/"),Cxe=t=>{var s;const e=((s=t.match(/(:\d+:\d+)$/))==null?void 0:s[1])??"",r=e?t.slice(0,-e.length):t;if(/^https?:\/\//i.test(r))try{const i=new URL(r),a=typeof window>"u"?"3dtrees.earth":window.location.hostname;return i.hostname===a||i.hostname.endsWith(".3dtrees.earth")||i.hostname.endsWith(".web.app")||i.hostname==="localhost"||i.hostname==="127.0.0.1"?`${Y2(i.pathname)}${e}`:null}catch{return null}const n=r.split(/[?#]/,1)[0];return`${Y2(n)}${e}`},Nxe=t=>{var i;const e=((i=GB(t))==null?void 0:i.replace(/[^A-Za-z0-9_$]/g,""))||"Exception",r=new Error(`${e}: unexpected application failure`);r.name=e;const s=(t&&typeof t=="object"&&"stack"in t&&typeof t.stack=="string"?t.stack:"").split(`
533`).slice(1).flatMap(a=>{var p,f;const l=a.match(/(?:\(|\s)(https?:\/\/[^\s)]+|\/?[^\s()]+\.(?:js|jsx|ts|tsx)(?:[?#][^\s)]*)?(?::\d+:\d+)?)(?:\)|$)/);if(!(l!=null&&l[1]))return[];const u=Cxe(l[1]);return u?[`    at ${((f=(p=a.match(/^\s*at\s+([^\s(]+)/))==null?void 0:p[1])==null?void 0:f.replace(/[^A-Za-z0-9_.$<>-]/g,""))||"<anonymous>"} (${u})`]:[]});return r.stack=[`${e}: unexpected application failure`,...s].join(`
534`),r},KB=t=>{const e=GB(t);if(e==="AbortError"||e==="CanceledError"||e==="CancelledError")return!0;if(!t||typeof t!="object")return!1;const r=t;return typeof(r.reasonCode??r.reason_code)=="string"&&typeof r.stage=="string"},Pxe=t=>KB(t)||!(t instanceof TypeError)?!1:Sxe.some(e=>e.test(t.message.trim())),Bb=(t,e)=>{if(t&&typeof t=="object"&&K2.has(t)||KB(t))return!1;const r=e.environment??xxe,n=Lg(r),s=e.consented??zo();if(!n.enabled||!s)return!1;const i=e.route??(typeof window>"u"?"/":window.location.pathname),a=WB(i),l={component:e.component,route:a,workflow:e.workflow??jxe(a)};n.environment!=="production"&&(l.internal_test=!0),e.traceId&&HB.test(e.traceId)&&(l.trace_id=e.traceId);try{return $l.captureException(Nxe(t),l),t&&typeof t=="object"&&K2.add(t),!0}catch{return!1}},Rxe=(t=window)=>{const e=n=>{Bb(n.error??new Error("BrowserError"),{component:"browser"})},r=n=>{Bb(n.reason,{component:"browser"})};return t.addEventListener("error",e),t.addEventListener("unhandledrejection",r),()=>{t.removeEventListener("error",e),t.removeEventListener("unhandledrejection",r)}},Z2=t=>{Pxe(t)&&Bb(t,{component:"network"})},zN=new yq({queryCache:new cL({onError:Z2}),mutationCache:new lL({onError:Z2}),defaultOptions:{queries:{staleTime:3e4,gcTime:1800*1e3,refetchOnWindowFocus:!0,retry:1},mutations:{retry:0}}});async function Axe({params:t}){const e=Number(t.id);if(!Number.isSafeInteger(e)||e<=0)throw new Response("Not Found",{status:404});try{return await zN.fetchQuery({...Ule(e),staleTime:0}),{datasetId:e}}catch{throw new Response("Not Found",{status:404})}}async function Txe({params:t}){const e=Number(t.id);if(!Number.isFinite(e))throw ga("/");try{return await zN.ensureQueryData(zle(e)),{datasetId:e}}catch{throw new Response("Not Found",{status:404})}}function J2({embedded:t=!1}){const e=rC();return o.jsx(Ixe,{embedded:t,isNotFound:Sd(e)&&e.status===404})}function Ixe({embedded:t=!1,isNotFound:e}){const r=Vo();return o.jsx("div",{className:"w-full px-2 py-2",style:{height:t?"100%":CU},children:o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsxs(HU,{className:"w-full max-w-2xl border bg-background/70 shadow-sm",children:[o.jsxs(qU,{children:[o.jsx(WU,{variant:"icon",className:"bg-amber-100 text-amber-700 dark:bg-amber-950/40 dark:text-amber-300",children:o.jsx(Q9,{className:"size-5"})}),o.jsx(GU,{children:e?"This dataset does not exist or is not public.":"An unexpected error occurred while loading this dataset."}),o.jsx(KU,{children:e?"The dataset might have been removed, is private, or the URL is incorrect.":"Please try again or return to the home page."})]}),o.jsxs(YU,{className:"flex-row justify-center",children:[!t&&o.jsxs(we,{variant:"outline",onClick:()=>window.history.length>1?r(-1):r("/"),children:[o.jsx(fL,{className:"h-4 w-4"}),"Back"]}),t?o.jsx(we,{asChild:!0,children:o.jsxs("a",{href:"/",target:"_blank",rel:"noopener noreferrer",children:[o.jsx(Ik,{className:"h-4 w-4"}),"Go to home"]})}):o.jsxs(we,{onClick:()=>r("/"),children:[o.jsx(Ik,{className:"h-4 w-4"}),"Go to home"]})]})]})})})}const Dxe=y.lazy(()=>Nn(()=>import("./audit-detail-5abq-xv3.js"),__vite__mapDeps([61,62,1,63,64,65])));function Oxe(){const{id:t}=H8();return o.jsx(Dxe,{},t)}const Q2="3dtrees:chunk-reload-attempted-at",Mxe=3e4;function YB(t){return Sd(t)?`${t.status} ${t.statusText}`.trim():t instanceof Error?t.message:typeof t=="string"?t:"An unexpected error occurred."}function Lxe(t){const e=YB(t);return/Failed to fetch dynamically imported module|Importing a module script failed|error loading dynamically imported module|Loading chunk \d+ failed/i.test(e)}function hk({fallback:t}){const e=rC(),r=Lxe(e),n=YB(e);return y.useEffect(()=>{if(r){try{const s=Number.parseInt(window.sessionStorage.getItem(Q2)??"0",10);if(Number.isFinite(s)&&Date.now()-s<Mxe)return;window.sessionStorage.setItem(Q2,Date.now().toString())}catch{return}window.location.reload()}},[r]),!r&&t?t:o.jsx("main",{className:"min-h-[calc(100vh-3.5rem)] w-full px-4 py-8",children:o.jsx("div",{className:"mx-auto flex min-h-[60vh] max-w-xl items-center justify-center",children:o.jsxs(Vs,{className:"w-full rounded-lg border bg-background/80 shadow-sm",children:[o.jsxs(va,{className:"gap-3",children:[o.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-amber-100 text-amber-700 dark:bg-amber-950/40 dark:text-amber-300",children:o.jsx(Oo,{className:"h-5 w-5"})}),o.jsx(Ka,{className:"text-xl",children:r?"A newer version is available":"The page could not be loaded"})]}),o.jsxs(zi,{className:"space-y-3 text-sm text-muted-foreground",children:[o.jsx("p",{children:r?"The application files changed while this browser still had an older bundle cached.":"Please reload the page or return to the home page."}),!r&&o.jsx("p",{className:"rounded-md bg-muted px-3 py-2 font-mono text-xs text-foreground",children:n})]}),o.jsxs(pte,{className:"flex flex-col gap-2 sm:flex-row sm:justify-end",children:[o.jsxs(we,{variant:"outline",onClick:()=>
534window.location.assign("/"),children:[o.jsx(Ik,{className:"h-4 w-4"}),"Home"]}),o.jsxs(we,{onClick:()=>window.location.reload(),children:[o.jsx(G9,{className:"h-4 w-4"}),"Reload"]})]})]})})})}const Fxe=y.lazy(()=>Nn(()=>import("./map-page-BGd2B_tl.js"),__vite__mapDeps([66,63,67,64]))),$xe=y.lazy(()=>Nn(()=>import("./dataset-details-pAu9I6ev.js"),__vite__mapDeps([68,69,62,1,63,64,67]))),zxe=y.lazy(()=>Nn(()=>import("./dataset-embed-CKVj-IPe.js"),__vite__mapDeps([70,69,62,1,63]))),Uxe=y.lazy(()=>Nn(()=>import("./audit-queue-DC1VCKxA.js"),__vite__mapDeps([71,65])));function X2(){return o.jsx("div",{className:"w-full overflow-hidden px-2 py-2",style:{height:CU},children:o.jsxs("div",{className:"flex gap-2 h-full",children:[o.jsx("div",{className:"w-full md:w-[320px] shrink-0 pr-2",children:o.jsxs(Vs,{className:"h-full flex flex-col pr-2",children:[o.jsxs(va,{className:"space-y-2",children:[o.jsx(Xu,{className:"h-9 w-24"}),o.jsx(Xu,{className:"h-6 w-40"})]}),o.jsxs(zi,{className:"space-y-3",children:[o.jsx(Xu,{className:"h-24 w-full"}),o.jsx(Xu,{className:"h-24 w-full"}),o.jsx(Xu,{className:"h-24 w-full"})]})]})}),o.jsx("div",{className:"hidden md:block flex-1 min-w-0 rounded-md overflow-hidden",children:o.jsx(Xu,{className:"h-full w-full"})})]})})}const Bxe=[{path:JC,element:o.jsx(Qle,{}),children:[{path:":id",loader:Axe,errorElement:o.jsx(hk,{fallback:o.jsx(J2,{embedded:!0})}),element:o.jsx(y.Suspense,{fallback:o.jsx("p",{role:"status",className:"p-4",children:"Loading viewer…"}),children:o.jsx(zxe,{})})}]},{path:"/",element:o.jsx(Jle,{}),errorElement:o.jsx(hk,{}),children:[{index:!0,element:o.jsx(wue,{})},{path:"map",element:o.jsx(y.Suspense,{fallback:o.jsx("div",{className:"p-4 text-sm",children:"Loading map…"}),children:o.jsx(Fxe,{})})},{path:"about",element:o.jsx(Hue,{})},{path:"legal/terms",element:o.jsx(kO,{})},{path:"legal/privacy",element:o.jsx(IS,{})},{path:"legal/impressum",element:o.jsx(dde,{})},{path:"privacy-policy",element:o.jsx(IS,{})},{path:"datenschutzerklaerung",element:o.jsx(IS,{})},{path:"terms-of-service",element:o.jsx(kO,{})},{path:"login",element:o.jsx(Que,{}),action:Jue},{path:"sign-up",element:o.jsx(SO,{}),action:xO},{path:"auth/signup",element:o.jsx(SO,{}),action:xO},{path:"auth/error",element:o.jsx(ede,{})},{path:"auth/confirm",loader:bxe,element:o.jsx("div",{})},{path:"auth/verify-code",element:o.jsx(lde,{}),action:ode},{path:"forgot-password",element:o.jsx(rde,{}),action:tde},{path:"update-password",element:o.jsx(sde,{}),action:nde},{path:"logout",loader:wxe,element:o.jsx("div",{})},{path:"protected",element:o.jsx(ude,{}),loader:cde},{path:"account",element:o.jsx(yxe,{}),loader:j0e},{path:"audit",element:o.jsx(y.Suspense,{fallback:o.jsx("div",{className:"p-4 text-sm",children:"Loading audit queue…"}),children:o.jsx(Uxe,{})})},{path:"audit/:id",element:o.jsx(y.Suspense,{fallback:o.jsx(X2,{}),children:o.jsx(Oxe,{})})},{path:"datasets/:id",loader:Txe,errorElement:o.jsx(hk,{fallback:o.jsx(J2,{})}),element:o.jsx(y.Suspense,{fallback:o.jsx(X2,{}),children:o.jsx($xe,{})})}]}],Vxe=OH(Bxe);function Hxe(){return o.jsx(WH,{router:Vxe})}function qxe(t){return o.jsx(Upe,{closeButton:!0,richColors:!0,expand:!1,position:"top-right",...t})}function Wxe(){return o.jsxs(o.Fragment,{children:[o.jsx(Hxe,{}),o.jsx(qxe,{})]})}class Gxe extends y.Component{constructor(){super(...arguments);En(this,"state",{failed:!1})}static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(r){Bb(r,{component:"react"})}render(){return this.state.failed?o.jsx("main",{className:"flex min-h-screen items-center justify-center p-6",children:o.jsxs("div",{className:"max-w-md text-center",children:[o.jsx("h1",{className:"text-xl font-semibold",children:"Something went wrong"}),o.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Reload the page to try again. If the problem continues, please contact the 3Dtrees team."}),o.jsx("button",{className:"mt-4 underline",type:"button",onClick:()=>window.location.reload(),children:"Reload page"})]})}):this.props.children}}const Kxe={VITE_PUBLIC_POSTHOG_ENABLED:"true",VITE_PUBLIC_POSTHOG_ENVIRONMENT:"production",VITE_PUBLIC_POSTHOG_HOST:"https://canopy.3dtrees.earth",VITE_PUBLIC_POSTHOG_KEY:"phc_x6VTLIMGNNccCbnvkWLj8K2aAr9LiIUNadEECXqsZv1",VITE_PUBLIC_POSTHOG_RELEASE:"be93fd5adde5bee951c16bee082c50e2f7a7cdf3",VITE_PUBLIC_POSTHOG_UI_HOST:"https://eu.posthog.com"};typeof window<"u"&&!Dz(window.location.pathname)&&(nX($l,Lg(Kxe),void 0,zo()),Rxe());kV.createRoot(document.getElementById("root")).render(o.jsx(y.StrictMode,{children:o.jsx(_q,{client:zN,children:o.jsx(cte,{client:$l,children:o.jsx(Gxe,{children:o.jsx(EX,{children:o.jsx(Wxe,{})})})})})}));export{cu as $,Vf as A,qf as B,Ul as C,Ixe as D,HU as E,$g as F,Vs as G,va as H,Ka as I,EL as J,Nt as K,B2 as L,Og as M,Is as N,we as O,zi as P,WO as Q,FS as R,Bf as S,Dg as T,Cm as U,ml as V,GO as W,Cn as X,_n as Y,p9 as Z,ke as _,fr as a,Zc as a$,xb as a0,Ds as a1,Oo as a2,cg as a3,Q9 as a4,jSe as a5,eke as a6,tke as a7,XSe as a8,QSe as a9,Mo as aA,_L as aB,n_ as aC,gl as aD,Yb as aE,Xbe as aF,swe as aG,vSe as aH,SSe as aI,LN as aJ,FN as aK,xL as aL,$N as aM,ko as aN,zb as aO,yL as aP,qt as aQ,wSe as aR,xSe as aS,Ib as aT,Db as aU,Ob as aV,ySe as aW,_Se as aX,bSe as aY,ft as aZ,Vl as a_,CU as aa,Nn as ab,Od as ac,ya as ad,H8 as ae,Rg as af,gw as ag,zle as ah,pSe as ai,mSe as aj,dSe as ak,cSe as al,Aq as am,ake as an,nT as ao,rke as ap,fL as aq,eu as ar,Dme as as,qo as at,hi as au,$s as av,zs as aw,Us as ax,Mi as ay,Jl as az,ls as b,Ioe as b$,I_ as b0,Nj as b1,Pj as b2,Rj as b3,x_ as b4,S_ as b5,k_ as b6,hSe as b7,_U as b8,AX as b9,fue as bA,FSe as bB,$Se as bC,zSe as bD,T3 as bE,Vz as bF,ZSe as bG,Jxe as bH,Zxe as bI,dM as bJ,Coe as bK,yoe as bL,USe as bM,BSe as bN,to as bO,qSe as bP,j1 as bQ,Eoe as bR,TSe as bS,_oe as bT,E1 as bU,GSe as bV,Noe as bW,koe as bX,OSe as bY,WSe as bZ,HSe as b_,Kg as ba,R9 as bb,Yg as bc,jke as bd,N3 as be,KA as bf,Qxe as bg,VX as bh,oke as bi,mi as bj,VSe as bk,CSe as bl,pke as bm,Bpe as bn,ske as bo,uue as bp,Ebe as bq,jbe as br,hke as b
534s,L0e as bt,Eke as bu,mke as bv,ow as bw,fke as bx,due as by,hue as bz,xt as c,LSe as c0,YSe as c1,ASe as c2,WD as c3,KSe as c4,es as c5,Ske as c6,kke as c7,Bs as c8,ha as c9,fi as ca,vL as cb,k0e as cc,kL as cd,bL as ce,E0e as cf,lW as cg,pC as ch,V9 as ci,JSe as cj,Goe as ck,Zb as cl,ISe as cm,Poe as cn,O0e as co,RSe as cp,oSe as cq,_4 as cr,fX as cs,lSe as ct,b4 as cu,rSe as cv,Ro as cw,l7 as cx,nSe as cy,Ule as d,DSe as e,qU as f,MSe as g,WU as h,GU as i,o as j,KU as k,Vo as l,lu as m,Ql as n,XC as o,uSe as p,gSe as q,y as r,Ye as s,ESe as t,qM as u,Ht as v,kSe as w,fSe as x,FE as y,Hf as z};
535//# sourceMappingURL=index-DOIL8smB.js.map
536
537//# chunkId=01a11585-69a9-7a63-9dc3-77fb47ab3044

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.