@reearth/core 0.0.7-alpha.47 → 0.0.7-alpha.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.umd.cjs
CHANGED
|
@@ -24,7 +24,7 @@ Check the render method of \``+al+"`."}return""}}function qm(al){return""}var Ef
|
|
|
24
24
|
|
|
25
25
|
Check the top-level render call using <`+uf+">.")}return nf}}function gf(al,nf){{if(!al._store||al._store.validated||al.key!=null)return;al._store.validated=!0;var uf=tf(nf);if(Ef[uf])return;Ef[uf]=!0;var bf="";al&&al._owner&&al._owner!==xf.current&&(bf=" It was passed a child from "+yt(al._owner.type)+"."),kf(al),se('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',uf,bf),kf(null)}}function Mf(al,nf){{if(typeof al!="object")return;if(rf(al))for(var uf=0;uf<al.length;uf++){var bf=al[uf];_m(bf)&&gf(bf,nf)}else if(_m(al))al._store&&(al._store.validated=!0);else if(al){var Of=lt(al);if(typeof Of=="function"&&Of!==al.entries)for(var Ff=Of.call(al),If;!(If=Ff.next()).done;)_m(If.value)&&gf(If.value,nf)}}}function Wf(al){{var nf=al.type;if(nf==null||typeof nf=="string")return;var uf;if(typeof nf=="function")uf=nf.propTypes;else if(typeof nf=="object"&&(nf.$$typeof===y||nf.$$typeof===L))uf=nf.propTypes;else return;if(uf){var bf=yt(nf);cf(uf,al.props,"prop",bf,al)}else if(nf.PropTypes!==void 0&&!$f){$f=!0;var Of=yt(nf);se("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Of||"Unknown")}typeof nf.getDefaultProps=="function"&&!nf.getDefaultProps.isReactClassApproved&&se("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Uf(al){{for(var nf=Object.keys(al.props),uf=0;uf<nf.length;uf++){var bf=nf[uf];if(bf!=="children"&&bf!=="key"){kf(al),se("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",bf),kf(null);break}}al.ref!==null&&(kf(al),se("Invalid attribute `ref` supplied to `React.Fragment`."),kf(null))}}function Om(al,nf,uf,bf,Of,Ff){{var If=La(al);if(!If){var Vf="";(al===void 0||typeof al=="object"&&al!==null&&Object.keys(al).length===0)&&(Vf+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Gf=qm();Gf?Vf+=Gf:Vf+=Am();var Df;al===null?Df="null":rf(al)?Df="array":al!==void 0&&al.$$typeof===n?(Df="<"+(yt(al.type)||"Unknown")+" />",Vf=" Did you accidentally export a JSX literal instead of a component?"):Df=typeof al,se("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Df,Vf)}var Zf=jm(al,nf,uf,Of,Ff);if(Zf==null)return Zf;if(If){var Kf=nf.children;if(Kf!==void 0)if(bf)if(rf(Kf)){for(var yp=0;yp<Kf.length;yp++)Mf(Kf[yp],al);Object.freeze&&Object.freeze(Kf)}else se("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Mf(Kf,al)}return al===s?Uf(Zf):Wf(Zf),Zf}}function sp(al,nf,uf){return Om(al,nf,uf,!0)}function cp(al,nf,uf){return Om(al,nf,uf,!1)}var fp=cp,mp=sp;reactJsxRuntime_development.Fragment=s,reactJsxRuntime_development.jsx=fp,reactJsxRuntime_development.jsxs=mp}()),reactJsxRuntime_development}process.env.NODE_ENV==="production"?jsxRuntime$1.exports=requireReactJsxRuntime_production_min():jsxRuntime$1.exports=requireReactJsxRuntime_development();var jsxRuntimeExports=jsxRuntime$1.exports;const FEATURE_FLAGS={CAMERA_MOVE:1,CAMERA_ZOOM:2,CAMERA_TILT:4,CAMERA_LOOK:8,SINGLE_SELECTION:16,MULTIPLE_SELECTION:32,SKETCH:64},INTERACTION_MODES={default:FEATURE_FLAGS.CAMERA_MOVE|FEATURE_FLAGS.CAMERA_ZOOM|FEATURE_FLAGS.CAMERA_LOOK|FEATURE_FLAGS.CAMERA_TILT|FEATURE_FLAGS.SINGLE_SELECTION,move:FEATURE_FLAGS.CAMERA_MOVE|FEATURE_FLAGS.CAMERA_ZOOM|FEATURE_FLAGS.CAMERA_LOOK|FEATURE_FLAGS.CAMERA_TILT,selection:FEATURE_FLAGS.SINGLE_SELECTION|FEATURE_FLAGS.MULTIPLE_SELECTION|FEATURE_FLAGS.CAMERA_ZOOM|FEATURE_FLAGS.CAMERA_TILT,sketch:FEATURE_FLAGS.SKETCH|FEATURE_FLAGS.CAMERA_ZOOM|FEATURE_FLAGS.CAMERA_TILT,spatialId:FEATURE_FLAGS.CAMERA_ZOOM|FEATURE_FLAGS.CAMERA_TILT},MAX_GEOID_CACHE_SIZE=1e3,Geoid=({geoidServer:t},n)=>{const o=React.useRef(new Map),s=React.useCallback(async(c,d)=>{if(!(t!=null&&t.url)||!(t!=null&&t.geoidProperty))return console.error("Geoid: Server is not set properly"),Promise.resolve(void 0);if(d===void 0||c===void 0)return console.error("Geoid: Invalid lat or lng"),Promise.resolve(void 0);const h=o.current.get(`${c},${d}`);return h?Promise.resolve(h):fetch(t.url.replace("${lng}",c.toString()).replace("${lat}",d.toString())).then(p=>p.json().then(y=>{if(!y)return;const S=Number(y[t==null?void 0:t.geoidProperty]);if(!isNaN(S)){const P=o.current;if(P.size>MAX_GEOID_CACHE_SIZE){const L=P.keys().next().value;L&&P.delete(L)}return P.set(`${c},${d}`,S),S}})).catch(p=>{console.error("Failed to fetch geoid height",p)})},[t==null?void 0:t.url,t==null?void 0:t.geoidProperty]);return React.useImperativeHandle(n,()=>({getGeoidHeight:s})),null},Geoid$1=React.forwardRef(Geoid);function useGet(t){const n=React.useRef(t);return n.current=t,React.useCallback(()=>n.current,[])}function wrapRef(t,n){return Object.fromEntries(Object.keys(n).map(o=>[o,(...s)=>{var c,d;return(d=(c=t.current)==null?void 0:c[o])==null?void 0:d.call(c,...s)}]))}const engineRefKeys={captureScreen:1,changeSceneMode:1,changeSpeed:1,changeTime:1,enableScreenSpaceCameraController:1,flyTo:1,flyToGround:1,getCamera:1,getCameraFovInfo:1,getClock:1,getLocationFromScreen:1,sampleTerrainHeight:1,computeGlobeHeight:1,getGlobeHeight:1,toXYZ:1,toLngLatHeight:1,convertScreenToPositionOffset:1,isPositionVisible:1,setView:1,toWindowPosition:1,getViewport:1,flyToBBox:1,rotateOnCenter:1,overrideScreenSpaceController:1,lookAt:1,lookAtLayer:1,lookHorizontal:1,lookVertical:1,moveBackward:1,moveDown:1,moveForward:1,moveLeft:1,moveOverTerrain:1,moveRight:1,moveUp:1,onClick:1,onDoubleClick:1,onMiddleClick:1,onMiddleDown:1,onMiddleUp:1,onMouseDown:1,onMouseEnter:1,onMouseLeave:1,onMouseMove:1,onMouseUp:1,onRightClick:1,onRightDown:1,onRightUp:1,onWheel:1,orbit:1,pause:1,play:1,requestRender:1,rotateRight:1,tick:1,zoomIn:1,zoomOut:1,changeStart:1,changeStop:1,inViewport:1,onTick:1,removeTickEventListener:1,findFeaturesByIds:1,findFeatureById:1,findComputedFeatureById:1,findComputedFeaturesByIds:1,selectFeatures:1,unselectFeatures:1,pickManyFromViewport:1,getExtrudedHeight:1,getExtrudedPoint:1,getSurfaceDistance:1,equalsEpsilon2d:1,equalsEpsilon3d:1,createGeometry:1,setCursor:1,bringToFront:1,sendToBack:1,calcRectangleControlPoint:1,getCredits:1},layersRefKeys={add:1,addAll:1,deleteLayer:1,find:1,findAll:1,findById:1,findByIds:1,findByTagLabels:1,findByTags:1,hide:1,isLayer:1,isComputedLayer:1,isTempLayer:1,layers:1,override:1,replace:1,select:1,selectFeature:1,selectFeatures:1,selectedLayer:1,selectedFeature:1,show:1,walk:1,overriddenLayers:1},sketchRefKeys={getType:1,setType:1,getOptions:1,overrideOptions:1,editFeature:1,applyEdit:1,cancelEdit:1,deleteFeature:1,onEditFeatureChange:1},spatialIdRefKeys={pickSpace:1,exitPickSpace:1,onSpacePick:1},geoidRefKeys={getGeoidHeight:1};function mapRef({engineRef:t,layersRef:n,sketchRef:o,spatialIdRef:s,geoidRef:c,timelineManagerRef:d}){return{engine:wrapRef(t,engineRefKeys),layers:wrapRef(n,layersRefKeys),sketch:wrapRef(o,sketchRefKeys),spatialId:wrapRef(s,spatialIdRefKeys),geoid:wrapRef(c,geoidRefKeys),timeline:d}}var escapeStringRegexp=t=>{if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")};const escapeStringRegexp$1=getDefaultExportFromCjs(escapeStringRegexp);class StringMatcher{constructor(){Rf(this,"commands",[])}concat(...n){const o=new StringMatcher;return o.commands.push(...this.commands),n.forEach(s=>{o.commands.push(...s.commands)}),o}static match(n,o,s=!1){const c=Array.isArray(o)?new RegExp(o.map(h=>escapeStringRegexp$1(h)).join("\\s*"),"g"):new RegExp(escapeStringRegexp$1(o),"g"),d=[...n.matchAll(c)].filter(h=>h.index!=null);if(d==null||d.length===0)throw new Error(`No matching codes found for: "${o}"`);if(!s&&d.length>1)throw new Error(`Multiple codes found for: "${o}"`);return d}replace(n,o,s=!1){return this.commands.push(c=>{const d=StringMatcher.match(c,n,s),h=[0,...d.flatMap(y=>[y.index,y.index+y[0].length]),c.length],p=[];return h.reduce((y,S,P)=>(p.push(d[(P-2)/2]!=null?o:c.slice(y,S)),S),0),p.join("")}),this}insertBefore(n,o,s){return this.commands.push(c=>{const d=StringMatcher.match(c,n,s),h=[0,...d.flatMap(y=>[y.index,y.index+y[0].length]),c.length],p=[];return h.reduce((y,S,P)=>{const L=c.slice(y,S);return p.push(d[(P-2)/2]!=null?`${o}
|
|
26
26
|
${L}`:L),S},0),p.join("")}),this}insertAfter(n,o,s){return this.commands.push(c=>{const d=StringMatcher.match(c,n,s),h=[0,...d.flatMap(y=>[y.index,y.index+y[0].length]),c.length],p=[];return h.reduce((y,S,P)=>{const L=c.slice(y,S);return p.push(d[(P-2)/2]!=null?`${L}
|
|
27
|
-
${o}`:L),S},0),p.join("")}),this}erase(n,o){return this.replace(n,"",o)}execute(n){return this.commands.reduce((o,s)=>s(o),n)}}function useConstant$2(t){const n=React.useRef();return n.current==null&&(n.current={value:t()}),n.current.value}const ctx=typeof window<"u"?window:global,requestIdleCallbackShim=(t,n)=>{const o=Date.now();return ctx.setTimeout(function(){t({didTimeout:!1,timeRemaining:function(){return Math.max(0,12-(Date.now()-o))}})})},requestIdleCallback=ctx.requestIdleCallback||requestIdleCallbackShim,requestIdleCallbackWithRequiredWork=t=>{requestIdleCallback(t,{timeout:1})},usableChars$1="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",generateRandomString$1=t=>Array.from(window.crypto.getRandomValues(new Uint8Array(t))).map(n=>usableChars$1[n%t]).join("").toLowerCase();function objectFromGetter(t,n){const o={},s=t.reduce((c,d)=>({...c,[d]:{get(){return n.call(this,d)},configurable:!1,enumerable:!0}}),{});return Object.defineProperties(o,s),o}const convertTime=t=>{if(t){if(t instanceof Date)return isNaN(t.getTime())?void 0:t;try{const n=new Date(t);return isNaN(n.getTime())?void 0:n}catch{return}}};var ValueType=(t=>(t.Array="ARRAY",t.Bool="BOOL",t.Camera="CAMERA",t.Coordinates="COORDINATES",t.Latlng="LATLNG",t.Latlngheight="LATLNGHEIGHT",t.Number="NUMBER",t.Polygon="POLYGON",t.Rect="RECT",t.Ref="REF",t.Spacing="SPACING",t.String="STRING",t.Timeline="TIMELINE",t.Typography="TYPOGRAPHY",t.Url="URL",t))(ValueType||{});ValueType.Bool+"",ValueType.Number+"",ValueType.String+"",ValueType.Url+"",ValueType.Latlng+"",ValueType.Latlngheight+"",ValueType.Camera+"",ValueType.Typography+"",ValueType.Coordinates+"",ValueType.Polygon+"",ValueType.Rect+"",ValueType.Ref+"",ValueType.Spacing+"",ValueType.Array+"",ValueType.Timeline+"";const getCSSFontFamily=t=>t?t==="YuGothic"?'"游ゴシック体", YuGothic, "游ゴシック Medium", "Yu Gothic Medium", "游ゴシック", "Yu Gothic"':t:void 0,toCSSFont=(t,n)=>{var s;const o=(s=getCSSFontFamily((t==null?void 0:t.fontFamily)??(n==null?void 0:n.fontFamily)))==null?void 0:s.replace("'",'"').trim();return`${(t==null?void 0:t.italic)??(n==null?void 0:n.italic)?"italic ":""}${(t==null?void 0:t.bold)??(n==null?void 0:n.bold)?"bold ":((t==null?void 0:t.fontWeight)??(n==null?void 0:n.fontWeight)??"")+" "}${(t==null?void 0:t.fontSize)??(n==null?void 0:n.fontSize)??16}px ${o?o.includes('"')?o:`"${o}"`:"sans-serif"}`},toColor$2=t=>{if(!t||typeof t!="string")return;const n=t.match(/^#([A-Fa-f0-9]{6})([A-Fa-f0-9]{2})$|^#([A-Fa-f0-9]{3})([A-Fa-f0-9])$/);if(!n)return Cesium$1.Color.fromCssColorString(t);const o=parseInt(n[4]?n[4].repeat(2):n[2],16)/255;return Cesium$1.Color.fromCssColorString(`#${n[1]??n[3]}`).withAlpha(o)};var lib={};Object.defineProperty(lib,"__esModule",{value:!0});var easing=lib.easing={linear:function(t){return t},quadratic:function(t){return t*(-(t*t)*t+4*t*t-6*t+4)},cubic:function(t){return t*(4*t*t-9*t+6)},elastic:function(t){return t*(33*t*t*t*t-106*t*t*t+126*t*t-67*t+15)},inQuad:function(t){return t*t},outQuad:function(t){return t*(2-t)},inOutQuad:function(t){return t<.5?2*t*t:-1+(4-2*t)*t},inCubic:function(t){return t*t*t},outCubic:function(t){return--t*t*t+1},inOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},inQuart:function(t){return t*t*t*t},outQuart:function(t){return 1- --t*t*t*t},inOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},inQuint:function(t){return t*t*t*t*t},outQuint:function(t){return 1+--t*t*t*t*t},inOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t},inSine:function(t){return-Math.cos(t*(Math.PI/2))+1},outSine:function(t){return Math.sin(t*(Math.PI/2))},inOutSine:function(t){return-(Math.cos(Math.PI*t)-1)/2},inExpo:function(t){return Math.pow(2,10*(t-1))},outExpo:function(t){return-Math.pow(2,-10*t)+1},inOutExpo:function(t){return t/=.5,t<1?Math.pow(2,10*(t-1))/2:(t--,(-Math.pow(2,-10*t)+2)/2)},inCirc:function(t){return-Math.sqrt(1-t*t)+1},outCirc:function(t){return Math.sqrt(1-(t=t-1)*t)},inOutCirc:function(t){return t/=.5,t<1?-(Math.sqrt(1-t*t)-1)/2:(t-=2,(Math.sqrt(1-t*t)+1)/2)}};function interval$1(t,n){let o=0,s=0,c=0;const d=()=>{t(o===0?0:Date.now()-o)&&(s=window.requestAnimationFrame(d)),o===0&&(o=Date.now())};return s=window.requestAnimationFrame(d),()=>{window.clearTimeout(c),window.cancelAnimationFrame(s)}}function intervalDuring(t,n,o){return n<0?()=>{}:interval$1(s=>{const c=Math.min(1,n===0?1:s/n);return t(c),c<1})}function tweenInterval(t,n,o,s){const c=typeof n=="function"?n:easing[n];return intervalDuring(d=>{t(c(d),d)},o)}const useImage=t=>{const n=React.useRef(),[o,s]=React.useState();return React.useEffect(()=>{if(!t){s(void 0),n.current&&(n.current.src="");return}const c=new Image;c.crossOrigin="anonymous",c.onload=()=>{s(n.current)},c.src=t,n.current=c},[t]),o};function useFirstMountState(){var t=React.useRef(!0);return t.current?(t.current=!1,!0):t.current}var __assign$2=function(){return __assign$2=Object.assign||function(n){for(var o,s=1,c=arguments.length;s<c;s++){o=arguments[s];for(var d in o)Object.prototype.hasOwnProperty.call(o,d)&&(n[d]=o[d])}return n},__assign$2.apply(this,arguments)};function __spreadArrays(){for(var t=0,n=0,o=arguments.length;n<o;n++)t+=arguments[n].length;for(var s=Array(t),c=0,n=0;n<o;n++)for(var d=arguments[n],h=0,p=d.length;h<p;h++,c++)s[c]=d[h];return s}typeof SuppressedError=="function"&&SuppressedError;var strictEquals=function(t,n){return t===n};function usePreviousDistinct(t,n){n===void 0&&(n=strictEquals);var o=React.useRef(),s=React.useRef(t),c=useFirstMountState();return!c&&!n(s.current,t)&&(o.current=s.current,s.current=t),o.current}var useSet=function(t){t===void 0&&(t=new Set);var n=React.useState(t),o=n[0],s=n[1],c=React.useMemo(function(){var h=function(S){return s(function(P){return new Set(__spreadArrays(Array.from(P),[S]))})},p=function(S){return s(function(P){return new Set(Array.from(P).filter(function(L){return L!==S}))})},y=function(S){return s(function(P){return P.has(S)?new Set(Array.from(P).filter(function(L){return L!==S})):new Set(__spreadArrays(Array.from(P),[S]))})};return{add:h,remove:p,toggle:y,reset:function(){return s(t)},clear:function(){return s(new Set)}}},[s]),d=__assign$2({has:React.useCallback(function(h){return o.has(h)},[o])},c);return[o,d]};const useDelayedCount=(t=[])=>{const[n,o]=React.useState(0),s=usePreviousDistinct(n),c=React.useRef(!1),d=React.useRef(),h=React.useCallback(()=>{o(y=>Math.max(0,Math.min(t.length+1,y+(c.current?-1:1))))},[t.length]),p=React.useCallback((y,S)=>{if(d.current&&(clearTimeout(d.current),d.current=void 0),S){o(y?0:t.length+1);return}c.current=y,h()},[h,t.length]);return React.useEffect(()=>{if(d.current!==void 0&&(clearTimeout(d.current),d.current=void 0),n<=0||n>=t.length+1)return;const y=t==null?void 0:t[n-1],S=Array.isArray(y)?y[c.current?1:0]:y;d.current=window.setTimeout(()=>{d.current=void 0,h()},S??0)},[h,t,n]),React.useEffect(()=>()=>{d.current&&(clearTimeout(d.current),d.current=void 0)},[]),[n,s,p]},DEFAULT_RANGE=864e5,useTimelineManager=({init:t,engineRef:n,timelineManagerRef:o})=>{const[s,c]=React.useState({start:convertTime(t==null?void 0:t.start)??new Date,stop:convertTime(t==null?void 0:t.stop)??new Date,current:convertTime(t==null?void 0:t.current)??new Date}),[d,h]=React.useState({animation:(t==null?void 0:t.animation)??!1,stepType:(t==null?void 0:t.stepType)??"rate",multiplier:(t==null?void 0:t.stepType)==="fixed"?(t==null?void 0:t.step)??1:(t==null?void 0:t.multiplier)??1,rangeType:(t==null?void 0:t.rangeType)??"unbounded"}),p=React.useMemo(()=>{const{start:Pe,stop:se,current:mt}=s,kt=Pe.getTime(),mn=se.getTime(),_i=mt.getTime(),zi=kt>_i?_i:kt,ba=mn<_i?_i+DEFAULT_RANGE:mn;return{start:new Date(zi),stop:new Date(ba),current:new Date(_i)}},[s]),y=React.useCallback(Pe=>{Pe.cmd&&(Pe.cmd==="PLAY"?h(se=>({...se,animation:!0})):Pe.cmd==="PAUSE"?h(se=>({...se,animation:!1})):Pe.cmd==="SET_TIME"?c(se=>({start:convertTime(Pe.payload.start)??se.start,stop:convertTime(Pe.payload.stop)??se.stop,current:convertTime(Pe.payload.current)??se.current})):Pe.cmd==="SET_OPTIONS"&&h(se=>{var mt,kt,mn;return{...se,stepType:((mt=Pe.payload)==null?void 0:mt.stepType)===void 0?se.stepType:Pe.payload.stepType,multiplier:((kt=Pe.payload)==null?void 0:kt.multiplier)===void 0?se.multiplier:Pe.payload.multiplier,rangeType:((mn=Pe.payload)==null?void 0:mn.rangeType)===void 0?se.rangeType:Pe.payload.rangeType}}),F.current.forEach(se=>se(Pe.committer)))},[]),S=React.useRef([]),P=React.useCallback(Pe=>{S.current.push(Pe)},[]),L=React.useCallback(Pe=>{S.current=S.current.filter(se=>se!==Pe)},[]),F=React.useRef([]),N=React.useCallback(Pe=>{F.current.push(Pe)},[]),W=React.useCallback(Pe=>{F.current=F.current.filter(se=>se!==Pe)},[]),z=React.useCallback(()=>{S.current.forEach(Pe=>{var mt;const se=(mt=n==null?void 0:n.current)==null?void 0:mt.getClock();se!=null&&se.current&&(se!=null&&se.start)&&(se!=null&&se.stop)&&Pe(se.current,{start:se==null?void 0:se.start,stop:se==null?void 0:se.stop})})},[n]),lt=React.useMemo(()=>({timeline:{get start(){var Pe,se;return(se=(Pe=n==null?void 0:n.current)==null?void 0:Pe.getClock())==null?void 0:se.start},get stop(){var Pe,se;return(se=(Pe=n==null?void 0:n.current)==null?void 0:Pe.getClock())==null?void 0:se.stop},get current(){var Pe,se;return(se=(Pe=n==null?void 0:n.current)==null?void 0:Pe.getClock())==null?void 0:se.current}},options:d,computedTimeline:p,commit:y,onTick:P,offTick:L,onCommit:N,offCommit:W,handleTick:z,get tick(){var Pe;return(Pe=n==null?void 0:n.current)==null?void 0:Pe.tick}}),[d,p,n,y,P,L,N,W,z]);return o&&(o.current=lt),null},FORCE_REQUEST_RENDER=-1,NO_REQUEST_RENDER=0,REQUEST_RENDER_ONCE=1;function useHooks$c({ref:t,timelineManagerRef:n,onLayerSelect:o,onMount:s,onAPIReady:c}){const[d,h]=React.useState({engine:!1,layers:!1,sketch:!1,spatialId:!1}),p=React.useRef(null),y=React.useRef(null),S=React.useRef(null),P=React.useRef(null),L=React.useRef(null),F=React.useRef(NO_REQUEST_RENDER);React.useImperativeHandle(t,()=>mapRef({engineRef:p,layersRef:y,sketchRef:S,spatialIdRef:P,geoidRef:L,timelineManagerRef:n}),[n]),React.useEffect(()=>{c&&d.engine&&d.layers&&d.sketch&&d.spatialId&&(c==null||c())},[c,d]);const[N,W]=React.useState({}),z=React.useCallback(async(zi,ba,fa,La,Ra)=>{W({layerId:zi,featureId:ba,reason:La}),o==null||o(zi,ba,fa,La,Ra)},[o]),lt=React.useCallback((zi,ba,fa,La)=>{var Ra;(Ra=y.current)==null||Ra.selectFeatures([{layerId:zi,featureId:ba?[ba]:void 0}],fa,La)},[]);useTimelineManager({engineRef:p,timelineManagerRef:n});const[Pe,se]=React.useState(),mt=React.useCallback(()=>{h(zi=>({...zi,engine:!0})),s==null||s()},[s]),kt=React.useCallback(()=>{h(zi=>({...zi,layers:!0}))},[]),mn=React.useCallback(()=>{h(zi=>({...zi,sketch:!0}))},[]),_i=React.useCallback(()=>{h(zi=>({...zi,spatialId:!0}))},[]);return{engineRef:p,layersRef:y,sketchRef:S,spatialIdRef:P,geoidRef:L,selectedLayer:N,requestingRenderMode:F,handleLayerSelect:z,handleEngineLayerSelect:lt,sketchEditingFeature:Pe,setSketchEditingFeature:se,handleEngineMount:mt,handleLayersMount:kt,handleSketchMount:mn,handleSpatialIdMount:_i}}let keyCount=0;function atom$1(t,n){const o=`atom${++keyCount}`,s={toString:()=>o};return typeof t=="function"?s.read=t:(s.init=t,s.read=c=>c(s),s.write=(c,d,h)=>d(s,typeof h=="function"?h(c(s)):h)),n&&(s.write=n),s}const SUSPENSE_PROMISE=Symbol(),isSuspensePromise=t=>!!t[SUSPENSE_PROMISE],isSuspensePromiseAlreadyCancelled=t=>!t[SUSPENSE_PROMISE].c,cancelSuspensePromise=t=>{var n;const{b:o,c:s}=t[SUSPENSE_PROMISE];s&&(s(),(n=promiseAbortMap.get(o))==null||n())},isEqualSuspensePromise=(t,n)=>{const o=t[SUSPENSE_PROMISE].o,s=n[SUSPENSE_PROMISE].o;return o===s||t===s||isSuspensePromise(o)&&isEqualSuspensePromise(o,n)},createSuspensePromise=(t,n)=>{const o={b:t,o:n,c:null},s=new Promise(c=>{o.c=()=>{o.c=null,c()},n.finally(o.c)});return s[SUSPENSE_PROMISE]=o,s},copySuspensePromise=t=>createSuspensePromise(t[SUSPENSE_PROMISE].b,t[SUSPENSE_PROMISE].o),promiseAbortMap=new WeakMap,hasInitialValue=t=>"init"in t,READ_ATOM="r",WRITE_ATOM="w",COMMIT_ATOM="c",SUBSCRIBE_ATOM="s",RESTORE_ATOMS="h",createStore=t=>{const n=new WeakMap,o=new WeakMap,s=new Map,c=new WeakMap,d=(Xs,ms,yu)=>{let pu=c.get(ms);pu||(pu=new Map,c.set(ms,pu)),yu.then(()=>{pu.get(Xs)===yu&&(pu.delete(Xs),pu.size||c.delete(ms))}),pu.set(Xs,yu)},h=Xs=>{const ms=new Set,yu=c.get(Xs);return yu&&(c.delete(Xs),yu.forEach((pu,Nl)=>{cancelSuspensePromise(pu),ms.add(Nl)})),ms},p=new WeakMap,y=Xs=>{let ms=p.get(Xs);return ms||(ms=new Map,p.set(Xs,ms)),ms},S=(Xs,ms)=>{if(Xs){const yu=y(Xs);let pu=yu.get(ms);return pu||(pu=S(Xs.p,ms),pu&&"p"in pu&&isSuspensePromiseAlreadyCancelled(pu.p)&&(pu=void 0),pu&&yu.set(ms,pu)),pu}return n.get(ms)},P=(Xs,ms,yu)=>{if(Xs)y(Xs).set(ms,yu);else{const pu=n.get(ms);n.set(ms,yu),s.has(ms)||s.set(ms,pu)}},L=(Xs,ms=new Map,yu)=>{if(!yu)return ms;const pu=new Map;let Nl=!1;return yu.forEach(Ru=>{var Vd;const Gd=((Vd=S(Xs,Ru))==null?void 0:Vd.r)||0;pu.set(Ru,Gd),ms.get(Ru)!==Gd&&(Nl=!0)}),ms.size===pu.size&&!Nl?ms:pu},F=(Xs,ms,yu,pu,Nl)=>{const Ru=S(Xs,ms);if(Ru){if(Nl&&(!("p"in Ru)||!isEqualSuspensePromise(Ru.p,Nl)))return Ru;"p"in Ru&&cancelSuspensePromise(Ru.p)}const Vd={v:yu,r:(Ru==null?void 0:Ru.r)||0,y:!0,d:L(Xs,Ru==null?void 0:Ru.d,pu)};let Gd=!(Ru!=null&&Ru.y);return!Ru||!("v"in Ru)||!Object.is(Ru.v,yu)?(Gd=!0,++Vd.r,Vd.d.has(ms)&&(Vd.d=new Map(Vd.d).set(ms,Vd.r))):Vd.d!==Ru.d&&(Vd.d.size!==Ru.d.size||!Array.from(Vd.d.keys()).every(lf=>Ru.d.has(lf)))&&(Gd=!0,Promise.resolve().then(()=>{yt(Xs)})),Ru&&!Gd?Ru:(P(Xs,ms,Vd),Vd)},N=(Xs,ms,yu,pu,Nl)=>{const Ru=S(Xs,ms);if(Ru){if(Nl&&(!("p"in Ru)||!isEqualSuspensePromise(Ru.p,Nl)))return Ru;"p"in Ru&&cancelSuspensePromise(Ru.p)}const Vd={e:yu,r:((Ru==null?void 0:Ru.r)||0)+1,y:!0,d:L(Xs,Ru==null?void 0:Ru.d,pu)};return P(Xs,ms,Vd),Vd},W=(Xs,ms,yu,pu)=>{const Nl=S(Xs,ms);if(Nl&&"p"in Nl){if(isEqualSuspensePromise(Nl.p,yu)&&!isSuspensePromiseAlreadyCancelled(Nl.p))return Nl.y?Nl:{...Nl,y:!0};cancelSuspensePromise(Nl.p)}d(Xs,ms,yu);const Ru={p:yu,r:((Nl==null?void 0:Nl.r)||0)+1,y:!0,d:L(Xs,Nl==null?void 0:Nl.d,pu)};return P(Xs,ms,Ru),Ru},z=(Xs,ms,yu,pu)=>{if(yu instanceof Promise){const Nl=createSuspensePromise(yu,yu.then(Ru=>{F(Xs,ms,Ru,pu,Nl)}).catch(Ru=>{if(Ru instanceof Promise)return isSuspensePromise(Ru)?Ru.then(()=>{Pe(Xs,ms,!0)}):Ru;N(Xs,ms,Ru,pu,Nl)}));return W(Xs,ms,Nl,pu)}return F(Xs,ms,yu,pu)},lt=(Xs,ms)=>{const yu=S(Xs,ms);if(yu){const pu={...yu,y:!1};P(Xs,ms,pu)}},Pe=(Xs,ms,yu)=>{if(!yu){const Nl=S(Xs,ms);if(Nl){if(Nl.y&&"p"in Nl&&!isSuspensePromiseAlreadyCancelled(Nl.p))return Nl;if(Nl.d.forEach((Ru,Vd)=>{if(Vd!==ms)if(!o.has(Vd))Pe(Xs,Vd);else{const Gd=S(Xs,Vd);Gd&&!Gd.y&&Pe(Xs,Vd)}}),Array.from(Nl.d).every(([Ru,Vd])=>{const Gd=S(Xs,Ru);return Gd&&!("p"in Gd)&&Gd.r===Vd}))return Nl.y?Nl:{...Nl,y:!0}}}const pu=new Set;try{const Nl=ms.read(Ru=>{pu.add(Ru);const Vd=Ru===ms?S(Xs,Ru):Pe(Xs,Ru);if(Vd){if("e"in Vd)throw Vd.e;if("p"in Vd)throw Vd.p;return Vd.v}if(hasInitialValue(Ru))return Ru.init;throw new Error("no atom init")});return z(Xs,ms,Nl,pu)}catch(Nl){if(Nl instanceof Promise){const Ru=isSuspensePromise(Nl)&&isSuspensePromiseAlreadyCancelled(Nl)?copySuspensePromise(Nl):createSuspensePromise(Nl,Nl);return W(Xs,ms,Ru,pu)}return N(Xs,ms,Nl,pu)}},se=(Xs,ms)=>Pe(ms,Xs),mt=(Xs,ms)=>{let yu=o.get(ms);return yu||(yu=La(Xs,ms)),yu},kt=(Xs,ms)=>!ms.l.size&&(!ms.t.size||ms.t.size===1&&ms.t.has(Xs)),mn=(Xs,ms)=>{const yu=o.get(ms);yu&&kt(ms,yu)&&Ra(Xs,ms)},_i=(Xs,ms)=>{const yu=o.get(ms);yu==null||yu.t.forEach(pu=>{pu!==ms&&(lt(Xs,pu),_i(Xs,pu))})},zi=(Xs,ms,yu)=>{let pu=!0;const Nl=(Gd,lf)=>{const hf=Pe(Xs,Gd);if("e"in hf)throw hf.e;if("p"in hf){if(lf!=null&&lf.unstable_promise)return hf.p.then(()=>{const pf=S(Xs,Gd);return pf&&"p"in pf&&pf.p===hf.p?new Promise(mf=>setTimeout(mf)).then(()=>Nl(Gd,lf)):Nl(Gd,lf)});throw hf.p}if("v"in hf)return hf.v;throw new Error("no value found")},Ru=(Gd,lf)=>{let hf;if(Gd===ms){if(!hasInitialValue(Gd))throw new Error("atom not writable");h(Gd).forEach(yf=>{yf!==Xs&&z(yf,Gd,lf)});const mf=S(Xs,Gd),sf=z(Xs,Gd,lf);mf!==sf&&_i(Xs,Gd)}else hf=zi(Xs,Gd,lf);return pu||yt(Xs),hf},Vd=ms.write(Nl,Ru,yu);return pu=!1,Vd},ba=(Xs,ms,yu)=>{const pu=zi(yu,Xs,ms);return yt(yu),pu},fa=Xs=>!!Xs.write,La=(Xs,ms,yu)=>{const pu={t:new Set(yu&&[yu]),l:new Set};if(o.set(ms,pu),Pe(void 0,ms).d.forEach((Ru,Vd)=>{const Gd=o.get(Vd);Gd?Gd.t.add(ms):Vd!==ms&&La(Xs,Vd,ms)}),fa(ms)&&ms.onMount){const Ru=Gd=>ba(ms,Gd,Xs),Vd=ms.onMount(Ru);Xs=void 0,Vd&&(pu.u=Vd)}return pu},Ra=(Xs,ms)=>{var yu;const pu=(yu=o.get(ms))==null?void 0:yu.u;pu&&pu(),o.delete(ms);const Nl=S(Xs,ms);Nl&&("p"in Nl&&cancelSuspensePromise(Nl.p),Nl.d.forEach((Ru,Vd)=>{if(Vd!==ms){const Gd=o.get(Vd);Gd&&(Gd.t.delete(ms),kt(Vd,Gd)&&Ra(Xs,Vd))}}))},ma=(Xs,ms,yu,pu)=>{const Nl=new Set(yu.d.keys());pu==null||pu.forEach((Ru,Vd)=>{if(Nl.has(Vd)){Nl.delete(Vd);return}const Gd=o.get(Vd);Gd&&(Gd.t.delete(ms),kt(Vd,Gd)&&Ra(Xs,Vd))}),Nl.forEach(Ru=>{const Vd=o.get(Ru);Vd?Vd.t.add(ms):o.has(ms)&&La(Xs,Ru,ms)})},yt=Xs=>{if(Xs){y(Xs).forEach((yu,pu)=>{const Nl=n.get(pu);if(yu!==Nl){const Ru=o.get(pu);Ru==null||Ru.l.forEach(Vd=>Vd(Xs))}});return}for(;s.size;){const ms=Array.from(s);s.clear(),ms.forEach(([yu,pu])=>{const Nl=S(void 0,yu);if(Nl&&Nl.d!==(pu==null?void 0:pu.d)&&ma(void 0,yu,Nl,pu==null?void 0:pu.d),pu&&!pu.y&&(Nl!=null&&Nl.y))return;const Ru=o.get(yu);Ru==null||Ru.l.forEach(Vd=>Vd())})}},nt=Xs=>{y(Xs).forEach((yu,pu)=>{const Nl=n.get(pu);(!Nl||yu.r>Nl.r||yu.y!==Nl.y||yu.r===Nl.r&&yu.d!==Nl.d)&&(n.set(pu,yu),yu.d!==(Nl==null?void 0:Nl.d)&&ma(Xs,pu,yu,Nl==null?void 0:Nl.d))})},pi=(Xs,ms)=>{ms&&nt(ms),yt(void 0)},Sa=(Xs,ms,yu)=>{const Nl=mt(yu,Xs).l;return Nl.add(ms),()=>{Nl.delete(ms),mn(yu,Xs)}},Sc=(Xs,ms)=>{for(const[yu,pu]of Xs)hasInitialValue(yu)&&(z(ms,yu,pu),_i(ms,yu));yt(ms)};return{[READ_ATOM]:se,[WRITE_ATOM]:ba,[COMMIT_ATOM]:pi,[SUBSCRIBE_ATOM]:Sa,[RESTORE_ATOMS]:Sc}},createScopeContainer=(t,n)=>({s:n?n(t).SECRET_INTERNAL_store:createStore()}),ScopeContextMap=new Map,getScopeContext=t=>(ScopeContextMap.has(t)||ScopeContextMap.set(t,React.createContext(createScopeContainer())),ScopeContextMap.get(t));function atom(t,n){return atom$1(t,n)}function useAtomValue(t,n){const o=getScopeContext(n),s=React.useContext(o),{s:c,v:d}=s,h=F=>{const N=c[READ_ATOM](t,F);if("e"in N)throw N.e;if("p"in N)throw N.p;if("v"in N)return N.v;throw new Error("no atom value")},[[p,y,S],P]=React.useReducer((F,N)=>{const W=h(N);return Object.is(F[1],W)&&F[2]===t?F:[N,W,t]},d,F=>{const N=h(F);return[F,N,t]});let L=y;return S!==t&&(P(p),L=h(p)),React.useEffect(()=>{const{v:F}=s;F&&c[COMMIT_ATOM](t,F);const N=c[SUBSCRIBE_ATOM](t,P,F);return P(F),N},[c,t,s]),React.useEffect(()=>{c[COMMIT_ATOM](t,p)}),React.useDebugValue(L),L}function useSetAtom(t,n){const o=getScopeContext(n),{s,w:c}=React.useContext(o);return React.useCallback(h=>{const p=y=>s[WRITE_ATOM](t,h,y);return c?c(p):p()},[s,c,t])}function useAtom(t,n){return"scope"in t&&(console.warn("atom.scope is deprecated. Please do useAtom(atom, scope) instead."),n=t.scope),[useAtomValue(t,n),useSetAtom(t,n)]}var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root$1=freeGlobal||freeSelf||Function("return this")(),Symbol$1=root$1.Symbol,objectProto$h=Object.prototype,hasOwnProperty$f=objectProto$h.hasOwnProperty,nativeObjectToString$1=objectProto$h.toString,symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0;function getRawTag(t){var n=hasOwnProperty$f.call(t,symToStringTag$1),o=t[symToStringTag$1];try{t[symToStringTag$1]=void 0;var s=!0}catch{}var c=nativeObjectToString$1.call(t);return s&&(n?t[symToStringTag$1]=o:delete t[symToStringTag$1]),c}var objectProto$g=Object.prototype,nativeObjectToString=objectProto$g.toString;function objectToString$1(t){return nativeObjectToString.call(t)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$1?Symbol$1.toStringTag:void 0;function baseGetTag(t){return t==null?t===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(t)?getRawTag(t):objectToString$1(t)}function isObjectLike(t){return t!=null&&typeof t=="object"}var symbolTag$3="[object Symbol]";function isSymbol(t){return typeof t=="symbol"||isObjectLike(t)&&baseGetTag(t)==symbolTag$3}function arrayMap(t,n){for(var o=-1,s=t==null?0:t.length,c=Array(s);++o<s;)c[o]=n(t[o],o,t);return c}var isArray$4=Array.isArray,symbolProto$2=Symbol$1?Symbol$1.prototype:void 0,symbolToString=symbolProto$2?symbolProto$2.toString:void 0;function baseToString(t){if(typeof t=="string")return t;if(isArray$4(t))return arrayMap(t,baseToString)+"";if(isSymbol(t))return symbolToString?symbolToString.call(t):"";var n=t+"";return n=="0"&&1/t==-1/0?"-0":n}function isObject$2(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}function identity$3(t){return t}var asyncTag="[object AsyncFunction]",funcTag$2="[object Function]",genTag$1="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$2(t){if(!isObject$2(t))return!1;var n=baseGetTag(t);return n==funcTag$2||n==genTag$1||n==asyncTag||n==proxyTag}var coreJsData=root$1["__core-js_shared__"],maskSrcKey=function(){var t=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function isMasked(t){return!!maskSrcKey&&maskSrcKey in t}var funcProto$2=Function.prototype,funcToString$2=funcProto$2.toString;function toSource(t){if(t!=null){try{return funcToString$2.call(t)}catch{}try{return t+""}catch{}}return""}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$f=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$e=objectProto$f.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$e).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(t){if(!isObject$2(t)||isMasked(t))return!1;var n=isFunction$2(t)?reIsNative:reIsHostCtor;return n.test(toSource(t))}function getValue$1(t,n){return t==null?void 0:t[n]}function getNative(t,n){var o=getValue$1(t,n);return baseIsNative(o)?o:void 0}var WeakMap$1=getNative(root$1,"WeakMap"),objectCreate=Object.create,baseCreate=function(){function t(){}return function(n){if(!isObject$2(n))return{};if(objectCreate)return objectCreate(n);t.prototype=n;var o=new t;return t.prototype=void 0,o}}();function apply(t,n,o){switch(o.length){case 0:return t.call(n);case 1:return t.call(n,o[0]);case 2:return t.call(n,o[0],o[1]);case 3:return t.call(n,o[0],o[1],o[2])}return t.apply(n,o)}function noop$3(){}function copyArray(t,n){var o=-1,s=t.length;for(n||(n=Array(s));++o<s;)n[o]=t[o];return n}var HOT_COUNT=800,HOT_SPAN=16,nativeNow=Date.now;function shortOut(t){var n=0,o=0;return function(){var s=nativeNow(),c=HOT_SPAN-(s-o);if(o=s,c>0){if(++n>=HOT_COUNT)return arguments[0]}else n=0;return t.apply(void 0,arguments)}}function constant$2(t){return function(){return t}}var defineProperty=function(){try{var t=getNative(Object,"defineProperty");return t({},"",{}),t}catch{}}(),baseSetToString=defineProperty?function(t,n){return defineProperty(t,"toString",{configurable:!0,enumerable:!1,value:constant$2(n),writable:!0})}:identity$3,setToString=shortOut(baseSetToString);function arrayEach(t,n){for(var o=-1,s=t==null?0:t.length;++o<s&&n(t[o],o,t)!==!1;);return t}function baseFindIndex(t,n,o,s){for(var c=t.length,d=o+-1;++d<c;)if(n(t[d],d,t))return d;return-1}function baseIsNaN(t){return t!==t}function strictIndexOf(t,n,o){for(var s=o-1,c=t.length;++s<c;)if(t[s]===n)return s;return-1}function baseIndexOf(t,n,o){return n===n?strictIndexOf(t,n,o):baseFindIndex(t,baseIsNaN,o)}function arrayIncludes(t,n){var o=t==null?0:t.length;return!!o&&baseIndexOf(t,n,0)>-1}var MAX_SAFE_INTEGER$1=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(t,n){var o=typeof t;return n=n??MAX_SAFE_INTEGER$1,!!n&&(o=="number"||o!="symbol"&&reIsUint.test(t))&&t>-1&&t%1==0&&t<n}function baseAssignValue(t,n,o){n=="__proto__"&&defineProperty?defineProperty(t,n,{configurable:!0,enumerable:!0,value:o,writable:!0}):t[n]=o}function eq(t,n){return t===n||t!==t&&n!==n}var objectProto$e=Object.prototype,hasOwnProperty$d=objectProto$e.hasOwnProperty;function assignValue(t,n,o){var s=t[n];(!(hasOwnProperty$d.call(t,n)&&eq(s,o))||o===void 0&&!(n in t))&&baseAssignValue(t,n,o)}function copyObject(t,n,o,s){var c=!o;o||(o={});for(var d=-1,h=n.length;++d<h;){var p=n[d],y=void 0;y===void 0&&(y=t[p]),c?baseAssignValue(o,p,y):assignValue(o,p,y)}return o}var nativeMax=Math.max;function overRest(t,n,o){return n=nativeMax(n===void 0?t.length-1:n,0),function(){for(var s=arguments,c=-1,d=nativeMax(s.length-n,0),h=Array(d);++c<d;)h[c]=s[n+c];c=-1;for(var p=Array(n+1);++c<n;)p[c]=s[c];return p[n]=o(h),apply(t,this,p)}}function baseRest(t,n){return setToString(overRest(t,n,identity$3),t+"")}var MAX_SAFE_INTEGER=9007199254740991;function isLength(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=MAX_SAFE_INTEGER}function isArrayLike(t){return t!=null&&isLength(t.length)&&!isFunction$2(t)}function isIterateeCall(t,n,o){if(!isObject$2(o))return!1;var s=typeof n;return(s=="number"?isArrayLike(o)&&isIndex(n,o.length):s=="string"&&n in o)?eq(o[n],t):!1}function createAssigner(t){return baseRest(function(n,o){var s=-1,c=o.length,d=c>1?o[c-1]:void 0,h=c>2?o[2]:void 0;for(d=t.length>3&&typeof d=="function"?(c--,d):void 0,h&&isIterateeCall(o[0],o[1],h)&&(d=c<3?void 0:d,c=1),n=Object(n);++s<c;){var p=o[s];p&&t(n,p,s,d)}return n})}var objectProto$d=Object.prototype;function isPrototype(t){var n=t&&t.constructor,o=typeof n=="function"&&n.prototype||objectProto$d;return t===o}function baseTimes(t,n){for(var o=-1,s=Array(t);++o<t;)s[o]=n(o);return s}var argsTag$3="[object Arguments]";function baseIsArguments(t){return isObjectLike(t)&&baseGetTag(t)==argsTag$3}var objectProto$c=Object.prototype,hasOwnProperty$c=objectProto$c.hasOwnProperty,propertyIsEnumerable$1=objectProto$c.propertyIsEnumerable,isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(t){return isObjectLike(t)&&hasOwnProperty$c.call(t,"callee")&&!propertyIsEnumerable$1.call(t,"callee")};function stubFalse(){return!1}var freeExports$2=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule$2=freeExports$2&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports$2=freeModule$2&&freeModule$2.exports===freeExports$2,Buffer$4=moduleExports$2?root$1.Buffer:void 0,nativeIsBuffer=Buffer$4?Buffer$4.isBuffer:void 0,isBuffer$1=nativeIsBuffer||stubFalse,argsTag$2="[object Arguments]",arrayTag$2="[object Array]",boolTag$3="[object Boolean]",dateTag$3="[object Date]",errorTag$2="[object Error]",funcTag$1="[object Function]",mapTag$5="[object Map]",numberTag$3="[object Number]",objectTag$4="[object Object]",regexpTag$3="[object RegExp]",setTag$5="[object Set]",stringTag$3="[object String]",weakMapTag$2="[object WeakMap]",arrayBufferTag$3="[object ArrayBuffer]",dataViewTag$4="[object DataView]",float32Tag$2="[object Float32Array]",float64Tag$2="[object Float64Array]",int8Tag$2="[object Int8Array]",int16Tag$2="[object Int16Array]",int32Tag$2="[object Int32Array]",uint8Tag$2="[object Uint8Array]",uint8ClampedTag$2="[object Uint8ClampedArray]",uint16Tag$2="[object Uint16Array]",uint32Tag$2="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag$2]=typedArrayTags[float64Tag$2]=typedArrayTags[int8Tag$2]=typedArrayTags[int16Tag$2]=typedArrayTags[int32Tag$2]=typedArrayTags[uint8Tag$2]=typedArrayTags[uint8ClampedTag$2]=typedArrayTags[uint16Tag$2]=typedArrayTags[uint32Tag$2]=!0,typedArrayTags[argsTag$2]=typedArrayTags[arrayTag$2]=typedArrayTags[arrayBufferTag$3]=typedArrayTags[boolTag$3]=typedArrayTags[dataViewTag$4]=typedArrayTags[dateTag$3]=typedArrayTags[errorTag$2]=typedArrayTags[funcTag$1]=typedArrayTags[mapTag$5]=typedArrayTags[numberTag$3]=typedArrayTags[objectTag$4]=typedArrayTags[regexpTag$3]=typedArrayTags[setTag$5]=typedArrayTags[stringTag$3]=typedArrayTags[weakMapTag$2]=!1;function baseIsTypedArray(t){return isObjectLike(t)&&isLength(t.length)&&!!typedArrayTags[baseGetTag(t)]}function baseUnary(t){return function(n){return t(n)}}var freeExports$1=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule$1=freeExports$1&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports$1=freeModule$1&&freeModule$1.exports===freeExports$1,freeProcess=moduleExports$1&&freeGlobal.process,nodeUtil=function(){try{var t=freeModule$1&&freeModule$1.require&&freeModule$1.require("util").types;return t||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch{}}(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray,objectProto$b=Object.prototype,hasOwnProperty$b=objectProto$b.hasOwnProperty;function arrayLikeKeys(t,n){var o=isArray$4(t),s=!o&&isArguments(t),c=!o&&!s&&isBuffer$1(t),d=!o&&!s&&!c&&isTypedArray(t),h=o||s||c||d,p=h?baseTimes(t.length,String):[],y=p.length;for(var S in t)(n||hasOwnProperty$b.call(t,S))&&!(h&&(S=="length"||c&&(S=="offset"||S=="parent")||d&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||isIndex(S,y)))&&p.push(S);return p}function overArg(t,n){return function(o){return t(n(o))}}var nativeKeys=overArg(Object.keys,Object),objectProto$a=Object.prototype,hasOwnProperty$a=objectProto$a.hasOwnProperty;function baseKeys(t){if(!isPrototype(t))return nativeKeys(t);var n=[];for(var o in Object(t))hasOwnProperty$a.call(t,o)&&o!="constructor"&&n.push(o);return n}function keys$1(t){return isArrayLike(t)?arrayLikeKeys(t):baseKeys(t)}function nativeKeysIn(t){var n=[];if(t!=null)for(var o in Object(t))n.push(o);return n}var objectProto$9=Object.prototype,hasOwnProperty$9=objectProto$9.hasOwnProperty;function baseKeysIn(t){if(!isObject$2(t))return nativeKeysIn(t);var n=isPrototype(t),o=[];for(var s in t)s=="constructor"&&(n||!hasOwnProperty$9.call(t,s))||o.push(s);return o}function keysIn(t){return isArrayLike(t)?arrayLikeKeys(t,!0):baseKeysIn(t)}var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(t,n){if(isArray$4(t))return!1;var o=typeof t;return o=="number"||o=="symbol"||o=="boolean"||t==null||isSymbol(t)?!0:reIsPlainProp.test(t)||!reIsDeepProp.test(t)||n!=null&&t in Object(n)}var nativeCreate=getNative(Object,"create");function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{},this.size=0}function hashDelete(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}var HASH_UNDEFINED$2="__lodash_hash_undefined__",objectProto$8=Object.prototype,hasOwnProperty$8=objectProto$8.hasOwnProperty;function hashGet(t){var n=this.__data__;if(nativeCreate){var o=n[t];return o===HASH_UNDEFINED$2?void 0:o}return hasOwnProperty$8.call(n,t)?n[t]:void 0}var objectProto$7=Object.prototype,hasOwnProperty$7=objectProto$7.hasOwnProperty;function hashHas(t){var n=this.__data__;return nativeCreate?n[t]!==void 0:hasOwnProperty$7.call(n,t)}var HASH_UNDEFINED$1="__lodash_hash_undefined__";function hashSet(t,n){var o=this.__data__;return this.size+=this.has(t)?0:1,o[t]=nativeCreate&&n===void 0?HASH_UNDEFINED$1:n,this}function Hash(t){var n=-1,o=t==null?0:t.length;for(this.clear();++n<o;){var s=t[n];this.set(s[0],s[1])}}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet;function listCacheClear(){this.__data__=[],this.size=0}function assocIndexOf(t,n){for(var o=t.length;o--;)if(eq(t[o][0],n))return o;return-1}var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(t){var n=this.__data__,o=assocIndexOf(n,t);if(o<0)return!1;var s=n.length-1;return o==s?n.pop():splice.call(n,o,1),--this.size,!0}function listCacheGet(t){var n=this.__data__,o=assocIndexOf(n,t);return o<0?void 0:n[o][1]}function listCacheHas(t){return assocIndexOf(this.__data__,t)>-1}function listCacheSet(t,n){var o=this.__data__,s=assocIndexOf(o,t);return s<0?(++this.size,o.push([t,n])):o[s][1]=n,this}function ListCache(t){var n=-1,o=t==null?0:t.length;for(this.clear();++n<o;){var s=t[n];this.set(s[0],s[1])}}ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet;var Map$2=getNative(root$1,"Map");function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map$2||ListCache),string:new Hash}}function isKeyable(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}function getMapData(t,n){var o=t.__data__;return isKeyable(n)?o[typeof n=="string"?"string":"hash"]:o.map}function mapCacheDelete(t){var n=getMapData(this,t).delete(t);return this.size-=n?1:0,n}function mapCacheGet(t){return getMapData(this,t).get(t)}function mapCacheHas(t){return getMapData(this,t).has(t)}function mapCacheSet(t,n){var o=getMapData(this,t),s=o.size;return o.set(t,n),this.size+=o.size==s?0:1,this}function MapCache(t){var n=-1,o=t==null?0:t.length;for(this.clear();++n<o;){var s=t[n];this.set(s[0],s[1])}}MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var FUNC_ERROR_TEXT$1="Expected a function";function memoize(t,n){if(typeof t!="function"||n!=null&&typeof n!="function")throw new TypeError(FUNC_ERROR_TEXT$1);var o=function(){var s=arguments,c=n?n.apply(this,s):s[0],d=o.cache;if(d.has(c))return d.get(c);var h=t.apply(this,s);return o.cache=d.set(c,h)||d,h};return o.cache=new(memoize.Cache||MapCache),o}memoize.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(t){var n=memoize(t,function(s){return o.size===MAX_MEMOIZE_SIZE&&o.clear(),s}),o=n.cache;return n}var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped(function(t){var n=[];return t.charCodeAt(0)===46&&n.push(""),t.replace(rePropName,function(o,s,c,d){n.push(c?d.replace(reEscapeChar,"$1"):s||o)}),n});function toString$1(t){return t==null?"":baseToString(t)}function castPath(t,n){return isArray$4(t)?t:isKey(t,n)?[t]:stringToPath(toString$1(t))}function toKey(t){if(typeof t=="string"||isSymbol(t))return t;var n=t+"";return n=="0"&&1/t==-1/0?"-0":n}function baseGet(t,n){n=castPath(n,t);for(var o=0,s=n.length;t!=null&&o<s;)t=t[toKey(n[o++])];return o&&o==s?t:void 0}function get$3(t,n,o){var s=t==null?void 0:baseGet(t,n);return s===void 0?o:s}function arrayPush(t,n){for(var o=-1,s=n.length,c=t.length;++o<s;)t[c+o]=n[o];return t}var spreadableSymbol=Symbol$1?Symbol$1.isConcatSpreadable:void 0;function isFlattenable(t){return isArray$4(t)||isArguments(t)||!!(spreadableSymbol&&t&&t[spreadableSymbol])}function baseFlatten(t,n,o,s,c){var d=-1,h=t.length;for(o||(o=isFlattenable),c||(c=[]);++d<h;){var p=t[d];o(p)?arrayPush(c,p):c[c.length]=p}return c}function flatten$1(t){var n=t==null?0:t.length;return n?baseFlatten(t):[]}function flatRest(t){return setToString(overRest(t,void 0,flatten$1),t+"")}var getPrototype=overArg(Object.getPrototypeOf,Object),objectTag$3="[object Object]",funcProto=Function.prototype,objectProto$6=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$6=objectProto$6.hasOwnProperty,objectCtorString=funcToString.call(Object);function isPlainObject(t){if(!isObjectLike(t)||baseGetTag(t)!=objectTag$3)return!1;var n=getPrototype(t);if(n===null)return!0;var o=hasOwnProperty$6.call(n,"constructor")&&n.constructor;return typeof o=="function"&&o instanceof o&&funcToString.call(o)==objectCtorString}function baseSlice(t,n,o){var s=-1,c=t.length;n<0&&(n=-n>c?0:c+n),o=o>c?c:o,o<0&&(o+=c),c=n>o?0:o-n>>>0,n>>>=0;for(var d=Array(c);++s<c;)d[s]=t[s+n];return d}function stackClear(){this.__data__=new ListCache,this.size=0}function stackDelete(t){var n=this.__data__,o=n.delete(t);return this.size=n.size,o}function stackGet(t){return this.__data__.get(t)}function stackHas(t){return this.__data__.has(t)}var LARGE_ARRAY_SIZE$2=200;function stackSet(t,n){var o=this.__data__;if(o instanceof ListCache){var s=o.__data__;if(!Map$2||s.length<LARGE_ARRAY_SIZE$2-1)return s.push([t,n]),this.size=++o.size,this;o=this.__data__=new MapCache(s)}return o.set(t,n),this.size=o.size,this}function Stack$1(t){var n=this.__data__=new ListCache(t);this.size=n.size}Stack$1.prototype.clear=stackClear,Stack$1.prototype.delete=stackDelete,Stack$1.prototype.get=stackGet,Stack$1.prototype.has=stackHas,Stack$1.prototype.set=stackSet;function baseAssign(t,n){return t&©Object(n,keys$1(n),t)}function baseAssignIn(t,n){return t&©Object(n,keysIn(n),t)}var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,Buffer$3=moduleExports?root$1.Buffer:void 0,allocUnsafe$1=Buffer$3?Buffer$3.allocUnsafe:void 0;function cloneBuffer(t,n){if(n)return t.slice();var o=t.length,s=allocUnsafe$1?allocUnsafe$1(o):new t.constructor(o);return t.copy(s),s}function arrayFilter(t,n){for(var o=-1,s=t==null?0:t.length,c=0,d=[];++o<s;){var h=t[o];n(h,o,t)&&(d[c++]=h)}return d}function stubArray(){return[]}var objectProto$5=Object.prototype,propertyIsEnumerable=objectProto$5.propertyIsEnumerable,nativeGetSymbols$1=Object.getOwnPropertySymbols,getSymbols=nativeGetSymbols$1?function(t){return t==null?[]:(t=Object(t),arrayFilter(nativeGetSymbols$1(t),function(n){return propertyIsEnumerable.call(t,n)}))}:stubArray;function copySymbols(t,n){return copyObject(t,getSymbols(t),n)}var nativeGetSymbols=Object.getOwnPropertySymbols,getSymbolsIn=nativeGetSymbols?function(t){for(var n=[];t;)arrayPush(n,getSymbols(t)),t=getPrototype(t);return n}:stubArray;function copySymbolsIn(t,n){return copyObject(t,getSymbolsIn(t),n)}function baseGetAllKeys(t,n,o){var s=n(t);return isArray$4(t)?s:arrayPush(s,o(t))}function getAllKeys(t){return baseGetAllKeys(t,keys$1,getSymbols)}function getAllKeysIn(t){return baseGetAllKeys(t,keysIn,getSymbolsIn)}var DataView$1=getNative(root$1,"DataView"),Promise$1=getNative(root$1,"Promise"),Set$1=getNative(root$1,"Set"),mapTag$4="[object Map]",objectTag$2="[object Object]",promiseTag="[object Promise]",setTag$4="[object Set]",weakMapTag$1="[object WeakMap]",dataViewTag$3="[object DataView]",dataViewCtorString=toSource(DataView$1),mapCtorString=toSource(Map$2),promiseCtorString=toSource(Promise$1),setCtorString=toSource(Set$1),weakMapCtorString=toSource(WeakMap$1),getTag$1=baseGetTag;(DataView$1&&getTag$1(new DataView$1(new ArrayBuffer(1)))!=dataViewTag$3||Map$2&&getTag$1(new Map$2)!=mapTag$4||Promise$1&&getTag$1(Promise$1.resolve())!=promiseTag||Set$1&&getTag$1(new Set$1)!=setTag$4||WeakMap$1&&getTag$1(new WeakMap$1)!=weakMapTag$1)&&(getTag$1=function(t){var n=baseGetTag(t),o=n==objectTag$2?t.constructor:void 0,s=o?toSource(o):"";if(s)switch(s){case dataViewCtorString:return dataViewTag$3;case mapCtorString:return mapTag$4;case promiseCtorString:return promiseTag;case setCtorString:return setTag$4;case weakMapCtorString:return weakMapTag$1}return n});var objectProto$4=Object.prototype,hasOwnProperty$5=objectProto$4.hasOwnProperty;function initCloneArray(t){var n=t.length,o=new t.constructor(n);return n&&typeof t[0]=="string"&&hasOwnProperty$5.call(t,"index")&&(o.index=t.index,o.input=t.input),o}var Uint8Array$1=root$1.Uint8Array;function cloneArrayBuffer(t){var n=new t.constructor(t.byteLength);return new Uint8Array$1(n).set(new Uint8Array$1(t)),n}function cloneDataView(t,n){var o=n?cloneArrayBuffer(t.buffer):t.buffer;return new t.constructor(o,t.byteOffset,t.byteLength)}var reFlags=/\w*$/;function cloneRegExp(t){var n=new t.constructor(t.source,reFlags.exec(t));return n.lastIndex=t.lastIndex,n}var symbolProto$1=Symbol$1?Symbol$1.prototype:void 0,symbolValueOf$1=symbolProto$1?symbolProto$1.valueOf:void 0;function cloneSymbol(t){return symbolValueOf$1?Object(symbolValueOf$1.call(t)):{}}function cloneTypedArray(t,n){var o=n?cloneArrayBuffer(t.buffer):t.buffer;return new t.constructor(o,t.byteOffset,t.length)}var boolTag$2="[object Boolean]",dateTag$2="[object Date]",mapTag$3="[object Map]",numberTag$2="[object Number]",regexpTag$2="[object RegExp]",setTag$3="[object Set]",stringTag$2="[object String]",symbolTag$2="[object Symbol]",arrayBufferTag$2="[object ArrayBuffer]",dataViewTag$2="[object DataView]",float32Tag$1="[object Float32Array]",float64Tag$1="[object Float64Array]",int8Tag$1="[object Int8Array]",int16Tag$1="[object Int16Array]",int32Tag$1="[object Int32Array]",uint8Tag$1="[object Uint8Array]",uint8ClampedTag$1="[object Uint8ClampedArray]",uint16Tag$1="[object Uint16Array]",uint32Tag$1="[object Uint32Array]";function initCloneByTag(t,n,o){var s=t.constructor;switch(n){case arrayBufferTag$2:return cloneArrayBuffer(t);case boolTag$2:case dateTag$2:return new s(+t);case dataViewTag$2:return cloneDataView(t,o);case float32Tag$1:case float64Tag$1:case int8Tag$1:case int16Tag$1:case int32Tag$1:case uint8Tag$1:case uint8ClampedTag$1:case uint16Tag$1:case uint32Tag$1:return cloneTypedArray(t,o);case mapTag$3:return new s;case numberTag$2:case stringTag$2:return new s(t);case regexpTag$2:return cloneRegExp(t);case setTag$3:return new s;case symbolTag$2:return cloneSymbol(t)}}function initCloneObject(t){return typeof t.constructor=="function"&&!isPrototype(t)?baseCreate(getPrototype(t)):{}}var mapTag$2="[object Map]";function baseIsMap(t){return isObjectLike(t)&&getTag$1(t)==mapTag$2}var nodeIsMap=nodeUtil&&nodeUtil.isMap,isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap,setTag$2="[object Set]";function baseIsSet(t){return isObjectLike(t)&&getTag$1(t)==setTag$2}var nodeIsSet=nodeUtil&&nodeUtil.isSet,isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet,CLONE_DEEP_FLAG$2=1,CLONE_FLAT_FLAG$1=2,CLONE_SYMBOLS_FLAG$2=4,argsTag$1="[object Arguments]",arrayTag$1="[object Array]",boolTag$1="[object Boolean]",dateTag$1="[object Date]",errorTag$1="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]",mapTag$1="[object Map]",numberTag$1="[object Number]",objectTag$1="[object Object]",regexpTag$1="[object RegExp]",setTag$1="[object Set]",stringTag$1="[object String]",symbolTag$1="[object Symbol]",weakMapTag="[object WeakMap]",arrayBufferTag$1="[object ArrayBuffer]",dataViewTag$1="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",cloneableTags={};cloneableTags[argsTag$1]=cloneableTags[arrayTag$1]=cloneableTags[arrayBufferTag$1]=cloneableTags[dataViewTag$1]=cloneableTags[boolTag$1]=cloneableTags[dateTag$1]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag$1]=cloneableTags[numberTag$1]=cloneableTags[objectTag$1]=cloneableTags[regexpTag$1]=cloneableTags[setTag$1]=cloneableTags[stringTag$1]=cloneableTags[symbolTag$1]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=!0,cloneableTags[errorTag$1]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=!1;function baseClone(t,n,o,s,c,d){var h,p=n&CLONE_DEEP_FLAG$2,y=n&CLONE_FLAT_FLAG$1,S=n&CLONE_SYMBOLS_FLAG$2;if(o&&(h=c?o(t,s,c,d):o(t)),h!==void 0)return h;if(!isObject$2(t))return t;var P=isArray$4(t);if(P){if(h=initCloneArray(t),!p)return copyArray(t,h)}else{var L=getTag$1(t),F=L==funcTag||L==genTag;if(isBuffer$1(t))return cloneBuffer(t,p);if(L==objectTag$1||L==argsTag$1||F&&!c){if(h=y||F?{}:initCloneObject(t),!p)return y?copySymbolsIn(t,baseAssignIn(h,t)):copySymbols(t,baseAssign(h,t))}else{if(!cloneableTags[L])return c?t:{};h=initCloneByTag(t,L,p)}}d||(d=new Stack$1);var N=d.get(t);if(N)return N;d.set(t,h),isSet(t)?t.forEach(function(lt){h.add(baseClone(lt,n,o,lt,t,d))}):isMap(t)&&t.forEach(function(lt,Pe){h.set(Pe,baseClone(lt,n,o,Pe,t,d))});var W=S?y?getAllKeysIn:getAllKeys:y?keysIn:keys$1,z=P?void 0:W(t);return arrayEach(z||t,function(lt,Pe){z&&(Pe=lt,lt=t[Pe]),assignValue(h,Pe,baseClone(lt,n,o,Pe,t,d))}),h}var CLONE_DEEP_FLAG$1=1,CLONE_SYMBOLS_FLAG$1=4;function cloneDeep(t){return baseClone(t,CLONE_DEEP_FLAG$1|CLONE_SYMBOLS_FLAG$1)}var HASH_UNDEFINED="__lodash_hash_undefined__";function setCacheAdd(t){return this.__data__.set(t,HASH_UNDEFINED),this}function setCacheHas(t){return this.__data__.has(t)}function SetCache(t){var n=-1,o=t==null?0:t.length;for(this.__data__=new MapCache;++n<o;)this.add(t[n])}SetCache.prototype.add=SetCache.prototype.push=setCacheAdd,SetCache.prototype.has=setCacheHas;function arraySome(t,n){for(var o=-1,s=t==null?0:t.length;++o<s;)if(n(t[o],o,t))return!0;return!1}function cacheHas(t,n){return t.has(n)}var COMPARE_PARTIAL_FLAG$5=1,COMPARE_UNORDERED_FLAG$3=2;function equalArrays$2(t,n,o,s,c,d){var h=o&COMPARE_PARTIAL_FLAG$5,p=t.length,y=n.length;if(p!=y&&!(h&&y>p))return!1;var S=d.get(t),P=d.get(n);if(S&&P)return S==n&&P==t;var L=-1,F=!0,N=o&COMPARE_UNORDERED_FLAG$3?new SetCache:void 0;for(d.set(t,n),d.set(n,t);++L<p;){var W=t[L],z=n[L];if(s)var lt=h?s(z,W,L,n,t,d):s(W,z,L,t,n,d);if(lt!==void 0){if(lt)continue;F=!1;break}if(N){if(!arraySome(n,function(Pe,se){if(!cacheHas(N,se)&&(W===Pe||c(W,Pe,o,s,d)))return N.push(se)})){F=!1;break}}else if(!(W===z||c(W,z,o,s,d))){F=!1;break}}return d.delete(t),d.delete(n),F}function mapToArray(t){var n=-1,o=Array(t.size);return t.forEach(function(s,c){o[++n]=[c,s]}),o}function setToArray(t){var n=-1,o=Array(t.size);return t.forEach(function(s){o[++n]=s}),o}var COMPARE_PARTIAL_FLAG$4=1,COMPARE_UNORDERED_FLAG$2=2,boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",mapTag="[object Map]",numberTag="[object Number]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",symbolProto=Symbol$1?Symbol$1.prototype:void 0,symbolValueOf=symbolProto?symbolProto.valueOf:void 0;function equalByTag(t,n,o,s,c,d,h){switch(o){case dataViewTag:if(t.byteLength!=n.byteLength||t.byteOffset!=n.byteOffset)return!1;t=t.buffer,n=n.buffer;case arrayBufferTag:return!(t.byteLength!=n.byteLength||!d(new Uint8Array$1(t),new Uint8Array$1(n)));case boolTag:case dateTag:case numberTag:return eq(+t,+n);case errorTag:return t.name==n.name&&t.message==n.message;case regexpTag:case stringTag:return t==n+"";case mapTag:var p=mapToArray;case setTag:var y=s&COMPARE_PARTIAL_FLAG$4;if(p||(p=setToArray),t.size!=n.size&&!y)return!1;var S=h.get(t);if(S)return S==n;s|=COMPARE_UNORDERED_FLAG$2,h.set(t,n);var P=equalArrays$2(p(t),p(n),s,c,d,h);return h.delete(t),P;case symbolTag:if(symbolValueOf)return symbolValueOf.call(t)==symbolValueOf.call(n)}return!1}var COMPARE_PARTIAL_FLAG$3=1,objectProto$3=Object.prototype,hasOwnProperty$4=objectProto$3.hasOwnProperty;function equalObjects(t,n,o,s,c,d){var h=o&COMPARE_PARTIAL_FLAG$3,p=getAllKeys(t),y=p.length,S=getAllKeys(n),P=S.length;if(y!=P&&!h)return!1;for(var L=y;L--;){var F=p[L];if(!(h?F in n:hasOwnProperty$4.call(n,F)))return!1}var N=d.get(t),W=d.get(n);if(N&&W)return N==n&&W==t;var z=!0;d.set(t,n),d.set(n,t);for(var lt=h;++L<y;){F=p[L];var Pe=t[F],se=n[F];if(s)var mt=h?s(se,Pe,F,n,t,d):s(Pe,se,F,t,n,d);if(!(mt===void 0?Pe===se||c(Pe,se,o,s,d):mt)){z=!1;break}lt||(lt=F=="constructor")}if(z&&!lt){var kt=t.constructor,mn=n.constructor;kt!=mn&&"constructor"in t&&"constructor"in n&&!(typeof kt=="function"&&kt instanceof kt&&typeof mn=="function"&&mn instanceof mn)&&(z=!1)}return d.delete(t),d.delete(n),z}var COMPARE_PARTIAL_FLAG$2=1,argsTag="[object Arguments]",arrayTag="[object Array]",objectTag="[object Object]",objectProto$2=Object.prototype,hasOwnProperty$3=objectProto$2.hasOwnProperty;function baseIsEqualDeep(t,n,o,s,c,d){var h=isArray$4(t),p=isArray$4(n),y=h?arrayTag:getTag$1(t),S=p?arrayTag:getTag$1(n);y=y==argsTag?objectTag:y,S=S==argsTag?objectTag:S;var P=y==objectTag,L=S==objectTag,F=y==S;if(F&&isBuffer$1(t)){if(!isBuffer$1(n))return!1;h=!0,P=!1}if(F&&!P)return d||(d=new Stack$1),h||isTypedArray(t)?equalArrays$2(t,n,o,s,c,d):equalByTag(t,n,y,o,s,c,d);if(!(o&COMPARE_PARTIAL_FLAG$2)){var N=P&&hasOwnProperty$3.call(t,"__wrapped__"),W=L&&hasOwnProperty$3.call(n,"__wrapped__");if(N||W){var z=N?t.value():t,lt=W?n.value():n;return d||(d=new Stack$1),c(z,lt,o,s,d)}}return F?(d||(d=new Stack$1),equalObjects(t,n,o,s,c,d)):!1}function baseIsEqual(t,n,o,s,c){return t===n?!0:t==null||n==null||!isObjectLike(t)&&!isObjectLike(n)?t!==t&&n!==n:baseIsEqualDeep(t,n,o,s,baseIsEqual,c)}var COMPARE_PARTIAL_FLAG$1=1,COMPARE_UNORDERED_FLAG$1=2;function baseIsMatch(t,n,o,s){var c=o.length,d=c;if(t==null)return!d;for(t=Object(t);c--;){var h=o[c];if(h[2]?h[1]!==t[h[0]]:!(h[0]in t))return!1}for(;++c<d;){h=o[c];var p=h[0],y=t[p],S=h[1];if(h[2]){if(y===void 0&&!(p in t))return!1}else{var P=new Stack$1,L;if(!(L===void 0?baseIsEqual(S,y,COMPARE_PARTIAL_FLAG$1|COMPARE_UNORDERED_FLAG$1,s,P):L))return!1}}return!0}function isStrictComparable(t){return t===t&&!isObject$2(t)}function getMatchData(t){for(var n=keys$1(t),o=n.length;o--;){var s=n[o],c=t[s];n[o]=[s,c,isStrictComparable(c)]}return n}function matchesStrictComparable(t,n){return function(o){return o==null?!1:o[t]===n&&(n!==void 0||t in Object(o))}}function baseMatches(t){var n=getMatchData(t);return n.length==1&&n[0][2]?matchesStrictComparable(n[0][0],n[0][1]):function(o){return o===t||baseIsMatch(o,t,n)}}function baseHasIn(t,n){return t!=null&&n in Object(t)}function hasPath(t,n,o){n=castPath(n,t);for(var s=-1,c=n.length,d=!1;++s<c;){var h=toKey(n[s]);if(!(d=t!=null&&o(t,h)))break;t=t[h]}return d||++s!=c?d:(c=t==null?0:t.length,!!c&&isLength(c)&&isIndex(h,c)&&(isArray$4(t)||isArguments(t)))}function hasIn(t,n){return t!=null&&hasPath(t,n,baseHasIn)}var COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;function baseMatchesProperty(t,n){return isKey(t)&&isStrictComparable(n)?matchesStrictComparable(toKey(t),n):function(o){var s=get$3(o,t);return s===void 0&&s===n?hasIn(o,t):baseIsEqual(n,s,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG)}}function baseProperty(t){return function(n){return n==null?void 0:n[t]}}function basePropertyDeep(t){return function(n){return baseGet(n,t)}}function property(t){return isKey(t)?baseProperty(toKey(t)):basePropertyDeep(t)}function baseIteratee(t){return typeof t=="function"?t:t==null?identity$3:typeof t=="object"?isArray$4(t)?baseMatchesProperty(t[0],t[1]):baseMatches(t):property(t)}function arrayAggregator(t,n,o,s){for(var c=-1,d=t==null?0:t.length;++c<d;){var h=t[c];n(s,h,o(h),t)}return s}function createBaseFor(t){return function(n,o,s){for(var c=-1,d=Object(n),h=s(n),p=h.length;p--;){var y=h[++c];if(o(d[y],y,d)===!1)break}return n}}var baseFor=createBaseFor();function baseForOwn(t,n){return t&&baseFor(t,n,keys$1)}function createBaseEach(t,n){return function(o,s){if(o==null)return o;if(!isArrayLike(o))return t(o,s);for(var c=o.length,d=-1,h=Object(o);++d<c&&s(h[d],d,h)!==!1;);return o}}var baseEach=createBaseEach(baseForOwn);function baseAggregator(t,n,o,s){return baseEach(t,function(c,d,h){n(s,c,o(c),h)}),s}function createAggregator(t,n){return function(o,s){var c=isArray$4(o)?arrayAggregator:baseAggregator,d={};return c(o,t,baseIteratee(s),d)}}var objectProto$1=Object.prototype,hasOwnProperty$2=objectProto$1.hasOwnProperty,defaults=baseRest(function(t,n){t=Object(t);var o=-1,s=n.length,c=s>2?n[2]:void 0;for(c&&isIterateeCall(n[0],n[1],c)&&(s=1);++o<s;)for(var d=n[o],h=keysIn(d),p=-1,y=h.length;++p<y;){var S=h[p],P=t[S];(P===void 0||eq(P,objectProto$1[S])&&!hasOwnProperty$2.call(t,S))&&(t[S]=d[S])}return t});function assignMergeValue(t,n,o){(o!==void 0&&!eq(t[n],o)||o===void 0&&!(n in t))&&baseAssignValue(t,n,o)}function isArrayLikeObject(t){return isObjectLike(t)&&isArrayLike(t)}function safeGet(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}function toPlainObject(t){return copyObject(t,keysIn(t))}function baseMergeDeep(t,n,o,s,c,d,h){var p=safeGet(t,o),y=safeGet(n,o),S=h.get(y);if(S){assignMergeValue(t,o,S);return}var P=d?d(p,y,o+"",t,n,h):void 0,L=P===void 0;if(L){var F=isArray$4(y),N=!F&&isBuffer$1(y),W=!F&&!N&&isTypedArray(y);P=y,F||N||W?isArray$4(p)?P=p:isArrayLikeObject(p)?P=copyArray(p):N?(L=!1,P=cloneBuffer(y,!0)):W?(L=!1,P=cloneTypedArray(y,!0)):P=[]:isPlainObject(y)||isArguments(y)?(P=p,isArguments(p)?P=toPlainObject(p):(!isObject$2(p)||isFunction$2(p))&&(P=initCloneObject(y))):L=!1}L&&(h.set(y,P),c(P,y,s,d,h),h.delete(y)),assignMergeValue(t,o,P)}function baseMerge(t,n,o,s,c){t!==n&&baseFor(n,function(d,h){if(c||(c=new Stack$1),isObject$2(d))baseMergeDeep(t,n,h,o,baseMerge,s,c);else{var p=s?s(safeGet(t,h),d,h+"",t,n,c):void 0;p===void 0&&(p=d),assignMergeValue(t,h,p)}},keysIn)}var LARGE_ARRAY_SIZE$1=200;function baseDifference(t,n,o,s){var c=-1,d=arrayIncludes,h=!0,p=t.length,y=[],S=n.length;if(!p)return y;o&&(n=arrayMap(n,baseUnary(o))),n.length>=LARGE_ARRAY_SIZE$1&&(d=cacheHas,h=!1,n=new SetCache(n));e:for(;++c<p;){var P=t[c],L=o==null?P:o(P);if(P=P!==0?P:0,h&&L===L){for(var F=S;F--;)if(n[F]===L)continue e;y.push(P)}else d(n,L,s)||y.push(P)}return y}function last(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}function fromPairs(t){for(var n=-1,o=t==null?0:t.length,s={};++n<o;){var c=t[n];s[c[0]]=c[1]}return s}var objectProto=Object.prototype,hasOwnProperty$1=objectProto.hasOwnProperty,groupBy=createAggregator(function(t,n,o){hasOwnProperty$1.call(t,o)?t[o].push(n):baseAssignValue(t,o,[n])});function parent(t,n){return n.length<2?t:baseGet(t,baseSlice(n,0,-1))}function isEqual(t,n){return baseIsEqual(t,n)}var merge=createAssigner(function(t,n,o){baseMerge(t,n,o)}),FUNC_ERROR_TEXT="Expected a function";function negate(t){if(typeof t!="function")throw new TypeError(FUNC_ERROR_TEXT);return function(){var n=arguments;switch(n.length){case 0:return!t.call(this);case 1:return!t.call(this,n[0]);case 2:return!t.call(this,n[0],n[1]);case 3:return!t.call(this,n[0],n[1],n[2])}return!t.apply(this,n)}}function baseUnset(t,n){return n=castPath(n,t),t=parent(t,n),t==null||delete t[toKey(last(n))]}function customOmitClone(t){return isPlainObject(t)?void 0:t}var CLONE_DEEP_FLAG=1,CLONE_FLAT_FLAG=2,CLONE_SYMBOLS_FLAG=4,omit=flatRest(function(t,n){var o={};if(t==null)return o;var s=!1;n=arrayMap(n,function(d){return d=castPath(d,t),s||(s=d.length>1),d}),copyObject(t,getAllKeysIn(t),o),s&&(o=baseClone(o,CLONE_DEEP_FLAG|CLONE_FLAT_FLAG|CLONE_SYMBOLS_FLAG,customOmitClone));for(var c=n.length;c--;)baseUnset(o,n[c]);return o});function baseSet(t,n,o,s){if(!isObject$2(t))return t;n=castPath(n,t);for(var c=-1,d=n.length,h=d-1,p=t;p!=null&&++c<d;){var y=toKey(n[c]),S=o;if(y==="__proto__"||y==="constructor"||y==="prototype")return t;if(c!=h){var P=p[y];S=void 0,S===void 0&&(S=isObject$2(P)?P:isIndex(n[c+1])?[]:{})}assignValue(p,y,S),p=p[y]}return t}function basePickBy(t,n,o){for(var s=-1,c=n.length,d={};++s<c;){var h=n[s],p=baseGet(t,h);o(p,h)&&baseSet(d,castPath(h,t),p)}return d}function pickBy(t,n){if(t==null)return{};var o=arrayMap(getAllKeysIn(t),function(s){return[s]});return n=baseIteratee(n),basePickBy(t,o,function(s,c){return n(s,c[0])})}function omitBy(t,n){return pickBy(t,negate(baseIteratee(n)))}function basePick(t,n){return basePickBy(t,n,function(o,s){return hasIn(t,s)})}var pick=flatRest(function(t,n){return t==null?{}:basePick(t,n)}),INFINITY=1/0,createSet=Set$1&&1/setToArray(new Set$1([,-0]))[1]==INFINITY?function(t){return new Set$1(t)}:noop$3,LARGE_ARRAY_SIZE=200;function baseUniq(t,n,o){var s=-1,c=arrayIncludes,d=t.length,h=!0,p=[],y=p;if(d>=LARGE_ARRAY_SIZE){var S=n?null:createSet(t);if(S)return setToArray(S);h=!1,c=cacheHas,y=new SetCache}else y=n?[]:p;e:for(;++s<d;){var P=t[s],L=n?n(P):P;if(P=P!==0?P:0,h&&L===L){for(var F=y.length;F--;)if(y[F]===L)continue e;n&&y.push(L),p.push(P)}else c(y,L,o)||(y!==p&&y.push(L),p.push(P))}return p}function uniqBy(t,n){return t&&t.length?baseUniq(t,baseIteratee(n)):[]}function baseXor(t,n,o){var s=t.length;if(s<2)return s?baseUniq(t[0]):[];for(var c=-1,d=Array(s);++c<s;)for(var h=t[c],p=-1;++p<s;)p!=c&&(d[c]=baseDifference(d[c]||h,t[p],n,o));return baseUniq(baseFlatten(d),n,o)}var xorBy=baseRest(function(t){var n=last(t);return isArrayLikeObject(n)&&(n=void 0),baseXor(arrayFilter(t,isArrayLikeObject),baseIteratee(n))}),earthRadius=63710088e-1,factors={centimeters:earthRadius*100,centimetres:earthRadius*100,degrees:earthRadius/111325,feet:earthRadius*3.28084,inches:earthRadius*39.37,kilometers:earthRadius/1e3,kilometres:earthRadius/1e3,meters:earthRadius,metres:earthRadius,miles:earthRadius/1609.344,millimeters:earthRadius*1e3,millimetres:earthRadius*1e3,nauticalmiles:earthRadius/1852,radians:1,yards:earthRadius*1.0936};function feature$1(t,n,o){o===void 0&&(o={});var s={type:"Feature"};return(o.id===0||o.id)&&(s.id=o.id),o.bbox&&(s.bbox=o.bbox),s.properties=n||{},s.geometry=t,s}function point$1(t,n,o){if(o===void 0&&(o={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!isNumber$2(t[0])||!isNumber$2(t[1]))throw new Error("coordinates must contain numbers");var s={type:"Point",coordinates:t};return feature$1(s,n,o)}function polygon(t,n,o){o===void 0&&(o={});for(var s=0,c=t;s<c.length;s++){var d=c[s];if(d.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<d[d.length-1].length;h++)if(d[d.length-1][h]!==d[0][h])throw new Error("First and last Position are not equivalent.")}var p={type:"Polygon",coordinates:t};return feature$1(p,n,o)}function lineString$1(t,n,o){if(o===void 0&&(o={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");var s={type:"LineString",coordinates:t};return feature$1(s,n,o)}function featureCollection$2(t,n){n===void 0&&(n={});var o={type:"FeatureCollection"};return n.id&&(o.id=n.id),n.bbox&&(o.bbox=n.bbox),o.features=t,o}function radiansToLength(t,n){n===void 0&&(n="kilometers");var o=factors[n];if(!o)throw new Error(n+" units is invalid");return t*o}function lengthToRadians(t,n){n===void 0&&(n="kilometers");var o=factors[n];if(!o)throw new Error(n+" units is invalid");return t/o}function radiansToDegrees(t){var n=t%(2*Math.PI);return n*180/Math.PI}function degreesToRadians(t){var n=t%360;return n*Math.PI/180}function convertLength(t,n,o){if(n===void 0&&(n="kilometers"),o===void 0&&(o="kilometers"),!(t>=0))throw new Error("length must be a positive number");return radiansToLength(lengthToRadians(t,n),o)}function isNumber$2(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function isObject$1(t){return!!t&&t.constructor===Object}function getCoord$2(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return t.geometry.coordinates;if(t.type==="Point")return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function getCoords$2(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function getGeom$2(t){return t.type==="Feature"?t.geometry:t}const getCoord$1=wrap(getCoord$2),getCoords$1=wrap(getCoords$2),getGeom$1=t=>{if(!(typeof t!="object"||!t||!("type"in t))){if(t.type==="Feature")return getGeom$1(t.geometry);if(!(t.type!=="Point"&&t.type!=="MultiPoint"&&t.type!=="LineString"&&t.type!=="MultiLineString"&&t.type!=="Polygon"&&t.type!=="MultiPolygon"))return t}};function wrap(t){return n=>{try{return t(n)}catch{return}}}function objKeys$1(t){return Object.keys(t)}function defaultValue$1(t,n){return t??n}const appearanceKeyObj={marker:1,polyline:1,polygon:1,ellipsoid:1,ellipse:1,model:1,"3dtiles":1,box:1,photooverlay:1,resource:1,raster:1,heatMap:1,frustum:1,transition:1},appearanceKeys=objKeys$1(appearanceKeyObj);function convertLayer(t){return convertLayerGroup(t)??convertLayerItem(t)}function convertLayerCommon(t){var n,o,s,c;return omitBy({id:t.id,isVisible:t.visible,title:t.title,creator:t.creator,infobox:t.infobox,tags:t.tags,property:(n=t.compat)==null?void 0:n.property,propertyId:(o=t.compat)==null?void 0:o.propertyId,pluginId:(s=t.compat)!=null&&s.extensionId?"reearth":void 0,extensionId:(c=t.compat)==null?void 0:c.extensionId},d=>typeof d>"u"||d===null)}function convertLayerGroup(t){var n;if(t.type==="group")return{...convertLayerCommon(t),children:((n=t.children)==null?void 0:n.map(convertLayer).filter(o=>!!o))??[]}}function convertLayerItem(t){if(t.type==="simple")return convertLayerCommon(t)}function getCompat(t){var c,d,h,p;if(!t||typeof t!="object"||t.type!=="simple")return;const n=((c=t.data)==null?void 0:c.type)==="geojson"?t.data.value:void 0;let o,s;if("marker"in t){const y=getCoord$1(n);s="marker",o={default:{...t.marker,...y&&y.length>=2?{location:{lng:y[0],lat:y[1]},height:y[2]}:{}}}}else if("polyline"in t){const y=getCoords$1(n);s="polyline",o={default:{...t.polyline,...y?{coordinates:y.map(S=>({lng:S[0],lat:S[1],height:S[2]}))}:{}}}}else if("polygon"in t){const y=getGeom$1(n);s="polygon",o={default:{...t.polygon,...(y==null?void 0:y.type)==="Polygon"?{polygon:y.coordinates.map(S=>S.map(P=>({lng:P[0],lat:P[1],height:P[2]})))}:{}}}}else if("photooverlay"in t){const y=getCoord$1(n);s="photooverlay",o={default:{...t.photooverlay,...y&&y.length>=2?{location:{lng:y[0],lat:y[1]},height:y[2]}:{}}}}else if("ellipsoid"in t){const y=getCoord$1(n);s="ellipsoid",o={default:{...t.ellipsoid,...y&&y.length>=2?{position:{lng:y[0],lat:y[1]},height:y[2]}:{}}}}else if("model"in t){const y=["shadows","colorBlend","color","colorBlendAmount","lightColor","silhouette","silhouetteColor","silhouetteSize"],S=omit(t.model,...y),P=omitBy(pick(t.model,...y),F=>typeof F>"u"||F===null),L=getCoord$1(n);s="model",o={default:{...S,...L&&L.length>=2?{location:{lng:L[0],lat:L[1]},height:L[2]}:{}},...Object.keys(P).length?{appearance:P}:{}}}else"3dtiles"in t?(s="tileset",o={default:{...t["3dtiles"],...((d=t.data)==null?void 0:d.type)==="3dtiles"&&t.data.url?{tileset:t.data.url}:{}}}):"resource"in t&&(s="resource",o={default:{...t.resource}});return{extensionId:s,property:o,...(h=t.compat)!=null&&h.propertyId?{propertyId:(p=t.compat)==null?void 0:p.propertyId}:{}}}function convertLegacyLayer(t){return t?convertLegacyLayerGroup(t)??convertLegacyLayerItem(t):void 0}function convertLegacyLayerCommon(t){const n=omitBy({extensionId:t.extensionId,property:t.property,propertyId:t.propertyId},o=>typeof o>"u"||o===null);return omitBy({id:t.id,title:t.title,visible:t.isVisible,creator:t.creator,infobox:t.infobox,tags:t.tags,...Object.keys(n).length?{compat:n}:{}},o=>typeof o>"u"||o===null)}function convertLegacyLayerGroup(t){var n;if(Array.isArray(t.children))return{type:"group",...convertLegacyLayerCommon(t),children:((n=t.children)==null?void 0:n.map(convertLegacyLayer).filter(o=>!!o))??[]}}function convertLegacyLayerItem(t){var d,h,p,y,S,P,L,F,N,W,z,lt,Pe,se,mt,kt,mn,_i,zi,ba,fa,La,Ra,ma,yt,nt,pi,Sa;if(Array.isArray(t.children))return;let n,o,s;if(t.extensionId==="marker")n="marker",s=["location","height"],(h=(d=t.property)==null?void 0:d.default)!=null&&h.location&&(o={type:"geojson",value:{type:"Feature",geometry:{type:"Point",coordinates:[t.property.default.location.lng,t.property.default.location.lat,...t.property.default.height?[t.property.default.height]:[]]}}});else if(t.extensionId==="polyline")n="polyline",s=["coordinates"],(y=(p=t.property)==null?void 0:p.default)!=null&&y.coordinates&&(o={type:"geojson",value:{type:"Feature",geometry:{type:"LineString",coordinates:t.property.default.coordinates.map(Sc=>[Sc.lng,Sc.lat,Sc.height])}}});else if(t.extensionId==="polygon")n="polygon",s=["polygon"],(P=(S=t.property)==null?void 0:S.default)!=null&&P.polygon&&(o={type:"geojson",value:{type:"Feature",geometry:{type:"Polygon",coordinates:t.property.default.polygon.map(Sc=>Sc.map(Xs=>[Xs.lng,Xs.lat,Xs.height]))}}});else if(t.extensionId==="rect"){if(n="polygon",s=["rect","height"],(F=(L=t.property)==null?void 0:L.default)!=null&&F.rect){const Sc=(W=(N=t.property)==null?void 0:N.default)==null?void 0:W.rect,Xs=t.property.default.height;o={type:"geojson",value:{type:"Feature",geometry:{type:"Polygon",coordinates:[[[Sc.west,Sc.north,Xs],[Sc.east,Sc.north,Xs],[Sc.east,Sc.south,Xs],[Sc.west,Sc.south,Xs],[Sc.west,Sc.north,Xs]]]}}}}}else if(t.extensionId==="photooverlay")n="photooverlay",s=["location","height"],(lt=(z=t.property)==null?void 0:z.default)!=null&<.location&&(o={type:"geojson",value:{type:"Feature",geometry:{type:"Point",coordinates:[t.property.default.location.lng,t.property.default.location.lat,...t.property.default.height?[t.property.default.height]:[]]}}});else if(t.extensionId==="ellipsoid")n="ellipsoid",s=["position","height"],(se=(Pe=t.property)==null?void 0:Pe.default)!=null&&se.position&&(o={type:"geojson",value:{type:"Feature",geometry:{type:"Point",coordinates:[t.property.default.position.lng,t.property.default.position.lat,...typeof t.property.default.height=="number"?[t.property.default.height]:[]]}}});else if(t.extensionId==="model")n="model",s=["location","height"],(kt=(mt=t.property)==null?void 0:mt.default)!=null&&kt.location&&(o={type:"geojson",value:{type:"Feature",geometry:{type:"Point",coordinates:[t.property.default.location.lng,t.property.default.location.lat,...typeof t.property.default.height=="number"?[t.property.default.height]:[]]}}});else if(t.extensionId==="tileset")n="3dtiles",s=["tileset","sourceType"],((_i=(mn=t.property)==null?void 0:mn.default)==null?void 0:_i.sourceType)==="osm"?o={type:"osm-buildings"}:(ba=(zi=t.property)==null?void 0:zi.default)!=null&&ba.tileset&&(o={type:"3dtiles",url:t.property.default.tileset});else if(t.extensionId==="resource")if(n="resource",(La=(fa=t.property)==null?void 0:fa.default)!=null&&La.url&&typeof t.property.default.url=="object"){const Sc=t.property.default.url;o={type:t.property.default.type,value:Sc}}else o={type:((ma=(Ra=t.property)==null?void 0:Ra.default)==null?void 0:ma.type)||"auto",url:(nt=(yt=t.property)==null?void 0:yt.default)==null?void 0:nt.url};else t.extensionId==="box"&&(n="box",s=["location","height"],(Sa=(pi=t.property)==null?void 0:pi.default)!=null&&Sa.location&&(o={type:"geojson",value:{type:"Feature",geometry:{type:"Point",coordinates:[t.property.default.location.lng,t.property.default.location.lat,...typeof t.property.default.location.height=="number"?[t.property.default.location.height]:[]]}}}));const c=n&&t.property?Object.fromEntries(Object.entries(t.property).flatMap(([Sc,Xs])=>{if(!(Array.isArray(Xs)||Sc==="id"||!Xs||typeof Xs!="object"))return Object.entries(Xs).filter(([ms])=>!(s!=null&&s.includes(ms)))}).filter(Sc=>!!Sc)):void 0;return omitBy({type:"simple",...convertLegacyLayerCommon(t),data:o,...n&&c?{[n]:c}:{}},Sc=>typeof Sc>"u"||Sc===null)}function convertLegacyCluster(t){return t.map(n=>{var o;return{id:n.id,property:{default:n.default,layers:n.layers},layers:(o=n.layers)==null?void 0:o.map(s=>s.layer).filter(s=>!!s)}})}class Hooks{add(n,o,s){if(typeof arguments[0]!="string")for(let c in arguments[0])this.add(c,arguments[0][c],arguments[1]);else(Array.isArray(n)?n:[n]).forEach(function(c){this[c]=this[c]||[],o&&this[c][s?"unshift":"push"](o)},this)}run(n,o){this[n]=this[n]||[],this[n].forEach(function(s){s.call(o&&o.context?o.context:o,o)})}}class Plugins{constructor(n){this.jsep=n,this.registered={}}register(...n){n.forEach(o=>{if(typeof o!="object"||!o.name||!o.init)throw new Error("Invalid JSEP plugin format");this.registered[o.name]||(o.init(this.jsep),this.registered[o.name]=o)})}}class Jsep{static get version(){return"1.3.8"}static toString(){return"JavaScript Expression Parser (JSEP) v"+Jsep.version}static addUnaryOp(n){return Jsep.max_unop_len=Math.max(n.length,Jsep.max_unop_len),Jsep.unary_ops[n]=1,Jsep}static addBinaryOp(n,o,s){return Jsep.max_binop_len=Math.max(n.length,Jsep.max_binop_len),Jsep.binary_ops[n]=o,s?Jsep.right_associative.add(n):Jsep.right_associative.delete(n),Jsep}static addIdentifierChar(n){return Jsep.additional_identifier_chars.add(n),Jsep}static addLiteral(n,o){return Jsep.literals[n]=o,Jsep}static removeUnaryOp(n){return delete Jsep.unary_ops[n],n.length===Jsep.max_unop_len&&(Jsep.max_unop_len=Jsep.getMaxKeyLen(Jsep.unary_ops)),Jsep}static removeAllUnaryOps(){return Jsep.unary_ops={},Jsep.max_unop_len=0,Jsep}static removeIdentifierChar(n){return Jsep.additional_identifier_chars.delete(n),Jsep}static removeBinaryOp(n){return delete Jsep.binary_ops[n],n.length===Jsep.max_binop_len&&(Jsep.max_binop_len=Jsep.getMaxKeyLen(Jsep.binary_ops)),Jsep.right_associative.delete(n),Jsep}static removeAllBinaryOps(){return Jsep.binary_ops={},Jsep.max_binop_len=0,Jsep}static removeLiteral(n){return delete Jsep.literals[n],Jsep}static removeAllLiterals(){return Jsep.literals={},Jsep}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(n){this.expr=n,this.index=0}static parse(n){return new Jsep(n).parse()}static getMaxKeyLen(n){return Math.max(0,...Object.keys(n).map(o=>o.length))}static isDecimalDigit(n){return n>=48&&n<=57}static binaryPrecedence(n){return Jsep.binary_ops[n]||0}static isIdentifierStart(n){return n>=65&&n<=90||n>=97&&n<=122||n>=128&&!Jsep.binary_ops[String.fromCharCode(n)]||Jsep.additional_identifier_chars.has(String.fromCharCode(n))}static isIdentifierPart(n){return Jsep.isIdentifierStart(n)||Jsep.isDecimalDigit(n)}throwError(n){const o=new Error(n+" at character "+this.index);throw o.index=this.index,o.description=n,o}runHook(n,o){if(Jsep.hooks[n]){const s={context:this,node:o};return Jsep.hooks.run(n,s),s.node}return o}searchHook(n){if(Jsep.hooks[n]){const o={context:this};return Jsep.hooks[n].find(function(s){return s.call(o.context,o),o.node}),o.node}}gobbleSpaces(){let n=this.code;for(;n===Jsep.SPACE_CODE||n===Jsep.TAB_CODE||n===Jsep.LF_CODE||n===Jsep.CR_CODE;)n=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const n=this.gobbleExpressions(),o=n.length===1?n[0]:{type:Jsep.COMPOUND,body:n};return this.runHook("after-all",o)}gobbleExpressions(n){let o=[],s,c;for(;this.index<this.expr.length;)if(s=this.code,s===Jsep.SEMCOL_CODE||s===Jsep.COMMA_CODE)this.index++;else if(c=this.gobbleExpression())o.push(c);else if(this.index<this.expr.length){if(s===n)break;this.throwError('Unexpected "'+this.char+'"')}return o}gobbleExpression(){const n=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",n)}gobbleBinaryOp(){this.gobbleSpaces();let n=this.expr.substr(this.index,Jsep.max_binop_len),o=n.length;for(;o>0;){if(Jsep.binary_ops.hasOwnProperty(n)&&(!Jsep.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!Jsep.isIdentifierPart(this.expr.charCodeAt(this.index+n.length))))return this.index+=o,n;n=n.substr(0,--o)}return!1}gobbleBinaryExpression(){let n,o,s,c,d,h,p,y,S;if(h=this.gobbleToken(),!h||(o=this.gobbleBinaryOp(),!o))return h;for(d={value:o,prec:Jsep.binaryPrecedence(o),right_a:Jsep.right_associative.has(o)},p=this.gobbleToken(),p||this.throwError("Expected expression after "+o),c=[h,d,p];o=this.gobbleBinaryOp();){if(s=Jsep.binaryPrecedence(o),s===0){this.index-=o.length;break}d={value:o,prec:s,right_a:Jsep.right_associative.has(o)},S=o;const P=L=>d.right_a&&L.right_a?s>L.prec:s<=L.prec;for(;c.length>2&&P(c[c.length-2]);)p=c.pop(),o=c.pop().value,h=c.pop(),n={type:Jsep.BINARY_EXP,operator:o,left:h,right:p},c.push(n);n=this.gobbleToken(),n||this.throwError("Expected expression after "+S),c.push(d,n)}for(y=c.length-1,n=c[y];y>1;)n={type:Jsep.BINARY_EXP,operator:c[y-1].value,left:c[y-2],right:n},y-=2;return n}gobbleToken(){let n,o,s,c;if(this.gobbleSpaces(),c=this.searchHook("gobble-token"),c)return this.runHook("after-token",c);if(n=this.code,Jsep.isDecimalDigit(n)||n===Jsep.PERIOD_CODE)return this.gobbleNumericLiteral();if(n===Jsep.SQUOTE_CODE||n===Jsep.DQUOTE_CODE)c=this.gobbleStringLiteral();else if(n===Jsep.OBRACK_CODE)c=this.gobbleArray();else{for(o=this.expr.substr(this.index,Jsep.max_unop_len),s=o.length;s>0;){if(Jsep.unary_ops.hasOwnProperty(o)&&(!Jsep.isIdentifierStart(this.code)||this.index+o.length<this.expr.length&&!Jsep.isIdentifierPart(this.expr.charCodeAt(this.index+o.length)))){this.index+=s;const d=this.gobbleToken();return d||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:Jsep.UNARY_EXP,operator:o,argument:d,prefix:!0})}o=o.substr(0,--s)}Jsep.isIdentifierStart(n)?(c=this.gobbleIdentifier(),Jsep.literals.hasOwnProperty(c.name)?c={type:Jsep.LITERAL,value:Jsep.literals[c.name],raw:c.name}:c.name===Jsep.this_str&&(c={type:Jsep.THIS_EXP})):n===Jsep.OPAREN_CODE&&(c=this.gobbleGroup())}return c?(c=this.gobbleTokenProperty(c),this.runHook("after-token",c)):this.runHook("after-token",!1)}gobbleTokenProperty(n){this.gobbleSpaces();let o=this.code;for(;o===Jsep.PERIOD_CODE||o===Jsep.OBRACK_CODE||o===Jsep.OPAREN_CODE||o===Jsep.QUMARK_CODE;){let s;if(o===Jsep.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==Jsep.PERIOD_CODE)break;s=!0,this.index+=2,this.gobbleSpaces(),o=this.code}this.index++,o===Jsep.OBRACK_CODE?(n={type:Jsep.MEMBER_EXP,computed:!0,object:n,property:this.gobbleExpression()},this.gobbleSpaces(),o=this.code,o!==Jsep.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):o===Jsep.OPAREN_CODE?n={type:Jsep.CALL_EXP,arguments:this.gobbleArguments(Jsep.CPAREN_CODE),callee:n}:(o===Jsep.PERIOD_CODE||s)&&(s&&this.index--,this.gobbleSpaces(),n={type:Jsep.MEMBER_EXP,computed:!1,object:n,property:this.gobbleIdentifier()}),s&&(n.optional=!0),this.gobbleSpaces(),o=this.code}return n}gobbleNumericLiteral(){let n="",o,s;for(;Jsep.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(this.code===Jsep.PERIOD_CODE)for(n+=this.expr.charAt(this.index++);Jsep.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(o=this.char,o==="e"||o==="E"){for(n+=this.expr.charAt(this.index++),o=this.char,(o==="+"||o==="-")&&(n+=this.expr.charAt(this.index++));Jsep.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);Jsep.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")")}return s=this.code,Jsep.isIdentifierStart(s)?this.throwError("Variable names cannot start with a number ("+n+this.char+")"):(s===Jsep.PERIOD_CODE||n.length===1&&n.charCodeAt(0)===Jsep.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:Jsep.LITERAL,value:parseFloat(n),raw:n}}gobbleStringLiteral(){let n="";const o=this.index,s=this.expr.charAt(this.index++);let c=!1;for(;this.index<this.expr.length;){let d=this.expr.charAt(this.index++);if(d===s){c=!0;break}else if(d==="\\")switch(d=this.expr.charAt(this.index++),d){case"n":n+=`
|
|
27
|
+
${o}`:L),S},0),p.join("")}),this}erase(n,o){return this.replace(n,"",o)}execute(n){return this.commands.reduce((o,s)=>s(o),n)}}function useConstant$2(t){const n=React.useRef();return n.current==null&&(n.current={value:t()}),n.current.value}const ctx=typeof window<"u"?window:global,requestIdleCallbackShim=(t,n)=>{const o=Date.now();return ctx.setTimeout(function(){t({didTimeout:!1,timeRemaining:function(){return Math.max(0,12-(Date.now()-o))}})})},requestIdleCallback=ctx.requestIdleCallback||requestIdleCallbackShim,requestIdleCallbackWithRequiredWork=t=>{requestIdleCallback(t,{timeout:1})},usableChars$1="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",generateRandomString$1=t=>Array.from(window.crypto.getRandomValues(new Uint8Array(t))).map(n=>usableChars$1[n%t]).join("").toLowerCase();function objectFromGetter(t,n){const o={},s=t.reduce((c,d)=>({...c,[d]:{get(){return n.call(this,d)},configurable:!1,enumerable:!0}}),{});return Object.defineProperties(o,s),o}const convertTime=t=>{if(t){if(t instanceof Date)return isNaN(t.getTime())?void 0:t;try{const n=new Date(t);return isNaN(n.getTime())?void 0:n}catch{return}}};var ValueType=(t=>(t.Array="ARRAY",t.Bool="BOOL",t.Camera="CAMERA",t.Coordinates="COORDINATES",t.Latlng="LATLNG",t.Latlngheight="LATLNGHEIGHT",t.Number="NUMBER",t.Polygon="POLYGON",t.Rect="RECT",t.Ref="REF",t.Spacing="SPACING",t.String="STRING",t.Timeline="TIMELINE",t.Typography="TYPOGRAPHY",t.Url="URL",t))(ValueType||{});ValueType.Bool+"",ValueType.Number+"",ValueType.String+"",ValueType.Url+"",ValueType.Latlng+"",ValueType.Latlngheight+"",ValueType.Camera+"",ValueType.Typography+"",ValueType.Coordinates+"",ValueType.Polygon+"",ValueType.Rect+"",ValueType.Ref+"",ValueType.Spacing+"",ValueType.Array+"",ValueType.Timeline+"";const getCSSFontFamily=t=>t?t==="YuGothic"?'"游ゴシック体", YuGothic, "游ゴシック Medium", "Yu Gothic Medium", "游ゴシック", "Yu Gothic"':t:void 0,toCSSFont=(t,n)=>{var s;const o=(s=getCSSFontFamily((t==null?void 0:t.fontFamily)??(n==null?void 0:n.fontFamily)))==null?void 0:s.replace("'",'"').trim();return`${(t==null?void 0:t.italic)??(n==null?void 0:n.italic)?"italic ":""}${(t==null?void 0:t.bold)??(n==null?void 0:n.bold)?"bold ":((t==null?void 0:t.fontWeight)??(n==null?void 0:n.fontWeight)??"")+" "}${(t==null?void 0:t.fontSize)??(n==null?void 0:n.fontSize)??16}px ${o?o.includes('"')?o:`"${o}"`:"sans-serif"}`},toColor$2=t=>{if(!t||typeof t!="string")return;const n=t.match(/^#([A-Fa-f0-9]{6})([A-Fa-f0-9]{2})$|^#([A-Fa-f0-9]{3})([A-Fa-f0-9])$/);if(!n)return Cesium$1.Color.fromCssColorString(t);const o=parseInt(n[4]?n[4].repeat(2):n[2],16)/255;return Cesium$1.Color.fromCssColorString(`#${n[1]??n[3]}`).withAlpha(o)};var lib={};Object.defineProperty(lib,"__esModule",{value:!0});var easing=lib.easing={linear:function(t){return t},quadratic:function(t){return t*(-(t*t)*t+4*t*t-6*t+4)},cubic:function(t){return t*(4*t*t-9*t+6)},elastic:function(t){return t*(33*t*t*t*t-106*t*t*t+126*t*t-67*t+15)},inQuad:function(t){return t*t},outQuad:function(t){return t*(2-t)},inOutQuad:function(t){return t<.5?2*t*t:-1+(4-2*t)*t},inCubic:function(t){return t*t*t},outCubic:function(t){return--t*t*t+1},inOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},inQuart:function(t){return t*t*t*t},outQuart:function(t){return 1- --t*t*t*t},inOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},inQuint:function(t){return t*t*t*t*t},outQuint:function(t){return 1+--t*t*t*t*t},inOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t},inSine:function(t){return-Math.cos(t*(Math.PI/2))+1},outSine:function(t){return Math.sin(t*(Math.PI/2))},inOutSine:function(t){return-(Math.cos(Math.PI*t)-1)/2},inExpo:function(t){return Math.pow(2,10*(t-1))},outExpo:function(t){return-Math.pow(2,-10*t)+1},inOutExpo:function(t){return t/=.5,t<1?Math.pow(2,10*(t-1))/2:(t--,(-Math.pow(2,-10*t)+2)/2)},inCirc:function(t){return-Math.sqrt(1-t*t)+1},outCirc:function(t){return Math.sqrt(1-(t=t-1)*t)},inOutCirc:function(t){return t/=.5,t<1?-(Math.sqrt(1-t*t)-1)/2:(t-=2,(Math.sqrt(1-t*t)+1)/2)}};function interval$1(t,n){let o=0,s=0,c=0;const d=()=>{t(o===0?0:Date.now()-o)&&(s=window.requestAnimationFrame(d)),o===0&&(o=Date.now())};return s=window.requestAnimationFrame(d),()=>{window.clearTimeout(c),window.cancelAnimationFrame(s)}}function intervalDuring(t,n,o){return n<0?()=>{}:interval$1(s=>{const c=Math.min(1,n===0?1:s/n);return t(c),c<1})}function tweenInterval(t,n,o,s){const c=typeof n=="function"?n:easing[n];return intervalDuring(d=>{t(c(d),d)},o)}const useImage=t=>{const n=React.useRef(),[o,s]=React.useState();return React.useEffect(()=>{if(!t){s(void 0),n.current&&(n.current.src="");return}const c=new Image;c.crossOrigin="anonymous",c.onload=()=>{s(n.current)},c.src=t,n.current=c},[t]),o};function useFirstMountState(){var t=React.useRef(!0);return t.current?(t.current=!1,!0):t.current}var __assign$2=function(){return __assign$2=Object.assign||function(n){for(var o,s=1,c=arguments.length;s<c;s++){o=arguments[s];for(var d in o)Object.prototype.hasOwnProperty.call(o,d)&&(n[d]=o[d])}return n},__assign$2.apply(this,arguments)};function __spreadArrays(){for(var t=0,n=0,o=arguments.length;n<o;n++)t+=arguments[n].length;for(var s=Array(t),c=0,n=0;n<o;n++)for(var d=arguments[n],h=0,p=d.length;h<p;h++,c++)s[c]=d[h];return s}typeof SuppressedError=="function"&&SuppressedError;var strictEquals=function(t,n){return t===n};function usePreviousDistinct(t,n){n===void 0&&(n=strictEquals);var o=React.useRef(),s=React.useRef(t),c=useFirstMountState();return!c&&!n(s.current,t)&&(o.current=s.current,s.current=t),o.current}var useSet=function(t){t===void 0&&(t=new Set);var n=React.useState(t),o=n[0],s=n[1],c=React.useMemo(function(){var h=function(S){return s(function(P){return new Set(__spreadArrays(Array.from(P),[S]))})},p=function(S){return s(function(P){return new Set(Array.from(P).filter(function(L){return L!==S}))})},y=function(S){return s(function(P){return P.has(S)?new Set(Array.from(P).filter(function(L){return L!==S})):new Set(__spreadArrays(Array.from(P),[S]))})};return{add:h,remove:p,toggle:y,reset:function(){return s(t)},clear:function(){return s(new Set)}}},[s]),d=__assign$2({has:React.useCallback(function(h){return o.has(h)},[o])},c);return[o,d]};const useDelayedCount=(t=[])=>{const[n,o]=React.useState(0),s=usePreviousDistinct(n),c=React.useRef(!1),d=React.useRef(),h=React.useCallback(()=>{o(y=>Math.max(0,Math.min(t.length+1,y+(c.current?-1:1))))},[t.length]),p=React.useCallback((y,S)=>{if(d.current&&(clearTimeout(d.current),d.current=void 0),S){o(y?0:t.length+1);return}c.current=y,h()},[h,t.length]);return React.useEffect(()=>{if(d.current!==void 0&&(clearTimeout(d.current),d.current=void 0),n<=0||n>=t.length+1)return;const y=t==null?void 0:t[n-1],S=Array.isArray(y)?y[c.current?1:0]:y;d.current=window.setTimeout(()=>{d.current=void 0,h()},S??0)},[h,t,n]),React.useEffect(()=>()=>{d.current&&(clearTimeout(d.current),d.current=void 0)},[]),[n,s,p]},DEFAULT_RANGE=864e5,useTimelineManager=({init:t,engineRef:n,timelineManagerRef:o})=>{const[s,c]=React.useState({start:convertTime(t==null?void 0:t.start)??new Date,stop:convertTime(t==null?void 0:t.stop)??new Date,current:convertTime(t==null?void 0:t.current)??new Date}),[d,h]=React.useState({animation:(t==null?void 0:t.animation)??!1,stepType:(t==null?void 0:t.stepType)??"rate",multiplier:(t==null?void 0:t.stepType)==="fixed"?(t==null?void 0:t.step)??1:(t==null?void 0:t.multiplier)??1,rangeType:(t==null?void 0:t.rangeType)??"unbounded"}),p=React.useMemo(()=>{const{start:Pe,stop:se,current:mt}=s,kt=Pe.getTime(),mn=se.getTime(),_i=mt.getTime(),zi=kt>_i?_i:kt,ba=mn<_i?_i+DEFAULT_RANGE:mn;return{start:new Date(zi),stop:new Date(ba),current:new Date(_i)}},[s]),y=React.useCallback(Pe=>{Pe.cmd&&(Pe.cmd==="PLAY"?h(se=>({...se,animation:!0})):Pe.cmd==="PAUSE"?h(se=>({...se,animation:!1})):Pe.cmd==="SET_TIME"?c(se=>({start:convertTime(Pe.payload.start)??se.start,stop:convertTime(Pe.payload.stop)??se.stop,current:convertTime(Pe.payload.current)??se.current})):Pe.cmd==="SET_OPTIONS"&&h(se=>{var mt,kt,mn;return{...se,stepType:((mt=Pe.payload)==null?void 0:mt.stepType)===void 0?se.stepType:Pe.payload.stepType,multiplier:((kt=Pe.payload)==null?void 0:kt.multiplier)===void 0?se.multiplier:Pe.payload.multiplier,rangeType:((mn=Pe.payload)==null?void 0:mn.rangeType)===void 0?se.rangeType:Pe.payload.rangeType}}),F.current.forEach(se=>se(Pe.committer)))},[]),S=React.useRef([]),P=React.useCallback(Pe=>{S.current.push(Pe)},[]),L=React.useCallback(Pe=>{S.current=S.current.filter(se=>se!==Pe)},[]),F=React.useRef([]),N=React.useCallback(Pe=>{F.current.push(Pe)},[]),W=React.useCallback(Pe=>{F.current=F.current.filter(se=>se!==Pe)},[]),z=React.useCallback(()=>{S.current.forEach(Pe=>{var mt;const se=(mt=n==null?void 0:n.current)==null?void 0:mt.getClock();se!=null&&se.current&&(se!=null&&se.start)&&(se!=null&&se.stop)&&Pe(se.current,{start:se==null?void 0:se.start,stop:se==null?void 0:se.stop})})},[n]),lt=React.useMemo(()=>({timeline:{get start(){var Pe,se;return(se=(Pe=n==null?void 0:n.current)==null?void 0:Pe.getClock())==null?void 0:se.start},get stop(){var Pe,se;return(se=(Pe=n==null?void 0:n.current)==null?void 0:Pe.getClock())==null?void 0:se.stop},get current(){var Pe,se;return(se=(Pe=n==null?void 0:n.current)==null?void 0:Pe.getClock())==null?void 0:se.current}},options:d,computedTimeline:p,commit:y,onTick:P,offTick:L,onCommit:N,offCommit:W,handleTick:z,get tick(){var Pe;return(Pe=n==null?void 0:n.current)==null?void 0:Pe.tick}}),[d,p,n,y,P,L,N,W,z]);return o&&(o.current=lt),null},FORCE_REQUEST_RENDER=-1,NO_REQUEST_RENDER=0,REQUEST_RENDER_ONCE=1;function useHooks$c({ref:t,timelineManagerRef:n,onLayerSelect:o,onMount:s,onAPIReady:c}){const[d,h]=React.useState({engine:!1,layers:!1,sketch:!1,spatialId:!1}),p=React.useRef(null),y=React.useRef(null),S=React.useRef(null),P=React.useRef(null),L=React.useRef(null),F=React.useRef(NO_REQUEST_RENDER);React.useImperativeHandle(t,()=>mapRef({engineRef:p,layersRef:y,sketchRef:S,spatialIdRef:P,geoidRef:L,timelineManagerRef:n}),[n]),React.useEffect(()=>{c&&d.engine&&d.layers&&d.sketch&&d.spatialId&&(c==null||c())},[c,d]);const[N,W]=React.useState({}),z=React.useCallback(async(zi,ba,fa,La,Ra)=>{W({layerId:zi,featureId:ba,reason:La}),o==null||o(zi,ba,fa,La,Ra)},[o]),lt=React.useCallback((zi,ba,fa,La)=>{var Ra;(Ra=y.current)==null||Ra.selectFeatures([{layerId:zi,featureId:ba?[ba]:void 0}],fa,La)},[]);useTimelineManager({engineRef:p,timelineManagerRef:n});const[Pe,se]=React.useState(),mt=React.useCallback(()=>{h(zi=>({...zi,engine:!0})),s==null||s()},[s]),kt=React.useCallback(()=>{h(zi=>({...zi,layers:!0}))},[]),mn=React.useCallback(()=>{h(zi=>({...zi,sketch:!0}))},[]),_i=React.useCallback(()=>{h(zi=>({...zi,spatialId:!0}))},[]);return{engineRef:p,layersRef:y,sketchRef:S,spatialIdRef:P,geoidRef:L,selectedLayer:N,requestingRenderMode:F,handleLayerSelect:z,handleEngineLayerSelect:lt,sketchEditingFeature:Pe,setSketchEditingFeature:se,handleEngineMount:mt,handleLayersMount:kt,handleSketchMount:mn,handleSpatialIdMount:_i}}let keyCount=0;function atom$1(t,n){const o=`atom${++keyCount}`,s={toString:()=>o};return typeof t=="function"?s.read=t:(s.init=t,s.read=c=>c(s),s.write=(c,d,h)=>d(s,typeof h=="function"?h(c(s)):h)),n&&(s.write=n),s}const SUSPENSE_PROMISE=Symbol(),isSuspensePromise=t=>!!t[SUSPENSE_PROMISE],isSuspensePromiseAlreadyCancelled=t=>!t[SUSPENSE_PROMISE].c,cancelSuspensePromise=t=>{var n;const{b:o,c:s}=t[SUSPENSE_PROMISE];s&&(s(),(n=promiseAbortMap.get(o))==null||n())},isEqualSuspensePromise=(t,n)=>{const o=t[SUSPENSE_PROMISE].o,s=n[SUSPENSE_PROMISE].o;return o===s||t===s||isSuspensePromise(o)&&isEqualSuspensePromise(o,n)},createSuspensePromise=(t,n)=>{const o={b:t,o:n,c:null},s=new Promise(c=>{o.c=()=>{o.c=null,c()},n.finally(o.c)});return s[SUSPENSE_PROMISE]=o,s},copySuspensePromise=t=>createSuspensePromise(t[SUSPENSE_PROMISE].b,t[SUSPENSE_PROMISE].o),promiseAbortMap=new WeakMap,hasInitialValue=t=>"init"in t,READ_ATOM="r",WRITE_ATOM="w",COMMIT_ATOM="c",SUBSCRIBE_ATOM="s",RESTORE_ATOMS="h",createStore=t=>{const n=new WeakMap,o=new WeakMap,s=new Map,c=new WeakMap,d=(Xs,ms,yu)=>{let pu=c.get(ms);pu||(pu=new Map,c.set(ms,pu)),yu.then(()=>{pu.get(Xs)===yu&&(pu.delete(Xs),pu.size||c.delete(ms))}),pu.set(Xs,yu)},h=Xs=>{const ms=new Set,yu=c.get(Xs);return yu&&(c.delete(Xs),yu.forEach((pu,Nl)=>{cancelSuspensePromise(pu),ms.add(Nl)})),ms},p=new WeakMap,y=Xs=>{let ms=p.get(Xs);return ms||(ms=new Map,p.set(Xs,ms)),ms},S=(Xs,ms)=>{if(Xs){const yu=y(Xs);let pu=yu.get(ms);return pu||(pu=S(Xs.p,ms),pu&&"p"in pu&&isSuspensePromiseAlreadyCancelled(pu.p)&&(pu=void 0),pu&&yu.set(ms,pu)),pu}return n.get(ms)},P=(Xs,ms,yu)=>{if(Xs)y(Xs).set(ms,yu);else{const pu=n.get(ms);n.set(ms,yu),s.has(ms)||s.set(ms,pu)}},L=(Xs,ms=new Map,yu)=>{if(!yu)return ms;const pu=new Map;let Nl=!1;return yu.forEach(Ru=>{var Vd;const Gd=((Vd=S(Xs,Ru))==null?void 0:Vd.r)||0;pu.set(Ru,Gd),ms.get(Ru)!==Gd&&(Nl=!0)}),ms.size===pu.size&&!Nl?ms:pu},F=(Xs,ms,yu,pu,Nl)=>{const Ru=S(Xs,ms);if(Ru){if(Nl&&(!("p"in Ru)||!isEqualSuspensePromise(Ru.p,Nl)))return Ru;"p"in Ru&&cancelSuspensePromise(Ru.p)}const Vd={v:yu,r:(Ru==null?void 0:Ru.r)||0,y:!0,d:L(Xs,Ru==null?void 0:Ru.d,pu)};let Gd=!(Ru!=null&&Ru.y);return!Ru||!("v"in Ru)||!Object.is(Ru.v,yu)?(Gd=!0,++Vd.r,Vd.d.has(ms)&&(Vd.d=new Map(Vd.d).set(ms,Vd.r))):Vd.d!==Ru.d&&(Vd.d.size!==Ru.d.size||!Array.from(Vd.d.keys()).every(lf=>Ru.d.has(lf)))&&(Gd=!0,Promise.resolve().then(()=>{yt(Xs)})),Ru&&!Gd?Ru:(P(Xs,ms,Vd),Vd)},N=(Xs,ms,yu,pu,Nl)=>{const Ru=S(Xs,ms);if(Ru){if(Nl&&(!("p"in Ru)||!isEqualSuspensePromise(Ru.p,Nl)))return Ru;"p"in Ru&&cancelSuspensePromise(Ru.p)}const Vd={e:yu,r:((Ru==null?void 0:Ru.r)||0)+1,y:!0,d:L(Xs,Ru==null?void 0:Ru.d,pu)};return P(Xs,ms,Vd),Vd},W=(Xs,ms,yu,pu)=>{const Nl=S(Xs,ms);if(Nl&&"p"in Nl){if(isEqualSuspensePromise(Nl.p,yu)&&!isSuspensePromiseAlreadyCancelled(Nl.p))return Nl.y?Nl:{...Nl,y:!0};cancelSuspensePromise(Nl.p)}d(Xs,ms,yu);const Ru={p:yu,r:((Nl==null?void 0:Nl.r)||0)+1,y:!0,d:L(Xs,Nl==null?void 0:Nl.d,pu)};return P(Xs,ms,Ru),Ru},z=(Xs,ms,yu,pu)=>{if(yu instanceof Promise){const Nl=createSuspensePromise(yu,yu.then(Ru=>{F(Xs,ms,Ru,pu,Nl)}).catch(Ru=>{if(Ru instanceof Promise)return isSuspensePromise(Ru)?Ru.then(()=>{Pe(Xs,ms,!0)}):Ru;N(Xs,ms,Ru,pu,Nl)}));return W(Xs,ms,Nl,pu)}return F(Xs,ms,yu,pu)},lt=(Xs,ms)=>{const yu=S(Xs,ms);if(yu){const pu={...yu,y:!1};P(Xs,ms,pu)}},Pe=(Xs,ms,yu)=>{if(!yu){const Nl=S(Xs,ms);if(Nl){if(Nl.y&&"p"in Nl&&!isSuspensePromiseAlreadyCancelled(Nl.p))return Nl;if(Nl.d.forEach((Ru,Vd)=>{if(Vd!==ms)if(!o.has(Vd))Pe(Xs,Vd);else{const Gd=S(Xs,Vd);Gd&&!Gd.y&&Pe(Xs,Vd)}}),Array.from(Nl.d).every(([Ru,Vd])=>{const Gd=S(Xs,Ru);return Gd&&!("p"in Gd)&&Gd.r===Vd}))return Nl.y?Nl:{...Nl,y:!0}}}const pu=new Set;try{const Nl=ms.read(Ru=>{pu.add(Ru);const Vd=Ru===ms?S(Xs,Ru):Pe(Xs,Ru);if(Vd){if("e"in Vd)throw Vd.e;if("p"in Vd)throw Vd.p;return Vd.v}if(hasInitialValue(Ru))return Ru.init;throw new Error("no atom init")});return z(Xs,ms,Nl,pu)}catch(Nl){if(Nl instanceof Promise){const Ru=isSuspensePromise(Nl)&&isSuspensePromiseAlreadyCancelled(Nl)?copySuspensePromise(Nl):createSuspensePromise(Nl,Nl);return W(Xs,ms,Ru,pu)}return N(Xs,ms,Nl,pu)}},se=(Xs,ms)=>Pe(ms,Xs),mt=(Xs,ms)=>{let yu=o.get(ms);return yu||(yu=La(Xs,ms)),yu},kt=(Xs,ms)=>!ms.l.size&&(!ms.t.size||ms.t.size===1&&ms.t.has(Xs)),mn=(Xs,ms)=>{const yu=o.get(ms);yu&&kt(ms,yu)&&Ra(Xs,ms)},_i=(Xs,ms)=>{const yu=o.get(ms);yu==null||yu.t.forEach(pu=>{pu!==ms&&(lt(Xs,pu),_i(Xs,pu))})},zi=(Xs,ms,yu)=>{let pu=!0;const Nl=(Gd,lf)=>{const hf=Pe(Xs,Gd);if("e"in hf)throw hf.e;if("p"in hf){if(lf!=null&&lf.unstable_promise)return hf.p.then(()=>{const pf=S(Xs,Gd);return pf&&"p"in pf&&pf.p===hf.p?new Promise(mf=>setTimeout(mf)).then(()=>Nl(Gd,lf)):Nl(Gd,lf)});throw hf.p}if("v"in hf)return hf.v;throw new Error("no value found")},Ru=(Gd,lf)=>{let hf;if(Gd===ms){if(!hasInitialValue(Gd))throw new Error("atom not writable");h(Gd).forEach(yf=>{yf!==Xs&&z(yf,Gd,lf)});const mf=S(Xs,Gd),sf=z(Xs,Gd,lf);mf!==sf&&_i(Xs,Gd)}else hf=zi(Xs,Gd,lf);return pu||yt(Xs),hf},Vd=ms.write(Nl,Ru,yu);return pu=!1,Vd},ba=(Xs,ms,yu)=>{const pu=zi(yu,Xs,ms);return yt(yu),pu},fa=Xs=>!!Xs.write,La=(Xs,ms,yu)=>{const pu={t:new Set(yu&&[yu]),l:new Set};if(o.set(ms,pu),Pe(void 0,ms).d.forEach((Ru,Vd)=>{const Gd=o.get(Vd);Gd?Gd.t.add(ms):Vd!==ms&&La(Xs,Vd,ms)}),fa(ms)&&ms.onMount){const Ru=Gd=>ba(ms,Gd,Xs),Vd=ms.onMount(Ru);Xs=void 0,Vd&&(pu.u=Vd)}return pu},Ra=(Xs,ms)=>{var yu;const pu=(yu=o.get(ms))==null?void 0:yu.u;pu&&pu(),o.delete(ms);const Nl=S(Xs,ms);Nl&&("p"in Nl&&cancelSuspensePromise(Nl.p),Nl.d.forEach((Ru,Vd)=>{if(Vd!==ms){const Gd=o.get(Vd);Gd&&(Gd.t.delete(ms),kt(Vd,Gd)&&Ra(Xs,Vd))}}))},ma=(Xs,ms,yu,pu)=>{const Nl=new Set(yu.d.keys());pu==null||pu.forEach((Ru,Vd)=>{if(Nl.has(Vd)){Nl.delete(Vd);return}const Gd=o.get(Vd);Gd&&(Gd.t.delete(ms),kt(Vd,Gd)&&Ra(Xs,Vd))}),Nl.forEach(Ru=>{const Vd=o.get(Ru);Vd?Vd.t.add(ms):o.has(ms)&&La(Xs,Ru,ms)})},yt=Xs=>{if(Xs){y(Xs).forEach((yu,pu)=>{const Nl=n.get(pu);if(yu!==Nl){const Ru=o.get(pu);Ru==null||Ru.l.forEach(Vd=>Vd(Xs))}});return}for(;s.size;){const ms=Array.from(s);s.clear(),ms.forEach(([yu,pu])=>{const Nl=S(void 0,yu);if(Nl&&Nl.d!==(pu==null?void 0:pu.d)&&ma(void 0,yu,Nl,pu==null?void 0:pu.d),pu&&!pu.y&&(Nl!=null&&Nl.y))return;const Ru=o.get(yu);Ru==null||Ru.l.forEach(Vd=>Vd())})}},nt=Xs=>{y(Xs).forEach((yu,pu)=>{const Nl=n.get(pu);(!Nl||yu.r>Nl.r||yu.y!==Nl.y||yu.r===Nl.r&&yu.d!==Nl.d)&&(n.set(pu,yu),yu.d!==(Nl==null?void 0:Nl.d)&&ma(Xs,pu,yu,Nl==null?void 0:Nl.d))})},pi=(Xs,ms)=>{ms&&nt(ms),yt(void 0)},Sa=(Xs,ms,yu)=>{const Nl=mt(yu,Xs).l;return Nl.add(ms),()=>{Nl.delete(ms),mn(yu,Xs)}},Sc=(Xs,ms)=>{for(const[yu,pu]of Xs)hasInitialValue(yu)&&(z(ms,yu,pu),_i(ms,yu));yt(ms)};return{[READ_ATOM]:se,[WRITE_ATOM]:ba,[COMMIT_ATOM]:pi,[SUBSCRIBE_ATOM]:Sa,[RESTORE_ATOMS]:Sc}},createScopeContainer=(t,n)=>({s:n?n(t).SECRET_INTERNAL_store:createStore()}),ScopeContextMap=new Map,getScopeContext=t=>(ScopeContextMap.has(t)||ScopeContextMap.set(t,React.createContext(createScopeContainer())),ScopeContextMap.get(t));function atom(t,n){return atom$1(t,n)}function useAtomValue(t,n){const o=getScopeContext(n),s=React.useContext(o),{s:c,v:d}=s,h=F=>{const N=c[READ_ATOM](t,F);if("e"in N)throw N.e;if("p"in N)throw N.p;if("v"in N)return N.v;throw new Error("no atom value")},[[p,y,S],P]=React.useReducer((F,N)=>{const W=h(N);return Object.is(F[1],W)&&F[2]===t?F:[N,W,t]},d,F=>{const N=h(F);return[F,N,t]});let L=y;return S!==t&&(P(p),L=h(p)),React.useEffect(()=>{const{v:F}=s;F&&c[COMMIT_ATOM](t,F);const N=c[SUBSCRIBE_ATOM](t,P,F);return P(F),N},[c,t,s]),React.useEffect(()=>{c[COMMIT_ATOM](t,p)}),React.useDebugValue(L),L}function useSetAtom(t,n){const o=getScopeContext(n),{s,w:c}=React.useContext(o);return React.useCallback(h=>{const p=y=>s[WRITE_ATOM](t,h,y);return c?c(p):p()},[s,c,t])}function useAtom(t,n){return"scope"in t&&(console.warn("atom.scope is deprecated. Please do useAtom(atom, scope) instead."),n=t.scope),[useAtomValue(t,n),useSetAtom(t,n)]}var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root$1=freeGlobal||freeSelf||Function("return this")(),Symbol$1=root$1.Symbol,objectProto$h=Object.prototype,hasOwnProperty$f=objectProto$h.hasOwnProperty,nativeObjectToString$1=objectProto$h.toString,symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0;function getRawTag(t){var n=hasOwnProperty$f.call(t,symToStringTag$1),o=t[symToStringTag$1];try{t[symToStringTag$1]=void 0;var s=!0}catch{}var c=nativeObjectToString$1.call(t);return s&&(n?t[symToStringTag$1]=o:delete t[symToStringTag$1]),c}var objectProto$g=Object.prototype,nativeObjectToString=objectProto$g.toString;function objectToString$1(t){return nativeObjectToString.call(t)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$1?Symbol$1.toStringTag:void 0;function baseGetTag(t){return t==null?t===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(t)?getRawTag(t):objectToString$1(t)}function isObjectLike(t){return t!=null&&typeof t=="object"}var symbolTag$3="[object Symbol]";function isSymbol(t){return typeof t=="symbol"||isObjectLike(t)&&baseGetTag(t)==symbolTag$3}function arrayMap(t,n){for(var o=-1,s=t==null?0:t.length,c=Array(s);++o<s;)c[o]=n(t[o],o,t);return c}var isArray$4=Array.isArray,symbolProto$2=Symbol$1?Symbol$1.prototype:void 0,symbolToString=symbolProto$2?symbolProto$2.toString:void 0;function baseToString(t){if(typeof t=="string")return t;if(isArray$4(t))return arrayMap(t,baseToString)+"";if(isSymbol(t))return symbolToString?symbolToString.call(t):"";var n=t+"";return n=="0"&&1/t==-1/0?"-0":n}function isObject$2(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}function identity$3(t){return t}var asyncTag="[object AsyncFunction]",funcTag$2="[object Function]",genTag$1="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$2(t){if(!isObject$2(t))return!1;var n=baseGetTag(t);return n==funcTag$2||n==genTag$1||n==asyncTag||n==proxyTag}var coreJsData=root$1["__core-js_shared__"],maskSrcKey=function(){var t=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function isMasked(t){return!!maskSrcKey&&maskSrcKey in t}var funcProto$2=Function.prototype,funcToString$2=funcProto$2.toString;function toSource(t){if(t!=null){try{return funcToString$2.call(t)}catch{}try{return t+""}catch{}}return""}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$f=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$e=objectProto$f.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$e).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(t){if(!isObject$2(t)||isMasked(t))return!1;var n=isFunction$2(t)?reIsNative:reIsHostCtor;return n.test(toSource(t))}function getValue$1(t,n){return t==null?void 0:t[n]}function getNative(t,n){var o=getValue$1(t,n);return baseIsNative(o)?o:void 0}var WeakMap$1=getNative(root$1,"WeakMap"),objectCreate=Object.create,baseCreate=function(){function t(){}return function(n){if(!isObject$2(n))return{};if(objectCreate)return objectCreate(n);t.prototype=n;var o=new t;return t.prototype=void 0,o}}();function apply(t,n,o){switch(o.length){case 0:return t.call(n);case 1:return t.call(n,o[0]);case 2:return t.call(n,o[0],o[1]);case 3:return t.call(n,o[0],o[1],o[2])}return t.apply(n,o)}function noop$3(){}function copyArray(t,n){var o=-1,s=t.length;for(n||(n=Array(s));++o<s;)n[o]=t[o];return n}var HOT_COUNT=800,HOT_SPAN=16,nativeNow=Date.now;function shortOut(t){var n=0,o=0;return function(){var s=nativeNow(),c=HOT_SPAN-(s-o);if(o=s,c>0){if(++n>=HOT_COUNT)return arguments[0]}else n=0;return t.apply(void 0,arguments)}}function constant$2(t){return function(){return t}}var defineProperty=function(){try{var t=getNative(Object,"defineProperty");return t({},"",{}),t}catch{}}(),baseSetToString=defineProperty?function(t,n){return defineProperty(t,"toString",{configurable:!0,enumerable:!1,value:constant$2(n),writable:!0})}:identity$3,setToString=shortOut(baseSetToString);function arrayEach(t,n){for(var o=-1,s=t==null?0:t.length;++o<s&&n(t[o],o,t)!==!1;);return t}function baseFindIndex(t,n,o,s){for(var c=t.length,d=o+-1;++d<c;)if(n(t[d],d,t))return d;return-1}function baseIsNaN(t){return t!==t}function strictIndexOf(t,n,o){for(var s=o-1,c=t.length;++s<c;)if(t[s]===n)return s;return-1}function baseIndexOf(t,n,o){return n===n?strictIndexOf(t,n,o):baseFindIndex(t,baseIsNaN,o)}function arrayIncludes(t,n){var o=t==null?0:t.length;return!!o&&baseIndexOf(t,n,0)>-1}var MAX_SAFE_INTEGER$1=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(t,n){var o=typeof t;return n=n??MAX_SAFE_INTEGER$1,!!n&&(o=="number"||o!="symbol"&&reIsUint.test(t))&&t>-1&&t%1==0&&t<n}function baseAssignValue(t,n,o){n=="__proto__"&&defineProperty?defineProperty(t,n,{configurable:!0,enumerable:!0,value:o,writable:!0}):t[n]=o}function eq(t,n){return t===n||t!==t&&n!==n}var objectProto$e=Object.prototype,hasOwnProperty$d=objectProto$e.hasOwnProperty;function assignValue(t,n,o){var s=t[n];(!(hasOwnProperty$d.call(t,n)&&eq(s,o))||o===void 0&&!(n in t))&&baseAssignValue(t,n,o)}function copyObject(t,n,o,s){var c=!o;o||(o={});for(var d=-1,h=n.length;++d<h;){var p=n[d],y=void 0;y===void 0&&(y=t[p]),c?baseAssignValue(o,p,y):assignValue(o,p,y)}return o}var nativeMax=Math.max;function overRest(t,n,o){return n=nativeMax(n===void 0?t.length-1:n,0),function(){for(var s=arguments,c=-1,d=nativeMax(s.length-n,0),h=Array(d);++c<d;)h[c]=s[n+c];c=-1;for(var p=Array(n+1);++c<n;)p[c]=s[c];return p[n]=o(h),apply(t,this,p)}}function baseRest(t,n){return setToString(overRest(t,n,identity$3),t+"")}var MAX_SAFE_INTEGER=9007199254740991;function isLength(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=MAX_SAFE_INTEGER}function isArrayLike(t){return t!=null&&isLength(t.length)&&!isFunction$2(t)}function isIterateeCall(t,n,o){if(!isObject$2(o))return!1;var s=typeof n;return(s=="number"?isArrayLike(o)&&isIndex(n,o.length):s=="string"&&n in o)?eq(o[n],t):!1}function createAssigner(t){return baseRest(function(n,o){var s=-1,c=o.length,d=c>1?o[c-1]:void 0,h=c>2?o[2]:void 0;for(d=t.length>3&&typeof d=="function"?(c--,d):void 0,h&&isIterateeCall(o[0],o[1],h)&&(d=c<3?void 0:d,c=1),n=Object(n);++s<c;){var p=o[s];p&&t(n,p,s,d)}return n})}var objectProto$d=Object.prototype;function isPrototype(t){var n=t&&t.constructor,o=typeof n=="function"&&n.prototype||objectProto$d;return t===o}function baseTimes(t,n){for(var o=-1,s=Array(t);++o<t;)s[o]=n(o);return s}var argsTag$3="[object Arguments]";function baseIsArguments(t){return isObjectLike(t)&&baseGetTag(t)==argsTag$3}var objectProto$c=Object.prototype,hasOwnProperty$c=objectProto$c.hasOwnProperty,propertyIsEnumerable$1=objectProto$c.propertyIsEnumerable,isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(t){return isObjectLike(t)&&hasOwnProperty$c.call(t,"callee")&&!propertyIsEnumerable$1.call(t,"callee")};function stubFalse(){return!1}var freeExports$2=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule$2=freeExports$2&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports$2=freeModule$2&&freeModule$2.exports===freeExports$2,Buffer$4=moduleExports$2?root$1.Buffer:void 0,nativeIsBuffer=Buffer$4?Buffer$4.isBuffer:void 0,isBuffer$1=nativeIsBuffer||stubFalse,argsTag$2="[object Arguments]",arrayTag$2="[object Array]",boolTag$3="[object Boolean]",dateTag$3="[object Date]",errorTag$2="[object Error]",funcTag$1="[object Function]",mapTag$5="[object Map]",numberTag$3="[object Number]",objectTag$4="[object Object]",regexpTag$3="[object RegExp]",setTag$5="[object Set]",stringTag$3="[object String]",weakMapTag$2="[object WeakMap]",arrayBufferTag$3="[object ArrayBuffer]",dataViewTag$4="[object DataView]",float32Tag$2="[object Float32Array]",float64Tag$2="[object Float64Array]",int8Tag$2="[object Int8Array]",int16Tag$2="[object Int16Array]",int32Tag$2="[object Int32Array]",uint8Tag$2="[object Uint8Array]",uint8ClampedTag$2="[object Uint8ClampedArray]",uint16Tag$2="[object Uint16Array]",uint32Tag$2="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag$2]=typedArrayTags[float64Tag$2]=typedArrayTags[int8Tag$2]=typedArrayTags[int16Tag$2]=typedArrayTags[int32Tag$2]=typedArrayTags[uint8Tag$2]=typedArrayTags[uint8ClampedTag$2]=typedArrayTags[uint16Tag$2]=typedArrayTags[uint32Tag$2]=!0,typedArrayTags[argsTag$2]=typedArrayTags[arrayTag$2]=typedArrayTags[arrayBufferTag$3]=typedArrayTags[boolTag$3]=typedArrayTags[dataViewTag$4]=typedArrayTags[dateTag$3]=typedArrayTags[errorTag$2]=typedArrayTags[funcTag$1]=typedArrayTags[mapTag$5]=typedArrayTags[numberTag$3]=typedArrayTags[objectTag$4]=typedArrayTags[regexpTag$3]=typedArrayTags[setTag$5]=typedArrayTags[stringTag$3]=typedArrayTags[weakMapTag$2]=!1;function baseIsTypedArray(t){return isObjectLike(t)&&isLength(t.length)&&!!typedArrayTags[baseGetTag(t)]}function baseUnary(t){return function(n){return t(n)}}var freeExports$1=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule$1=freeExports$1&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports$1=freeModule$1&&freeModule$1.exports===freeExports$1,freeProcess=moduleExports$1&&freeGlobal.process,nodeUtil=function(){try{var t=freeModule$1&&freeModule$1.require&&freeModule$1.require("util").types;return t||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch{}}(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray,objectProto$b=Object.prototype,hasOwnProperty$b=objectProto$b.hasOwnProperty;function arrayLikeKeys(t,n){var o=isArray$4(t),s=!o&&isArguments(t),c=!o&&!s&&isBuffer$1(t),d=!o&&!s&&!c&&isTypedArray(t),h=o||s||c||d,p=h?baseTimes(t.length,String):[],y=p.length;for(var S in t)(n||hasOwnProperty$b.call(t,S))&&!(h&&(S=="length"||c&&(S=="offset"||S=="parent")||d&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||isIndex(S,y)))&&p.push(S);return p}function overArg(t,n){return function(o){return t(n(o))}}var nativeKeys=overArg(Object.keys,Object),objectProto$a=Object.prototype,hasOwnProperty$a=objectProto$a.hasOwnProperty;function baseKeys(t){if(!isPrototype(t))return nativeKeys(t);var n=[];for(var o in Object(t))hasOwnProperty$a.call(t,o)&&o!="constructor"&&n.push(o);return n}function keys$1(t){return isArrayLike(t)?arrayLikeKeys(t):baseKeys(t)}function nativeKeysIn(t){var n=[];if(t!=null)for(var o in Object(t))n.push(o);return n}var objectProto$9=Object.prototype,hasOwnProperty$9=objectProto$9.hasOwnProperty;function baseKeysIn(t){if(!isObject$2(t))return nativeKeysIn(t);var n=isPrototype(t),o=[];for(var s in t)s=="constructor"&&(n||!hasOwnProperty$9.call(t,s))||o.push(s);return o}function keysIn(t){return isArrayLike(t)?arrayLikeKeys(t,!0):baseKeysIn(t)}var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(t,n){if(isArray$4(t))return!1;var o=typeof t;return o=="number"||o=="symbol"||o=="boolean"||t==null||isSymbol(t)?!0:reIsPlainProp.test(t)||!reIsDeepProp.test(t)||n!=null&&t in Object(n)}var nativeCreate=getNative(Object,"create");function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{},this.size=0}function hashDelete(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}var HASH_UNDEFINED$2="__lodash_hash_undefined__",objectProto$8=Object.prototype,hasOwnProperty$8=objectProto$8.hasOwnProperty;function hashGet(t){var n=this.__data__;if(nativeCreate){var o=n[t];return o===HASH_UNDEFINED$2?void 0:o}return hasOwnProperty$8.call(n,t)?n[t]:void 0}var objectProto$7=Object.prototype,hasOwnProperty$7=objectProto$7.hasOwnProperty;function hashHas(t){var n=this.__data__;return nativeCreate?n[t]!==void 0:hasOwnProperty$7.call(n,t)}var HASH_UNDEFINED$1="__lodash_hash_undefined__";function hashSet(t,n){var o=this.__data__;return this.size+=this.has(t)?0:1,o[t]=nativeCreate&&n===void 0?HASH_UNDEFINED$1:n,this}function Hash(t){var n=-1,o=t==null?0:t.length;for(this.clear();++n<o;){var s=t[n];this.set(s[0],s[1])}}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet;function listCacheClear(){this.__data__=[],this.size=0}function assocIndexOf(t,n){for(var o=t.length;o--;)if(eq(t[o][0],n))return o;return-1}var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(t){var n=this.__data__,o=assocIndexOf(n,t);if(o<0)return!1;var s=n.length-1;return o==s?n.pop():splice.call(n,o,1),--this.size,!0}function listCacheGet(t){var n=this.__data__,o=assocIndexOf(n,t);return o<0?void 0:n[o][1]}function listCacheHas(t){return assocIndexOf(this.__data__,t)>-1}function listCacheSet(t,n){var o=this.__data__,s=assocIndexOf(o,t);return s<0?(++this.size,o.push([t,n])):o[s][1]=n,this}function ListCache(t){var n=-1,o=t==null?0:t.length;for(this.clear();++n<o;){var s=t[n];this.set(s[0],s[1])}}ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet;var Map$2=getNative(root$1,"Map");function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map$2||ListCache),string:new Hash}}function isKeyable(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}function getMapData(t,n){var o=t.__data__;return isKeyable(n)?o[typeof n=="string"?"string":"hash"]:o.map}function mapCacheDelete(t){var n=getMapData(this,t).delete(t);return this.size-=n?1:0,n}function mapCacheGet(t){return getMapData(this,t).get(t)}function mapCacheHas(t){return getMapData(this,t).has(t)}function mapCacheSet(t,n){var o=getMapData(this,t),s=o.size;return o.set(t,n),this.size+=o.size==s?0:1,this}function MapCache(t){var n=-1,o=t==null?0:t.length;for(this.clear();++n<o;){var s=t[n];this.set(s[0],s[1])}}MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var FUNC_ERROR_TEXT$1="Expected a function";function memoize(t,n){if(typeof t!="function"||n!=null&&typeof n!="function")throw new TypeError(FUNC_ERROR_TEXT$1);var o=function(){var s=arguments,c=n?n.apply(this,s):s[0],d=o.cache;if(d.has(c))return d.get(c);var h=t.apply(this,s);return o.cache=d.set(c,h)||d,h};return o.cache=new(memoize.Cache||MapCache),o}memoize.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(t){var n=memoize(t,function(s){return o.size===MAX_MEMOIZE_SIZE&&o.clear(),s}),o=n.cache;return n}var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped(function(t){var n=[];return t.charCodeAt(0)===46&&n.push(""),t.replace(rePropName,function(o,s,c,d){n.push(c?d.replace(reEscapeChar,"$1"):s||o)}),n});function toString$1(t){return t==null?"":baseToString(t)}function castPath(t,n){return isArray$4(t)?t:isKey(t,n)?[t]:stringToPath(toString$1(t))}function toKey(t){if(typeof t=="string"||isSymbol(t))return t;var n=t+"";return n=="0"&&1/t==-1/0?"-0":n}function baseGet(t,n){n=castPath(n,t);for(var o=0,s=n.length;t!=null&&o<s;)t=t[toKey(n[o++])];return o&&o==s?t:void 0}function get$3(t,n,o){var s=t==null?void 0:baseGet(t,n);return s===void 0?o:s}function arrayPush(t,n){for(var o=-1,s=n.length,c=t.length;++o<s;)t[c+o]=n[o];return t}var spreadableSymbol=Symbol$1?Symbol$1.isConcatSpreadable:void 0;function isFlattenable(t){return isArray$4(t)||isArguments(t)||!!(spreadableSymbol&&t&&t[spreadableSymbol])}function baseFlatten(t,n,o,s,c){var d=-1,h=t.length;for(o||(o=isFlattenable),c||(c=[]);++d<h;){var p=t[d];o(p)?arrayPush(c,p):c[c.length]=p}return c}function flatten$1(t){var n=t==null?0:t.length;return n?baseFlatten(t):[]}function flatRest(t){return setToString(overRest(t,void 0,flatten$1),t+"")}var getPrototype=overArg(Object.getPrototypeOf,Object),objectTag$3="[object Object]",funcProto=Function.prototype,objectProto$6=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$6=objectProto$6.hasOwnProperty,objectCtorString=funcToString.call(Object);function isPlainObject(t){if(!isObjectLike(t)||baseGetTag(t)!=objectTag$3)return!1;var n=getPrototype(t);if(n===null)return!0;var o=hasOwnProperty$6.call(n,"constructor")&&n.constructor;return typeof o=="function"&&o instanceof o&&funcToString.call(o)==objectCtorString}function baseSlice(t,n,o){var s=-1,c=t.length;n<0&&(n=-n>c?0:c+n),o=o>c?c:o,o<0&&(o+=c),c=n>o?0:o-n>>>0,n>>>=0;for(var d=Array(c);++s<c;)d[s]=t[s+n];return d}function stackClear(){this.__data__=new ListCache,this.size=0}function stackDelete(t){var n=this.__data__,o=n.delete(t);return this.size=n.size,o}function stackGet(t){return this.__data__.get(t)}function stackHas(t){return this.__data__.has(t)}var LARGE_ARRAY_SIZE$2=200;function stackSet(t,n){var o=this.__data__;if(o instanceof ListCache){var s=o.__data__;if(!Map$2||s.length<LARGE_ARRAY_SIZE$2-1)return s.push([t,n]),this.size=++o.size,this;o=this.__data__=new MapCache(s)}return o.set(t,n),this.size=o.size,this}function Stack$1(t){var n=this.__data__=new ListCache(t);this.size=n.size}Stack$1.prototype.clear=stackClear,Stack$1.prototype.delete=stackDelete,Stack$1.prototype.get=stackGet,Stack$1.prototype.has=stackHas,Stack$1.prototype.set=stackSet;function baseAssign(t,n){return t&©Object(n,keys$1(n),t)}function baseAssignIn(t,n){return t&©Object(n,keysIn(n),t)}var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,Buffer$3=moduleExports?root$1.Buffer:void 0,allocUnsafe$1=Buffer$3?Buffer$3.allocUnsafe:void 0;function cloneBuffer(t,n){if(n)return t.slice();var o=t.length,s=allocUnsafe$1?allocUnsafe$1(o):new t.constructor(o);return t.copy(s),s}function arrayFilter(t,n){for(var o=-1,s=t==null?0:t.length,c=0,d=[];++o<s;){var h=t[o];n(h,o,t)&&(d[c++]=h)}return d}function stubArray(){return[]}var objectProto$5=Object.prototype,propertyIsEnumerable=objectProto$5.propertyIsEnumerable,nativeGetSymbols$1=Object.getOwnPropertySymbols,getSymbols=nativeGetSymbols$1?function(t){return t==null?[]:(t=Object(t),arrayFilter(nativeGetSymbols$1(t),function(n){return propertyIsEnumerable.call(t,n)}))}:stubArray;function copySymbols(t,n){return copyObject(t,getSymbols(t),n)}var nativeGetSymbols=Object.getOwnPropertySymbols,getSymbolsIn=nativeGetSymbols?function(t){for(var n=[];t;)arrayPush(n,getSymbols(t)),t=getPrototype(t);return n}:stubArray;function copySymbolsIn(t,n){return copyObject(t,getSymbolsIn(t),n)}function baseGetAllKeys(t,n,o){var s=n(t);return isArray$4(t)?s:arrayPush(s,o(t))}function getAllKeys(t){return baseGetAllKeys(t,keys$1,getSymbols)}function getAllKeysIn(t){return baseGetAllKeys(t,keysIn,getSymbolsIn)}var DataView$1=getNative(root$1,"DataView"),Promise$1=getNative(root$1,"Promise"),Set$1=getNative(root$1,"Set"),mapTag$4="[object Map]",objectTag$2="[object Object]",promiseTag="[object Promise]",setTag$4="[object Set]",weakMapTag$1="[object WeakMap]",dataViewTag$3="[object DataView]",dataViewCtorString=toSource(DataView$1),mapCtorString=toSource(Map$2),promiseCtorString=toSource(Promise$1),setCtorString=toSource(Set$1),weakMapCtorString=toSource(WeakMap$1),getTag$1=baseGetTag;(DataView$1&&getTag$1(new DataView$1(new ArrayBuffer(1)))!=dataViewTag$3||Map$2&&getTag$1(new Map$2)!=mapTag$4||Promise$1&&getTag$1(Promise$1.resolve())!=promiseTag||Set$1&&getTag$1(new Set$1)!=setTag$4||WeakMap$1&&getTag$1(new WeakMap$1)!=weakMapTag$1)&&(getTag$1=function(t){var n=baseGetTag(t),o=n==objectTag$2?t.constructor:void 0,s=o?toSource(o):"";if(s)switch(s){case dataViewCtorString:return dataViewTag$3;case mapCtorString:return mapTag$4;case promiseCtorString:return promiseTag;case setCtorString:return setTag$4;case weakMapCtorString:return weakMapTag$1}return n});var objectProto$4=Object.prototype,hasOwnProperty$5=objectProto$4.hasOwnProperty;function initCloneArray(t){var n=t.length,o=new t.constructor(n);return n&&typeof t[0]=="string"&&hasOwnProperty$5.call(t,"index")&&(o.index=t.index,o.input=t.input),o}var Uint8Array$1=root$1.Uint8Array;function cloneArrayBuffer(t){var n=new t.constructor(t.byteLength);return new Uint8Array$1(n).set(new Uint8Array$1(t)),n}function cloneDataView(t,n){var o=n?cloneArrayBuffer(t.buffer):t.buffer;return new t.constructor(o,t.byteOffset,t.byteLength)}var reFlags=/\w*$/;function cloneRegExp(t){var n=new t.constructor(t.source,reFlags.exec(t));return n.lastIndex=t.lastIndex,n}var symbolProto$1=Symbol$1?Symbol$1.prototype:void 0,symbolValueOf$1=symbolProto$1?symbolProto$1.valueOf:void 0;function cloneSymbol(t){return symbolValueOf$1?Object(symbolValueOf$1.call(t)):{}}function cloneTypedArray(t,n){var o=n?cloneArrayBuffer(t.buffer):t.buffer;return new t.constructor(o,t.byteOffset,t.length)}var boolTag$2="[object Boolean]",dateTag$2="[object Date]",mapTag$3="[object Map]",numberTag$2="[object Number]",regexpTag$2="[object RegExp]",setTag$3="[object Set]",stringTag$2="[object String]",symbolTag$2="[object Symbol]",arrayBufferTag$2="[object ArrayBuffer]",dataViewTag$2="[object DataView]",float32Tag$1="[object Float32Array]",float64Tag$1="[object Float64Array]",int8Tag$1="[object Int8Array]",int16Tag$1="[object Int16Array]",int32Tag$1="[object Int32Array]",uint8Tag$1="[object Uint8Array]",uint8ClampedTag$1="[object Uint8ClampedArray]",uint16Tag$1="[object Uint16Array]",uint32Tag$1="[object Uint32Array]";function initCloneByTag(t,n,o){var s=t.constructor;switch(n){case arrayBufferTag$2:return cloneArrayBuffer(t);case boolTag$2:case dateTag$2:return new s(+t);case dataViewTag$2:return cloneDataView(t,o);case float32Tag$1:case float64Tag$1:case int8Tag$1:case int16Tag$1:case int32Tag$1:case uint8Tag$1:case uint8ClampedTag$1:case uint16Tag$1:case uint32Tag$1:return cloneTypedArray(t,o);case mapTag$3:return new s;case numberTag$2:case stringTag$2:return new s(t);case regexpTag$2:return cloneRegExp(t);case setTag$3:return new s;case symbolTag$2:return cloneSymbol(t)}}function initCloneObject(t){return typeof t.constructor=="function"&&!isPrototype(t)?baseCreate(getPrototype(t)):{}}var mapTag$2="[object Map]";function baseIsMap(t){return isObjectLike(t)&&getTag$1(t)==mapTag$2}var nodeIsMap=nodeUtil&&nodeUtil.isMap,isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap,setTag$2="[object Set]";function baseIsSet(t){return isObjectLike(t)&&getTag$1(t)==setTag$2}var nodeIsSet=nodeUtil&&nodeUtil.isSet,isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet,CLONE_DEEP_FLAG$2=1,CLONE_FLAT_FLAG$1=2,CLONE_SYMBOLS_FLAG$2=4,argsTag$1="[object Arguments]",arrayTag$1="[object Array]",boolTag$1="[object Boolean]",dateTag$1="[object Date]",errorTag$1="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]",mapTag$1="[object Map]",numberTag$1="[object Number]",objectTag$1="[object Object]",regexpTag$1="[object RegExp]",setTag$1="[object Set]",stringTag$1="[object String]",symbolTag$1="[object Symbol]",weakMapTag="[object WeakMap]",arrayBufferTag$1="[object ArrayBuffer]",dataViewTag$1="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",cloneableTags={};cloneableTags[argsTag$1]=cloneableTags[arrayTag$1]=cloneableTags[arrayBufferTag$1]=cloneableTags[dataViewTag$1]=cloneableTags[boolTag$1]=cloneableTags[dateTag$1]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag$1]=cloneableTags[numberTag$1]=cloneableTags[objectTag$1]=cloneableTags[regexpTag$1]=cloneableTags[setTag$1]=cloneableTags[stringTag$1]=cloneableTags[symbolTag$1]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=!0,cloneableTags[errorTag$1]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=!1;function baseClone(t,n,o,s,c,d){var h,p=n&CLONE_DEEP_FLAG$2,y=n&CLONE_FLAT_FLAG$1,S=n&CLONE_SYMBOLS_FLAG$2;if(o&&(h=c?o(t,s,c,d):o(t)),h!==void 0)return h;if(!isObject$2(t))return t;var P=isArray$4(t);if(P){if(h=initCloneArray(t),!p)return copyArray(t,h)}else{var L=getTag$1(t),F=L==funcTag||L==genTag;if(isBuffer$1(t))return cloneBuffer(t,p);if(L==objectTag$1||L==argsTag$1||F&&!c){if(h=y||F?{}:initCloneObject(t),!p)return y?copySymbolsIn(t,baseAssignIn(h,t)):copySymbols(t,baseAssign(h,t))}else{if(!cloneableTags[L])return c?t:{};h=initCloneByTag(t,L,p)}}d||(d=new Stack$1);var N=d.get(t);if(N)return N;d.set(t,h),isSet(t)?t.forEach(function(lt){h.add(baseClone(lt,n,o,lt,t,d))}):isMap(t)&&t.forEach(function(lt,Pe){h.set(Pe,baseClone(lt,n,o,Pe,t,d))});var W=S?y?getAllKeysIn:getAllKeys:y?keysIn:keys$1,z=P?void 0:W(t);return arrayEach(z||t,function(lt,Pe){z&&(Pe=lt,lt=t[Pe]),assignValue(h,Pe,baseClone(lt,n,o,Pe,t,d))}),h}var CLONE_DEEP_FLAG$1=1,CLONE_SYMBOLS_FLAG$1=4;function cloneDeep(t){return baseClone(t,CLONE_DEEP_FLAG$1|CLONE_SYMBOLS_FLAG$1)}var HASH_UNDEFINED="__lodash_hash_undefined__";function setCacheAdd(t){return this.__data__.set(t,HASH_UNDEFINED),this}function setCacheHas(t){return this.__data__.has(t)}function SetCache(t){var n=-1,o=t==null?0:t.length;for(this.__data__=new MapCache;++n<o;)this.add(t[n])}SetCache.prototype.add=SetCache.prototype.push=setCacheAdd,SetCache.prototype.has=setCacheHas;function arraySome(t,n){for(var o=-1,s=t==null?0:t.length;++o<s;)if(n(t[o],o,t))return!0;return!1}function cacheHas(t,n){return t.has(n)}var COMPARE_PARTIAL_FLAG$5=1,COMPARE_UNORDERED_FLAG$3=2;function equalArrays$2(t,n,o,s,c,d){var h=o&COMPARE_PARTIAL_FLAG$5,p=t.length,y=n.length;if(p!=y&&!(h&&y>p))return!1;var S=d.get(t),P=d.get(n);if(S&&P)return S==n&&P==t;var L=-1,F=!0,N=o&COMPARE_UNORDERED_FLAG$3?new SetCache:void 0;for(d.set(t,n),d.set(n,t);++L<p;){var W=t[L],z=n[L];if(s)var lt=h?s(z,W,L,n,t,d):s(W,z,L,t,n,d);if(lt!==void 0){if(lt)continue;F=!1;break}if(N){if(!arraySome(n,function(Pe,se){if(!cacheHas(N,se)&&(W===Pe||c(W,Pe,o,s,d)))return N.push(se)})){F=!1;break}}else if(!(W===z||c(W,z,o,s,d))){F=!1;break}}return d.delete(t),d.delete(n),F}function mapToArray(t){var n=-1,o=Array(t.size);return t.forEach(function(s,c){o[++n]=[c,s]}),o}function setToArray(t){var n=-1,o=Array(t.size);return t.forEach(function(s){o[++n]=s}),o}var COMPARE_PARTIAL_FLAG$4=1,COMPARE_UNORDERED_FLAG$2=2,boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",mapTag="[object Map]",numberTag="[object Number]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",symbolProto=Symbol$1?Symbol$1.prototype:void 0,symbolValueOf=symbolProto?symbolProto.valueOf:void 0;function equalByTag(t,n,o,s,c,d,h){switch(o){case dataViewTag:if(t.byteLength!=n.byteLength||t.byteOffset!=n.byteOffset)return!1;t=t.buffer,n=n.buffer;case arrayBufferTag:return!(t.byteLength!=n.byteLength||!d(new Uint8Array$1(t),new Uint8Array$1(n)));case boolTag:case dateTag:case numberTag:return eq(+t,+n);case errorTag:return t.name==n.name&&t.message==n.message;case regexpTag:case stringTag:return t==n+"";case mapTag:var p=mapToArray;case setTag:var y=s&COMPARE_PARTIAL_FLAG$4;if(p||(p=setToArray),t.size!=n.size&&!y)return!1;var S=h.get(t);if(S)return S==n;s|=COMPARE_UNORDERED_FLAG$2,h.set(t,n);var P=equalArrays$2(p(t),p(n),s,c,d,h);return h.delete(t),P;case symbolTag:if(symbolValueOf)return symbolValueOf.call(t)==symbolValueOf.call(n)}return!1}var COMPARE_PARTIAL_FLAG$3=1,objectProto$3=Object.prototype,hasOwnProperty$4=objectProto$3.hasOwnProperty;function equalObjects(t,n,o,s,c,d){var h=o&COMPARE_PARTIAL_FLAG$3,p=getAllKeys(t),y=p.length,S=getAllKeys(n),P=S.length;if(y!=P&&!h)return!1;for(var L=y;L--;){var F=p[L];if(!(h?F in n:hasOwnProperty$4.call(n,F)))return!1}var N=d.get(t),W=d.get(n);if(N&&W)return N==n&&W==t;var z=!0;d.set(t,n),d.set(n,t);for(var lt=h;++L<y;){F=p[L];var Pe=t[F],se=n[F];if(s)var mt=h?s(se,Pe,F,n,t,d):s(Pe,se,F,t,n,d);if(!(mt===void 0?Pe===se||c(Pe,se,o,s,d):mt)){z=!1;break}lt||(lt=F=="constructor")}if(z&&!lt){var kt=t.constructor,mn=n.constructor;kt!=mn&&"constructor"in t&&"constructor"in n&&!(typeof kt=="function"&&kt instanceof kt&&typeof mn=="function"&&mn instanceof mn)&&(z=!1)}return d.delete(t),d.delete(n),z}var COMPARE_PARTIAL_FLAG$2=1,argsTag="[object Arguments]",arrayTag="[object Array]",objectTag="[object Object]",objectProto$2=Object.prototype,hasOwnProperty$3=objectProto$2.hasOwnProperty;function baseIsEqualDeep(t,n,o,s,c,d){var h=isArray$4(t),p=isArray$4(n),y=h?arrayTag:getTag$1(t),S=p?arrayTag:getTag$1(n);y=y==argsTag?objectTag:y,S=S==argsTag?objectTag:S;var P=y==objectTag,L=S==objectTag,F=y==S;if(F&&isBuffer$1(t)){if(!isBuffer$1(n))return!1;h=!0,P=!1}if(F&&!P)return d||(d=new Stack$1),h||isTypedArray(t)?equalArrays$2(t,n,o,s,c,d):equalByTag(t,n,y,o,s,c,d);if(!(o&COMPARE_PARTIAL_FLAG$2)){var N=P&&hasOwnProperty$3.call(t,"__wrapped__"),W=L&&hasOwnProperty$3.call(n,"__wrapped__");if(N||W){var z=N?t.value():t,lt=W?n.value():n;return d||(d=new Stack$1),c(z,lt,o,s,d)}}return F?(d||(d=new Stack$1),equalObjects(t,n,o,s,c,d)):!1}function baseIsEqual(t,n,o,s,c){return t===n?!0:t==null||n==null||!isObjectLike(t)&&!isObjectLike(n)?t!==t&&n!==n:baseIsEqualDeep(t,n,o,s,baseIsEqual,c)}var COMPARE_PARTIAL_FLAG$1=1,COMPARE_UNORDERED_FLAG$1=2;function baseIsMatch(t,n,o,s){var c=o.length,d=c;if(t==null)return!d;for(t=Object(t);c--;){var h=o[c];if(h[2]?h[1]!==t[h[0]]:!(h[0]in t))return!1}for(;++c<d;){h=o[c];var p=h[0],y=t[p],S=h[1];if(h[2]){if(y===void 0&&!(p in t))return!1}else{var P=new Stack$1,L;if(!(L===void 0?baseIsEqual(S,y,COMPARE_PARTIAL_FLAG$1|COMPARE_UNORDERED_FLAG$1,s,P):L))return!1}}return!0}function isStrictComparable(t){return t===t&&!isObject$2(t)}function getMatchData(t){for(var n=keys$1(t),o=n.length;o--;){var s=n[o],c=t[s];n[o]=[s,c,isStrictComparable(c)]}return n}function matchesStrictComparable(t,n){return function(o){return o==null?!1:o[t]===n&&(n!==void 0||t in Object(o))}}function baseMatches(t){var n=getMatchData(t);return n.length==1&&n[0][2]?matchesStrictComparable(n[0][0],n[0][1]):function(o){return o===t||baseIsMatch(o,t,n)}}function baseHasIn(t,n){return t!=null&&n in Object(t)}function hasPath(t,n,o){n=castPath(n,t);for(var s=-1,c=n.length,d=!1;++s<c;){var h=toKey(n[s]);if(!(d=t!=null&&o(t,h)))break;t=t[h]}return d||++s!=c?d:(c=t==null?0:t.length,!!c&&isLength(c)&&isIndex(h,c)&&(isArray$4(t)||isArguments(t)))}function hasIn(t,n){return t!=null&&hasPath(t,n,baseHasIn)}var COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;function baseMatchesProperty(t,n){return isKey(t)&&isStrictComparable(n)?matchesStrictComparable(toKey(t),n):function(o){var s=get$3(o,t);return s===void 0&&s===n?hasIn(o,t):baseIsEqual(n,s,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG)}}function baseProperty(t){return function(n){return n==null?void 0:n[t]}}function basePropertyDeep(t){return function(n){return baseGet(n,t)}}function property(t){return isKey(t)?baseProperty(toKey(t)):basePropertyDeep(t)}function baseIteratee(t){return typeof t=="function"?t:t==null?identity$3:typeof t=="object"?isArray$4(t)?baseMatchesProperty(t[0],t[1]):baseMatches(t):property(t)}function arrayAggregator(t,n,o,s){for(var c=-1,d=t==null?0:t.length;++c<d;){var h=t[c];n(s,h,o(h),t)}return s}function createBaseFor(t){return function(n,o,s){for(var c=-1,d=Object(n),h=s(n),p=h.length;p--;){var y=h[++c];if(o(d[y],y,d)===!1)break}return n}}var baseFor=createBaseFor();function baseForOwn(t,n){return t&&baseFor(t,n,keys$1)}function createBaseEach(t,n){return function(o,s){if(o==null)return o;if(!isArrayLike(o))return t(o,s);for(var c=o.length,d=-1,h=Object(o);++d<c&&s(h[d],d,h)!==!1;);return o}}var baseEach=createBaseEach(baseForOwn);function baseAggregator(t,n,o,s){return baseEach(t,function(c,d,h){n(s,c,o(c),h)}),s}function createAggregator(t,n){return function(o,s){var c=isArray$4(o)?arrayAggregator:baseAggregator,d={};return c(o,t,baseIteratee(s),d)}}var objectProto$1=Object.prototype,hasOwnProperty$2=objectProto$1.hasOwnProperty,defaults=baseRest(function(t,n){t=Object(t);var o=-1,s=n.length,c=s>2?n[2]:void 0;for(c&&isIterateeCall(n[0],n[1],c)&&(s=1);++o<s;)for(var d=n[o],h=keysIn(d),p=-1,y=h.length;++p<y;){var S=h[p],P=t[S];(P===void 0||eq(P,objectProto$1[S])&&!hasOwnProperty$2.call(t,S))&&(t[S]=d[S])}return t});function assignMergeValue(t,n,o){(o!==void 0&&!eq(t[n],o)||o===void 0&&!(n in t))&&baseAssignValue(t,n,o)}function isArrayLikeObject(t){return isObjectLike(t)&&isArrayLike(t)}function safeGet(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}function toPlainObject$1(t){return copyObject(t,keysIn(t))}function baseMergeDeep(t,n,o,s,c,d,h){var p=safeGet(t,o),y=safeGet(n,o),S=h.get(y);if(S){assignMergeValue(t,o,S);return}var P=d?d(p,y,o+"",t,n,h):void 0,L=P===void 0;if(L){var F=isArray$4(y),N=!F&&isBuffer$1(y),W=!F&&!N&&isTypedArray(y);P=y,F||N||W?isArray$4(p)?P=p:isArrayLikeObject(p)?P=copyArray(p):N?(L=!1,P=cloneBuffer(y,!0)):W?(L=!1,P=cloneTypedArray(y,!0)):P=[]:isPlainObject(y)||isArguments(y)?(P=p,isArguments(p)?P=toPlainObject$1(p):(!isObject$2(p)||isFunction$2(p))&&(P=initCloneObject(y))):L=!1}L&&(h.set(y,P),c(P,y,s,d,h),h.delete(y)),assignMergeValue(t,o,P)}function baseMerge(t,n,o,s,c){t!==n&&baseFor(n,function(d,h){if(c||(c=new Stack$1),isObject$2(d))baseMergeDeep(t,n,h,o,baseMerge,s,c);else{var p=s?s(safeGet(t,h),d,h+"",t,n,c):void 0;p===void 0&&(p=d),assignMergeValue(t,h,p)}},keysIn)}var LARGE_ARRAY_SIZE$1=200;function baseDifference(t,n,o,s){var c=-1,d=arrayIncludes,h=!0,p=t.length,y=[],S=n.length;if(!p)return y;o&&(n=arrayMap(n,baseUnary(o))),n.length>=LARGE_ARRAY_SIZE$1&&(d=cacheHas,h=!1,n=new SetCache(n));e:for(;++c<p;){var P=t[c],L=o==null?P:o(P);if(P=P!==0?P:0,h&&L===L){for(var F=S;F--;)if(n[F]===L)continue e;y.push(P)}else d(n,L,s)||y.push(P)}return y}function last(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}function fromPairs(t){for(var n=-1,o=t==null?0:t.length,s={};++n<o;){var c=t[n];s[c[0]]=c[1]}return s}var objectProto=Object.prototype,hasOwnProperty$1=objectProto.hasOwnProperty,groupBy=createAggregator(function(t,n,o){hasOwnProperty$1.call(t,o)?t[o].push(n):baseAssignValue(t,o,[n])});function parent(t,n){return n.length<2?t:baseGet(t,baseSlice(n,0,-1))}function isEqual(t,n){return baseIsEqual(t,n)}var merge=createAssigner(function(t,n,o){baseMerge(t,n,o)}),FUNC_ERROR_TEXT="Expected a function";function negate(t){if(typeof t!="function")throw new TypeError(FUNC_ERROR_TEXT);return function(){var n=arguments;switch(n.length){case 0:return!t.call(this);case 1:return!t.call(this,n[0]);case 2:return!t.call(this,n[0],n[1]);case 3:return!t.call(this,n[0],n[1],n[2])}return!t.apply(this,n)}}function baseUnset(t,n){return n=castPath(n,t),t=parent(t,n),t==null||delete t[toKey(last(n))]}function customOmitClone(t){return isPlainObject(t)?void 0:t}var CLONE_DEEP_FLAG=1,CLONE_FLAT_FLAG=2,CLONE_SYMBOLS_FLAG=4,omit=flatRest(function(t,n){var o={};if(t==null)return o;var s=!1;n=arrayMap(n,function(d){return d=castPath(d,t),s||(s=d.length>1),d}),copyObject(t,getAllKeysIn(t),o),s&&(o=baseClone(o,CLONE_DEEP_FLAG|CLONE_FLAT_FLAG|CLONE_SYMBOLS_FLAG,customOmitClone));for(var c=n.length;c--;)baseUnset(o,n[c]);return o});function baseSet(t,n,o,s){if(!isObject$2(t))return t;n=castPath(n,t);for(var c=-1,d=n.length,h=d-1,p=t;p!=null&&++c<d;){var y=toKey(n[c]),S=o;if(y==="__proto__"||y==="constructor"||y==="prototype")return t;if(c!=h){var P=p[y];S=void 0,S===void 0&&(S=isObject$2(P)?P:isIndex(n[c+1])?[]:{})}assignValue(p,y,S),p=p[y]}return t}function basePickBy(t,n,o){for(var s=-1,c=n.length,d={};++s<c;){var h=n[s],p=baseGet(t,h);o(p,h)&&baseSet(d,castPath(h,t),p)}return d}function pickBy(t,n){if(t==null)return{};var o=arrayMap(getAllKeysIn(t),function(s){return[s]});return n=baseIteratee(n),basePickBy(t,o,function(s,c){return n(s,c[0])})}function omitBy(t,n){return pickBy(t,negate(baseIteratee(n)))}function basePick(t,n){return basePickBy(t,n,function(o,s){return hasIn(t,s)})}var pick=flatRest(function(t,n){return t==null?{}:basePick(t,n)}),INFINITY=1/0,createSet=Set$1&&1/setToArray(new Set$1([,-0]))[1]==INFINITY?function(t){return new Set$1(t)}:noop$3,LARGE_ARRAY_SIZE=200;function baseUniq(t,n,o){var s=-1,c=arrayIncludes,d=t.length,h=!0,p=[],y=p;if(d>=LARGE_ARRAY_SIZE){var S=n?null:createSet(t);if(S)return setToArray(S);h=!1,c=cacheHas,y=new SetCache}else y=n?[]:p;e:for(;++s<d;){var P=t[s],L=n?n(P):P;if(P=P!==0?P:0,h&&L===L){for(var F=y.length;F--;)if(y[F]===L)continue e;n&&y.push(L),p.push(P)}else c(y,L,o)||(y!==p&&y.push(L),p.push(P))}return p}function uniqBy(t,n){return t&&t.length?baseUniq(t,baseIteratee(n)):[]}function baseXor(t,n,o){var s=t.length;if(s<2)return s?baseUniq(t[0]):[];for(var c=-1,d=Array(s);++c<s;)for(var h=t[c],p=-1;++p<s;)p!=c&&(d[c]=baseDifference(d[c]||h,t[p],n,o));return baseUniq(baseFlatten(d),n,o)}var xorBy=baseRest(function(t){var n=last(t);return isArrayLikeObject(n)&&(n=void 0),baseXor(arrayFilter(t,isArrayLikeObject),baseIteratee(n))}),earthRadius=63710088e-1,factors={centimeters:earthRadius*100,centimetres:earthRadius*100,degrees:earthRadius/111325,feet:earthRadius*3.28084,inches:earthRadius*39.37,kilometers:earthRadius/1e3,kilometres:earthRadius/1e3,meters:earthRadius,metres:earthRadius,miles:earthRadius/1609.344,millimeters:earthRadius*1e3,millimetres:earthRadius*1e3,nauticalmiles:earthRadius/1852,radians:1,yards:earthRadius*1.0936};function feature$1(t,n,o){o===void 0&&(o={});var s={type:"Feature"};return(o.id===0||o.id)&&(s.id=o.id),o.bbox&&(s.bbox=o.bbox),s.properties=n||{},s.geometry=t,s}function point$1(t,n,o){if(o===void 0&&(o={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!isNumber$2(t[0])||!isNumber$2(t[1]))throw new Error("coordinates must contain numbers");var s={type:"Point",coordinates:t};return feature$1(s,n,o)}function polygon(t,n,o){o===void 0&&(o={});for(var s=0,c=t;s<c.length;s++){var d=c[s];if(d.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<d[d.length-1].length;h++)if(d[d.length-1][h]!==d[0][h])throw new Error("First and last Position are not equivalent.")}var p={type:"Polygon",coordinates:t};return feature$1(p,n,o)}function lineString$1(t,n,o){if(o===void 0&&(o={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");var s={type:"LineString",coordinates:t};return feature$1(s,n,o)}function featureCollection$2(t,n){n===void 0&&(n={});var o={type:"FeatureCollection"};return n.id&&(o.id=n.id),n.bbox&&(o.bbox=n.bbox),o.features=t,o}function radiansToLength(t,n){n===void 0&&(n="kilometers");var o=factors[n];if(!o)throw new Error(n+" units is invalid");return t*o}function lengthToRadians(t,n){n===void 0&&(n="kilometers");var o=factors[n];if(!o)throw new Error(n+" units is invalid");return t/o}function radiansToDegrees(t){var n=t%(2*Math.PI);return n*180/Math.PI}function degreesToRadians(t){var n=t%360;return n*Math.PI/180}function convertLength(t,n,o){if(n===void 0&&(n="kilometers"),o===void 0&&(o="kilometers"),!(t>=0))throw new Error("length must be a positive number");return radiansToLength(lengthToRadians(t,n),o)}function isNumber$2(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function isObject$1(t){return!!t&&t.constructor===Object}function getCoord$2(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return t.geometry.coordinates;if(t.type==="Point")return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function getCoords$2(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function getGeom$2(t){return t.type==="Feature"?t.geometry:t}const getCoord$1=wrap(getCoord$2),getCoords$1=wrap(getCoords$2),getGeom$1=t=>{if(!(typeof t!="object"||!t||!("type"in t))){if(t.type==="Feature")return getGeom$1(t.geometry);if(!(t.type!=="Point"&&t.type!=="MultiPoint"&&t.type!=="LineString"&&t.type!=="MultiLineString"&&t.type!=="Polygon"&&t.type!=="MultiPolygon"))return t}};function wrap(t){return n=>{try{return t(n)}catch{return}}}function objKeys$1(t){return Object.keys(t)}function defaultValue$1(t,n){return t??n}const appearanceKeyObj={marker:1,polyline:1,polygon:1,ellipsoid:1,ellipse:1,model:1,"3dtiles":1,box:1,photooverlay:1,resource:1,raster:1,heatMap:1,frustum:1,transition:1},appearanceKeys=objKeys$1(appearanceKeyObj);function convertLayer(t){return convertLayerGroup(t)??convertLayerItem(t)}function convertLayerCommon(t){var n,o,s,c;return omitBy({id:t.id,isVisible:t.visible,title:t.title,creator:t.creator,infobox:t.infobox,tags:t.tags,property:(n=t.compat)==null?void 0:n.property,propertyId:(o=t.compat)==null?void 0:o.propertyId,pluginId:(s=t.compat)!=null&&s.extensionId?"reearth":void 0,extensionId:(c=t.compat)==null?void 0:c.extensionId},d=>typeof d>"u"||d===null)}function convertLayerGroup(t){var n;if(t.type==="group")return{...convertLayerCommon(t),children:((n=t.children)==null?void 0:n.map(convertLayer).filter(o=>!!o))??[]}}function convertLayerItem(t){if(t.type==="simple")return convertLayerCommon(t)}function getCompat(t){var c,d,h,p;if(!t||typeof t!="object"||t.type!=="simple")return;const n=((c=t.data)==null?void 0:c.type)==="geojson"?t.data.value:void 0;let o,s;if("marker"in t){const y=getCoord$1(n);s="marker",o={default:{...t.marker,...y&&y.length>=2?{location:{lng:y[0],lat:y[1]},height:y[2]}:{}}}}else if("polyline"in t){const y=getCoords$1(n);s="polyline",o={default:{...t.polyline,...y?{coordinates:y.map(S=>({lng:S[0],lat:S[1],height:S[2]}))}:{}}}}else if("polygon"in t){const y=getGeom$1(n);s="polygon",o={default:{...t.polygon,...(y==null?void 0:y.type)==="Polygon"?{polygon:y.coordinates.map(S=>S.map(P=>({lng:P[0],lat:P[1],height:P[2]})))}:{}}}}else if("photooverlay"in t){const y=getCoord$1(n);s="photooverlay",o={default:{...t.photooverlay,...y&&y.length>=2?{location:{lng:y[0],lat:y[1]},height:y[2]}:{}}}}else if("ellipsoid"in t){const y=getCoord$1(n);s="ellipsoid",o={default:{...t.ellipsoid,...y&&y.length>=2?{position:{lng:y[0],lat:y[1]},height:y[2]}:{}}}}else if("model"in t){const y=["shadows","colorBlend","color","colorBlendAmount","lightColor","silhouette","silhouetteColor","silhouetteSize"],S=omit(t.model,...y),P=omitBy(pick(t.model,...y),F=>typeof F>"u"||F===null),L=getCoord$1(n);s="model",o={default:{...S,...L&&L.length>=2?{location:{lng:L[0],lat:L[1]},height:L[2]}:{}},...Object.keys(P).length?{appearance:P}:{}}}else"3dtiles"in t?(s="tileset",o={default:{...t["3dtiles"],...((d=t.data)==null?void 0:d.type)==="3dtiles"&&t.data.url?{tileset:t.data.url}:{}}}):"resource"in t&&(s="resource",o={default:{...t.resource}});return{extensionId:s,property:o,...(h=t.compat)!=null&&h.propertyId?{propertyId:(p=t.compat)==null?void 0:p.propertyId}:{}}}function convertLegacyLayer(t){return t?convertLegacyLayerGroup(t)??convertLegacyLayerItem(t):void 0}function convertLegacyLayerCommon(t){const n=omitBy({extensionId:t.extensionId,property:t.property,propertyId:t.propertyId},o=>typeof o>"u"||o===null);return omitBy({id:t.id,title:t.title,visible:t.isVisible,creator:t.creator,infobox:t.infobox,tags:t.tags,...Object.keys(n).length?{compat:n}:{}},o=>typeof o>"u"||o===null)}function convertLegacyLayerGroup(t){var n;if(Array.isArray(t.children))return{type:"group",...convertLegacyLayerCommon(t),children:((n=t.children)==null?void 0:n.map(convertLegacyLayer).filter(o=>!!o))??[]}}function convertLegacyLayerItem(t){var d,h,p,y,S,P,L,F,N,W,z,lt,Pe,se,mt,kt,mn,_i,zi,ba,fa,La,Ra,ma,yt,nt,pi,Sa;if(Array.isArray(t.children))return;let n,o,s;if(t.extensionId==="marker")n="marker",s=["location","height"],(h=(d=t.property)==null?void 0:d.default)!=null&&h.location&&(o={type:"geojson",value:{type:"Feature",geometry:{type:"Point",coordinates:[t.property.default.location.lng,t.property.default.location.lat,...t.property.default.height?[t.property.default.height]:[]]}}});else if(t.extensionId==="polyline")n="polyline",s=["coordinates"],(y=(p=t.property)==null?void 0:p.default)!=null&&y.coordinates&&(o={type:"geojson",value:{type:"Feature",geometry:{type:"LineString",coordinates:t.property.default.coordinates.map(Sc=>[Sc.lng,Sc.lat,Sc.height])}}});else if(t.extensionId==="polygon")n="polygon",s=["polygon"],(P=(S=t.property)==null?void 0:S.default)!=null&&P.polygon&&(o={type:"geojson",value:{type:"Feature",geometry:{type:"Polygon",coordinates:t.property.default.polygon.map(Sc=>Sc.map(Xs=>[Xs.lng,Xs.lat,Xs.height]))}}});else if(t.extensionId==="rect"){if(n="polygon",s=["rect","height"],(F=(L=t.property)==null?void 0:L.default)!=null&&F.rect){const Sc=(W=(N=t.property)==null?void 0:N.default)==null?void 0:W.rect,Xs=t.property.default.height;o={type:"geojson",value:{type:"Feature",geometry:{type:"Polygon",coordinates:[[[Sc.west,Sc.north,Xs],[Sc.east,Sc.north,Xs],[Sc.east,Sc.south,Xs],[Sc.west,Sc.south,Xs],[Sc.west,Sc.north,Xs]]]}}}}}else if(t.extensionId==="photooverlay")n="photooverlay",s=["location","height"],(lt=(z=t.property)==null?void 0:z.default)!=null&<.location&&(o={type:"geojson",value:{type:"Feature",geometry:{type:"Point",coordinates:[t.property.default.location.lng,t.property.default.location.lat,...t.property.default.height?[t.property.default.height]:[]]}}});else if(t.extensionId==="ellipsoid")n="ellipsoid",s=["position","height"],(se=(Pe=t.property)==null?void 0:Pe.default)!=null&&se.position&&(o={type:"geojson",value:{type:"Feature",geometry:{type:"Point",coordinates:[t.property.default.position.lng,t.property.default.position.lat,...typeof t.property.default.height=="number"?[t.property.default.height]:[]]}}});else if(t.extensionId==="model")n="model",s=["location","height"],(kt=(mt=t.property)==null?void 0:mt.default)!=null&&kt.location&&(o={type:"geojson",value:{type:"Feature",geometry:{type:"Point",coordinates:[t.property.default.location.lng,t.property.default.location.lat,...typeof t.property.default.height=="number"?[t.property.default.height]:[]]}}});else if(t.extensionId==="tileset")n="3dtiles",s=["tileset","sourceType"],((_i=(mn=t.property)==null?void 0:mn.default)==null?void 0:_i.sourceType)==="osm"?o={type:"osm-buildings"}:(ba=(zi=t.property)==null?void 0:zi.default)!=null&&ba.tileset&&(o={type:"3dtiles",url:t.property.default.tileset});else if(t.extensionId==="resource")if(n="resource",(La=(fa=t.property)==null?void 0:fa.default)!=null&&La.url&&typeof t.property.default.url=="object"){const Sc=t.property.default.url;o={type:t.property.default.type,value:Sc}}else o={type:((ma=(Ra=t.property)==null?void 0:Ra.default)==null?void 0:ma.type)||"auto",url:(nt=(yt=t.property)==null?void 0:yt.default)==null?void 0:nt.url};else t.extensionId==="box"&&(n="box",s=["location","height"],(Sa=(pi=t.property)==null?void 0:pi.default)!=null&&Sa.location&&(o={type:"geojson",value:{type:"Feature",geometry:{type:"Point",coordinates:[t.property.default.location.lng,t.property.default.location.lat,...typeof t.property.default.location.height=="number"?[t.property.default.location.height]:[]]}}}));const c=n&&t.property?Object.fromEntries(Object.entries(t.property).flatMap(([Sc,Xs])=>{if(!(Array.isArray(Xs)||Sc==="id"||!Xs||typeof Xs!="object"))return Object.entries(Xs).filter(([ms])=>!(s!=null&&s.includes(ms)))}).filter(Sc=>!!Sc)):void 0;return omitBy({type:"simple",...convertLegacyLayerCommon(t),data:o,...n&&c?{[n]:c}:{}},Sc=>typeof Sc>"u"||Sc===null)}function convertLegacyCluster(t){return t.map(n=>{var o;return{id:n.id,property:{default:n.default,layers:n.layers},layers:(o=n.layers)==null?void 0:o.map(s=>s.layer).filter(s=>!!s)}})}class Hooks{add(n,o,s){if(typeof arguments[0]!="string")for(let c in arguments[0])this.add(c,arguments[0][c],arguments[1]);else(Array.isArray(n)?n:[n]).forEach(function(c){this[c]=this[c]||[],o&&this[c][s?"unshift":"push"](o)},this)}run(n,o){this[n]=this[n]||[],this[n].forEach(function(s){s.call(o&&o.context?o.context:o,o)})}}class Plugins{constructor(n){this.jsep=n,this.registered={}}register(...n){n.forEach(o=>{if(typeof o!="object"||!o.name||!o.init)throw new Error("Invalid JSEP plugin format");this.registered[o.name]||(o.init(this.jsep),this.registered[o.name]=o)})}}class Jsep{static get version(){return"1.3.8"}static toString(){return"JavaScript Expression Parser (JSEP) v"+Jsep.version}static addUnaryOp(n){return Jsep.max_unop_len=Math.max(n.length,Jsep.max_unop_len),Jsep.unary_ops[n]=1,Jsep}static addBinaryOp(n,o,s){return Jsep.max_binop_len=Math.max(n.length,Jsep.max_binop_len),Jsep.binary_ops[n]=o,s?Jsep.right_associative.add(n):Jsep.right_associative.delete(n),Jsep}static addIdentifierChar(n){return Jsep.additional_identifier_chars.add(n),Jsep}static addLiteral(n,o){return Jsep.literals[n]=o,Jsep}static removeUnaryOp(n){return delete Jsep.unary_ops[n],n.length===Jsep.max_unop_len&&(Jsep.max_unop_len=Jsep.getMaxKeyLen(Jsep.unary_ops)),Jsep}static removeAllUnaryOps(){return Jsep.unary_ops={},Jsep.max_unop_len=0,Jsep}static removeIdentifierChar(n){return Jsep.additional_identifier_chars.delete(n),Jsep}static removeBinaryOp(n){return delete Jsep.binary_ops[n],n.length===Jsep.max_binop_len&&(Jsep.max_binop_len=Jsep.getMaxKeyLen(Jsep.binary_ops)),Jsep.right_associative.delete(n),Jsep}static removeAllBinaryOps(){return Jsep.binary_ops={},Jsep.max_binop_len=0,Jsep}static removeLiteral(n){return delete Jsep.literals[n],Jsep}static removeAllLiterals(){return Jsep.literals={},Jsep}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(n){this.expr=n,this.index=0}static parse(n){return new Jsep(n).parse()}static getMaxKeyLen(n){return Math.max(0,...Object.keys(n).map(o=>o.length))}static isDecimalDigit(n){return n>=48&&n<=57}static binaryPrecedence(n){return Jsep.binary_ops[n]||0}static isIdentifierStart(n){return n>=65&&n<=90||n>=97&&n<=122||n>=128&&!Jsep.binary_ops[String.fromCharCode(n)]||Jsep.additional_identifier_chars.has(String.fromCharCode(n))}static isIdentifierPart(n){return Jsep.isIdentifierStart(n)||Jsep.isDecimalDigit(n)}throwError(n){const o=new Error(n+" at character "+this.index);throw o.index=this.index,o.description=n,o}runHook(n,o){if(Jsep.hooks[n]){const s={context:this,node:o};return Jsep.hooks.run(n,s),s.node}return o}searchHook(n){if(Jsep.hooks[n]){const o={context:this};return Jsep.hooks[n].find(function(s){return s.call(o.context,o),o.node}),o.node}}gobbleSpaces(){let n=this.code;for(;n===Jsep.SPACE_CODE||n===Jsep.TAB_CODE||n===Jsep.LF_CODE||n===Jsep.CR_CODE;)n=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const n=this.gobbleExpressions(),o=n.length===1?n[0]:{type:Jsep.COMPOUND,body:n};return this.runHook("after-all",o)}gobbleExpressions(n){let o=[],s,c;for(;this.index<this.expr.length;)if(s=this.code,s===Jsep.SEMCOL_CODE||s===Jsep.COMMA_CODE)this.index++;else if(c=this.gobbleExpression())o.push(c);else if(this.index<this.expr.length){if(s===n)break;this.throwError('Unexpected "'+this.char+'"')}return o}gobbleExpression(){const n=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",n)}gobbleBinaryOp(){this.gobbleSpaces();let n=this.expr.substr(this.index,Jsep.max_binop_len),o=n.length;for(;o>0;){if(Jsep.binary_ops.hasOwnProperty(n)&&(!Jsep.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!Jsep.isIdentifierPart(this.expr.charCodeAt(this.index+n.length))))return this.index+=o,n;n=n.substr(0,--o)}return!1}gobbleBinaryExpression(){let n,o,s,c,d,h,p,y,S;if(h=this.gobbleToken(),!h||(o=this.gobbleBinaryOp(),!o))return h;for(d={value:o,prec:Jsep.binaryPrecedence(o),right_a:Jsep.right_associative.has(o)},p=this.gobbleToken(),p||this.throwError("Expected expression after "+o),c=[h,d,p];o=this.gobbleBinaryOp();){if(s=Jsep.binaryPrecedence(o),s===0){this.index-=o.length;break}d={value:o,prec:s,right_a:Jsep.right_associative.has(o)},S=o;const P=L=>d.right_a&&L.right_a?s>L.prec:s<=L.prec;for(;c.length>2&&P(c[c.length-2]);)p=c.pop(),o=c.pop().value,h=c.pop(),n={type:Jsep.BINARY_EXP,operator:o,left:h,right:p},c.push(n);n=this.gobbleToken(),n||this.throwError("Expected expression after "+S),c.push(d,n)}for(y=c.length-1,n=c[y];y>1;)n={type:Jsep.BINARY_EXP,operator:c[y-1].value,left:c[y-2],right:n},y-=2;return n}gobbleToken(){let n,o,s,c;if(this.gobbleSpaces(),c=this.searchHook("gobble-token"),c)return this.runHook("after-token",c);if(n=this.code,Jsep.isDecimalDigit(n)||n===Jsep.PERIOD_CODE)return this.gobbleNumericLiteral();if(n===Jsep.SQUOTE_CODE||n===Jsep.DQUOTE_CODE)c=this.gobbleStringLiteral();else if(n===Jsep.OBRACK_CODE)c=this.gobbleArray();else{for(o=this.expr.substr(this.index,Jsep.max_unop_len),s=o.length;s>0;){if(Jsep.unary_ops.hasOwnProperty(o)&&(!Jsep.isIdentifierStart(this.code)||this.index+o.length<this.expr.length&&!Jsep.isIdentifierPart(this.expr.charCodeAt(this.index+o.length)))){this.index+=s;const d=this.gobbleToken();return d||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:Jsep.UNARY_EXP,operator:o,argument:d,prefix:!0})}o=o.substr(0,--s)}Jsep.isIdentifierStart(n)?(c=this.gobbleIdentifier(),Jsep.literals.hasOwnProperty(c.name)?c={type:Jsep.LITERAL,value:Jsep.literals[c.name],raw:c.name}:c.name===Jsep.this_str&&(c={type:Jsep.THIS_EXP})):n===Jsep.OPAREN_CODE&&(c=this.gobbleGroup())}return c?(c=this.gobbleTokenProperty(c),this.runHook("after-token",c)):this.runHook("after-token",!1)}gobbleTokenProperty(n){this.gobbleSpaces();let o=this.code;for(;o===Jsep.PERIOD_CODE||o===Jsep.OBRACK_CODE||o===Jsep.OPAREN_CODE||o===Jsep.QUMARK_CODE;){let s;if(o===Jsep.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==Jsep.PERIOD_CODE)break;s=!0,this.index+=2,this.gobbleSpaces(),o=this.code}this.index++,o===Jsep.OBRACK_CODE?(n={type:Jsep.MEMBER_EXP,computed:!0,object:n,property:this.gobbleExpression()},this.gobbleSpaces(),o=this.code,o!==Jsep.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):o===Jsep.OPAREN_CODE?n={type:Jsep.CALL_EXP,arguments:this.gobbleArguments(Jsep.CPAREN_CODE),callee:n}:(o===Jsep.PERIOD_CODE||s)&&(s&&this.index--,this.gobbleSpaces(),n={type:Jsep.MEMBER_EXP,computed:!1,object:n,property:this.gobbleIdentifier()}),s&&(n.optional=!0),this.gobbleSpaces(),o=this.code}return n}gobbleNumericLiteral(){let n="",o,s;for(;Jsep.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(this.code===Jsep.PERIOD_CODE)for(n+=this.expr.charAt(this.index++);Jsep.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(o=this.char,o==="e"||o==="E"){for(n+=this.expr.charAt(this.index++),o=this.char,(o==="+"||o==="-")&&(n+=this.expr.charAt(this.index++));Jsep.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);Jsep.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")")}return s=this.code,Jsep.isIdentifierStart(s)?this.throwError("Variable names cannot start with a number ("+n+this.char+")"):(s===Jsep.PERIOD_CODE||n.length===1&&n.charCodeAt(0)===Jsep.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:Jsep.LITERAL,value:parseFloat(n),raw:n}}gobbleStringLiteral(){let n="";const o=this.index,s=this.expr.charAt(this.index++);let c=!1;for(;this.index<this.expr.length;){let d=this.expr.charAt(this.index++);if(d===s){c=!0;break}else if(d==="\\")switch(d=this.expr.charAt(this.index++),d){case"n":n+=`
|
|
28
28
|
`;break;case"r":n+="\r";break;case"t":n+=" ";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;default:n+=d}else n+=d}return c||this.throwError('Unclosed quote after "'+n+'"'),{type:Jsep.LITERAL,value:n,raw:this.expr.substring(o,this.index)}}gobbleIdentifier(){let n=this.code,o=this.index;for(Jsep.isIdentifierStart(n)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(n=this.code,Jsep.isIdentifierPart(n));)this.index++;return{type:Jsep.IDENTIFIER,name:this.expr.slice(o,this.index)}}gobbleArguments(n){const o=[];let s=!1,c=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let d=this.code;if(d===n){s=!0,this.index++,n===Jsep.CPAREN_CODE&&c&&c>=o.length&&this.throwError("Unexpected token "+String.fromCharCode(n));break}else if(d===Jsep.COMMA_CODE){if(this.index++,c++,c!==o.length){if(n===Jsep.CPAREN_CODE)this.throwError("Unexpected token ,");else if(n===Jsep.CBRACK_CODE)for(let h=o.length;h<c;h++)o.push(null)}}else if(o.length!==c&&c!==0)this.throwError("Expected comma");else{const h=this.gobbleExpression();(!h||h.type===Jsep.COMPOUND)&&this.throwError("Expected comma"),o.push(h)}}return s||this.throwError("Expected "+String.fromCharCode(n)),o}gobbleGroup(){this.index++;let n=this.gobbleExpressions(Jsep.CPAREN_CODE);if(this.code===Jsep.CPAREN_CODE)return this.index++,n.length===1?n[0]:n.length?{type:Jsep.SEQUENCE_EXP,expressions:n}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:Jsep.ARRAY_EXP,elements:this.gobbleArguments(Jsep.CBRACK_CODE)}}}const hooks=new Hooks;Object.assign(Jsep,{hooks,plugins:new Plugins(Jsep),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),Jsep.max_unop_len=Jsep.getMaxKeyLen(Jsep.unary_ops),Jsep.max_binop_len=Jsep.getMaxKeyLen(Jsep.binary_ops);const jsep=t=>new Jsep(t).parse(),staticMethods=Object.getOwnPropertyNames(Jsep);staticMethods.forEach(t=>{jsep[t]===void 0&&t!=="prototype"&&(jsep[t]=Jsep[t])}),jsep.Jsep=Jsep;const CONDITIONAL_EXP="ConditionalExpression";var ternary={name:"ternary",init(t){t.hooks.add("after-expression",function(o){if(o.node&&this.code===t.QUMARK_CODE){this.index++;const s=o.node,c=this.gobbleExpression();if(c||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===t.COLON_CODE){this.index++;const d=this.gobbleExpression();if(d||this.throwError("Expected expression"),o.node={type:CONDITIONAL_EXP,test:s,consequent:c,alternate:d},s.operator&&t.binary_ops[s.operator]<=.9){let h=s;for(;h.right.operator&&t.binary_ops[h.right.operator]<=.9;)h=h.right;o.node.test=h.right,h.right=o.node,o.node=s}}else this.throwError("Expected :")}})}};jsep.plugins.register(ternary);var ExpressionNodeType=(t=>(t[t.VARIABLE=0]="VARIABLE",t[t.UNARY=1]="UNARY",t[t.BINARY=2]="BINARY",t[t.TERNARY=3]="TERNARY",t[t.CONDITIONAL=4]="CONDITIONAL",t[t.MEMBER=5]="MEMBER",t[t.FUNCTION_CALL=6]="FUNCTION_CALL",t[t.ARRAY=7]="ARRAY",t[t.REGEX=8]="REGEX",t[t.VARIABLE_IN_STRING=9]="VARIABLE_IN_STRING",t[t.LITERAL_NULL=10]="LITERAL_NULL",t[t.LITERAL_BOOLEAN=11]="LITERAL_BOOLEAN",t[t.LITERAL_NUMBER=12]="LITERAL_NUMBER",t[t.LITERAL_STRING=13]="LITERAL_STRING",t[t.LITERAL_COLOR=14]="LITERAL_COLOR",t[t.LITERAL_VECTOR=15]="LITERAL_VECTOR",t[t.LITERAL_REGEX=16]="LITERAL_REGEX",t[t.LITERAL_UNDEFINED=17]="LITERAL_UNDEFINED",t[t.BUILTIN_VARIABLE=18]="BUILTIN_VARIABLE",t))(ExpressionNodeType||{});const unaryOperators=["!","-","+"],binaryOperators=["+","-","*","/","%","===","!==",">",">=","<","<=","&&","||","!~","=~","==","!="],backslashRegex=/\\/g,backslashReplacement="@#%",replacementRegex=/@#%/g,rgbaMatcher$1=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,rrggbbaaMatcher$1=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,builtInColor={ALICEBLUE:"#F0F8FF",ANTIQUEWHITE:"#FAEBD7",AQUA:"#00FFFF",AQUAMARINE:"#7FFFD4",AZURE:"#F0FFFF",BEIGE:"#F5F5DC",BISQUE:"#FFE4C4",BLACK:"#000000",BLANCHEDALMOND:"#FFEBCD",BLUE:"#0000FF",BLUEVIOLET:"#8A2BE2",BROWN:"#A52A2A",BURLYWOOD:"#DEB887",CADETBLUE:"#5F9EA0",CHARTREUSE:"#7FFF00",CHOCOLATE:"#D2691E",CORAL:"#FF7F50",CORNFLOWERBLUE:"#6495ED",CORNSILK:"#FFF8DC",CRIMSON:"#DC143C",CYAN:"#00FFFF",DARKBLUE:"#00008B",DARKCYAN:"#008B8B",DARKGOLDENROD:"#B8860B",DARKGRAY:"#A9A9A9",DARKGREEN:"#006400",DARKGREY:"#A9A9A9",DARKKHAKI:"#BDB76B",DARKMAGENTA:"#8B008B",DARKOLIVEGREEN:"#556B2F",DARKORANGE:"#FF8C00",DARKORCHID:"#9932CC",DARKRED:"#8B0000",DARKSALMON:"#E9967A",DARKSEAGREEN:"#8FBC8F",DARKSLATEBLUE:"#483D8B",DARKSLATEGRAY:"#2F4F4F",DARKSLATEGREY:"#2F4F4F",DARKTURQUOISE:"#00CED1",DARKVIOLET:"#9400D3",DEEPPINK:"#FF1493",DEEPSKYBLUE:"#00BFFF",DIMGRAY:"#696969",DIMGREY:"#696969",DODGERBLUE:"#1E90FF",FIREBRICK:"#B22222",FLORALWHITE:"#FFFAF0",FORESTGREEN:"#228B22",FUCHSIA:"#FF00FF",GAINSBORO:"#DCDCDC",GHOSTWHITE:"#F8F8FF",GOLD:"#FFD700",GOLDENROD:"#DAA520",GRAY:"#808080",GREEN:"#008000",GREENYELLOW:"#ADFF2F",GREY:"#808080",HONEYDEW:"#F0FFF0",HOTPINK:"#FF69B4",INDIANRED:"#CD5C5C",INDIGO:"#4B0082",IVORY:"#FFFFF0",KHAKI:"#F0E68C",LAVENDER:"#E6E6FA",LAVENDAR_BLUSH:"#FFF0F5",LAWNGREEN:"#7CFC00",LEMONCHIFFON:"#FFFACD",LIGHTBLUE:"#ADD8E6",LIGHTCORAL:"#F08080",LIGHTCYAN:"#E0FFFF",LIGHTGOLDENRODYELLOW:"#FAFAD2",LIGHTGRAY:"#D3D3D3",LIGHTGREEN:"#90EE90",LIGHTGREY:"#D3D3D3",LIGHTPINK:"#FFB6C1",LIGHTSEAGREEN:"#20B2AA",LIGHTSKYBLUE:"#87CEFA",LIGHTSLATEGRAY:"#778899",LIGHTSLATEGREY:"#778899",LIGHTSTEELBLUE:"#B0C4DE",LIGHTYELLOW:"#FFFFE0",LIME:"#00FF00",LIMEGREEN:"#32CD32",LINEN:"#FAF0E6",MAGENTA:"#FF00FF",MAROON:"#800000",MEDIUMAQUAMARINE:"#66CDAA",MEDIUMBLUE:"#0000CD",MEDIUMORCHID:"#BA55D3",MEDIUMPURPLE:"#9370DB",MEDIUMSEAGREEN:"#3CB371",MEDIUMSLATEBLUE:"#7B68EE",MEDIUMSPRINGGREEN:"#00FA9A",MEDIUMTURQUOISE:"#48D1CC",MEDIUMVIOLETRED:"#C71585",MIDNIGHTBLUE:"#191970",MINTCREAM:"#F5FFFA",MISTYROSE:"#FFE4E1",MOCCASIN:"#FFE4B5",NAVAJOWHITE:"#FFDEAD",NAVY:"#000080",OLDLACE:"#FDF5E6",OLIVE:"#808000",OLIVEDRAB:"#6B8E23",ORANGE:"#FFA500",ORANGERED:"#FF4500",ORCHID:"#DA70D6",PALEGOLDENROD:"#EEE8AA",PALEGREEN:"#98FB98",PALETURQUOISE:"#AFEEEE",PALEVIOLETRED:"#DB7093",PAPAYAWHIP:"#FFEFD5",PEACHPUFF:"#FFDAB9",PERU:"#CD853F",PINK:"#FFC0CB",PLUM:"#DDA0DD",POWDERBLUE:"#B0E0E6",PURPLE:"#800080",RED:"#FF0000",ROSYBROWN:"#BC8F8F",ROYALBLUE:"#4169E1",SADDLEBROWN:"#8B4513",SALMON:"#FA8072",SANDYBROWN:"#F4A460",SEAGREEN:"#2E8B57",SEASHELL:"#FFF5EE",SIENNA:"#A0522D",SILVER:"#C0C0C0",SKYBLUE:"#87CEEB",SLATEBLUE:"#6A5ACD",SLATEGRAY:"#708090",SLATEGREY:"#708090",SNOW:"#FFFAFA",SPRINGGREEN:"#00FF7F",STEELBLUE:"#4682B4",TAN:"#D2B48C",TEAL:"#008080",THISTLE:"#D8BFD8",TOMATO:"#FF6347",TURQUOISE:"#40E0D0",VIOLET:"#EE82EE",WHEAT:"#F5DEB3",WHITE:"#FFFFFF",WHITESMOKE:"#F5F5F5",YELLOW:"#FFFF00",YELLOWGREEN:"#9ACD32"};function getEvaluateBinaryFunction(t){const n=binaryFunctions[t];return function(o){const s=this._left.evaluate(o),c=this._right.evaluate(o);return n(t,s,c)}}const binaryFunctions={atan2:getEvaluateBinaryComponentwise(Math.atan2,!1),pow:getEvaluateBinaryComponentwise(Math.pow,!1),min:getEvaluateBinaryComponentwise(Math.min,!0),max:getEvaluateBinaryComponentwise(Math.max,!0),startsWith:getEvaluateBinaryComponentwise(startsWith,!1)};function getEvaluateBinaryComponentwise(t,n){return function(o,s,c){if(n&&typeof c=="number"&&typeof s=="number"||typeof s=="number"&&typeof c=="number"||typeof s=="string"&&typeof c=="string")return t(s,c);throw new Error(`Function "${o}" requires vector or number arguments of matching types. Arguments are ${s} and ${c}.`)}}function startsWith(t,n){return t.startsWith(n)}function getEvaluateUnaryFunction(t){const n=unaryFunctions[t];return function(o){const s=this._left.evaluate(o);return n(t,s)}}const unaryFunctions={abs:getEvaluateUnaryComponentwise(Math.abs),sqrt:getEvaluateUnaryComponentwise(Math.sqrt),cos:getEvaluateUnaryComponentwise(Math.cos),sin:getEvaluateUnaryComponentwise(Math.sin),tan:getEvaluateUnaryComponentwise(Math.tan),acos:getEvaluateUnaryComponentwise(Math.acos),asin:getEvaluateUnaryComponentwise(Math.asin),atan:getEvaluateUnaryComponentwise(Math.atan),radians:getEvaluateUnaryComponentwise(Cesium$1.Math.toRadians),degrees:getEvaluateUnaryComponentwise(Cesium$1.Math.toDegrees),sign:getEvaluateUnaryComponentwise(Cesium$1.Math.sign),floor:getEvaluateUnaryComponentwise(Math.floor),ceil:getEvaluateUnaryComponentwise(Math.ceil),round:getEvaluateUnaryComponentwise(Math.round),exp2:getEvaluateUnaryComponentwise(exp2),log:getEvaluateUnaryComponentwise(Math.log),log2:getEvaluateUnaryComponentwise(log2),fract:getEvaluateUnaryComponentwise(fract)};function getEvaluateUnaryComponentwise(t){return function(n,o){if(typeof o=="number")return t(o);throw new Error(`Function "${n}" requires a vector or number argument. Argument is ${o}.`)}}function fract(t){return t-Math.floor(t)}function exp2(t){return Math.pow(2,t)}function log2(t){return Cesium$1.Math.log2(t)}const rgbParenthesesMatcher$1=/^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i,hslParenthesesMatcher$1=/^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;let Color$2=class Cp{constructor(n,o,s,c){Rf(this,"red");Rf(this,"green");Rf(this,"blue");Rf(this,"alpha");this.red=defaultValue$1(n,1),this.green=defaultValue$1(o,1),this.blue=defaultValue$1(s,1),this.alpha=defaultValue$1(c,1)}static byteToFloat(n){return n/255}static floatToByte(n){return n===1?255:n*256|0}static fromCssColorString(n){n=n.replace(/\s/g,"");const o=getColor(n);if(typeof o<"u")return o;let s=rgbaMatcher$1.exec(n);if(s!==null){const c=new Cp;return c.red=parseInt(s[1],16)/15,c.green=parseInt(s[2],16)/15,c.blue=parseInt(s[3],16)/15,c.alpha=parseInt(defaultValue$1(s[4],"f"),16)/15,c}if(s=rrggbbaaMatcher$1.exec(n),s!==null){const c=new Cp;return c.red=parseInt(s[1],16)/255,c.green=parseInt(s[2],16)/255,c.blue=parseInt(s[3],16)/255,c.alpha=parseInt(defaultValue$1(s[4],"ff"),16)/255,c}if(s=rgbParenthesesMatcher$1.exec(n),s!==null){const c=new Cp;return c.red=parseFloat(s[1])/(s[1].substr(-1)==="%"?100:255),c.green=parseFloat(s[2])/(s[2].substr(-1)==="%"?100:255),c.blue=parseFloat(s[3])/(s[3].substr(-1)==="%"?100:255),c.alpha=parseFloat(defaultValue$1(s[4],"1.0")),c}if(s=hslParenthesesMatcher$1.exec(n),s!==null)return Cp.fromHsl(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,parseFloat(defaultValue$1(s[4],"1.0")))}static fromHsl(n,o,s,c){if(n=defaultValue$1(n,0)%1,o=defaultValue$1(o,0),s=defaultValue$1(s,0),c=defaultValue$1(c,1),n&&o&&s&&c){let d=s,h=s,p=s;const y=new Cp;if(o!==0){let S;s<.5?S=s*(1+o):S=s+o-s*o;const P=2*s-S;d=hue2rgb$1(P,S,n+1/3),h=hue2rgb$1(P,S,n),p=hue2rgb$1(P,S,n-1/3)}return typeof y>"u"?new Cp(d,h,p,c):(y.red=d,y.green=h,y.blue=p,y.alpha=c,y)}}toCssHexString(){let n=Cp.floatToByte(this.red).toString(16);n.length<2&&(n=`0${n}`);let o=Cp.floatToByte(this.green).toString(16);o.length<2&&(o=`0${o}`);let s=Cp.floatToByte(this.blue).toString(16);if(s.length<2&&(s=`0${s}`),this.alpha<1){let c=Cp.floatToByte(this.alpha).toString(16);return c.length<2&&(c=`0${c}`),`#${n}${o}${s}${c}`}return`#${n}${o}${s}`.toUpperCase()}static fromBytes(n,o,s,c){return n=this.byteToFloat(defaultValue$1(n,255)),o=Cp.byteToFloat(defaultValue$1(o,255)),s=Cp.byteToFloat(defaultValue$1(s,255)),c=Cp.byteToFloat(defaultValue$1(c,255)),new Cp(n,o,s,c)}};function getColor(t){if(t=t.toUpperCase(),builtInColor[t])return Color$2.fromCssColorString(builtInColor[t]);switch(t){case"TRANSPARENT":return new Color$2(0,0,0,0);default:return}}function hue2rgb$1(t,n,o){return o<0&&(o+=1),o>1&&(o-=1),o*6<1?t+(n-t)*6*o:o*2<1?n:o*3<2?t+(n-t)*(2/3-o)*6:t}class Node{constructor(n,o,s,c,d){Rf(this,"_type");Rf(this,"_value");Rf(this,"_left");Rf(this,"_right");Rf(this,"_test");Rf(this,"evaluate");this._type=n,this._value=o,this._left=s,this._right=c,this._test=d,this.setEvaluateFunction()}setEvaluateFunction(){const n=this._type,o=this._value;switch(n){case ExpressionNodeType.CONDITIONAL:this.evaluate=this._evaluateConditional;break;case ExpressionNodeType.FUNCTION_CALL:switch(o){case"toString":this.evaluate=this._evaluateToString;break}break;case ExpressionNodeType.UNARY:switch(o){case"!":this.evaluate=this._evaluateNot;break;case"-":this.evaluate=this._evaluateNegative;break;case"+":this.evaluate=this._evaluatePositive;break;case"isNaN":this.evaluate=this._evaluateNaN;break;case"isFinite":this.evaluate=this._evaluateIsFinite;break;case"Boolean":this.evaluate=this._evaluateBooleanConversion;break;case"Number":this.evaluate=this._evaluateNumberConversion;break;case"String":this.evaluate=this._evaluateStringConversion;break;default:typeof unaryFunctions[o]<"u"&&(this.evaluate=getEvaluateUnaryFunction(o));break}break;case ExpressionNodeType.BINARY:switch(o){case"+":this.evaluate=this._evaluatePlus;break;case"-":this.evaluate=this._evaluateMinus;break;case"*":this.evaluate=this._evaluateTimes;break;case"/":this.evaluate=this._evaluateDivide;break;case"%":this.evaluate=this._evaluateMod;break;case"===":this.evaluate=this._evaluateEqualsStrict;break;case"!==":this.evaluate=this._evaluateNotEqualsStrict;break;case"<":this.evaluate=this._evaluateLessThan;break;case"<=":this.evaluate=this._evaluateLessThanOrEquals;break;case">":this.evaluate=this._evaluateGreaterThan;break;case">=":this.evaluate=this._evaluateGreaterThanOrEquals;break;case"&&":this.evaluate=this._evaluateAnd;break;case"||":this.evaluate=this._evaluateOr;break;case"==":this.evaluate=this._evaluateEquals;break;case"!=":this.evaluate=this._evaluateNotEquals;break;default:typeof binaryFunctions[o]<"u"&&(this.evaluate=getEvaluateBinaryFunction(o));break}break;case ExpressionNodeType.MEMBER:o==="brackets"?this.evaluate=this._evaluateMemberBrackets:this.evaluate=this._evaluateMemberDot;break;case ExpressionNodeType.ARRAY:this.evaluate=this._evaluateArray;break;case ExpressionNodeType.VARIABLE:this.evaluate=this._evaluateVariable;break;case ExpressionNodeType.VARIABLE_IN_STRING:this.evaluate=this._evaluateVariableString;break;case ExpressionNodeType.LITERAL_COLOR:this.evaluate=this._evaluateLiteralColor;break;case ExpressionNodeType.LITERAL_STRING:this.evaluate=this._evaluateLiteralString;break;default:this.evaluate=this._evaluateLiteral;break}}_evaluateLiteral(){return this._value}_evaluateLiteralString(){return this._value}_evaluateVariableString(n){const o=/\${(.*?)}/g;return this._value.replace(o,(c,d)=>{let h=n==null?void 0:n.properties[d];return typeof h>"u"&&(h=""),h})}_evaluateVariable(n){let o;return n&&String(this._value)in n.properties?o=n.properties[String(this._value)]:String(this._value)==="id"?o=n==null?void 0:n.id:n&&String(this._value)==="rootProperties"&&(o=n.properties),typeof o>"u"&&(o=""),o}_evaluateMemberDot(n){if(checkFeature(this._left))return n==null?void 0:n.properties[this._right.evaluate(n)];const o=this._left.evaluate(n);if(typeof o>"u")return;const s=this._right.evaluate(n);return o[s]}_evaluateMemberBrackets(n){if(checkFeature(this._left))return n==null?void 0:n.properties[this._right.evaluate(n)];const o=this._left.evaluate(n);if(typeof o>"u")return;const s=this._right.evaluate(n);return o[s]}_evaluateArray(n){const o=[];for(let s=0;s<this._value.length;s++)o[s]=this._value[s].evaluate(n);return o}_evaluateNot(n){const o=this._left.evaluate(n);if(typeof o!="boolean")throw new Error(`Operator "!" requires a boolean argument. Argument is ${o}.`);return!o}_evaluateNegative(n){const o=this._left.evaluate(n);if(typeof o=="number")return-o;throw new Error(`Operator "-" requires a vector or number argument. Argument is ${o}.`)}_evaluatePositive(n){const o=this._left.evaluate(n);if(typeof o!="number")throw new Error(`Operator "+" requires a vector or number argument. Argument is ${o}.`);return o}_evaluateLessThan(n){const o=this._left.evaluate(n),s=this._right.evaluate(n);return typeof o!="number"||typeof s!="number"?(console.warn(`Operator "<" requires number arguments. Arguments are ${o} and ${s}.`),!1):o<s}_evaluateLessThanOrEquals(n){const o=this._left.evaluate(n),s=this._right.evaluate(n);return typeof o!="number"||typeof s!="number"?(console.warn(`Operator "<=" requires number arguments. Arguments are ${o} and ${s}.`),!1):o<=s}_evaluateGreaterThan(n){const o=this._left.evaluate(n),s=this._right.evaluate(n);return typeof o!="number"||typeof s!="number"?(console.warn(`Operator ">" requires number arguments. Arguments are ${o} and ${s}.`),!1):o>s}_evaluateGreaterThanOrEquals(n){const o=this._left.evaluate(n),s=this._right.evaluate(n);return typeof o!="number"||typeof s!="number"?(console.warn(`Operator ">=" requires number arguments. Arguments are ${o} and ${s}.`),!1):o>=s}_evaluateOr(n){const o=this._left.evaluate(n);if(typeof o!="boolean")return console.warn(`Operator "||" requires boolean arguments. First argument is ${o}.`),!1;if(o)return!0;const s=this._right.evaluate(n);return typeof s!="boolean"?(console.warn(`Operator "||" requires boolean arguments. Second argument is ${s}.`),!1):o||s}_evaluateAnd(n){const o=this._left.evaluate(n);if(typeof o!="boolean")return console.warn(`Operator "&&" requires boolean arguments. First argument is ${o}.`),!1;if(!o)return!1;const s=this._right.evaluate(n);return typeof s!="boolean"?(console.warn(`Operator "&&" requires boolean arguments. Second argument is ${s}.`),!1):o&&s}_evaluatePlus(n){const o=this._left.evaluate(n),s=this._right.evaluate(n);if(typeof o=="number"&&typeof s=="number")return o+s;throw new Error(`Operator "+" requires vector or number arguments of matching types, or at least one string argument. Arguments are ${o} and ${s}.`)}_evaluateMinus(n){const o=this._left.evaluate(n),s=this._right.evaluate(n);if(typeof o=="number"&&typeof s=="number")return o-s;throw new Error(`Operator "-" requires vector or number arguments of matching types. Arguments are ${o} and ${s}.`)}_evaluateTimes(n){const o=this._left.evaluate(n),s=this._right.evaluate(n);if(typeof o=="number"&&typeof s=="number")return o*s;throw new Error(`Operator "*" requires vector or number arguments. If both arguments are vectors they must be matching types. Arguments are ${o} and ${s}.`)}_evaluateDivide(n){const o=this._left.evaluate(n),s=this._right.evaluate(n);if(typeof o=="number"&&typeof s=="number")return o/s;throw new Error(`Operator "/" requires vector or number arguments of matching types, or a number as the second argument. Arguments are ${o} and ${s}.`)}_evaluateMod(n){const o=this._left.evaluate(n),s=this._right.evaluate(n);if(typeof o=="number"&&typeof s=="number")return o%s;throw new Error(`Operator "%" requires vector or number arguments of matching types. Arguments are ${o} and ${s}.`)}_evaluateEqualsStrict(n){const o=this._left.evaluate(n),s=this._right.evaluate(n);return o===s}_evaluateNotEqualsStrict(n){const o=this._left.evaluate(n),s=this._right.evaluate(n);return o!==s}_evaluateConditional(n){const o=this._test.evaluate(n);if(typeof o!="boolean")throw new Error(`Conditional argument of conditional expression must be a boolean. Argument is ${o}.`);return o?this._left.evaluate(n):this._right.evaluate(n)}_evaluateNaN(n){return isNaN(this._left.evaluate(n))}_evaluateIsFinite(n){return isFinite(this._left.evaluate(n))}_evaluateBooleanConversion(n){return!!this._left.evaluate(n)}_evaluateNumberConversion(n){const o=cleanseNumberStringInput(this._left.evaluate(n));return Number(o)}_evaluateStringConversion(n){return String(this._left.evaluate(n))}_evaluateToString(n){const o=this._left.evaluate(n);if(o instanceof RegExp)return String(o);throw new Error(`Unexpected function call "${this._value}".`)}_evaluateLiteralColor(n){const o=this._left;let s=new Color$2;if(this._value==="color")if(typeof o>"u")s=Color$2.fromBytes(255,255,255,255);else if(o.length>1){const c=Color$2.fromCssColorString(o[0].evaluate(n));if(c)s=c;else throw new Error(`wrong literalColor call "${this._value}, ${o}}"`);s.alpha=o[1].evaluate(n)}else{const c=Color$2.fromCssColorString(o[0].evaluate(n));if(c)s=c;else throw new Error(`wrong literalColor call "${this._value}, ${o}}"`)}else if(this._value==="rgb")s=Color$2.fromBytes(o[0].evaluate(n),o[1].evaluate(n),o[2].evaluate(n),255);else if(this._value==="rgba"){const c=o[3].evaluate(n)*255;s=Color$2.fromBytes(o[0].evaluate(n),o[1].evaluate(n),o[2].evaluate(n),c)}else if(this._value==="hsl"){const c=Color$2.fromHsl(o[0].evaluate(n),o[1].evaluate(n),o[2].evaluate(n),1);c&&(s=c)}else if(this._value==="hsla"){const c=Color$2.fromHsl(o[0].evaluate(n),o[1].evaluate(n),o[2].evaluate(n),o[3].evaluate(n));c&&(s=c)}return s.toCssHexString()}_evaluateEquals(n){const o=this._left.evaluate(n),s=this._right.evaluate(n);return isArray$3(o)&&!isArray$3(s)?o.includes(s):isArray$3(s)&&!isArray$3(o)?s.includes(o):(isArray$3(s)&&isArray$3(o)&&console.error("Equals left and right both can't be array at the same time"),o==s)}_evaluateNotEquals(n){const o=this._left.evaluate(n),s=this._right.evaluate(n);return isArray$3(o)&&!isArray$3(s)?!o.includes(s):isArray$3(s)&&!isArray$3(o)?!s.includes(o):(isArray$3(s)&&isArray$3(o)&&console.error("NotEquals left and right both can't be array at the same time"),o!=s)}}function cleanseNumberStringInput(t){if(typeof t!="string")return t;const n=["%"];for(const o of n)if(t.endsWith(o))return t.slice(0,-o.length).trim();return t.trim()}function checkFeature(t){return t._value==="feature"}function isArray$3(t){return Array.isArray(t)}function _typeof(t){"@babel/helpers - typeof";return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},_typeof(t)}function _classCallCheck(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,n){for(var o=0;o<n.length;o++){var s=n[o];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}function _createClass(t,n,o){return n&&_defineProperties(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function _inherits(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&_setPrototypeOf(t,n)}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},_getPrototypeOf(t)}function _setPrototypeOf(t,n){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,c){return s.__proto__=c,s},_setPrototypeOf(t,n)}function _isNativeReflectConstruct(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function _construct(t,n,o){return _isNativeReflectConstruct()?_construct=Reflect.construct.bind():_construct=function(c,d,h){var p=[null];p.push.apply(p,d);var y=Function.bind.apply(c,p),S=new y;return h&&_setPrototypeOf(S,h.prototype),S},_construct.apply(null,arguments)}function _isNativeFunction(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function _wrapNativeSuper(t){var n=typeof Map=="function"?new Map:void 0;return _wrapNativeSuper=function(s){if(s===null||!_isNativeFunction(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof n<"u"){if(n.has(s))return n.get(s);n.set(s,c)}function c(){return _construct(s,arguments,_getPrototypeOf(this).constructor)}return c.prototype=Object.create(s.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(c,s)},_wrapNativeSuper(t)}function _assertThisInitialized(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _possibleConstructorReturn(t,n){if(n&&(typeof n=="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _createSuper(t){var n=_isNativeReflectConstruct();return function(){var s=_getPrototypeOf(t),c;if(n){var d=_getPrototypeOf(this).constructor;c=Reflect.construct(s,arguments,d)}else c=s.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _iterableToArray(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function _unsupportedIterableToArray(t,n){if(t){if(typeof t=="string")return _arrayLikeToArray(t,n);var o=Object.prototype.toString.call(t).slice(8,-1);if(o==="Object"&&t.constructor&&(o=t.constructor.name),o==="Map"||o==="Set")return Array.from(t);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return _arrayLikeToArray(t,n)}}function _arrayLikeToArray(t,n){(n==null||n>t.length)&&(n=t.length);for(var o=0,s=new Array(n);o<n;o++)s[o]=t[o];return s}function _nonIterableSpread(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
29
29
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _createForOfIteratorHelper(t,n){var o=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!o){if(Array.isArray(t)||(o=_unsupportedIterableToArray(t))||n){o&&(t=o);var s=0,c=function(){};return{s:c,n:function(){return s>=t.length?{done:!0}:{done:!1,value:t[s++]}},e:function(y){throw y},f:c}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
30
30
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var d=!0,h=!1,p;return{s:function(){o=o.call(t)},n:function(){var y=o.next();return d=y.done,y},e:function(y){h=!0,p=y},f:function(){try{!d&&o.return!=null&&o.return()}finally{if(h)throw p}}}}var hasOwnProp=Object.prototype.hasOwnProperty;function push(t,n){return t=t.slice(),t.push(n),t}function unshift(t,n){return n=n.slice(),n.unshift(t),n}var NewError=function(t){_inherits(o,t);var n=_createSuper(o);function o(s){var c;return _classCallCheck(this,o),c=n.call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),c.avoidNew=!0,c.value=s,c.name="NewError",c}return _createClass(o)}(_wrapNativeSuper(Error));function JSONPath(t,n,o,s,c){if(!(this instanceof JSONPath))try{return new JSONPath(t,n,o,s,c)}catch(y){if(!y.avoidNew)throw y;return y.value}typeof t=="string"&&(c=s,s=o,o=n,n=t,t=null);var d=t&&_typeof(t)==="object";if(t=t||{},this.json=t.json||o,this.path=t.path||n,this.resultType=t.resultType||"value",this.flatten=t.flatten||!1,this.wrap=hasOwnProp.call(t,"wrap")?t.wrap:!0,this.sandbox=t.sandbox||{},this.preventEval=t.preventEval||!1,this.parent=t.parent||null,this.parentProperty=t.parentProperty||null,this.callback=t.callback||s||null,this.otherTypeCallback=t.otherTypeCallback||c||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},t.autostart!==!1){var h={path:d?t.path:n};d?"json"in t&&(h.json=t.json):h.json=o;var p=this.evaluate(h);if(!p||_typeof(p)!=="object")throw new NewError(p);return p}}JSONPath.prototype.evaluate=function(t,n,o,s){var c=this,d=this.parent,h=this.parentProperty,p=this.flatten,y=this.wrap;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,o=o||this.callback,this.currOtherTypeCallback=s||this.otherTypeCallback,n=n||this.json,t=t||this.path,t&&_typeof(t)==="object"&&!Array.isArray(t)){if(!t.path&&t.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!hasOwnProp.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');var S=t;n=S.json,p=hasOwnProp.call(t,"flatten")?t.flatten:p,this.currResultType=hasOwnProp.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=hasOwnProp.call(t,"sandbox")?t.sandbox:this.currSandbox,y=hasOwnProp.call(t,"wrap")?t.wrap:y,this.currPreventEval=hasOwnProp.call(t,"preventEval")?t.preventEval:this.currPreventEval,o=hasOwnProp.call(t,"callback")?t.callback:o,this.currOtherTypeCallback=hasOwnProp.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,d=hasOwnProp.call(t,"parent")?t.parent:d,h=hasOwnProp.call(t,"parentProperty")?t.parentProperty:h,t=t.path}if(d=d||null,h=h||null,Array.isArray(t)&&(t=JSONPath.toPathString(t)),!(!t&&t!==""||!n)){var P=JSONPath.toPathArray(t);P[0]==="$"&&P.length>1&&P.shift(),this._hasParentSelector=null;var L=this._trace(P,n,["$"],d,h,o).filter(function(F){return F&&!F.isParentSelector});return L.length?!y&&L.length===1&&!L[0].hasArrExpr?this._getPreferredOutput(L[0]):L.reduce(function(F,N){var W=c._getPreferredOutput(N);return p&&Array.isArray(W)?F=F.concat(W):F.push(W),F},[]):y?[]:void 0}},JSONPath.prototype._getPreferredOutput=function(t){var n=this.currResultType;switch(n){case"all":{var o=Array.isArray(t.path)?t.path:JSONPath.toPathArray(t.path);return t.pointer=JSONPath.toPointer(o),t.path=typeof t.path=="string"?t.path:JSONPath.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[n];case"path":return JSONPath.toPathString(t[n]);case"pointer":return JSONPath.toPointer(t.path);default:throw new TypeError("Unknown result type")}},JSONPath.prototype._handleCallback=function(t,n,o){if(n){var s=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:JSONPath.toPathString(t.path),n(s,o,t)}},JSONPath.prototype._trace=function(t,n,o,s,c,d,h,p){var y=this,S;if(!t.length)return S={path:o,value:n,parent:s,parentProperty:c,hasArrExpr:h},this._handleCallback(S,d,"value"),S;var P=t[0],L=t.slice(1),F=[];function N(Ra){Array.isArray(Ra)?Ra.forEach(function(ma){F.push(ma)}):F.push(Ra)}if((typeof P!="string"||p)&&n&&hasOwnProp.call(n,P))N(this._trace(L,n[P],push(o,P),n,P,d,h));else if(P==="*")this._walk(n,function(Ra){N(y._trace(L,n[Ra],push(o,Ra),n,Ra,d,!0,!0))});else if(P==="..")N(this._trace(L,n,o,s,c,d,h)),this._walk(n,function(Ra){_typeof(n[Ra])==="object"&&N(y._trace(t.slice(),n[Ra],push(o,Ra),n,Ra,d,!0))});else{if(P==="^")return this._hasParentSelector=!0,{path:o.slice(0,-1),expr:L,isParentSelector:!0};if(P==="~")return S={path:push(o,P),value:c,parent:s,parentProperty:null},this._handleCallback(S,d,"property"),S;if(P==="$")N(this._trace(L,n,o,null,null,d,h));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(P))N(this._slice(P,L,n,o,s,c,d));else if(P.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var W=P.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1");this._walk(n,function(Ra){y._eval(W,n[Ra],Ra,o,s,c)&&N(y._trace(L,n[Ra],push(o,Ra),n,Ra,d,!0))})}else if(P[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");N(this._trace(unshift(this._eval(P,n,o[o.length-1],o.slice(0,-1),s,c),L),n,o,s,c,d,h))}else if(P[0]==="@"){var z=!1,lt=P.slice(1,-2);switch(lt){case"scalar":(!n||!["object","function"].includes(_typeof(n)))&&(z=!0);break;case"boolean":case"string":case"undefined":case"function":_typeof(n)===lt&&(z=!0);break;case"integer":Number.isFinite(n)&&!(n%1)&&(z=!0);break;case"number":Number.isFinite(n)&&(z=!0);break;case"nonFinite":typeof n=="number"&&!Number.isFinite(n)&&(z=!0);break;case"object":n&&_typeof(n)===lt&&(z=!0);break;case"array":Array.isArray(n)&&(z=!0);break;case"other":z=this.currOtherTypeCallback(n,o,s,c);break;case"null":n===null&&(z=!0);break;default:throw new TypeError("Unknown value type "+lt)}if(z)return S={path:o,value:n,parent:s,parentProperty:c},this._handleCallback(S,d,"value"),S}else if(P[0]==="`"&&n&&hasOwnProp.call(n,P.slice(1))){var Pe=P.slice(1);N(this._trace(L,n[Pe],push(o,Pe),n,Pe,d,h,!0))}else if(P.includes(",")){var se=P.split(","),mt=_createForOfIteratorHelper(se),kt;try{for(mt.s();!(kt=mt.n()).done;){var mn=kt.value;N(this._trace(unshift(mn,L),n,o,s,c,d,!0))}}catch(Ra){mt.e(Ra)}finally{mt.f()}}else!p&&n&&hasOwnProp.call(n,P)&&N(this._trace(L,n[P],push(o,P),n,P,d,h,!0))}if(this._hasParentSelector)for(var _i=0;_i<F.length;_i++){var zi=F[_i];if(zi&&zi.isParentSelector){var ba=this._trace(zi.expr,n,zi.path,s,c,d,h);if(Array.isArray(ba)){F[_i]=ba[0];for(var fa=ba.length,La=1;La<fa;La++)_i++,F.splice(_i,0,ba[La])}else F[_i]=ba}}return F},JSONPath.prototype._walk=function(t,n){if(Array.isArray(t))for(var o=t.length,s=0;s<o;s++)n(s);else t&&_typeof(t)==="object"&&Object.keys(t).forEach(function(c){n(c)})},JSONPath.prototype._slice=function(t,n,o,s,c,d,h){if(Array.isArray(o)){var p=o.length,y=t.split(":"),S=y[2]&&Number.parseInt(y[2])||1,P=y[0]&&Number.parseInt(y[0])||0,L=y[1]&&Number.parseInt(y[1])||p;P=P<0?Math.max(0,P+p):Math.min(p,P),L=L<0?Math.max(0,L+p):Math.min(p,L);for(var F=[],N=P;N<L;N+=S){var W=this._trace(unshift(N,n),o,s,c,d,h,!0);W.forEach(function(z){F.push(z)})}return F}},JSONPath.prototype._eval=function(t,n,o,s,c,d){this.currSandbox._$_parentProperty=d,this.currSandbox._$_parent=c,this.currSandbox._$_property=o,this.currSandbox._$_root=this.json,this.currSandbox._$_v=n;var h=t.includes("@path");h&&(this.currSandbox._$_path=JSONPath.toPathString(s.concat([o])));var p="script:"+t;if(!JSONPath.cache[p]){var y=t.replace(/@parentProperty/g,"_$_parentProperty").replace(/@parent/g,"_$_parent").replace(/@property/g,"_$_property").replace(/@root/g,"_$_root").replace(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,"_$_v$1");h&&(y=y.replace(/@path/g,"_$_path")),JSONPath.cache[p]=new this.vm.Script(y)}try{return JSONPath.cache[p].runInNewContext(this.currSandbox)}catch(S){throw new Error("jsonPath: "+S.message+": "+t)}},JSONPath.cache={},JSONPath.toPathString=function(t){for(var n=t,o=n.length,s="$",c=1;c<o;c++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(n[c])||(s+=/^[\*0-9]+$/.test(n[c])?"["+n[c]+"]":"['"+n[c]+"']");return s},JSONPath.toPointer=function(t){for(var n=t,o=n.length,s="",c=1;c<o;c++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(n[c])||(s+="/"+n[c].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return s},JSONPath.toPathArray=function(t){var n=JSONPath.cache;if(n[t])return n[t].concat();var o=[],s=t.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/g,";$&;").replace(/['\[](\??\((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\))['\]]/g,function(d,h){return"[#"+(o.push(h)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(d,h){return"['"+h.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(d,h){return";"+h.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),c=s.split(";").map(function(d){var h=d.match(/#([0-9]+)/);return!h||!h[1]?d:o[h[1]]});return n[t]=c,n[t].concat()};var moveToAnotherArray=function(n,o,s){for(var c=n.length,d=0;d<c;d++){var h=n[d];s(h)&&o.push(n.splice(d--,1)[0])}},Script=function(){function t(n){_classCallCheck(this,t),this.code=n}return _createClass(t,[{key:"runInNewContext",value:function(o){var s=this.code,c=Object.keys(o),d=[];moveToAnotherArray(c,d,function(P){return typeof o[P]=="function"});var h=c.map(function(P,L){return o[P]}),p=d.reduce(function(P,L){var F=o[L].toString();return/function/.test(F)||(F="function "+F),"var "+L+"="+F+";"+P},"");s=p+s,!/(["'])use strict\1/.test(s)&&!c.includes("arguments")&&(s="var arguments = undefined;"+s),s=s.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var y=s.lastIndexOf(";"),S=y>-1?s.slice(0,y+1)+" return "+s.slice(y+1):" return "+s;return _construct(Function,c.concat([S])).apply(void 0,_toConsumableArray(h))}}]),t}();JSONPath.prototype.vm={Script};const usableChars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",generateRandomString=t=>Array.from(window.crypto.getRandomValues(new Uint8Array(t))).map(n=>usableChars[n%t]).join("").toLowerCase(),recursiveJSONParse=t=>{if(typeof t!="object"||t===null)return t;for(const n in t)if(typeof t[n]=="string")try{t[n].startsWith("{")&&t[n].endsWith("}")&&(t[n]=JSON.parse(t[n]))}catch{console.error("Invalid JSON:",t[n])}else typeof t[n]=="object"&&(t[n]=recursiveJSONParse(t[n]));return t},VARIABLE_PREFIX="czm_";function replaceVariables(t,n){let o=t,s="";const c=[];let d=o.indexOf("${");const h=typeof n<"u",p={},y=/^\$./;for(;d>=0;)if(isInsideQuotes(o,d)){const S=findCloseQuote(o,d);s+=o.slice(0,S+1),o=o.slice(S+1),d=o.indexOf("${")}else{s+=o.slice(0,d);const S=getCloseBracketIndex(o,d),P=o.slice(d+2,S);if(y.test(P)){if(!h)return[s,[]];let L=p[P];if(!L)try{L=JSONPath({json:n,path:P}),p[P]=L}catch{return[s,[]]}if(L.length!==0){const F=generateRandomString(10);c.push({literalName:F,literalValue:L[0]}),s+=F}else return["false",[]]}else{const L=replaceReservedWord(P);s+=`${VARIABLE_PREFIX}${L}`}o=o.slice(S+1),d=o.indexOf("${")}return s+=o,[s,c]}function isInsideQuotes(t,n){const o=t.indexOf("'"),s=t.indexOf('"');return o>=0&&o<n?t.indexOf("'",o+1)>=n:s>=0&&s<n?t.indexOf('"',s+1)>=n:!1}function findCloseQuote(t,n){const o=t.indexOf("'"),s=t.indexOf('"');return o>=0&&o<n?t.indexOf("'",o+1):s>=0&&s<n?t.indexOf('"',s+1):-1}function getCloseBracketIndex(t,n){const o=t.indexOf("}",n);if(o<0)throw new Error("replaceVariable: Unmatched {.");return o}const makeReservedWord=t=>`$reearth_${t}_$`,RESERVED_WORDS={"[":makeReservedWord("opened_square_bracket"),"]":makeReservedWord("closed_square_bracket"),"{":makeReservedWord("opened_curly_bracket"),"}":makeReservedWord("closed_curly_bracket"),"(":makeReservedWord("opened_parentheses"),")":makeReservedWord("closed_parentheses"),"-":makeReservedWord("hyphen"),":":makeReservedWord("colon")},replaceReservedWord=t=>{const n=t.replace(/-/g,RESERVED_WORDS["-"]).replace(/:/g,RESERVED_WORDS[":"]);return/(\]|\)|\})[^[.]+$/.test(n)?Object.entries(RESERVED_WORDS).reduce((o,[s,c])=>o.replaceAll(s,c),n):n},restoreReservedWord=t=>Object.entries(RESERVED_WORDS).reduce((n,[o,s])=>n.replaceAll(s,o),t),UNARY_OPERATORS_SET=new Set(unaryOperators),BINARY_OPERATORS_SET=new Set(binaryOperators);function createRuntimeAst(t,n){let o=new Error("failed to parse");const s=n.type;if(s==="Literal")o=parseLiteral(n);else if(s==="CallExpression")o=parseCall(t,n);else if(s==="Identifier")o=parseKeywordsAndVariables(n);else if(s==="UnaryExpression"){const c=n.operator,d=createRuntimeAst(t,n.argument);if(UNARY_OPERATORS_SET.has(c))o=new Node(ExpressionNodeType.UNARY,c,d);else throw new Error(`Unexpected operator "${c}".`)}else if(s==="BinaryExpression"){const c=n.operator,d=createRuntimeAst(t,n.left),h=createRuntimeAst(t,n.right);if(BINARY_OPERATORS_SET.has(c))o=new Node(ExpressionNodeType.BINARY,c,d,h);else throw new Error(`Unexpected operator "${c}".`)}else if(s==="LogicalExpression"){const c=n.operator,d=createRuntimeAst(t,n.left),h=createRuntimeAst(t,n.right);BINARY_OPERATORS_SET.has(c)&&(o=new Node(ExpressionNodeType.BINARY,c,d,h))}else if(s==="ConditionalExpression"){const c=createRuntimeAst(t,n.test),d=createRuntimeAst(t,n.consequent),h=createRuntimeAst(t,n.alternate);o=new Node(ExpressionNodeType.CONDITIONAL,"?",d,h,c)}else if(s==="MemberExpression")o=parseMemberExpression(t,n);else if(s==="ArrayExpression"){const c=[];for(let d=0;d<n.elements.length;d++)c[d]=createRuntimeAst(t,n.elements[d]);o=new Node(ExpressionNodeType.ARRAY,c)}else throw s==="Compound"?new Error("Provide exactly one expression."):new Error("Cannot parse expression.");return o}function parseLiteral(t){const n=typeof t.value;if(t.value===null)return new Node(ExpressionNodeType.LITERAL_NULL,null);if(n==="boolean")return new Node(ExpressionNodeType.LITERAL_BOOLEAN,t.value);if(n==="number")return new Node(ExpressionNodeType.LITERAL_NUMBER,t.value);if(n==="string")return t.value.indexOf("${")>=0?new Node(ExpressionNodeType.VARIABLE_IN_STRING,t.value):t.value.indexOf("$reearth_")>=0?new Node(ExpressionNodeType.LITERAL_STRING,restoreReservedWord(t.value)):new Node(ExpressionNodeType.LITERAL_STRING,replaceBackslashes(t.value));throw new Error(`${t} is not a function.`)}function replaceBackslashes(t){return t.replace(replacementRegex,"\\")}function parseCall(t,n){const o=n.arguments,s=o.length;if(n.callee.type==="MemberExpression"){const d=n.callee.property.name,h=n.callee.object;if(d==="test"||d==="exec"){if(h.callee.name!=="regExp")throw new Error(`${d} is not a function.`);if(s===0)return d==="test"?new Node(ExpressionNodeType.LITERAL_BOOLEAN,!1):new Node(ExpressionNodeType.LITERAL_NULL,null);const p=createRuntimeAst(t,h),y=createRuntimeAst(t,o[0]);return new Node(ExpressionNodeType.FUNCTION_CALL,d,p,y)}else if(d==="toString"){const p=createRuntimeAst(t,h);return new Node(ExpressionNodeType.FUNCTION_CALL,d,p)}throw new Error(`Unexpected function call "${d}".`)}const c=n.callee.name;if(c==="color"){if(s===0)return new Node(ExpressionNodeType.LITERAL_COLOR,c);const d=createRuntimeAst(t,o[0]);if(typeof o[1]<"u"){const h=createRuntimeAst(t,o[1]);return new Node(ExpressionNodeType.LITERAL_COLOR,c,[d,h])}return new Node(ExpressionNodeType.LITERAL_COLOR,c,[d])}else if(c==="rgb"||c==="hsl"){if(s<3)throw new Error(`${c} requires three arguments.`);const d=[createRuntimeAst(t,o[0]),createRuntimeAst(t,o[1]),createRuntimeAst(t,o[2])];return new Node(ExpressionNodeType.LITERAL_COLOR,c,d)}else if(c==="rgba"||c==="hsla"){if(s<4)throw new Error(`${c} requires four arguments.`);const d=[createRuntimeAst(t,o[0]),createRuntimeAst(t,o[1]),createRuntimeAst(t,o[2]),createRuntimeAst(t,o[3])];return new Node(ExpressionNodeType.LITERAL_COLOR,c,d)}else if(c==="isNaN"||c==="isFinite"){if(s===0)return c==="isNaN"?new Node(ExpressionNodeType.LITERAL_BOOLEAN,!0):new Node(ExpressionNodeType.LITERAL_BOOLEAN,!1);const d=createRuntimeAst(t,o[0]);return new Node(ExpressionNodeType.UNARY,c,d)}else if(typeof unaryFunctions[c]<"u"){if(s!==1)throw new Error(`${c} requires exactly one argument.`);const d=createRuntimeAst(t,o[0]);return new Node(ExpressionNodeType.UNARY,c,d)}else if(typeof binaryFunctions[c]<"u"){if(s!==2)throw new Error(`${c} requires exactly two arguments.`);const d=createRuntimeAst(t,o[0]),h=createRuntimeAst(t,o[1]);return new Node(ExpressionNodeType.BINARY,c,d,h)}else if(c==="Boolean"){if(s===0)return new Node(ExpressionNodeType.LITERAL_BOOLEAN,!1);const d=createRuntimeAst(t,o[0]);return new Node(ExpressionNodeType.UNARY,c,d)}else if(c==="Number"){if(s===0)return new Node(ExpressionNodeType.LITERAL_NUMBER,0);const d=createRuntimeAst(t,o[0]);return new Node(ExpressionNodeType.UNARY,c,d)}else if(c==="String"){if(s===0)return new Node(ExpressionNodeType.LITERAL_STRING,"");const d=createRuntimeAst(t,o[0]);return new Node(ExpressionNodeType.UNARY,c,d)}throw new Error(`Unexpected function call "${c}".`)}function parseKeywordsAndVariables(t){const n=t.name;if(isVariable(n)){const o=getPropertyName(n);return o.substring(0,8)==="tiles3d_"?new Node(ExpressionNodeType.BUILTIN_VARIABLE,o):new Node(ExpressionNodeType.VARIABLE,o)}else{if(n==="NaN")return new Node(ExpressionNodeType.LITERAL_NUMBER,NaN);if(n==="Infinity")return new Node(ExpressionNodeType.LITERAL_NUMBER,1/0);if(n==="undefined")return new Node(ExpressionNodeType.LITERAL_UNDEFINED,void 0)}throw new Error(`${n} is not defined.`)}function parseMathConstant(t){const n=t.property.name;if(n==="PI")return new Node(ExpressionNodeType.LITERAL_NUMBER,Math.PI);if(n==="E")return new Node(ExpressionNodeType.LITERAL_NUMBER,Math.E);throw new Error(`${n} Math Constant is not supported at the moment`)}function parseNumberConstant(t){const n=t.property.name;if(n==="POSITIVE_INFINITY")return new Node(ExpressionNodeType.LITERAL_NUMBER,Number.POSITIVE_INFINITY);throw new Error(`${n} Number Constant is not supported at the moment`)}function parseMemberExpression(t,n){if(n.object.name==="Math")return parseMathConstant(n);if(n.object.name==="Number")return parseNumberConstant(n);let o;const s=createRuntimeAst(t,n.object);return n.computed?(o=createRuntimeAst(t,n.property),new Node(ExpressionNodeType.MEMBER,"brackets",s,o)):(o=new Node(ExpressionNodeType.LITERAL_STRING,n.property.name),new Node(ExpressionNodeType.MEMBER,"dot",s,o))}function isVariable(t){return t.substring(0,4)===VARIABLE_PREFIX}function getPropertyName(t){return restoreReservedWord(t).substring(4)}const EXPRESSION_CACHES=new Map,REPLACED_VARIABLES_CACHE=new Map,DEFINE_PLACEHOLDER_REGEX_CACHE=new Map,DEFINE_REPLACEMENT_CACHE=new Map;class Expression{constructor(n,o,s){Rf(this,"_expression");Rf(this,"_runtimeAst");Rf(this,"_feature");var p;this._expression=n,this._feature=o;let c=[];n=replaceDefines(n,s);const d=REPLACED_VARIABLES_CACHE.get(n);if(d)[n,c]=d;else{const y=n;[n,c]=replaceVariables(removeBackslashes(n),(p=this._feature)==null?void 0:p.properties),n.includes(VARIABLE_PREFIX)&&REPLACED_VARIABLES_CACHE.set(y,[n,c])}const h=EXPRESSION_CACHES.get(n);if(h)this._runtimeAst=h;else{if(c.length!==0)for(const S of c)jsep.addLiteral(S.literalName,S.literalValue);jsep.addBinaryOp("=~",0),jsep.addBinaryOp("!~",0);let y;try{y=jsep(n)}catch(S){throw new Error(`failed to generate ast: ${S}`)}this._runtimeAst=createRuntimeAst(this,y),EXPRESSION_CACHES.set(n,this._runtimeAst)}}evaluate(){return this._runtimeAst.evaluate(this._feature)}}function replaceDefines(t,n){if(typeof n>"u")return t;const o=JSON.stringify(Object.entries(n).sort()),s=t+o,c=DEFINE_REPLACEMENT_CACHE.get(s);if(c)return c;let d=DEFINE_PLACEHOLDER_REGEX_CACHE.get(t);d||(d=new RegExp(`\\$\\{(${Object.keys(n).join("|")})\\}`,"g"),DEFINE_PLACEHOLDER_REGEX_CACHE.set(t,d));const h=t.replace(d,(p,y)=>typeof n[y]<"u"?`(${n[y]})`:"");return DEFINE_REPLACEMENT_CACHE.set(s,h),h}function removeBackslashes(t){return t.replace(backslashRegex,backslashReplacement)}function clearExpressionCaches(t,n,o){REPLACED_VARIABLES_CACHE.delete(t),t=replaceDefines(t,o),[t]=replaceVariables(removeBackslashes(t),n==null?void 0:n.properties),EXPRESSION_CACHES.delete(t)}class ConditionalExpression{constructor(n,o,s){Rf(this,"_conditions");Rf(this,"_runtimeConditions");Rf(this,"_feature");Rf(this,"_memoizedResult");this._conditions=n.conditions,this._runtimeConditions=[],this._feature=o,this._memoizedResult=void 0,this.setRuntime(s)}setRuntime(n){var s;const o=(s=this._conditions)==null?void 0:s.map(c=>{const d=String(c[0]),h=String(c[1]);return new Statement(new Expression(d,this._feature,n),new Expression(h,this._feature,n))});this._runtimeConditions=o??[],this._memoizedResult=void 0}evaluate(){if(typeof this._memoizedResult<"u")return this._memoizedResult;const n=this._runtimeConditions,o=n.length;for(let c=0;c<o;c++){const d=n[c];if(d.condition.evaluate()){const h=d.expression.evaluate();return this._memoizedResult=h,h}}const s=void 0;return this._memoizedResult=s,s}}class Statement{constructor(n,o){Rf(this,"condition");Rf(this,"expression");this.condition=n,this.expression=o}}function evalTimeInterval(t,n){if(!t||!(n!=null&&n.property))return;const o=[];for(const s of t){const c=s.properties[n.property];if(c)try{o.push(new Date(c))}catch{}}return o.sort((s,c)=>s.getTime()-c.getTime()),o.map((s,c)=>[s,n.interval?new Date(s.getTime()+n.interval):o[c+1]])}async function evalSimpleLayer(t,n){var d;const o=t.data?await n.getAllFeatures(t.data):void 0,s=pick(t,appearanceKeys),c=evalTimeInterval(o,(d=t.data)==null?void 0:d.time);return{layer:evalLayerAppearances(s,t),features:o==null?void 0:o.map((h,p)=>evalSimpleLayerFeature(t,h,c==null?void 0:c[p]))}}const evalSimpleLayerFeature=(t,n,o)=>{const s=pick(t,appearanceKeys),c=evalJsonProperties(t,n);return{...c,...evalLayerAppearances(s,t,c),type:"computedFeature",interval:o}};function evalLayerAppearances(t,n,o){if(!o){if(!n.id)throw new Error("layer id is required");o={type:"feature",id:n.id,properties:n.properties||{}}}return Object.fromEntries(Object.entries(t).map(([s,c])=>c?[s,recursiveValEval(c,n,o)]:void 0).filter(s=>!!s))}function recursiveValEval(t,n,o){return Object.fromEntries(Object.entries(t).map(([s,c])=>hasNonExpressionObject(c)?[s,recursiveValEval(c,n,o)]:[s,evalExpression(c,n,o)]))}function clearAllExpressionCaches(t,n){const o=pick(t,appearanceKeys);Object.entries(o).forEach(([,s])=>{recursiveClear(s,t,n)})}function recursiveClear(t,n,o){Object.entries(t).forEach(([,s])=>{if(hasNonExpressionObject(s))recursiveClear(s,n,o);else if(hasExpression(s)){const c=s.expression;typeof c=="object"&&c.conditions?c.conditions.forEach(([d,h])=>{clearExpressionCaches(d,o,n==null?void 0:n.defines),clearExpressionCaches(h,o,n==null?void 0:n.defines)}):typeof c=="boolean"||typeof c=="number"?clearExpressionCaches(String(c),o,n==null?void 0:n.defines):typeof c=="string"&&clearExpressionCaches(c,o,n==null?void 0:n.defines)}})}function hasExpression(t){return typeof t=="object"&&t&&"expression"in t}function hasNonExpressionObject(t){return typeof t=="object"&&t&&!("expression"in t)&&!Array.isArray(t)}function evalExpression(t,n,o){try{if(hasExpression(t)){const s=t.expression,c=recursiveJSONParse(cloneDeep(o));return typeof s>"u"?void 0:typeof s=="object"&&s.conditions?new ConditionalExpression(s,c,n==null?void 0:n.defines).evaluate():typeof s=="boolean"||typeof s=="number"?new Expression(String(s),c,n==null?void 0:n.defines).evaluate():typeof s=="string"?new Expression(s,c,n==null?void 0:n.defines).evaluate():s}return t}catch(s){console.error(s);return}}function evalJsonProperties(t,n){var c;const o=(c=t.data)==null?void 0:c.jsonProperties;if(!n.properties||!o||!o.length)return n;const s={...n,...n!=null&&n.properties?{properties:{...n.properties}}:{}};return o.forEach(d=>{s.properties[d]=(()=>{const h=s.properties[d];try{return JSON.parse(h)}catch{return h}})()}),s}async function evalLayer(t,n){if(t.type==="simple")return evalSimpleLayer(t,n)}function evalFeature(t,n){if(t.type==="simple")return evalSimpleLayerFeature(t,n)}async function f$1(t,n){const o=await fetch(t,n);if(o.status!==200)throw new Error(`fetched ${t} but status code was ${o.status}`);return o}function convertToCoordinates(t){return t.split(" ").map(n=>parseFloat(n))}async function fetchGeoJSON(t,n,o){const s=t.url?await(await f$1(t.url,o)).json():t.value;return processGeoJSON(s,n,t.idProperty)}function processGeoJSON(t,n,o){if(t.type==="FeatureCollection")return t.features.flatMap(s=>processGeoJSON(s,n,o));if(t.type==="Feature"){const s=t.geometry;return s.type==="GeometryCollection"?s.geometries.flatMap(c=>processGeoJSON({...t,geometry:c},void 0,o)):s.type==="MultiPoint"?s.coordinates.flatMap(c=>processGeoJSON({...t,geometry:{type:"Point",coordinates:c}},void 0,o)):s.type==="MultiLineString"?s.coordinates.flatMap(c=>processGeoJSON({...t,geometry:{type:"LineString",coordinates:c}},void 0,o)):s.type==="MultiPolygon"?s.coordinates.flatMap(c=>processGeoJSON({...t,geometry:{type:"Polygon",coordinates:c}},void 0,o)):[{type:"feature",id:o&&t.properties&&t.properties[o]?t.properties[o]:generateRandomString$1(12),geometry:s.type==="Point"||s.type==="LineString"||s.type==="Polygon"?s:void 0,properties:t.properties,range:n}]}return[]}async function fetchCSV(t,n,o){if(!t.url){const c=t.value;if(typeof c!="string"){const d=makeFeature$1(c,n);return d?[d]:void 0}return await parseCSV(c,t.csv,n)}const s=await(await f$1(t.url,o)).text();return await parseCSV(s,t.csv,n)}const parseCSV=async(t,n,o)=>{const{parse:s}=await Promise.resolve().then(()=>index);return new Promise((c,d)=>{const h=[],p=s({delimiter:[",",";"," "]});let y;p.on("readable",()=>{let S;for(;(S=p.read())!==null;){if(!y){if(!(n!=null&&n.noHeader)){y=S;continue}y=[]}const P=makeGeoJSONFromArray(y,S,n),L=makeFeature$1(P,o);L&&h.push(L)}}),p.on("error",S=>{d(`${S.name} is occurred while parsing CSV: ${S.message}`)}),p.on("end",()=>{c(h)}),p.write(t),p.end()})},SUPPORTED_COORDINATES={lng:0,lat:1,height:2},setCoordinatesToPointGeometry=(t,n,o,s)=>{if(t===null)return null;const c=Number(n);return isNaN(c)||typeof n!="number"&&!n?s?t:null:(t.coordinates[o]=c,t)},makeGeoJSONFromArray=(t,n,o)=>{var c;const s=n.reduce((d,h,p)=>{let y=h;return o!=null&&o.disableTypeConversion||(y=filterNumericString(h)),(o==null?void 0:o.idColumn)!==void 0&&[t[p],p].includes(o.idColumn)?{...d,id:y}:(o==null?void 0:o.lngColumn)!==void 0&&[t[p],p].includes(o.lngColumn)?{...d,geometry:setCoordinatesToPointGeometry(d.geometry,y,SUPPORTED_COORDINATES.lng)}:(o==null?void 0:o.latColumn)!==void 0&&[t[p],p].includes(o.latColumn)?{...d,geometry:setCoordinatesToPointGeometry(d.geometry,y,SUPPORTED_COORDINATES.lat)}:(o==null?void 0:o.heightColumn)!==void 0&&[t[p],p].includes(o.heightColumn)?{...d,geometry:setCoordinatesToPointGeometry(d.geometry,y,SUPPORTED_COORDINATES.height,!0)}:{...d,properties:{...d.properties,...t[p]?{[t[p]]:y}:{}}}},{type:"Feature",geometry:{type:"Point",coordinates:[]},properties:{}});return(((c=s.geometry)==null?void 0:c.coordinates.length)||0)<2&&(s.geometry=null),s},makeFeature$1=(t,n)=>{if(t.type!=="Feature")return;const o=t.geometry;return{type:"feature",id:t.id&&String(t.id)||generateRandomString$1(12),geometry:o??void 0,properties:t.properties,range:n}},filterNumericString=t=>{const n=Number(t);return isNaN(n)||t===""?t:n};var validator$2={},util$3={};(function(t){const n=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",o=n+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",s="["+n+"]["+o+"]*",c=new RegExp("^"+s+"$"),d=function(p,y){const S=[];let P=y.exec(p);for(;P;){const L=[];L.startIndex=y.lastIndex-P[0].length;const F=P.length;for(let N=0;N<F;N++)L.push(P[N]);S.push(L),P=y.exec(p)}return S},h=function(p){const y=c.exec(p);return!(y===null||typeof y>"u")};t.isExist=function(p){return typeof p<"u"},t.isEmptyObject=function(p){return Object.keys(p).length===0},t.merge=function(p,y,S){if(y){const P=Object.keys(y),L=P.length;for(let F=0;F<L;F++)S==="strict"?p[P[F]]=[y[P[F]]]:p[P[F]]=y[P[F]]}},t.getValue=function(p){return t.isExist(p)?p:""},t.isName=h,t.getAllMatches=d,t.nameRegexp=s})(util$3);const util$2=util$3,defaultOptions$3={allowBooleanAttributes:!1,unpairedTags:[]};validator$2.validate=function(t,n){n=Object.assign({},defaultOptions$3,n);const o=[];let s=!1,c=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let d=0;d<t.length;d++)if(t[d]==="<"&&t[d+1]==="?"){if(d+=2,d=readPI(t,d),d.err)return d}else if(t[d]==="<"){let h=d;if(d++,t[d]==="!"){d=readCommentAndCDATA(t,d);continue}else{let p=!1;t[d]==="/"&&(p=!0,d++);let y="";for(;d<t.length&&t[d]!==">"&&t[d]!==" "&&t[d]!==" "&&t[d]!==`
|
|
@@ -5837,7 +5837,7 @@ ${t}`),t}},fragmentShaderSource:{get:function(){return this._fragmentShaderSourc
|
|
|
5837
5837
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
5838
5838
|
* @copyright Chen, Yi-Cyuan 2014-2017
|
|
5839
5839
|
* @license MIT
|
|
5840
|
-
*/(function(module){(function(){var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_MD5_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_MD5_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;NODE_JS?root=commonjsGlobal:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&!0&&module.exports,ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[128,32768,8388608,-2147483648],SHIFT=[0,8,16,24],OUTPUT_TYPES=["hex","array","digest","buffer","arrayBuffer","base64"],BASE64_ENCODE_CHAR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),blocks=[],buffer8;if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);buffer8=new Uint8Array(buffer),blocks=new Uint32Array(buffer)}(root.JS_MD5_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(t){return Object.prototype.toString.call(t)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(t){return typeof t=="object"&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t){return function(n){return new Md5(!0).update(n)[t]()}},createMethod=function(){var t=createOutputMethod("hex");NODE_JS&&(t=nodeWrap(t)),t.create=function(){return new Md5},t.update=function(s){return t.create().update(s)};for(var n=0;n<OUTPUT_TYPES.length;++n){var o=OUTPUT_TYPES[n];t[o]=createOutputMethod(o)}return t},nodeWrap=function(method){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),nodeMethod=function(t){if(typeof t=="string")return crypto.createHash("md5").update(t,"utf8").digest("hex");if(t==null)throw ERROR;return t.constructor===ArrayBuffer&&(t=new Uint8Array(t)),Array.isArray(t)||ArrayBuffer.isView(t)||t.constructor===Buffer?crypto.createHash("md5").update(new Buffer(t)).digest("hex"):method(t)};return nodeMethod};function Md5(t){if(t)blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks,this.buffer8=buffer8;else if(ARRAY_BUFFER){var n=new ArrayBuffer(68);this.buffer8=new Uint8Array(n),this.blocks=new Uint32Array(n)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}Md5.prototype.update=function(t){if(!this.finalized){var n,o=typeof t;if(o!=="string"){if(o==="object"){if(t===null)throw ERROR;if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw ERROR}else throw ERROR;n=!0}for(var s,c=0,d,h=t.length,p=this.blocks,y=this.buffer8;c<h;){if(this.hashed&&(this.hashed=!1,p[0]=p[16],p[16]=p[1]=p[2]=p[3]=p[4]=p[5]=p[6]=p[7]=p[8]=p[9]=p[10]=p[11]=p[12]=p[13]=p[14]=p[15]=0),n)if(ARRAY_BUFFER)for(d=this.start;c<h&&d<64;++c)y[d++]=t[c];else for(d=this.start;c<h&&d<64;++c)p[d>>2]|=t[c]<<SHIFT[d++&3];else if(ARRAY_BUFFER)for(d=this.start;c<h&&d<64;++c)s=t.charCodeAt(c),s<128?y[d++]=s:s<2048?(y[d++]=192|s>>6,y[d++]=128|s&63):s<55296||s>=57344?(y[d++]=224|s>>12,y[d++]=128|s>>6&63,y[d++]=128|s&63):(s=65536+((s&1023)<<10|t.charCodeAt(++c)&1023),y[d++]=240|s>>18,y[d++]=128|s>>12&63,y[d++]=128|s>>6&63,y[d++]=128|s&63);else for(d=this.start;c<h&&d<64;++c)s=t.charCodeAt(c),s<128?p[d>>2]|=s<<SHIFT[d++&3]:s<2048?(p[d>>2]|=(192|s>>6)<<SHIFT[d++&3],p[d>>2]|=(128|s&63)<<SHIFT[d++&3]):s<55296||s>=57344?(p[d>>2]|=(224|s>>12)<<SHIFT[d++&3],p[d>>2]|=(128|s>>6&63)<<SHIFT[d++&3],p[d>>2]|=(128|s&63)<<SHIFT[d++&3]):(s=65536+((s&1023)<<10|t.charCodeAt(++c)&1023),p[d>>2]|=(240|s>>18)<<SHIFT[d++&3],p[d>>2]|=(128|s>>12&63)<<SHIFT[d++&3],p[d>>2]|=(128|s>>6&63)<<SHIFT[d++&3],p[d>>2]|=(128|s&63)<<SHIFT[d++&3]);this.lastByteIndex=d,this.bytes+=d-this.start,d>=64?(this.start=d-64,this.hash(),this.hashed=!0):this.start=d}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Md5.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,n=this.lastByteIndex;t[n>>2]|=EXTRA[n&3],n>=56&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,t[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var t,n,o,s,c,d,h=this.blocks;this.first?(t=h[0]-680876937,t=(t<<7|t>>>25)-271733879<<0,s=(-1732584194^t&2004318071)+h[1]-117830708,s=(s<<12|s>>>20)+t<<0,o=(-271733879^s&(t^-271733879))+h[2]-1126478375,o=(o<<17|o>>>15)+s<<0,n=(t^o&(s^t))+h[3]-1316259209,n=(n<<22|n>>>10)+o<<0):(t=this.h0,n=this.h1,o=this.h2,s=this.h3,t+=(s^n&(o^s))+h[0]-680876936,t=(t<<7|t>>>25)+n<<0,s+=(o^t&(n^o))+h[1]-389564586,s=(s<<12|s>>>20)+t<<0,o+=(n^s&(t^n))+h[2]+606105819,o=(o<<17|o>>>15)+s<<0,n+=(t^o&(s^t))+h[3]-1044525330,n=(n<<22|n>>>10)+o<<0),t+=(s^n&(o^s))+h[4]-176418897,t=(t<<7|t>>>25)+n<<0,s+=(o^t&(n^o))+h[5]+1200080426,s=(s<<12|s>>>20)+t<<0,o+=(n^s&(t^n))+h[6]-1473231341,o=(o<<17|o>>>15)+s<<0,n+=(t^o&(s^t))+h[7]-45705983,n=(n<<22|n>>>10)+o<<0,t+=(s^n&(o^s))+h[8]+1770035416,t=(t<<7|t>>>25)+n<<0,s+=(o^t&(n^o))+h[9]-1958414417,s=(s<<12|s>>>20)+t<<0,o+=(n^s&(t^n))+h[10]-42063,o=(o<<17|o>>>15)+s<<0,n+=(t^o&(s^t))+h[11]-1990404162,n=(n<<22|n>>>10)+o<<0,t+=(s^n&(o^s))+h[12]+1804603682,t=(t<<7|t>>>25)+n<<0,s+=(o^t&(n^o))+h[13]-40341101,s=(s<<12|s>>>20)+t<<0,o+=(n^s&(t^n))+h[14]-1502002290,o=(o<<17|o>>>15)+s<<0,n+=(t^o&(s^t))+h[15]+1236535329,n=(n<<22|n>>>10)+o<<0,t+=(o^s&(n^o))+h[1]-165796510,t=(t<<5|t>>>27)+n<<0,s+=(n^o&(t^n))+h[6]-1069501632,s=(s<<9|s>>>23)+t<<0,o+=(t^n&(s^t))+h[11]+643717713,o=(o<<14|o>>>18)+s<<0,n+=(s^t&(o^s))+h[0]-373897302,n=(n<<20|n>>>12)+o<<0,t+=(o^s&(n^o))+h[5]-701558691,t=(t<<5|t>>>27)+n<<0,s+=(n^o&(t^n))+h[10]+38016083,s=(s<<9|s>>>23)+t<<0,o+=(t^n&(s^t))+h[15]-660478335,o=(o<<14|o>>>18)+s<<0,n+=(s^t&(o^s))+h[4]-405537848,n=(n<<20|n>>>12)+o<<0,t+=(o^s&(n^o))+h[9]+568446438,t=(t<<5|t>>>27)+n<<0,s+=(n^o&(t^n))+h[14]-1019803690,s=(s<<9|s>>>23)+t<<0,o+=(t^n&(s^t))+h[3]-187363961,o=(o<<14|o>>>18)+s<<0,n+=(s^t&(o^s))+h[8]+1163531501,n=(n<<20|n>>>12)+o<<0,t+=(o^s&(n^o))+h[13]-1444681467,t=(t<<5|t>>>27)+n<<0,s+=(n^o&(t^n))+h[2]-51403784,s=(s<<9|s>>>23)+t<<0,o+=(t^n&(s^t))+h[7]+1735328473,o=(o<<14|o>>>18)+s<<0,n+=(s^t&(o^s))+h[12]-1926607734,n=(n<<20|n>>>12)+o<<0,c=n^o,t+=(c^s)+h[5]-378558,t=(t<<4|t>>>28)+n<<0,s+=(c^t)+h[8]-2022574463,s=(s<<11|s>>>21)+t<<0,d=s^t,o+=(d^n)+h[11]+1839030562,o=(o<<16|o>>>16)+s<<0,n+=(d^o)+h[14]-35309556,n=(n<<23|n>>>9)+o<<0,c=n^o,t+=(c^s)+h[1]-1530992060,t=(t<<4|t>>>28)+n<<0,s+=(c^t)+h[4]+1272893353,s=(s<<11|s>>>21)+t<<0,d=s^t,o+=(d^n)+h[7]-155497632,o=(o<<16|o>>>16)+s<<0,n+=(d^o)+h[10]-1094730640,n=(n<<23|n>>>9)+o<<0,c=n^o,t+=(c^s)+h[13]+681279174,t=(t<<4|t>>>28)+n<<0,s+=(c^t)+h[0]-358537222,s=(s<<11|s>>>21)+t<<0,d=s^t,o+=(d^n)+h[3]-722521979,o=(o<<16|o>>>16)+s<<0,n+=(d^o)+h[6]+76029189,n=(n<<23|n>>>9)+o<<0,c=n^o,t+=(c^s)+h[9]-640364487,t=(t<<4|t>>>28)+n<<0,s+=(c^t)+h[12]-421815835,s=(s<<11|s>>>21)+t<<0,d=s^t,o+=(d^n)+h[15]+530742520,o=(o<<16|o>>>16)+s<<0,n+=(d^o)+h[2]-995338651,n=(n<<23|n>>>9)+o<<0,t+=(o^(n|~s))+h[0]-198630844,t=(t<<6|t>>>26)+n<<0,s+=(n^(t|~o))+h[7]+1126891415,s=(s<<10|s>>>22)+t<<0,o+=(t^(s|~n))+h[14]-1416354905,o=(o<<15|o>>>17)+s<<0,n+=(s^(o|~t))+h[5]-57434055,n=(n<<21|n>>>11)+o<<0,t+=(o^(n|~s))+h[12]+1700485571,t=(t<<6|t>>>26)+n<<0,s+=(n^(t|~o))+h[3]-1894986606,s=(s<<10|s>>>22)+t<<0,o+=(t^(s|~n))+h[10]-1051523,o=(o<<15|o>>>17)+s<<0,n+=(s^(o|~t))+h[1]-2054922799,n=(n<<21|n>>>11)+o<<0,t+=(o^(n|~s))+h[8]+1873313359,t=(t<<6|t>>>26)+n<<0,s+=(n^(t|~o))+h[15]-30611744,s=(s<<10|s>>>22)+t<<0,o+=(t^(s|~n))+h[6]-1560198380,o=(o<<15|o>>>17)+s<<0,n+=(s^(o|~t))+h[13]+1309151649,n=(n<<21|n>>>11)+o<<0,t+=(o^(n|~s))+h[4]-145523070,t=(t<<6|t>>>26)+n<<0,s+=(n^(t|~o))+h[11]-1120210379,s=(s<<10|s>>>22)+t<<0,o+=(t^(s|~n))+h[2]+718787259,o=(o<<15|o>>>17)+s<<0,n+=(s^(o|~t))+h[9]-343485551,n=(n<<21|n>>>11)+o<<0,this.first?(this.h0=t+1732584193<<0,this.h1=n-271733879<<0,this.h2=o-1732584194<<0,this.h3=s+271733878<<0,this.first=!1):(this.h0=this.h0+t<<0,this.h1=this.h1+n<<0,this.h2=this.h2+o<<0,this.h3=this.h3+s<<0)},Md5.prototype.hex=function(){this.finalize();var t=this.h0,n=this.h1,o=this.h2,s=this.h3;return HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[s&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(){this.finalize();var t=this.h0,n=this.h1,o=this.h2,s=this.h3;return[t&255,t>>8&255,t>>16&255,t>>24&255,n&255,n>>8&255,n>>16&255,n>>24&255,o&255,o>>8&255,o>>16&255,o>>24&255,s&255,s>>8&255,s>>16&255,s>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),n=new Uint32Array(t);return n[0]=this.h0,n[1]=this.h1,n[2]=this.h2,n[3]=this.h3,t},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var t,n,o,s="",c=this.array(),d=0;d<15;)t=c[d++],n=c[d++],o=c[d++],s+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[(t<<4|n>>>4)&63]+BASE64_ENCODE_CHAR[(n<<2|o>>>6)&63]+BASE64_ENCODE_CHAR[o&63];return t=c[d],s+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[t<<4&63]+"==",s};var exports=createMethod();COMMON_JS?module.exports=exports:root.md5=exports})()})(md5$1);var md5Exports=md5$1.exports;const md5=getDefaultExportFromCjs(md5Exports),EntityExt=React.forwardRef(EntityExtComponent);function EntityExtComponent({layerId:t,featureId:n,draggable:o,unselectable:s,legacyLocationPropertyKey:c,hideIndicator:d,...h},p){const[y,S]=React.useState(null);React.useLayoutEffect(()=>{y!=null&&y.cesiumElement&&attachTag(y.cesiumElement,{layerId:t||h.id,featureId:n,draggable:o,unselectable:s,legacyLocationPropertyKey:c,hideIndicator:d})},[o,n,t,c,h.id,s,d,y]);const P=React.useCallback(L=>S(L),[]);return jsxRuntimeExports.jsx(Is$1,{ref:_default(p,P),...h})}function attachTag(t,n){if(t){if(t instanceof Cesium$1.Cesium3DTileset){t[tagKey]=n;return}if(t instanceof Cesium$1.Cesium3DTileFeature||t instanceof Cesium$1.Cesium3DTilePointFeature||t instanceof Cesium$1.Model||t instanceof Cesium$1.ImageryLayer){t[tagKey]=n;return}if(t instanceof Cesium$1.Primitive){t[tagKey]=n;return}if(t instanceof Cesium$1.GroundPrimitive){t[tagKey]=n;return}t.properties||(t.properties=new Cesium$1.PropertyBag);for(const o of tagKeys)!(o in n)&&t.properties.hasProperty(`reearth_${o}`)?t.properties.removeProperty(`reearth_${o}`):t.properties[`reearth_${o}`]=n[o]}}function getTag(t){if(t){if(t instanceof Cesium$1.Cesium3DTileset||t instanceof Cesium$1.Cesium3DTileFeature||t instanceof Cesium$1.Cesium3DTilePointFeature||t instanceof Cesium$1.Model||t instanceof Cesium$1.ImageryLayer||t instanceof Cesium$1.Primitive||t instanceof Cesium$1.GroundPrimitive)return t[tagKey];if(t.properties)return Object.fromEntries(Object.entries(t.properties).map(([n,o])=>tagKeys.includes(n.replace("reearth_",""))?[n.replace("reearth_",""),o]:null).filter(n=>!!n))}}const tagObj={draggable:1,featureId:1,layerId:1,unselectable:1,originalProperties:1,computedFeature:1,hideIndicator:1,appearanceType:1,featureIndex:1,isFeatureSelected:1},tagKeys=Object.keys(tagObj),tagKey="__reearth_tag",extractSimpleLayer=t=>{const n=t&&"layer"in t?t.layer:t;if((n==null?void 0:n.type)==="simple")return n},extractSimpleLayerData=t=>{var n;return(n=extractSimpleLayer(t))==null?void 0:n.data},toColor=t=>{if(!t||typeof t!="string")return;const n=t.match(/^#([A-Fa-f0-9]{6})([A-Fa-f0-9]{2})$|^#([A-Fa-f0-9]{3})([A-Fa-f0-9])$/);if(!n)return Cesium$1.Color.fromCssColorString(t);const o=parseInt(n[4]?n[4].repeat(2):n[2],16)/255;return Cesium$1.Color.fromCssColorString(`#${n[1]??n[3]}`).withAlpha(o)},toTimeInterval=t=>{if(t)return new Cesium$1.TimeIntervalCollection([new Cesium$1.TimeInterval({start:Cesium$1.JulianDate.fromDate(t[0]),stop:t[1]?Cesium$1.JulianDate.fromDate(t[1]):Cesium$1.Iso8601.MAXIMUM_VALUE})])},toDistanceDisplayCondition=(t,n)=>typeof t=="number"||typeof n=="number"?new Cesium$1.DistanceDisplayCondition(t??0,n??Number.MAX_VALUE):void 0,generateIDWithMD5=t=>{const n=md5.create();return n.update(t),n.hex()},usePick=(t,n)=>{const o=React.useMemo(()=>t?pick(t,n):void 0,[t,n]);return React.useMemo(()=>o,[JSON.stringify(o)])},useHooks$7=({id:t,index:n,edge:o,isHovered:s,fillColor:c,trs:d,hoverColor:h,onMouseDown:p,onMouseMove:y,onMouseUp:S})=>{const{viewer:P}=$e$1(),[L]=React.useState(()=>new Cesium$1.CallbackProperty(()=>{const se=new Cesium$1.Cartesian3,mt=new Cesium$1.Cartesian3,kt=Cesium$1.Matrix4.fromTranslationRotationScale(d);return Cesium$1.Matrix4.multiplyByPoint(kt,o.start,se),Cesium$1.Matrix4.multiplyByPoint(kt,o.end,mt),[se,mt]},!1)),F=React.useRef(!1),[N]=React.useState(()=>new Cesium$1.ColorMaterialProperty(new Cesium$1.CallbackProperty(()=>F.current?h??c:c,!1)));React.useEffect(()=>{F.current=s},[s]);const W=React.useCallback(se=>{var kt,mn;!P||((mn=getTag((kt=P.scene.pick(se.position))==null?void 0:kt.id))==null?void 0:mn.layerId)!==t||p==null||p(se,{layerId:t,index:n})},[p,t,n,P]),z=React.useCallback(se=>{y==null||y(se,{layerId:t,index:n})},[y,n,t]),lt=React.useCallback(se=>{S==null||S(se,{layerId:t,index:n})},[S,n,t]),Pe=React.useMemo(()=>new Cesium$1.ScreenSpaceEventHandler(P==null?void 0:P.scene.canvas),[P]);return React.useEffect(()=>{Pe.setInputAction(W,Cesium$1.ScreenSpaceEventType.LEFT_DOWN),Pe.setInputAction(z,Cesium$1.ScreenSpaceEventType.MOUSE_MOVE),Pe.setInputAction(lt,Cesium$1.ScreenSpaceEventType.LEFT_UP)},[Pe,W,z,lt]),React.useEffect(()=>()=>Pe.destroy(),[Pe]),{cbp:L,outlineColor:N}},Edge=React.memo(function t({layerId:n,featureId:o,index:s,edge:c,isHovered:d,fillColor:h,trs:p,width:y,hoverColor:S,availability:P,distanceDisplayCondition:L,onMouseDown:F,onMouseMove:N,onMouseUp:W,hideIndicator:z}){const{cbp:lt,outlineColor:Pe}=useHooks$7({id:n,index:s,edge:c,isHovered:d,fillColor:h,trs:p,hoverColor:S,onMouseDown:F,onMouseMove:N,onMouseUp:W});return jsxRuntimeExports.jsx(EntityExt,{layerId:n,featureId:o,availability:P,hideIndicator:z,children:jsxRuntimeExports.jsx(ua$1,{positions:lt,width:y,material:Pe,arcType:Cesium$1.ArcType.NONE,distanceDisplayCondition:L})})}),context=React.createContext({}),useContext=()=>React.useContext(context),convertCartesian3ToPosition=(t,n)=>{if(!n)return;const o=t==null?void 0:t.scene.globe.ellipsoid.cartesianToCartographic(n);if(o)return{lat:Cesium$1.Math.toDegrees(o.latitude),lng:Cesium$1.Math.toDegrees(o.longitude),height:o.height}},translationWithClamping=(t,n,o)=>{if(!n){const s=Cesium$1.Cartographic.fromCartesian(t.translation,void 0,new Cesium$1.Cartographic),c=s.height-t.scale.z/2,d=o;c<d&&(s.height+=d-c,Cesium$1.Cartographic.toCartesian(s,void 0,t.translation))}},getModelFromTileContent=t=>{if(!t.featuresLength&&"_model"in t&&t._model instanceof Cesium$1.Model)return t._model};function lookupFeatures(t,n){var c;if(!t)return;const o=getModelFromTileContent(t);if(o)return n(o,t);const s=t.featuresLength;for(let d=0;d<s;d++){const h=t.getFeature(d);h&&n(h,t,d)}(c=t.innerContents)==null||c.forEach(d=>lookupFeatures(d,n))}const findFeatureFrom3DTile=(t,n,o)=>{var c;let s;if(n&&(s=(c=o==null?void 0:o.find(n))==null?void 0:c[0],s&&s instanceof Cesium$1.Cesium3DTileFeature)||(lookupFeatures(t.content,d=>{const h=getTag(d);(h==null?void 0:h.featureId)===n&&(s=d)}),s&&s instanceof Cesium$1.Cesium3DTileFeature))return s;for(const d of t.children){const h=findFeatureFrom3DTile(d,n);if(h)return h}};function findEntity(t,n,o,s){const c=o??n,d=o?"featureId":"layerId";if(!c)return;let h=t.entities.getById(c);if(h||(h=t.entities.values.find(p=>{var y;return((y=getTag(p))==null?void 0:y[d])===c}),h))return h;for(const p of[t.dataSourceDisplay.dataSources,t.dataSources])for(let y=0;y<p.length;y++){const P=p.get(y).entities.values.find(L=>{var F;return((F=getTag(L))==null?void 0:F[d])===c});if(P)return P}for(let p=0;p<t.scene.primitives.length;p++){const y=t.scene.primitives.get(p);if(!(!(y instanceof Cesium$1.Cesium3DTileset)&&!(y instanceof Cesium$1.Primitive)&&!(y instanceof Cesium$1.GroundPrimitive))){if(n&&!o){const S=getTag(y);if(S!=null&&S.layerId&&n&&(S==null?void 0:S.layerId)===n)return y;continue}if(!y.isDestroyed()&&!s&&y instanceof Cesium$1.Cesium3DTileset){const S=findFeatureFrom3DTile(y.root,o);if(S)return S}}}for(let p=0;p<t.imageryLayers.length;p++){const y=t.imageryLayers.get(p),S=getTag(y);if((S==null?void 0:S.layerId)===n)return y}}const findFeaturesFrom3DTile=(t,n,o,s=new Set)=>{lookupFeatures(t.content,c=>{const d=getTag(c);if(n.includes((d==null?void 0:d.featureId)??"")){const h=o==null?void 0:o(c);h?s.add(h):s.add(c)}});for(const c of t.children)findFeaturesFrom3DTile(c,n,o,s)},filterEntity=(t,n,o,s)=>{const c=[];for(const d of t){const h=getTag(d);if((h==null?void 0:h.layerId)===n&&o.includes(h.featureId||"")){const p=s==null?void 0:s(d);p?c.push(p):d&&c.push(d)}}return c},findEntityFromDatasource=(t,n,o,s)=>{let c=[];for(const d of[t.dataSourceDisplay.dataSources,t.dataSources])for(let h=0;h<d.length;h++){const p=d.get(h).entities.values,y=filterEntity(p,n,o,s);y.length&&(c=c.concat(y))}return c},findTile3DFeaturesFromScene=(t,n,o,s)=>{const c=new Set;for(let d=0;d<t.scene.primitives.length;d++){const h=t.scene.primitives.get(d);if(!(h instanceof Cesium$1.Cesium3DTileset)||h.isDestroyed())continue;const p=getTag(h);if((p==null?void 0:p.layerId)!==n)continue;const y=p.featureIndex;if(y)return o.flatMap(P=>y.find(P)).filter(P=>!!P).map(P=>s==null?void 0:s(P,h)).filter(P=>!!P);if(findFeaturesFrom3DTile(h.root,o,s,c),c.size)return Array.from(c.values())}return[]};function findFeaturesFromLayer(t,n,o,s){const c=filterEntity(t.entities.values,n,o,s);if(c.length)return c;const d=findEntityFromDatasource(t,n,o,s);return d.length?d:findTile3DFeaturesFromScene(t,n,o,s)}const getEntityContent=(t,n,o)=>{var c;const s={description:{type:"html",value:t instanceof Cesium$1.ImageryLayerFeatureInfo?t.description:(c=t.description)==null?void 0:c.getValue(n)},attributes:{type:"table",value:!(t instanceof Cesium$1.Entity)&&"properties"in t&&t.properties&&typeof t.properties=="object"?propertiesToTableContent(t.properties):t instanceof Cesium$1.Entity&&t.properties?propertiesToTableContent(t.properties.getValue(n)):[]}};return o?s[o]:s.attributes??s.description};function propertiesToTableContent(t){return Object.entries(t).reduce((n,[o,s])=>[...n,{key:o,value:s}],[])}function getPixelRatio(t){return t.pixelRatio}const convertEntityProperties=(t,n)=>{var s;const o=(s=n.properties)==null?void 0:s.getValue(t);return n.properties&&o?Object.fromEntries(n.properties.propertyNames.map(c=>[c,o[c]])):{}},convertEntityDescription=(t,n)=>{var s;const o=(s=n.description)==null?void 0:s.getValue(t);if(typeof o=="string")return o},convertCesium3DTileFeatureProperties=t=>Object.fromEntries(t.getPropertyIds().map(n=>[n,t.getProperty(n)])),convertObjToComputedFeature=(t,n)=>{if(n instanceof Cesium$1.Cesium3DTileFeature||n instanceof Cesium$1.Cesium3DTilePointFeature){const o=getTag(n);return[o==null?void 0:o.layerId,(o==null?void 0:o.computedFeature)??{type:"computedFeature",id:(o==null?void 0:o.featureId)??"",properties:convertCesium3DTileFeatureProperties(n)}]}if(n instanceof Cesium$1.Model){const o=getTag(n);return[o==null?void 0:o.layerId,{type:"computedFeature",id:(o==null?void 0:o.featureId)??"",properties:{}}]}if(n instanceof Cesium$1.Entity||"id"in n&&n.id instanceof Cesium$1.Entity){const o=n instanceof Cesium$1.Entity?n:n.id,s=getTag(o);return[s==null?void 0:s.layerId,(s==null?void 0:s.computedFeature)??{type:"computedFeature",id:(s==null?void 0:s.featureId)??"",properties:convertEntityProperties(t,o),metaData:{description:convertEntityDescription(t,o)}}]}},updateTrs=(t,n,o,s,c)=>{const{height:d,width:h,length:p,heading:y,pitch:S,roll:P}=n??{},L=(s==null?void 0:s.type)==="Point"?s.coordinates:n!=null&&n.location?[n.location.lng,n.location.lat,n.location.height??0]:void 0,F=L?Cesium$1.Cartesian3.fromDegrees(L[0],L[1],L[2]):void 0;F&&Cesium$1.Cartesian3.clone(F,t.translation),c||translationWithClamping(t,!!c,o);const N=y&&S&&P?Cesium$1.Matrix3.fromHeadingPitchRoll(new Cesium$1.HeadingPitchRoll(y,S,P)):Cesium$1.Matrix3.getRotation(Cesium$1.Matrix4.getMatrix3(Cesium$1.Transforms.eastNorthUpToFixedFrame(t.translation),new Cesium$1.Matrix3),new Cesium$1.Matrix3);return Cesium$1.Quaternion.clone(Cesium$1.Quaternion.fromRotationMatrix(N),t.rotation),Cesium$1.Cartesian3.clone(new Cesium$1.Cartesian3(h||100,p||100,d||100),t.scale),t};function screenProjectVector(t,n,o,s,c){const d=new Cesium$1.Ray;d.origin=n,d.direction=o;const h=t.cartesianToCanvasCoordinates(Cesium$1.Ray.getPoint(d,0),new Cesium$1.Cartesian2),p=t.cartesianToCanvasCoordinates(Cesium$1.Ray.getPoint(d,s),new Cesium$1.Cartesian2);return Cesium$1.Cartesian2.subtract(p,h,c)}const dotMousePosition=(t,n,o,s)=>{const c=Cesium$1.Cartesian2.subtract(n.endPosition,n.startPosition,new Cesium$1.Cartesian2),d=screenProjectVector(t,o,s,1,new Cesium$1.Cartesian2),h=Cesium$1.Cartesian2.normalize(d,new Cesium$1.Cartesian2),p=Cesium$1.Cartesian2.magnitude(d),y=Cesium$1.Cartesian2.dot(c,h);return{pixelsPerStep:p,moveAmount:y/p}},computeMoveAmount=(t,n,o,s)=>{const c=Cesium$1.Cartesian2.subtract(n.endPosition,n.startPosition,new Cesium$1.Cartesian2),d=screenProjectVector(t,o,s,1,new Cesium$1.Cartesian2),h=Cesium$1.Cartesian2.normalize(d,new Cesium$1.Cartesian2),p=Cesium$1.Cartesian2.magnitude(d),y=Cesium$1.Cartesian2.dot(c,h);return{pixelsPerStep:p,moveAmount:y/p}},computeMouseMoveAmount=(t,n,o,s,c)=>{const{moveAmount:d,pixelsPerStep:h}=dotMousePosition(t,n,o,s),p=d/c;return{pixelLengthAfterScaling:h*c+h*c*p,scaleAmount:p}};function setPlaneDimensions(t,n,o){n===Cesium$1.Axis.X?(o.x=t.y,o.y=t.z):n===Cesium$1.Axis.Y?(o.x=t.x,o.y=t.z):n===Cesium$1.Axis.Z&&(o.x=t.x,o.y=t.y)}const useHooks$6=({property:t,geometry:n,feature:o,onLayerEdit:s})=>{const{viewer:c}=$e$1(),d=useContext(),{fillColor:h,outlineColor:p,activeOutlineColor:y,outlineWidth:S,draggableOutlineColor:P,activeDraggableOutlineColor:L,draggableOutlineWidth:F,pointFillColor:N,pointOutlineColor:W,activePointOutlineColor:z,axisLineColor:lt,cursor:Pe,allowEnterGround:se}=t??{},[mt,kt]=React.useState(0),[mn]=React.useState(()=>updateTrs(new Cesium$1.TranslationRotationScale,t,mt,n,se)),_i=React.useRef(!1),zi=React.useCallback(()=>{_i.current||!se&&c&&(_i.current=!0,sampleTerrainHeightFromCartesian(c.scene,mn.translation).then(Ru=>{kt(Ru??0),_i.current=!1}))},[se,c,mn]),{requestRender:ba}=useContext();React.useEffect(()=>{updateTrs(mn,t,mt,n,se),ba==null||ba(),zi()},[t,n,mn,c,mt,zi,se,ba]);const fa=React.useMemo(()=>({fillColor:toColor(h),outlineColor:toColor(p),activeOutlineColor:toColor(y),draggableOutlineColor:toColor(P),activeDraggableOutlineColor:toColor(L),outlineWidth:S,draggableOutlineWidth:F,fill:!!h,outline:!!p}),[h,p,y,S,F,P,L]),La=React.useMemo(()=>({pointFillColor:toColor(N)??fa.fillColor,pointOutlineColor:toColor(W)??fa.outlineColor,activePointOutlineColor:toColor(z)??fa.outlineColor,axisLineColor:toColor(lt)??fa.outlineColor}),[N,W,lt,fa,z]),Ra=React.useRef(),ma=React.useCallback((Ru,{index:Vd})=>{c&&(updateMapController(c,!1),Ra.current=Vd)},[c]),yt=React.useRef(),nt=React.useCallback((Ru,{position:Vd,oppositePosition:Gd,pointLocal:lf,index:hf,layerId:pf})=>{var Af;if(Ra.current!==hf||!Vd||!Gd||!lf||!c)return;const mf=Ru.startPosition;if(yt.current===void 0){yt.current=new Cesium$1.Cartesian2(mf.x,mf.y);return}const sf=new Cesium$1.Cartesian2(mf.x,mf.y),yf=Cesium$1.Cartesian3.subtract(Vd,Gd,new Cesium$1.Cartesian3),Tf=Cesium$1.Cartesian3.magnitude(yf),vf=Cesium$1.Cartesian3.normalize(yf,new Cesium$1.Cartesian3),{scaleAmount:Wa,pixelLengthAfterScaling:af}=computeMouseMoveAmount(c.scene,{startPosition:yt.current,endPosition:sf},Vd,vf,Tf);yt.current=sf.clone();const Xd=Cesium$1.Cartesian3.normalize(lf,new Cesium$1.Cartesian3),gd=Math.abs(Cesium$1.Cartesian3.dot(new Cesium$1.Cartesian3(1,0,0),Xd)),pd=Math.abs(Cesium$1.Cartesian3.dot(new Cesium$1.Cartesian3(0,1,0),Xd)),Zd=Math.abs(Cesium$1.Cartesian3.dot(new Cesium$1.Cartesian3(0,0,1),Xd)),cf=gd&&pd&&Zd;if(Wa<0&&(Xd.x&&Xd.y&&Xd.y?af/Math.sqrt(2):af)<20)return;const of=Cesium$1.Cartesian3.multiplyByScalar(Cesium$1.Cartesian3.abs(Cesium$1.Cartesian3.multiplyComponents(mn.scale,cf?new Cesium$1.Cartesian3(1,1,1):Xd,new Cesium$1.Cartesian3),new Cesium$1.Cartesian3),Wa,new Cesium$1.Cartesian3),rf=Cesium$1.Cartesian3.multiplyByScalar(yf,Wa/2,new Cesium$1.Cartesian3),df=Xd.z<0,Cf=Wa>0;!se&&Cf&&df&&Cesium$1.Cartographic.fromCartesian(mn.translation,void 0,new Cesium$1.Cartographic).height-mn.scale.z/2-Math.abs(rf.z)<0&&(of.z=0);const ff=new Cesium$1.Cartesian3,Sf=new Cesium$1.Cartesian3;Cesium$1.Cartesian3.add(mn.scale,of,ff),Cesium$1.Cartesian3.add(mn.translation,rf,Sf);const Pf=c==null?void 0:c.scene.globe.ellipsoid.cartesianToCartographic(Sf);s==null||s({layerId:pf,scale:{width:ff.x,length:ff.y,height:ff.z,location:{lat:Cesium$1.Math.toDegrees(Pf==null?void 0:Pf.latitude),lng:Cesium$1.Math.toDegrees(Pf==null?void 0:Pf.longitude),height:Pf==null?void 0:Pf.height}}}),(Af=d==null?void 0:d.onLayerEdit)==null||Af.call(d,{layerId:pf,scale:{width:ff.x,length:ff.y,height:ff.z,location:{lat:Cesium$1.Math.toDegrees(Pf==null?void 0:Pf.latitude),lng:Cesium$1.Math.toDegrees(Pf==null?void 0:Pf.longitude),height:Pf==null?void 0:Pf.height}}})},[mn,c,se,d,s]),pi=React.useCallback(()=>{c&&(Ra.current=void 0,yt.current=void 0,updateMapController(c,!0))},[c]),Sa=React.useRef(),Sc=React.useCallback((Ru,{index:Vd})=>{c&&(Sa.current=Vd,updateMapController(c,!1))},[c]),Xs=React.useRef(),ms=React.useCallback((Ru,{index:Vd,layerId:Gd})=>{var Wa;if(Sa.current!==Vd)return;const lf=Ru.startPosition;if(Xs.current===void 0){Xs.current=lf.x;return}const hf=lf.x-Xs.current;Xs.current=lf.x;const pf=.05,mf=new Cesium$1.HeadingPitchRoll(0,0,0);mf.heading=-hf*pf,mf.pitch=0,mf.roll=0;const sf=new Cesium$1.Quaternion;Cesium$1.Quaternion.multiply(mn.rotation,Cesium$1.Quaternion.fromHeadingPitchRoll(mf),sf);const{heading:yf,pitch:Tf,roll:vf}=Cesium$1.HeadingPitchRoll.fromQuaternion(sf);s==null||s({layerId:Gd,rotate:{heading:yf,pitch:Tf,roll:vf}}),(Wa=d==null?void 0:d.onLayerEdit)==null||Wa.call(d,{layerId:Gd,rotate:{heading:yf,pitch:Tf,roll:vf}})},[mn,d,s]),yu=React.useCallback(()=>{c&&(Sa.current=void 0,Xs.current=void 0,updateMapController(c,!0))},[c]);React.useEffect(()=>{document.body.style.cursor=Pe||"default"},[Pe]);const pu=React.useMemo(()=>toTimeInterval(o==null?void 0:o.interval),[o==null?void 0:o.interval]),Nl=React.useMemo(()=>toDistanceDisplayCondition(t==null?void 0:t.near,t==null?void 0:t.far),[t==null?void 0:t.near,t==null?void 0:t.far]);return{style:fa,trs:mn,scalePointStyle:La,availability:pu,distanceDisplayCondition:Nl,handlePointMouseDown:ma,handlePointMouseMove:nt,handlePointMouseUp:pi,handleEdgeMouseDown:Sc,handleEdgeMouseMove:ms,handleEdgeMouseUp:yu}},useHooks$5=({id:t,index:n,scalePoint:o,isHovered:s,pointOutlineColor:c,hoverPointOutlineColor:d,axisLineColor:h,trs:p,dimensions:y,onPointMouseDown:S,onPointMouseMove:P,onPointMouseUp:L})=>{const F=`${t}-${n}`,N=`${t}-opposite-${n}`,{viewer:W}=$e$1(),[z]=React.useState(()=>{const Ra=new Cesium$1.Cartesian3,ma=new Cesium$1.Cartesian3,yt=new Cesium$1.CallbackProperty(()=>{const pi=Cesium$1.Matrix4.fromTranslationRotationScale(p);return Cesium$1.Matrix4.multiplyByPoint(pi,o.point,Ra),Ra},!1),nt=new Cesium$1.CallbackProperty(()=>{const pi=Cesium$1.Matrix4.fromTranslationRotationScale(p);return Cesium$1.Matrix4.multiplyByPoint(pi,o.oppositePoint,ma),ma},!1);return{point:yt,oppositePoint:nt,axisLine:new Cesium$1.CallbackProperty(()=>[yt.getValue(Cesium$1.JulianDate.now()),nt.getValue(Cesium$1.JulianDate.now())],!1)}}),lt=React.useRef(!1),[Pe]=React.useState(()=>new Cesium$1.CallbackProperty(()=>lt.current?d:c,!1));React.useEffect(()=>{lt.current=s},[s]);const[se]=React.useState(()=>new Cesium$1.Cartesian3(y==null?void 0:y.width,y==null?void 0:y.length,y==null?void 0:y.height)),[mt]=React.useState(()=>new Cesium$1.CallbackProperty(()=>se,!1)),[kt]=React.useState(()=>new Cesium$1.CallbackProperty(()=>Cesium$1.Quaternion.IDENTITY,!1)),mn=React.useMemo(()=>new Cesium$1.PolylineDashMaterialProperty({color:h,dashLength:8}),[h]),_i=React.useRef(!1),zi=React.useCallback(Ra=>{var yt,nt;if(!W)return;const ma=(nt=getTag((yt=W.scene.pick(Ra.position))==null?void 0:yt.id))==null?void 0:nt.layerId;_i.current=ma===N,(ma===F||ma===N)&&(S==null||S(Ra,{layerId:_i.current?N:F,index:n,opposite:_i.current}))},[S,n,F,N,W]),ba=React.useCallback(Ra=>{P==null||P(Ra,{layerId:_i.current?N:F,index:n,opposite:_i.current,position:_i.current?z.oppositePoint.getValue(Cesium$1.JulianDate.now()):z.point.getValue(Cesium$1.JulianDate.now()),oppositePosition:_i.current?z.point.getValue(Cesium$1.JulianDate.now()):z.oppositePoint.getValue(Cesium$1.JulianDate.now()),pointLocal:_i?o.oppositePoint:o.point})},[P,n,z,o,F,N]),fa=React.useCallback(Ra=>{L==null||L(Ra,{layerId:_i.current?N:F,index:n,opposite:_i.current})},[L,n,F,N]);React.useEffect(()=>{Cesium$1.Cartesian3.clone(new Cesium$1.Cartesian3(y==null?void 0:y.width,y==null?void 0:y.length,y==null?void 0:y.height),se)},[y,se]);const La=React.useMemo(()=>new Cesium$1.ScreenSpaceEventHandler(W==null?void 0:W.scene.canvas),[W]);return React.useEffect(()=>{La.setInputAction(zi,Cesium$1.ScreenSpaceEventType.LEFT_DOWN),La.setInputAction(ba,Cesium$1.ScreenSpaceEventType.MOUSE_MOVE),La.setInputAction(fa,Cesium$1.ScreenSpaceEventType.LEFT_UP)},[La,zi,ba,fa]),React.useEffect(()=>()=>La.destroy(),[La]),{entitiesPosition:z,pointOutlineColorCb:Pe,cesiumDimensionsCallbackProperty:mt,orientation:kt,axisColorProperty:mn}},ScalePoints=React.memo(function t({layerId:n,featureId:o,index:s,scalePoint:c,isHovered:d,pointFillColor:h,pointOutlineColor:p,hoverPointOutlineColor:y,pointOutlineWidth:S,axisLineColor:P,axisLineWidth:L,trs:F,dimensions:N,visiblePoint:W,visibleAxisLine:z,availability:lt,distanceDisplayCondition:Pe,onPointMouseDown:se,onPointMouseMove:mt,onPointMouseUp:kt,hideIndicator:mn}){const{entitiesPosition:_i,pointOutlineColorCb:zi,cesiumDimensionsCallbackProperty:ba,orientation:fa,axisColorProperty:La}=useHooks$5({id:n,index:s,scalePoint:c,isHovered:d,pointOutlineColor:p,hoverPointOutlineColor:y,axisLineColor:P,trs:F,dimensions:N,onPointMouseDown:se,onPointMouseMove:mt,onPointMouseUp:kt});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(EntityExt,{layerId:`${n}-${s}`,featureId:`${o}-${s}`,position:_i.point,orientation:fa,hideIndicator:mn,availability:lt,children:jsxRuntimeExports.jsx(Cs$1,{show:W,dimensions:ba,material:h,fill:!!h,outline:!!p,outlineColor:zi,outlineWidth:S,distanceDisplayCondition:Pe})}),jsxRuntimeExports.jsx(EntityExt,{layerId:`${n}-opposite-${s}`,featureId:`${o}-opposite-${s}`,position:_i.oppositePoint,orientation:fa,hideIndicator:mn,availability:lt,children:jsxRuntimeExports.jsx(Cs$1,{show:W,dimensions:ba,material:h,fill:!!h,outline:!!p,outlineColor:zi,outlineWidth:S,distanceDisplayCondition:Pe})}),jsxRuntimeExports.jsx(EntityExt,{layerId:`${n}-axis-line-${s}`,featureId:`${o}-axis-line-${s}`,hideIndicator:mn,availability:lt,children:jsxRuntimeExports.jsx(ua$1,{positions:_i.axisLine,show:z,material:La,width:L,arcType:Cesium$1.ArcType.NONE,distanceDisplayCondition:Pe})})]})}),useHooks$4=({planeLocal:t,isActive:n,outlineColor:o,activeOutlineColor:s,trs:c})=>{const d=React.useMemo(()=>new Cesium$1.CallbackProperty(()=>c.translation,!1),[c]),[h,p,y]=React.useMemo(()=>[new Cesium$1.CallbackProperty(()=>{const L=new Cesium$1.Matrix4,F=Cesium$1.Matrix4.fromScale(c.scale,L);return Cesium$1.Plane.transform(t,F,new Cesium$1.Plane(Cesium$1.Cartesian3.UNIT_Z,0))},!1),new Cesium$1.CallbackProperty(()=>{const L=t.normal.x?Cesium$1.Axis.X:t.normal.y?Cesium$1.Axis.Y:Cesium$1.Axis.Z,F=new Cesium$1.Cartesian3;return setPlaneDimensions(c.scale,L,F),F},!1),new Cesium$1.CallbackProperty(()=>c.rotation,!1)],[c,t]),S=React.useRef(!1),[P]=React.useState(()=>new Cesium$1.CallbackProperty(()=>S.current?s??o:o,!1));return React.useEffect(()=>{S.current=n},[n]),{cbRef:d,plane:h,dimension:p,orientation:y,outlineColorCb:P}},Side=React.memo(function t({layerId:n,featureId:o,planeLocal:s,isActive:c,fill:d,fillColor:h,outlineColor:p,activeOutlineColor:y,trs:S,availability:P,distanceDisplayCondition:L,hideIndicator:F}){const{cbRef:N,plane:W,dimension:z,orientation:lt,outlineColorCb:Pe}=useHooks$4({planeLocal:s,isActive:c,outlineColor:p,activeOutlineColor:y,trs:S});return jsxRuntimeExports.jsx(EntityExt,{layerId:n,featureId:o,position:N,orientation:lt,availability:P,hideIndicator:F,children:jsxRuntimeExports.jsx(na$1,{plane:W,dimensions:z,fill:d,material:h,outlineWidth:1,outlineColor:Pe,distanceDisplayCondition:L,outline:!0})})}),Box=React.memo(function t({property:n,geometry:o,isVisible:s,layer:c,feature:d,onLayerEdit:h}){const{show:p=!0,height:y=100,width:S=100,length:P=100,pointOutlineWidth:L,axisLineWidth:F,scalePoint:N=!0,axisLine:W=!0,activeBox:z,activeEdgeIndex:lt,activeScalePointIndex:Pe,hideIndicator:se,disabledSelection:mt}=n??{},{style:kt,trs:mn,scalePointStyle:_i,availability:zi,distanceDisplayCondition:ba,handlePointMouseDown:fa,handlePointMouseMove:La,handlePointMouseUp:Ra,handleEdgeMouseDown:ma,handleEdgeMouseMove:yt,handleEdgeMouseUp:nt}=useHooks$6({property:n,geometry:o,feature:d,onLayerEdit:h}),pi=(S+y+P)/3*.05,[Sa,Sc]=[c==null?void 0:c.id,d==null?void 0:d.id];return!s||!p?null:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[SIDE_PLANES.map((Xs,ms)=>jsxRuntimeExports.jsx(Side,{layerId:`${Sa}-plane-${SIDE_PLANE_NAMES[ms]}`,featureId:`${Sc}-plane-${SIDE_PLANE_NAMES[ms]}`,planeLocal:Xs,fill:kt.fill,fillColor:kt.fillColor,outlineColor:kt.outlineColor,isActive:mt?!!z:!1,activeOutlineColor:kt.activeOutlineColor,trs:mn,availability:zi,distanceDisplayCondition:ba,hideIndicator:se},`${Sa}-plane-${SIDE_PLANE_NAMES[ms]}`)),BOX_EDGES.map((Xs,ms)=>jsxRuntimeExports.jsx(Edge,{featureId:`${Sc}-edge${Xs.isDraggable?"-draggable":""}-${ms}`,layerId:`${Sa}-edge${Xs.isDraggable?"-draggable":""}-${ms}`,index:ms,edge:Xs,isHovered:mt?lt===ms||!Xs.isDraggable&&!!z:!1,width:Xs.isDraggable&&mt?kt.draggableOutlineWidth:kt.outlineWidth,fillColor:Xs.isDraggable?kt.draggableOutlineColor:kt.outlineColor,hoverColor:mt?Xs.isDraggable?kt.activeDraggableOutlineColor:kt.activeOutlineColor:void 0,trs:mn,onMouseDown:Xs.isDraggable&&mt?ma:void 0,onMouseMove:Xs.isDraggable&&mt?yt:void 0,onMouseUp:Xs.isDraggable&&mt?nt:void 0,availability:zi,distanceDisplayCondition:ba,hideIndicator:se},`${Sa}-edge-${ms}`)),N&&SCALE_POINTS.map((Xs,ms)=>jsxRuntimeExports.jsx(ScalePoints,{layerId:`${Sa}-scale-point`,featureId:`${Sc}-scale-point`,index:ms,scalePoint:Xs,trs:mn,isHovered:mt?Pe===ms:!1,pointFillColor:mt?_i.pointFillColor:void 0,pointOutlineColor:mt?_i.pointOutlineColor:void 0,hoverPointOutlineColor:mt?_i.activePointOutlineColor:void 0,pointOutlineWidth:L,axisLineColor:_i.axisLineColor,axisLineWidth:F,dimensions:{width:pi,height:pi,length:pi},visiblePoint:N,visibleAxisLine:W&&Pe===ms,onPointMouseDown:mt?fa:void 0,onPointMouseMove:mt?La:void 0,onPointMouseUp:mt?Ra:void 0,availability:zi,distanceDisplayCondition:ba,hideIndicator:se},`${Sa}-scale-point-${ms}`))]})}),config$d={noLayer:!0};function Ellipse({id:t,isVisible:n,property:o,geometry:s,layer:c,feature:d}){const{show:h=!0}=o??{},p=React.useMemo(()=>(s==null?void 0:s.type)==="Point"?s.coordinates:void 0,[s==null?void 0:s.coordinates,s==null?void 0:s.type]),{heightReference:y,shadows:S,radius:P=1e3,fillColor:L,fill:F,classificationType:N}=o??{},{useTransition:W,translate:z}=(c==null?void 0:c.transition)??{},lt=React.useMemo(()=>p?Cesium$1.Cartesian3.fromDegrees(p[0],p[1],p[2]):void 0,[p]),Pe=React.useMemo(()=>W&&z?new Cesium$1.CallbackProperty(()=>Cesium$1.Cartesian3.fromDegrees(...z),!1):void 0,[W,z]),se=React.useMemo(()=>W?new Cesium$1.CallbackProperty(()=>P,!1):P,[P]),mt=React.useMemo(()=>toColor(L),[L]),kt=React.useMemo(()=>toTimeInterval(d==null?void 0:d.interval),[d==null?void 0:d.interval]),mn=React.useMemo(()=>toDistanceDisplayCondition(o==null?void 0:o.near,o==null?void 0:o.far),[o==null?void 0:o.near,o==null?void 0:o.far]);return!n||!lt||!h?null:jsxRuntimeExports.jsx(EntityExt,{id:t,position:Pe||lt,layerId:c==null?void 0:c.id,featureId:d==null?void 0:d.id,draggable:!0,availability:kt,properties:d==null?void 0:d.properties,children:jsxRuntimeExports.jsx(As$1,{semiMajorAxis:se,semiMinorAxis:se,material:mt,fill:F,heightReference:heightReference(y),classificationType:classificationType(N),shadows:shadowMode(S),distanceDisplayCondition:mn})})}const config$c={noLayer:!0};function Ellipsoid({id:t,isVisible:n,property:o,geometry:s,layer:c,feature:d}){const{show:h=!0}=o??{},p=React.useMemo(()=>(s==null?void 0:s.type)==="Point"?s.coordinates:o!=null&&o.position?[o.position.lng,o.position.lat,o.height??0]:o!=null&&o.location?[o.location.lng,o.location.lat,o.height??0]:void 0,[s==null?void 0:s.coordinates,s==null?void 0:s.type,o==null?void 0:o.height,o==null?void 0:o.location]),{heightReference:y,shadows:S,radius:P=1e3,fillColor:L}=o??{},F=React.useMemo(()=>p?Cesium$1.Cartesian3.fromDegrees(p[0],p[1],p[2]):void 0,[p]),N=React.useMemo(()=>new Cesium$1.Cartesian3(P,P,P),[P]),W=React.useMemo(()=>toColor$2(L),[L]),z=React.useMemo(()=>toTimeInterval(d==null?void 0:d.interval),[d==null?void 0:d.interval]),lt=React.useMemo(()=>toDistanceDisplayCondition(o==null?void 0:o.near,o==null?void 0:o.far),[o==null?void 0:o.near,o==null?void 0:o.far]);return!n||!F||!h?null:jsxRuntimeExports.jsx(EntityExt,{id:t,position:F,layerId:c==null?void 0:c.id,featureId:d==null?void 0:d.id,draggable:!0,legacyLocationPropertyKey:"default.position",availability:z,properties:d==null?void 0:d.properties,children:jsxRuntimeExports.jsx(Fs$1,{radii:N,material:W,heightReference:heightReference(y),shadows:shadowMode(S),distanceDisplayCondition:lt})})}const config$b={noLayer:!0},fragmentShaderSource=`in vec3 v_positionEC;
|
|
5840
|
+
*/(function(module){(function(){var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_MD5_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_MD5_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;NODE_JS?root=commonjsGlobal:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&!0&&module.exports,ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[128,32768,8388608,-2147483648],SHIFT=[0,8,16,24],OUTPUT_TYPES=["hex","array","digest","buffer","arrayBuffer","base64"],BASE64_ENCODE_CHAR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),blocks=[],buffer8;if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);buffer8=new Uint8Array(buffer),blocks=new Uint32Array(buffer)}(root.JS_MD5_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(t){return Object.prototype.toString.call(t)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(t){return typeof t=="object"&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t){return function(n){return new Md5(!0).update(n)[t]()}},createMethod=function(){var t=createOutputMethod("hex");NODE_JS&&(t=nodeWrap(t)),t.create=function(){return new Md5},t.update=function(s){return t.create().update(s)};for(var n=0;n<OUTPUT_TYPES.length;++n){var o=OUTPUT_TYPES[n];t[o]=createOutputMethod(o)}return t},nodeWrap=function(method){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),nodeMethod=function(t){if(typeof t=="string")return crypto.createHash("md5").update(t,"utf8").digest("hex");if(t==null)throw ERROR;return t.constructor===ArrayBuffer&&(t=new Uint8Array(t)),Array.isArray(t)||ArrayBuffer.isView(t)||t.constructor===Buffer?crypto.createHash("md5").update(new Buffer(t)).digest("hex"):method(t)};return nodeMethod};function Md5(t){if(t)blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks,this.buffer8=buffer8;else if(ARRAY_BUFFER){var n=new ArrayBuffer(68);this.buffer8=new Uint8Array(n),this.blocks=new Uint32Array(n)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}Md5.prototype.update=function(t){if(!this.finalized){var n,o=typeof t;if(o!=="string"){if(o==="object"){if(t===null)throw ERROR;if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw ERROR}else throw ERROR;n=!0}for(var s,c=0,d,h=t.length,p=this.blocks,y=this.buffer8;c<h;){if(this.hashed&&(this.hashed=!1,p[0]=p[16],p[16]=p[1]=p[2]=p[3]=p[4]=p[5]=p[6]=p[7]=p[8]=p[9]=p[10]=p[11]=p[12]=p[13]=p[14]=p[15]=0),n)if(ARRAY_BUFFER)for(d=this.start;c<h&&d<64;++c)y[d++]=t[c];else for(d=this.start;c<h&&d<64;++c)p[d>>2]|=t[c]<<SHIFT[d++&3];else if(ARRAY_BUFFER)for(d=this.start;c<h&&d<64;++c)s=t.charCodeAt(c),s<128?y[d++]=s:s<2048?(y[d++]=192|s>>6,y[d++]=128|s&63):s<55296||s>=57344?(y[d++]=224|s>>12,y[d++]=128|s>>6&63,y[d++]=128|s&63):(s=65536+((s&1023)<<10|t.charCodeAt(++c)&1023),y[d++]=240|s>>18,y[d++]=128|s>>12&63,y[d++]=128|s>>6&63,y[d++]=128|s&63);else for(d=this.start;c<h&&d<64;++c)s=t.charCodeAt(c),s<128?p[d>>2]|=s<<SHIFT[d++&3]:s<2048?(p[d>>2]|=(192|s>>6)<<SHIFT[d++&3],p[d>>2]|=(128|s&63)<<SHIFT[d++&3]):s<55296||s>=57344?(p[d>>2]|=(224|s>>12)<<SHIFT[d++&3],p[d>>2]|=(128|s>>6&63)<<SHIFT[d++&3],p[d>>2]|=(128|s&63)<<SHIFT[d++&3]):(s=65536+((s&1023)<<10|t.charCodeAt(++c)&1023),p[d>>2]|=(240|s>>18)<<SHIFT[d++&3],p[d>>2]|=(128|s>>12&63)<<SHIFT[d++&3],p[d>>2]|=(128|s>>6&63)<<SHIFT[d++&3],p[d>>2]|=(128|s&63)<<SHIFT[d++&3]);this.lastByteIndex=d,this.bytes+=d-this.start,d>=64?(this.start=d-64,this.hash(),this.hashed=!0):this.start=d}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Md5.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,n=this.lastByteIndex;t[n>>2]|=EXTRA[n&3],n>=56&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,t[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var t,n,o,s,c,d,h=this.blocks;this.first?(t=h[0]-680876937,t=(t<<7|t>>>25)-271733879<<0,s=(-1732584194^t&2004318071)+h[1]-117830708,s=(s<<12|s>>>20)+t<<0,o=(-271733879^s&(t^-271733879))+h[2]-1126478375,o=(o<<17|o>>>15)+s<<0,n=(t^o&(s^t))+h[3]-1316259209,n=(n<<22|n>>>10)+o<<0):(t=this.h0,n=this.h1,o=this.h2,s=this.h3,t+=(s^n&(o^s))+h[0]-680876936,t=(t<<7|t>>>25)+n<<0,s+=(o^t&(n^o))+h[1]-389564586,s=(s<<12|s>>>20)+t<<0,o+=(n^s&(t^n))+h[2]+606105819,o=(o<<17|o>>>15)+s<<0,n+=(t^o&(s^t))+h[3]-1044525330,n=(n<<22|n>>>10)+o<<0),t+=(s^n&(o^s))+h[4]-176418897,t=(t<<7|t>>>25)+n<<0,s+=(o^t&(n^o))+h[5]+1200080426,s=(s<<12|s>>>20)+t<<0,o+=(n^s&(t^n))+h[6]-1473231341,o=(o<<17|o>>>15)+s<<0,n+=(t^o&(s^t))+h[7]-45705983,n=(n<<22|n>>>10)+o<<0,t+=(s^n&(o^s))+h[8]+1770035416,t=(t<<7|t>>>25)+n<<0,s+=(o^t&(n^o))+h[9]-1958414417,s=(s<<12|s>>>20)+t<<0,o+=(n^s&(t^n))+h[10]-42063,o=(o<<17|o>>>15)+s<<0,n+=(t^o&(s^t))+h[11]-1990404162,n=(n<<22|n>>>10)+o<<0,t+=(s^n&(o^s))+h[12]+1804603682,t=(t<<7|t>>>25)+n<<0,s+=(o^t&(n^o))+h[13]-40341101,s=(s<<12|s>>>20)+t<<0,o+=(n^s&(t^n))+h[14]-1502002290,o=(o<<17|o>>>15)+s<<0,n+=(t^o&(s^t))+h[15]+1236535329,n=(n<<22|n>>>10)+o<<0,t+=(o^s&(n^o))+h[1]-165796510,t=(t<<5|t>>>27)+n<<0,s+=(n^o&(t^n))+h[6]-1069501632,s=(s<<9|s>>>23)+t<<0,o+=(t^n&(s^t))+h[11]+643717713,o=(o<<14|o>>>18)+s<<0,n+=(s^t&(o^s))+h[0]-373897302,n=(n<<20|n>>>12)+o<<0,t+=(o^s&(n^o))+h[5]-701558691,t=(t<<5|t>>>27)+n<<0,s+=(n^o&(t^n))+h[10]+38016083,s=(s<<9|s>>>23)+t<<0,o+=(t^n&(s^t))+h[15]-660478335,o=(o<<14|o>>>18)+s<<0,n+=(s^t&(o^s))+h[4]-405537848,n=(n<<20|n>>>12)+o<<0,t+=(o^s&(n^o))+h[9]+568446438,t=(t<<5|t>>>27)+n<<0,s+=(n^o&(t^n))+h[14]-1019803690,s=(s<<9|s>>>23)+t<<0,o+=(t^n&(s^t))+h[3]-187363961,o=(o<<14|o>>>18)+s<<0,n+=(s^t&(o^s))+h[8]+1163531501,n=(n<<20|n>>>12)+o<<0,t+=(o^s&(n^o))+h[13]-1444681467,t=(t<<5|t>>>27)+n<<0,s+=(n^o&(t^n))+h[2]-51403784,s=(s<<9|s>>>23)+t<<0,o+=(t^n&(s^t))+h[7]+1735328473,o=(o<<14|o>>>18)+s<<0,n+=(s^t&(o^s))+h[12]-1926607734,n=(n<<20|n>>>12)+o<<0,c=n^o,t+=(c^s)+h[5]-378558,t=(t<<4|t>>>28)+n<<0,s+=(c^t)+h[8]-2022574463,s=(s<<11|s>>>21)+t<<0,d=s^t,o+=(d^n)+h[11]+1839030562,o=(o<<16|o>>>16)+s<<0,n+=(d^o)+h[14]-35309556,n=(n<<23|n>>>9)+o<<0,c=n^o,t+=(c^s)+h[1]-1530992060,t=(t<<4|t>>>28)+n<<0,s+=(c^t)+h[4]+1272893353,s=(s<<11|s>>>21)+t<<0,d=s^t,o+=(d^n)+h[7]-155497632,o=(o<<16|o>>>16)+s<<0,n+=(d^o)+h[10]-1094730640,n=(n<<23|n>>>9)+o<<0,c=n^o,t+=(c^s)+h[13]+681279174,t=(t<<4|t>>>28)+n<<0,s+=(c^t)+h[0]-358537222,s=(s<<11|s>>>21)+t<<0,d=s^t,o+=(d^n)+h[3]-722521979,o=(o<<16|o>>>16)+s<<0,n+=(d^o)+h[6]+76029189,n=(n<<23|n>>>9)+o<<0,c=n^o,t+=(c^s)+h[9]-640364487,t=(t<<4|t>>>28)+n<<0,s+=(c^t)+h[12]-421815835,s=(s<<11|s>>>21)+t<<0,d=s^t,o+=(d^n)+h[15]+530742520,o=(o<<16|o>>>16)+s<<0,n+=(d^o)+h[2]-995338651,n=(n<<23|n>>>9)+o<<0,t+=(o^(n|~s))+h[0]-198630844,t=(t<<6|t>>>26)+n<<0,s+=(n^(t|~o))+h[7]+1126891415,s=(s<<10|s>>>22)+t<<0,o+=(t^(s|~n))+h[14]-1416354905,o=(o<<15|o>>>17)+s<<0,n+=(s^(o|~t))+h[5]-57434055,n=(n<<21|n>>>11)+o<<0,t+=(o^(n|~s))+h[12]+1700485571,t=(t<<6|t>>>26)+n<<0,s+=(n^(t|~o))+h[3]-1894986606,s=(s<<10|s>>>22)+t<<0,o+=(t^(s|~n))+h[10]-1051523,o=(o<<15|o>>>17)+s<<0,n+=(s^(o|~t))+h[1]-2054922799,n=(n<<21|n>>>11)+o<<0,t+=(o^(n|~s))+h[8]+1873313359,t=(t<<6|t>>>26)+n<<0,s+=(n^(t|~o))+h[15]-30611744,s=(s<<10|s>>>22)+t<<0,o+=(t^(s|~n))+h[6]-1560198380,o=(o<<15|o>>>17)+s<<0,n+=(s^(o|~t))+h[13]+1309151649,n=(n<<21|n>>>11)+o<<0,t+=(o^(n|~s))+h[4]-145523070,t=(t<<6|t>>>26)+n<<0,s+=(n^(t|~o))+h[11]-1120210379,s=(s<<10|s>>>22)+t<<0,o+=(t^(s|~n))+h[2]+718787259,o=(o<<15|o>>>17)+s<<0,n+=(s^(o|~t))+h[9]-343485551,n=(n<<21|n>>>11)+o<<0,this.first?(this.h0=t+1732584193<<0,this.h1=n-271733879<<0,this.h2=o-1732584194<<0,this.h3=s+271733878<<0,this.first=!1):(this.h0=this.h0+t<<0,this.h1=this.h1+n<<0,this.h2=this.h2+o<<0,this.h3=this.h3+s<<0)},Md5.prototype.hex=function(){this.finalize();var t=this.h0,n=this.h1,o=this.h2,s=this.h3;return HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[s&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(){this.finalize();var t=this.h0,n=this.h1,o=this.h2,s=this.h3;return[t&255,t>>8&255,t>>16&255,t>>24&255,n&255,n>>8&255,n>>16&255,n>>24&255,o&255,o>>8&255,o>>16&255,o>>24&255,s&255,s>>8&255,s>>16&255,s>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),n=new Uint32Array(t);return n[0]=this.h0,n[1]=this.h1,n[2]=this.h2,n[3]=this.h3,t},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var t,n,o,s="",c=this.array(),d=0;d<15;)t=c[d++],n=c[d++],o=c[d++],s+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[(t<<4|n>>>4)&63]+BASE64_ENCODE_CHAR[(n<<2|o>>>6)&63]+BASE64_ENCODE_CHAR[o&63];return t=c[d],s+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[t<<4&63]+"==",s};var exports=createMethod();COMMON_JS?module.exports=exports:root.md5=exports})()})(md5$1);var md5Exports=md5$1.exports;const md5=getDefaultExportFromCjs(md5Exports),EntityExt=React.forwardRef(EntityExtComponent);function EntityExtComponent({layerId:t,featureId:n,draggable:o,unselectable:s,legacyLocationPropertyKey:c,hideIndicator:d,...h},p){const[y,S]=React.useState(null);React.useLayoutEffect(()=>{y!=null&&y.cesiumElement&&attachTag(y.cesiumElement,{layerId:t||h.id,featureId:n,draggable:o,unselectable:s,legacyLocationPropertyKey:c,hideIndicator:d})},[o,n,t,c,h.id,s,d,y]);const P=React.useCallback(L=>S(L),[]);return jsxRuntimeExports.jsx(Is$1,{ref:_default(p,P),...h})}function attachTag(t,n){if(t){if(t instanceof Cesium$1.Cesium3DTileset){t[tagKey]=n;return}if(t instanceof Cesium$1.Cesium3DTileFeature||t instanceof Cesium$1.Cesium3DTilePointFeature||t instanceof Cesium$1.Model||t instanceof Cesium$1.ImageryLayer){t[tagKey]=n;return}if(t instanceof Cesium$1.Primitive){t[tagKey]=n;return}if(t instanceof Cesium$1.GroundPrimitive){t[tagKey]=n;return}t.properties||(t.properties=new Cesium$1.PropertyBag);for(const o of tagKeys)!(o in n)&&t.properties.hasProperty(`reearth_${o}`)?t.properties.removeProperty(`reearth_${o}`):t.properties[`reearth_${o}`]=n[o]}}function getTag(t){if(t){if(t instanceof Cesium$1.Cesium3DTileset||t instanceof Cesium$1.Cesium3DTileFeature||t instanceof Cesium$1.Cesium3DTilePointFeature||t instanceof Cesium$1.Model||t instanceof Cesium$1.ImageryLayer||t instanceof Cesium$1.Primitive||t instanceof Cesium$1.GroundPrimitive)return t[tagKey];if(t.properties)return Object.fromEntries(Object.entries(t.properties).map(([n,o])=>tagKeys.includes(n.replace("reearth_",""))?[n.replace("reearth_",""),o]:null).filter(n=>!!n))}}const tagObj={draggable:1,featureId:1,layerId:1,unselectable:1,originalProperties:1,computedFeature:1,hideIndicator:1,appearanceType:1,featureIndex:1,isFeatureSelected:1},tagKeys=Object.keys(tagObj),tagKey="__reearth_tag",extractSimpleLayer=t=>{const n=t&&"layer"in t?t.layer:t;if((n==null?void 0:n.type)==="simple")return toPlainObject(n)},extractSimpleLayerData=t=>{var n;return(n=extractSimpleLayer(t))==null?void 0:n.data},toPlainObject=t=>cloneDeep(t),toColor=t=>{if(!t||typeof t!="string")return;const n=t.match(/^#([A-Fa-f0-9]{6})([A-Fa-f0-9]{2})$|^#([A-Fa-f0-9]{3})([A-Fa-f0-9])$/);if(!n)return Cesium$1.Color.fromCssColorString(t);const o=parseInt(n[4]?n[4].repeat(2):n[2],16)/255;return Cesium$1.Color.fromCssColorString(`#${n[1]??n[3]}`).withAlpha(o)},toTimeInterval=t=>{if(t)return new Cesium$1.TimeIntervalCollection([new Cesium$1.TimeInterval({start:Cesium$1.JulianDate.fromDate(t[0]),stop:t[1]?Cesium$1.JulianDate.fromDate(t[1]):Cesium$1.Iso8601.MAXIMUM_VALUE})])},toDistanceDisplayCondition=(t,n)=>typeof t=="number"||typeof n=="number"?new Cesium$1.DistanceDisplayCondition(t??0,n??Number.MAX_VALUE):void 0,generateIDWithMD5=t=>{const n=md5.create();return n.update(t),n.hex()},usePick=(t,n)=>{const o=React.useMemo(()=>t?pick(t,n):void 0,[t,n]);return React.useMemo(()=>o,[JSON.stringify(o)])},useHooks$7=({id:t,index:n,edge:o,isHovered:s,fillColor:c,trs:d,hoverColor:h,onMouseDown:p,onMouseMove:y,onMouseUp:S})=>{const{viewer:P}=$e$1(),[L]=React.useState(()=>new Cesium$1.CallbackProperty(()=>{const se=new Cesium$1.Cartesian3,mt=new Cesium$1.Cartesian3,kt=Cesium$1.Matrix4.fromTranslationRotationScale(d);return Cesium$1.Matrix4.multiplyByPoint(kt,o.start,se),Cesium$1.Matrix4.multiplyByPoint(kt,o.end,mt),[se,mt]},!1)),F=React.useRef(!1),[N]=React.useState(()=>new Cesium$1.ColorMaterialProperty(new Cesium$1.CallbackProperty(()=>F.current?h??c:c,!1)));React.useEffect(()=>{F.current=s},[s]);const W=React.useCallback(se=>{var kt,mn;!P||((mn=getTag((kt=P.scene.pick(se.position))==null?void 0:kt.id))==null?void 0:mn.layerId)!==t||p==null||p(se,{layerId:t,index:n})},[p,t,n,P]),z=React.useCallback(se=>{y==null||y(se,{layerId:t,index:n})},[y,n,t]),lt=React.useCallback(se=>{S==null||S(se,{layerId:t,index:n})},[S,n,t]),Pe=React.useMemo(()=>new Cesium$1.ScreenSpaceEventHandler(P==null?void 0:P.scene.canvas),[P]);return React.useEffect(()=>{Pe.setInputAction(W,Cesium$1.ScreenSpaceEventType.LEFT_DOWN),Pe.setInputAction(z,Cesium$1.ScreenSpaceEventType.MOUSE_MOVE),Pe.setInputAction(lt,Cesium$1.ScreenSpaceEventType.LEFT_UP)},[Pe,W,z,lt]),React.useEffect(()=>()=>Pe.destroy(),[Pe]),{cbp:L,outlineColor:N}},Edge=React.memo(function t({layerId:n,featureId:o,index:s,edge:c,isHovered:d,fillColor:h,trs:p,width:y,hoverColor:S,availability:P,distanceDisplayCondition:L,onMouseDown:F,onMouseMove:N,onMouseUp:W,hideIndicator:z}){const{cbp:lt,outlineColor:Pe}=useHooks$7({id:n,index:s,edge:c,isHovered:d,fillColor:h,trs:p,hoverColor:S,onMouseDown:F,onMouseMove:N,onMouseUp:W});return jsxRuntimeExports.jsx(EntityExt,{layerId:n,featureId:o,availability:P,hideIndicator:z,children:jsxRuntimeExports.jsx(ua$1,{positions:lt,width:y,material:Pe,arcType:Cesium$1.ArcType.NONE,distanceDisplayCondition:L})})}),context=React.createContext({}),useContext=()=>React.useContext(context),convertCartesian3ToPosition=(t,n)=>{if(!n)return;const o=t==null?void 0:t.scene.globe.ellipsoid.cartesianToCartographic(n);if(o)return{lat:Cesium$1.Math.toDegrees(o.latitude),lng:Cesium$1.Math.toDegrees(o.longitude),height:o.height}},translationWithClamping=(t,n,o)=>{if(!n){const s=Cesium$1.Cartographic.fromCartesian(t.translation,void 0,new Cesium$1.Cartographic),c=s.height-t.scale.z/2,d=o;c<d&&(s.height+=d-c,Cesium$1.Cartographic.toCartesian(s,void 0,t.translation))}},getModelFromTileContent=t=>{if(!t.featuresLength&&"_model"in t&&t._model instanceof Cesium$1.Model)return t._model};function lookupFeatures(t,n){var c;if(!t)return;const o=getModelFromTileContent(t);if(o)return n(o,t);const s=t.featuresLength;for(let d=0;d<s;d++){const h=t.getFeature(d);h&&n(h,t,d)}(c=t.innerContents)==null||c.forEach(d=>lookupFeatures(d,n))}const findFeatureFrom3DTile=(t,n,o)=>{var c;let s;if(n&&(s=(c=o==null?void 0:o.find(n))==null?void 0:c[0],s&&s instanceof Cesium$1.Cesium3DTileFeature)||(lookupFeatures(t.content,d=>{const h=getTag(d);(h==null?void 0:h.featureId)===n&&(s=d)}),s&&s instanceof Cesium$1.Cesium3DTileFeature))return s;for(const d of t.children){const h=findFeatureFrom3DTile(d,n);if(h)return h}};function findEntity(t,n,o,s){const c=o??n,d=o?"featureId":"layerId";if(!c)return;let h=t.entities.getById(c);if(h||(h=t.entities.values.find(p=>{var y;return((y=getTag(p))==null?void 0:y[d])===c}),h))return h;for(const p of[t.dataSourceDisplay.dataSources,t.dataSources])for(let y=0;y<p.length;y++){const P=p.get(y).entities.values.find(L=>{var F;return((F=getTag(L))==null?void 0:F[d])===c});if(P)return P}for(let p=0;p<t.scene.primitives.length;p++){const y=t.scene.primitives.get(p);if(!(!(y instanceof Cesium$1.Cesium3DTileset)&&!(y instanceof Cesium$1.Primitive)&&!(y instanceof Cesium$1.GroundPrimitive))){if(n&&!o){const S=getTag(y);if(S!=null&&S.layerId&&n&&(S==null?void 0:S.layerId)===n)return y;continue}if(!y.isDestroyed()&&!s&&y instanceof Cesium$1.Cesium3DTileset){const S=findFeatureFrom3DTile(y.root,o);if(S)return S}}}for(let p=0;p<t.imageryLayers.length;p++){const y=t.imageryLayers.get(p),S=getTag(y);if((S==null?void 0:S.layerId)===n)return y}}const findFeaturesFrom3DTile=(t,n,o,s=new Set)=>{lookupFeatures(t.content,c=>{const d=getTag(c);if(n.includes((d==null?void 0:d.featureId)??"")){const h=o==null?void 0:o(c);h?s.add(h):s.add(c)}});for(const c of t.children)findFeaturesFrom3DTile(c,n,o,s)},filterEntity=(t,n,o,s)=>{const c=[];for(const d of t){const h=getTag(d);if((h==null?void 0:h.layerId)===n&&o.includes(h.featureId||"")){const p=s==null?void 0:s(d);p?c.push(p):d&&c.push(d)}}return c},findEntityFromDatasource=(t,n,o,s)=>{let c=[];for(const d of[t.dataSourceDisplay.dataSources,t.dataSources])for(let h=0;h<d.length;h++){const p=d.get(h).entities.values,y=filterEntity(p,n,o,s);y.length&&(c=c.concat(y))}return c},findTile3DFeaturesFromScene=(t,n,o,s)=>{const c=new Set;for(let d=0;d<t.scene.primitives.length;d++){const h=t.scene.primitives.get(d);if(!(h instanceof Cesium$1.Cesium3DTileset)||h.isDestroyed())continue;const p=getTag(h);if((p==null?void 0:p.layerId)!==n)continue;const y=p.featureIndex;if(y)return o.flatMap(P=>y.find(P)).filter(P=>!!P).map(P=>s==null?void 0:s(P,h)).filter(P=>!!P);if(findFeaturesFrom3DTile(h.root,o,s,c),c.size)return Array.from(c.values())}return[]};function findFeaturesFromLayer(t,n,o,s){const c=filterEntity(t.entities.values,n,o,s);if(c.length)return c;const d=findEntityFromDatasource(t,n,o,s);return d.length?d:findTile3DFeaturesFromScene(t,n,o,s)}const getEntityContent=(t,n,o)=>{var c;const s={description:{type:"html",value:t instanceof Cesium$1.ImageryLayerFeatureInfo?t.description:(c=t.description)==null?void 0:c.getValue(n)},attributes:{type:"table",value:!(t instanceof Cesium$1.Entity)&&"properties"in t&&t.properties&&typeof t.properties=="object"?propertiesToTableContent(t.properties):t instanceof Cesium$1.Entity&&t.properties?propertiesToTableContent(t.properties.getValue(n)):[]}};return o?s[o]:s.attributes??s.description};function propertiesToTableContent(t){return Object.entries(t).reduce((n,[o,s])=>[...n,{key:o,value:s}],[])}function getPixelRatio(t){return t.pixelRatio}const convertEntityProperties=(t,n)=>{var s;const o=(s=n.properties)==null?void 0:s.getValue(t);return n.properties&&o?Object.fromEntries(n.properties.propertyNames.map(c=>[c,o[c]])):{}},convertEntityDescription=(t,n)=>{var s;const o=(s=n.description)==null?void 0:s.getValue(t);if(typeof o=="string")return o},convertCesium3DTileFeatureProperties=t=>Object.fromEntries(t.getPropertyIds().map(n=>[n,t.getProperty(n)])),convertObjToComputedFeature=(t,n)=>{if(n instanceof Cesium$1.Cesium3DTileFeature||n instanceof Cesium$1.Cesium3DTilePointFeature){const o=getTag(n);return[o==null?void 0:o.layerId,(o==null?void 0:o.computedFeature)??{type:"computedFeature",id:(o==null?void 0:o.featureId)??"",properties:convertCesium3DTileFeatureProperties(n)}]}if(n instanceof Cesium$1.Model){const o=getTag(n);return[o==null?void 0:o.layerId,{type:"computedFeature",id:(o==null?void 0:o.featureId)??"",properties:{}}]}if(n instanceof Cesium$1.Entity||"id"in n&&n.id instanceof Cesium$1.Entity){const o=n instanceof Cesium$1.Entity?n:n.id,s=getTag(o);return[s==null?void 0:s.layerId,(s==null?void 0:s.computedFeature)??{type:"computedFeature",id:(s==null?void 0:s.featureId)??"",properties:convertEntityProperties(t,o),metaData:{description:convertEntityDescription(t,o)}}]}},updateTrs=(t,n,o,s,c)=>{const{height:d,width:h,length:p,heading:y,pitch:S,roll:P}=n??{},L=(s==null?void 0:s.type)==="Point"?s.coordinates:n!=null&&n.location?[n.location.lng,n.location.lat,n.location.height??0]:void 0,F=L?Cesium$1.Cartesian3.fromDegrees(L[0],L[1],L[2]):void 0;F&&Cesium$1.Cartesian3.clone(F,t.translation),c||translationWithClamping(t,!!c,o);const N=y&&S&&P?Cesium$1.Matrix3.fromHeadingPitchRoll(new Cesium$1.HeadingPitchRoll(y,S,P)):Cesium$1.Matrix3.getRotation(Cesium$1.Matrix4.getMatrix3(Cesium$1.Transforms.eastNorthUpToFixedFrame(t.translation),new Cesium$1.Matrix3),new Cesium$1.Matrix3);return Cesium$1.Quaternion.clone(Cesium$1.Quaternion.fromRotationMatrix(N),t.rotation),Cesium$1.Cartesian3.clone(new Cesium$1.Cartesian3(h||100,p||100,d||100),t.scale),t};function screenProjectVector(t,n,o,s,c){const d=new Cesium$1.Ray;d.origin=n,d.direction=o;const h=t.cartesianToCanvasCoordinates(Cesium$1.Ray.getPoint(d,0),new Cesium$1.Cartesian2),p=t.cartesianToCanvasCoordinates(Cesium$1.Ray.getPoint(d,s),new Cesium$1.Cartesian2);return Cesium$1.Cartesian2.subtract(p,h,c)}const dotMousePosition=(t,n,o,s)=>{const c=Cesium$1.Cartesian2.subtract(n.endPosition,n.startPosition,new Cesium$1.Cartesian2),d=screenProjectVector(t,o,s,1,new Cesium$1.Cartesian2),h=Cesium$1.Cartesian2.normalize(d,new Cesium$1.Cartesian2),p=Cesium$1.Cartesian2.magnitude(d),y=Cesium$1.Cartesian2.dot(c,h);return{pixelsPerStep:p,moveAmount:y/p}},computeMoveAmount=(t,n,o,s)=>{const c=Cesium$1.Cartesian2.subtract(n.endPosition,n.startPosition,new Cesium$1.Cartesian2),d=screenProjectVector(t,o,s,1,new Cesium$1.Cartesian2),h=Cesium$1.Cartesian2.normalize(d,new Cesium$1.Cartesian2),p=Cesium$1.Cartesian2.magnitude(d),y=Cesium$1.Cartesian2.dot(c,h);return{pixelsPerStep:p,moveAmount:y/p}},computeMouseMoveAmount=(t,n,o,s,c)=>{const{moveAmount:d,pixelsPerStep:h}=dotMousePosition(t,n,o,s),p=d/c;return{pixelLengthAfterScaling:h*c+h*c*p,scaleAmount:p}};function setPlaneDimensions(t,n,o){n===Cesium$1.Axis.X?(o.x=t.y,o.y=t.z):n===Cesium$1.Axis.Y?(o.x=t.x,o.y=t.z):n===Cesium$1.Axis.Z&&(o.x=t.x,o.y=t.y)}const useHooks$6=({property:t,geometry:n,feature:o,onLayerEdit:s})=>{const{viewer:c}=$e$1(),d=useContext(),{fillColor:h,outlineColor:p,activeOutlineColor:y,outlineWidth:S,draggableOutlineColor:P,activeDraggableOutlineColor:L,draggableOutlineWidth:F,pointFillColor:N,pointOutlineColor:W,activePointOutlineColor:z,axisLineColor:lt,cursor:Pe,allowEnterGround:se}=t??{},[mt,kt]=React.useState(0),[mn]=React.useState(()=>updateTrs(new Cesium$1.TranslationRotationScale,t,mt,n,se)),_i=React.useRef(!1),zi=React.useCallback(()=>{_i.current||!se&&c&&(_i.current=!0,sampleTerrainHeightFromCartesian(c.scene,mn.translation).then(Ru=>{kt(Ru??0),_i.current=!1}))},[se,c,mn]),{requestRender:ba}=useContext();React.useEffect(()=>{updateTrs(mn,t,mt,n,se),ba==null||ba(),zi()},[t,n,mn,c,mt,zi,se,ba]);const fa=React.useMemo(()=>({fillColor:toColor(h),outlineColor:toColor(p),activeOutlineColor:toColor(y),draggableOutlineColor:toColor(P),activeDraggableOutlineColor:toColor(L),outlineWidth:S,draggableOutlineWidth:F,fill:!!h,outline:!!p}),[h,p,y,S,F,P,L]),La=React.useMemo(()=>({pointFillColor:toColor(N)??fa.fillColor,pointOutlineColor:toColor(W)??fa.outlineColor,activePointOutlineColor:toColor(z)??fa.outlineColor,axisLineColor:toColor(lt)??fa.outlineColor}),[N,W,lt,fa,z]),Ra=React.useRef(),ma=React.useCallback((Ru,{index:Vd})=>{c&&(updateMapController(c,!1),Ra.current=Vd)},[c]),yt=React.useRef(),nt=React.useCallback((Ru,{position:Vd,oppositePosition:Gd,pointLocal:lf,index:hf,layerId:pf})=>{var Af;if(Ra.current!==hf||!Vd||!Gd||!lf||!c)return;const mf=Ru.startPosition;if(yt.current===void 0){yt.current=new Cesium$1.Cartesian2(mf.x,mf.y);return}const sf=new Cesium$1.Cartesian2(mf.x,mf.y),yf=Cesium$1.Cartesian3.subtract(Vd,Gd,new Cesium$1.Cartesian3),Tf=Cesium$1.Cartesian3.magnitude(yf),vf=Cesium$1.Cartesian3.normalize(yf,new Cesium$1.Cartesian3),{scaleAmount:Wa,pixelLengthAfterScaling:af}=computeMouseMoveAmount(c.scene,{startPosition:yt.current,endPosition:sf},Vd,vf,Tf);yt.current=sf.clone();const Xd=Cesium$1.Cartesian3.normalize(lf,new Cesium$1.Cartesian3),gd=Math.abs(Cesium$1.Cartesian3.dot(new Cesium$1.Cartesian3(1,0,0),Xd)),pd=Math.abs(Cesium$1.Cartesian3.dot(new Cesium$1.Cartesian3(0,1,0),Xd)),Zd=Math.abs(Cesium$1.Cartesian3.dot(new Cesium$1.Cartesian3(0,0,1),Xd)),cf=gd&&pd&&Zd;if(Wa<0&&(Xd.x&&Xd.y&&Xd.y?af/Math.sqrt(2):af)<20)return;const of=Cesium$1.Cartesian3.multiplyByScalar(Cesium$1.Cartesian3.abs(Cesium$1.Cartesian3.multiplyComponents(mn.scale,cf?new Cesium$1.Cartesian3(1,1,1):Xd,new Cesium$1.Cartesian3),new Cesium$1.Cartesian3),Wa,new Cesium$1.Cartesian3),rf=Cesium$1.Cartesian3.multiplyByScalar(yf,Wa/2,new Cesium$1.Cartesian3),df=Xd.z<0,Cf=Wa>0;!se&&Cf&&df&&Cesium$1.Cartographic.fromCartesian(mn.translation,void 0,new Cesium$1.Cartographic).height-mn.scale.z/2-Math.abs(rf.z)<0&&(of.z=0);const ff=new Cesium$1.Cartesian3,Sf=new Cesium$1.Cartesian3;Cesium$1.Cartesian3.add(mn.scale,of,ff),Cesium$1.Cartesian3.add(mn.translation,rf,Sf);const Pf=c==null?void 0:c.scene.globe.ellipsoid.cartesianToCartographic(Sf);s==null||s({layerId:pf,scale:{width:ff.x,length:ff.y,height:ff.z,location:{lat:Cesium$1.Math.toDegrees(Pf==null?void 0:Pf.latitude),lng:Cesium$1.Math.toDegrees(Pf==null?void 0:Pf.longitude),height:Pf==null?void 0:Pf.height}}}),(Af=d==null?void 0:d.onLayerEdit)==null||Af.call(d,{layerId:pf,scale:{width:ff.x,length:ff.y,height:ff.z,location:{lat:Cesium$1.Math.toDegrees(Pf==null?void 0:Pf.latitude),lng:Cesium$1.Math.toDegrees(Pf==null?void 0:Pf.longitude),height:Pf==null?void 0:Pf.height}}})},[mn,c,se,d,s]),pi=React.useCallback(()=>{c&&(Ra.current=void 0,yt.current=void 0,updateMapController(c,!0))},[c]),Sa=React.useRef(),Sc=React.useCallback((Ru,{index:Vd})=>{c&&(Sa.current=Vd,updateMapController(c,!1))},[c]),Xs=React.useRef(),ms=React.useCallback((Ru,{index:Vd,layerId:Gd})=>{var Wa;if(Sa.current!==Vd)return;const lf=Ru.startPosition;if(Xs.current===void 0){Xs.current=lf.x;return}const hf=lf.x-Xs.current;Xs.current=lf.x;const pf=.05,mf=new Cesium$1.HeadingPitchRoll(0,0,0);mf.heading=-hf*pf,mf.pitch=0,mf.roll=0;const sf=new Cesium$1.Quaternion;Cesium$1.Quaternion.multiply(mn.rotation,Cesium$1.Quaternion.fromHeadingPitchRoll(mf),sf);const{heading:yf,pitch:Tf,roll:vf}=Cesium$1.HeadingPitchRoll.fromQuaternion(sf);s==null||s({layerId:Gd,rotate:{heading:yf,pitch:Tf,roll:vf}}),(Wa=d==null?void 0:d.onLayerEdit)==null||Wa.call(d,{layerId:Gd,rotate:{heading:yf,pitch:Tf,roll:vf}})},[mn,d,s]),yu=React.useCallback(()=>{c&&(Sa.current=void 0,Xs.current=void 0,updateMapController(c,!0))},[c]);React.useEffect(()=>{document.body.style.cursor=Pe||"default"},[Pe]);const pu=React.useMemo(()=>toTimeInterval(o==null?void 0:o.interval),[o==null?void 0:o.interval]),Nl=React.useMemo(()=>toDistanceDisplayCondition(t==null?void 0:t.near,t==null?void 0:t.far),[t==null?void 0:t.near,t==null?void 0:t.far]);return{style:fa,trs:mn,scalePointStyle:La,availability:pu,distanceDisplayCondition:Nl,handlePointMouseDown:ma,handlePointMouseMove:nt,handlePointMouseUp:pi,handleEdgeMouseDown:Sc,handleEdgeMouseMove:ms,handleEdgeMouseUp:yu}},useHooks$5=({id:t,index:n,scalePoint:o,isHovered:s,pointOutlineColor:c,hoverPointOutlineColor:d,axisLineColor:h,trs:p,dimensions:y,onPointMouseDown:S,onPointMouseMove:P,onPointMouseUp:L})=>{const F=`${t}-${n}`,N=`${t}-opposite-${n}`,{viewer:W}=$e$1(),[z]=React.useState(()=>{const Ra=new Cesium$1.Cartesian3,ma=new Cesium$1.Cartesian3,yt=new Cesium$1.CallbackProperty(()=>{const pi=Cesium$1.Matrix4.fromTranslationRotationScale(p);return Cesium$1.Matrix4.multiplyByPoint(pi,o.point,Ra),Ra},!1),nt=new Cesium$1.CallbackProperty(()=>{const pi=Cesium$1.Matrix4.fromTranslationRotationScale(p);return Cesium$1.Matrix4.multiplyByPoint(pi,o.oppositePoint,ma),ma},!1);return{point:yt,oppositePoint:nt,axisLine:new Cesium$1.CallbackProperty(()=>[yt.getValue(Cesium$1.JulianDate.now()),nt.getValue(Cesium$1.JulianDate.now())],!1)}}),lt=React.useRef(!1),[Pe]=React.useState(()=>new Cesium$1.CallbackProperty(()=>lt.current?d:c,!1));React.useEffect(()=>{lt.current=s},[s]);const[se]=React.useState(()=>new Cesium$1.Cartesian3(y==null?void 0:y.width,y==null?void 0:y.length,y==null?void 0:y.height)),[mt]=React.useState(()=>new Cesium$1.CallbackProperty(()=>se,!1)),[kt]=React.useState(()=>new Cesium$1.CallbackProperty(()=>Cesium$1.Quaternion.IDENTITY,!1)),mn=React.useMemo(()=>new Cesium$1.PolylineDashMaterialProperty({color:h,dashLength:8}),[h]),_i=React.useRef(!1),zi=React.useCallback(Ra=>{var yt,nt;if(!W)return;const ma=(nt=getTag((yt=W.scene.pick(Ra.position))==null?void 0:yt.id))==null?void 0:nt.layerId;_i.current=ma===N,(ma===F||ma===N)&&(S==null||S(Ra,{layerId:_i.current?N:F,index:n,opposite:_i.current}))},[S,n,F,N,W]),ba=React.useCallback(Ra=>{P==null||P(Ra,{layerId:_i.current?N:F,index:n,opposite:_i.current,position:_i.current?z.oppositePoint.getValue(Cesium$1.JulianDate.now()):z.point.getValue(Cesium$1.JulianDate.now()),oppositePosition:_i.current?z.point.getValue(Cesium$1.JulianDate.now()):z.oppositePoint.getValue(Cesium$1.JulianDate.now()),pointLocal:_i?o.oppositePoint:o.point})},[P,n,z,o,F,N]),fa=React.useCallback(Ra=>{L==null||L(Ra,{layerId:_i.current?N:F,index:n,opposite:_i.current})},[L,n,F,N]);React.useEffect(()=>{Cesium$1.Cartesian3.clone(new Cesium$1.Cartesian3(y==null?void 0:y.width,y==null?void 0:y.length,y==null?void 0:y.height),se)},[y,se]);const La=React.useMemo(()=>new Cesium$1.ScreenSpaceEventHandler(W==null?void 0:W.scene.canvas),[W]);return React.useEffect(()=>{La.setInputAction(zi,Cesium$1.ScreenSpaceEventType.LEFT_DOWN),La.setInputAction(ba,Cesium$1.ScreenSpaceEventType.MOUSE_MOVE),La.setInputAction(fa,Cesium$1.ScreenSpaceEventType.LEFT_UP)},[La,zi,ba,fa]),React.useEffect(()=>()=>La.destroy(),[La]),{entitiesPosition:z,pointOutlineColorCb:Pe,cesiumDimensionsCallbackProperty:mt,orientation:kt,axisColorProperty:mn}},ScalePoints=React.memo(function t({layerId:n,featureId:o,index:s,scalePoint:c,isHovered:d,pointFillColor:h,pointOutlineColor:p,hoverPointOutlineColor:y,pointOutlineWidth:S,axisLineColor:P,axisLineWidth:L,trs:F,dimensions:N,visiblePoint:W,visibleAxisLine:z,availability:lt,distanceDisplayCondition:Pe,onPointMouseDown:se,onPointMouseMove:mt,onPointMouseUp:kt,hideIndicator:mn}){const{entitiesPosition:_i,pointOutlineColorCb:zi,cesiumDimensionsCallbackProperty:ba,orientation:fa,axisColorProperty:La}=useHooks$5({id:n,index:s,scalePoint:c,isHovered:d,pointOutlineColor:p,hoverPointOutlineColor:y,axisLineColor:P,trs:F,dimensions:N,onPointMouseDown:se,onPointMouseMove:mt,onPointMouseUp:kt});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(EntityExt,{layerId:`${n}-${s}`,featureId:`${o}-${s}`,position:_i.point,orientation:fa,hideIndicator:mn,availability:lt,children:jsxRuntimeExports.jsx(Cs$1,{show:W,dimensions:ba,material:h,fill:!!h,outline:!!p,outlineColor:zi,outlineWidth:S,distanceDisplayCondition:Pe})}),jsxRuntimeExports.jsx(EntityExt,{layerId:`${n}-opposite-${s}`,featureId:`${o}-opposite-${s}`,position:_i.oppositePoint,orientation:fa,hideIndicator:mn,availability:lt,children:jsxRuntimeExports.jsx(Cs$1,{show:W,dimensions:ba,material:h,fill:!!h,outline:!!p,outlineColor:zi,outlineWidth:S,distanceDisplayCondition:Pe})}),jsxRuntimeExports.jsx(EntityExt,{layerId:`${n}-axis-line-${s}`,featureId:`${o}-axis-line-${s}`,hideIndicator:mn,availability:lt,children:jsxRuntimeExports.jsx(ua$1,{positions:_i.axisLine,show:z,material:La,width:L,arcType:Cesium$1.ArcType.NONE,distanceDisplayCondition:Pe})})]})}),useHooks$4=({planeLocal:t,isActive:n,outlineColor:o,activeOutlineColor:s,trs:c})=>{const d=React.useMemo(()=>new Cesium$1.CallbackProperty(()=>c.translation,!1),[c]),[h,p,y]=React.useMemo(()=>[new Cesium$1.CallbackProperty(()=>{const L=new Cesium$1.Matrix4,F=Cesium$1.Matrix4.fromScale(c.scale,L);return Cesium$1.Plane.transform(t,F,new Cesium$1.Plane(Cesium$1.Cartesian3.UNIT_Z,0))},!1),new Cesium$1.CallbackProperty(()=>{const L=t.normal.x?Cesium$1.Axis.X:t.normal.y?Cesium$1.Axis.Y:Cesium$1.Axis.Z,F=new Cesium$1.Cartesian3;return setPlaneDimensions(c.scale,L,F),F},!1),new Cesium$1.CallbackProperty(()=>c.rotation,!1)],[c,t]),S=React.useRef(!1),[P]=React.useState(()=>new Cesium$1.CallbackProperty(()=>S.current?s??o:o,!1));return React.useEffect(()=>{S.current=n},[n]),{cbRef:d,plane:h,dimension:p,orientation:y,outlineColorCb:P}},Side=React.memo(function t({layerId:n,featureId:o,planeLocal:s,isActive:c,fill:d,fillColor:h,outlineColor:p,activeOutlineColor:y,trs:S,availability:P,distanceDisplayCondition:L,hideIndicator:F}){const{cbRef:N,plane:W,dimension:z,orientation:lt,outlineColorCb:Pe}=useHooks$4({planeLocal:s,isActive:c,outlineColor:p,activeOutlineColor:y,trs:S});return jsxRuntimeExports.jsx(EntityExt,{layerId:n,featureId:o,position:N,orientation:lt,availability:P,hideIndicator:F,children:jsxRuntimeExports.jsx(na$1,{plane:W,dimensions:z,fill:d,material:h,outlineWidth:1,outlineColor:Pe,distanceDisplayCondition:L,outline:!0})})}),Box=React.memo(function t({property:n,geometry:o,isVisible:s,layer:c,feature:d,onLayerEdit:h}){const{show:p=!0,height:y=100,width:S=100,length:P=100,pointOutlineWidth:L,axisLineWidth:F,scalePoint:N=!0,axisLine:W=!0,activeBox:z,activeEdgeIndex:lt,activeScalePointIndex:Pe,hideIndicator:se,disabledSelection:mt}=n??{},{style:kt,trs:mn,scalePointStyle:_i,availability:zi,distanceDisplayCondition:ba,handlePointMouseDown:fa,handlePointMouseMove:La,handlePointMouseUp:Ra,handleEdgeMouseDown:ma,handleEdgeMouseMove:yt,handleEdgeMouseUp:nt}=useHooks$6({property:n,geometry:o,feature:d,onLayerEdit:h}),pi=(S+y+P)/3*.05,[Sa,Sc]=[c==null?void 0:c.id,d==null?void 0:d.id];return!s||!p?null:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[SIDE_PLANES.map((Xs,ms)=>jsxRuntimeExports.jsx(Side,{layerId:`${Sa}-plane-${SIDE_PLANE_NAMES[ms]}`,featureId:`${Sc}-plane-${SIDE_PLANE_NAMES[ms]}`,planeLocal:Xs,fill:kt.fill,fillColor:kt.fillColor,outlineColor:kt.outlineColor,isActive:mt?!!z:!1,activeOutlineColor:kt.activeOutlineColor,trs:mn,availability:zi,distanceDisplayCondition:ba,hideIndicator:se},`${Sa}-plane-${SIDE_PLANE_NAMES[ms]}`)),BOX_EDGES.map((Xs,ms)=>jsxRuntimeExports.jsx(Edge,{featureId:`${Sc}-edge${Xs.isDraggable?"-draggable":""}-${ms}`,layerId:`${Sa}-edge${Xs.isDraggable?"-draggable":""}-${ms}`,index:ms,edge:Xs,isHovered:mt?lt===ms||!Xs.isDraggable&&!!z:!1,width:Xs.isDraggable&&mt?kt.draggableOutlineWidth:kt.outlineWidth,fillColor:Xs.isDraggable?kt.draggableOutlineColor:kt.outlineColor,hoverColor:mt?Xs.isDraggable?kt.activeDraggableOutlineColor:kt.activeOutlineColor:void 0,trs:mn,onMouseDown:Xs.isDraggable&&mt?ma:void 0,onMouseMove:Xs.isDraggable&&mt?yt:void 0,onMouseUp:Xs.isDraggable&&mt?nt:void 0,availability:zi,distanceDisplayCondition:ba,hideIndicator:se},`${Sa}-edge-${ms}`)),N&&SCALE_POINTS.map((Xs,ms)=>jsxRuntimeExports.jsx(ScalePoints,{layerId:`${Sa}-scale-point`,featureId:`${Sc}-scale-point`,index:ms,scalePoint:Xs,trs:mn,isHovered:mt?Pe===ms:!1,pointFillColor:mt?_i.pointFillColor:void 0,pointOutlineColor:mt?_i.pointOutlineColor:void 0,hoverPointOutlineColor:mt?_i.activePointOutlineColor:void 0,pointOutlineWidth:L,axisLineColor:_i.axisLineColor,axisLineWidth:F,dimensions:{width:pi,height:pi,length:pi},visiblePoint:N,visibleAxisLine:W&&Pe===ms,onPointMouseDown:mt?fa:void 0,onPointMouseMove:mt?La:void 0,onPointMouseUp:mt?Ra:void 0,availability:zi,distanceDisplayCondition:ba,hideIndicator:se},`${Sa}-scale-point-${ms}`))]})}),config$d={noLayer:!0};function Ellipse({id:t,isVisible:n,property:o,geometry:s,layer:c,feature:d}){const{show:h=!0}=o??{},p=React.useMemo(()=>(s==null?void 0:s.type)==="Point"?s.coordinates:void 0,[s==null?void 0:s.coordinates,s==null?void 0:s.type]),{heightReference:y,shadows:S,radius:P=1e3,fillColor:L,fill:F,classificationType:N}=o??{},{useTransition:W,translate:z}=(c==null?void 0:c.transition)??{},lt=React.useMemo(()=>p?Cesium$1.Cartesian3.fromDegrees(p[0],p[1],p[2]):void 0,[p]),Pe=React.useMemo(()=>W&&z?new Cesium$1.CallbackProperty(()=>Cesium$1.Cartesian3.fromDegrees(...z),!1):void 0,[W,z]),se=React.useMemo(()=>W?new Cesium$1.CallbackProperty(()=>P,!1):P,[P]),mt=React.useMemo(()=>toColor(L),[L]),kt=React.useMemo(()=>toTimeInterval(d==null?void 0:d.interval),[d==null?void 0:d.interval]),mn=React.useMemo(()=>toDistanceDisplayCondition(o==null?void 0:o.near,o==null?void 0:o.far),[o==null?void 0:o.near,o==null?void 0:o.far]);return!n||!lt||!h?null:jsxRuntimeExports.jsx(EntityExt,{id:t,position:Pe||lt,layerId:c==null?void 0:c.id,featureId:d==null?void 0:d.id,draggable:!0,availability:kt,properties:d==null?void 0:d.properties,children:jsxRuntimeExports.jsx(As$1,{semiMajorAxis:se,semiMinorAxis:se,material:mt,fill:F,heightReference:heightReference(y),classificationType:classificationType(N),shadows:shadowMode(S),distanceDisplayCondition:mn})})}const config$c={noLayer:!0};function Ellipsoid({id:t,isVisible:n,property:o,geometry:s,layer:c,feature:d}){const{show:h=!0}=o??{},p=React.useMemo(()=>(s==null?void 0:s.type)==="Point"?s.coordinates:o!=null&&o.position?[o.position.lng,o.position.lat,o.height??0]:o!=null&&o.location?[o.location.lng,o.location.lat,o.height??0]:void 0,[s==null?void 0:s.coordinates,s==null?void 0:s.type,o==null?void 0:o.height,o==null?void 0:o.location]),{heightReference:y,shadows:S,radius:P=1e3,fillColor:L}=o??{},F=React.useMemo(()=>p?Cesium$1.Cartesian3.fromDegrees(p[0],p[1],p[2]):void 0,[p]),N=React.useMemo(()=>new Cesium$1.Cartesian3(P,P,P),[P]),W=React.useMemo(()=>toColor$2(L),[L]),z=React.useMemo(()=>toTimeInterval(d==null?void 0:d.interval),[d==null?void 0:d.interval]),lt=React.useMemo(()=>toDistanceDisplayCondition(o==null?void 0:o.near,o==null?void 0:o.far),[o==null?void 0:o.near,o==null?void 0:o.far]);return!n||!F||!h?null:jsxRuntimeExports.jsx(EntityExt,{id:t,position:F,layerId:c==null?void 0:c.id,featureId:d==null?void 0:d.id,draggable:!0,legacyLocationPropertyKey:"default.position",availability:z,properties:d==null?void 0:d.properties,children:jsxRuntimeExports.jsx(Fs$1,{radii:N,material:W,heightReference:heightReference(y),shadows:shadowMode(S),distanceDisplayCondition:lt})})}const config$b={noLayer:!0},fragmentShaderSource=`in vec3 v_positionEC;
|
|
5841
5841
|
in vec3 v_normalEC;
|
|
5842
5842
|
in vec3 v_tangentEC;
|
|
5843
5843
|
in vec3 v_bitangentEC;
|
|
@@ -6742,7 +6742,7 @@ vec3 getTurboColormap(const float v) {
|
|
|
6742
6742
|
${reconstructPosition}
|
|
6743
6743
|
${turboColorMap}
|
|
6744
6744
|
${ambientOcclusionModulate}
|
|
6745
|
-
`,uniforms:{...pick(P,["color","frustumLength","blackPoint","whitePoint","gamma"]),globeDepthTexture:()=>(y==null?void 0:y())??F._depthTexture}});if(c){const N=createBilateralFilterStage({prefix:t,outputType:h,useGlobeDepth:p,getGlobeDepthTexture:y,uniforms:{textureScale:n,...pick(P,["frustumLength","normalExponent","depthExponent"])}}),W=new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion_generate_and_filter`,stages:[L,N]});return F.uniforms.ambientOcclusionTexture=W.name,new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion`,stages:[W,F],inputPreviousStageTexture:!1,uniforms:createUniforms([{stage:L,uniforms:["intensity","maxRadius","bias","frustumLength","focalLength"]},{stage:N,uniforms:["frustumLength","normalExponent","depthExponent"]},{stage:F,uniforms:["color","blackPoint","whitePoint","gamma"]}])})}else return F.uniforms.ambientOcclusionTexture=L.name,new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion`,stages:[L,F],inputPreviousStageTexture:!1,uniforms:createUniforms([{stage:L,uniforms:["intensity","maxRadius","bias","frustumLength","focalLength"]},{stage:F,uniforms:["color","blackPoint","whitePoint","gamma"]}])})}const AmbientOcclusionStage=({enabled:t=!0,textureScale:n,directions:o,steps:s,denoise:c,accurateNormalReconstruction:d,outputType:h,useGlobeDepth:p,...y})=>{const{viewer:S}=$e$1(),P=S==null?void 0:S.scene,L=useInstance({owner:P==null?void 0:P.postProcessStages,keys:[n,s,o,c,d,h,p],create:()=>{const F=createAmbientOcclusionStage({textureScale:n,steps:s,directions:o,denoise:c,accurateNormalReconstruction:d,outputType:h,useGlobeDepth:p,getGlobeDepthTexture:()=>P.context.uniformState.globeDepthTexture,uniforms:y});return F.enabled=t,F},transferOwnership:(F,N)=>(N==null||N.add(F),()=>{N==null||N.remove(F)})});return L.enabled=t,Object.assign(L.uniforms,y),P==null||P.requestRender(),usePreRender(()=>{const F=P==null?void 0:P.camera.frustum;if(F instanceof Cesium$1.PerspectiveFrustum){const N=1/Math.tan(F.fovy/2);L.uniforms.focalLength.x=N*F.aspectRatio,L.uniforms.focalLength.y=N}}),null},AmbientOcclusion=t=>{const n=$e$1(),[o,s]=React.useState(!1);return usePreRender(()=>{const c=n.scene;s(!(c!=null&&c.globe.depthTestAgainstTerrain));const{globeHeight:d}=c;if(!c||d==null)return;const h=c.camera.positionCartographic.height-d,p=c==null?void 0:c.camera.frustum;p instanceof Cesium$1.PerspectiveFrustum&&(c.camera.frustum.near=Cesium$1.Math.clamp(h-1,1,5)/Math.tan(p.fov/2))}),jsxRuntimeExports.jsx(AmbientOcclusionStage,{...t,useGlobeDepth:o})};var AmbientOcclusionOutputType=(t=>(t[t.Occlusion=1]="Occlusion",t[t.Normal=2]="Normal",t[t.Depth=3]="Depth",t[t.Weight=4]="Weight",t[t.Shade=5]="Shade",t))(AmbientOcclusionOutputType||{});const AMBIENT_OCCLUSION_QUALITY={low:{directions:4,steps:4,textureScale:.5,maxRadius:30},medium:{directions:4,steps:8,textureScale:.5,maxRadius:40},high:{directions:8,steps:8,textureScale:1,maxRadius:40},extreme:{directions:16,steps:16,textureScale:1,maxRadius:40}},DEFAULT_SKETCH_COLOR="#00bebe",DEFAULT_EDIT_COLOR="#3B3CD0",SELECTED_EDIT_COLOR="#FF9900",ADDING_POINT_COLOR="#3B3CD0";let drawPointImage,editPointImage,selectedPointImage,addingPointImage;const ControlPoint=({position:t,clampToGround:n=!1,index:o,isEditing:s,isSelected:c,isAddingPoint:d,isExtrudedControlPoint:h,handleControlPointMouseEvent:p})=>{const y=React.useRef(t);y.current=t;const S=useConstant$2(()=>new CallbackProperty((N,W)=>"getValue"in y.current?y.current.getValue(N,W):y.current,!1)),P=React.useMemo(()=>({position:S,billboard:{image:s?d?getAddingPointImage():c?getSelectedPointImage():getEditPointImage():getDrawPointImage(),width:s?16:8,height:s?16:8,heightReference:n?HeightReference$1.CLAMP_TO_GROUND:HeightReference$1.NONE,disableDepthTestDistance:1/0}}),[n,S,d,s,c]),L=React.useCallback(()=>{p==null||p(o,!!h,"mousedown")},[o,h,p]),F=React.useCallback(()=>{p==null||p(o,!!h,"click")},[o,h,p]);return jsxRuntimeExports.jsx(Is$1,{...P,onMouseDown:L,onClick:F})};function getDrawPointImage(){if(drawPointImage!=null)return drawPointImage;drawPointImage=document.createElement("canvas"),drawPointImage.width=16,drawPointImage.height=16;const t=drawPointImage.getContext("2d");return invariant$1(t!=null),t.fillStyle="white",t.fillRect(3,3,10,10),t.strokeStyle="black",t.lineWidth=2,t.strokeRect(3,3,10,10),drawPointImage}function getEditPointImage(){return getImage(editPointImage,{size:32,color:"white",strokeColor:DEFAULT_EDIT_COLOR})}function getSelectedPointImage(){return getImage(selectedPointImage,{size:32,color:"white",strokeColor:SELECTED_EDIT_COLOR})}function getAddingPointImage(){if(addingPointImage!=null)return addingPointImage;addingPointImage=document.createElement("canvas"),addingPointImage.width=32,addingPointImage.height=32;const t=addingPointImage.getContext("2d");return invariant$1(t!=null),t.beginPath(),t.arc(16,16,12,0,2*Math.PI),t.fillStyle="white",t.fill(),t.strokeStyle=ADDING_POINT_COLOR,t.lineWidth=4,t.stroke(),t.beginPath(),t.moveTo(16,8),t.lineTo(16,24),t.stroke(),t.moveTo(8,16),t.lineTo(24,16),t.stroke(),addingPointImage}function getImage(t,n){if(t!=null)return t;t=document.createElement("canvas"),t.width=n.size,t.height=n.size;const o=t.getContext("2d");return invariant$1(o!=null),o.beginPath(),o.arc(n.size/2,n.size/2,n.size/2-4,0,2*Math.PI),o.fillStyle=n.color,o.fill(),o.strokeStyle=n.strokeColor,o.lineWidth=4,o.stroke(),t}function assignForwardedRef(t,n){if(typeof t=="function")return t(n),()=>{t(null)};if(t!=null)return t.current=n,()=>{t.current=null}}const Entity=React.memo(React.forwardRef(({entities:t,...n},o)=>{const{viewer:s}=$e$1(),c=s==null?void 0:s.scene,d=s==null?void 0:s.entities,h=t??d,[p,y]=React.useState(()=>new Entity$1(n));return React.useEffect(()=>{y(new Entity$1(n))},[n.id]),React.useEffect(()=>(h==null||h.add(p),()=>{h==null||h.remove(p),c==null||c.requestRender()}),[c,h,p]),React.useEffect(()=>assignForwardedRef(o,p),[o,p]),Object.assign(p,omit(n,"id")),c==null||c.requestRender(),null})),textStyle={padding:"5px",color:"#fff",backgroundColor:"#000",borderRadius:"5px",lineHeight:1},MeasurementText=({children:t})=>jsxRuntimeExports.jsx("div",{style:textStyle,children:t}),MotionConfigContext=React.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),MotionContext=React.createContext({}),PresenceContext=React.createContext(null),isBrowser=typeof document<"u",useIsomorphicLayoutEffect$1=isBrowser?React.useLayoutEffect:React.useEffect,LazyContext=React.createContext({strict:!1}),camelToDash=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),optimizedAppearDataId="framerAppearId",optimizedAppearDataAttribute="data-"+camelToDash(optimizedAppearDataId),MotionGlobalConfig={skipAnimations:!1,useManualTiming:!1};class Queue{constructor(){this.order=[],this.scheduled=new Set}add(n){if(!this.scheduled.has(n))return this.scheduled.add(n),this.order.push(n),!0}remove(n){const o=this.order.indexOf(n);o!==-1&&(this.order.splice(o,1),this.scheduled.delete(n))}clear(){this.order.length=0,this.scheduled.clear()}}function createRenderStep(t){let n=new Queue,o=new Queue,s=0,c=!1,d=!1;const h=new WeakSet,p={schedule:(y,S=!1,P=!1)=>{const L=P&&c,F=L?n:o;return S&&h.add(y),F.add(y)&&L&&c&&(s=n.order.length),y},cancel:y=>{o.remove(y),h.delete(y)},process:y=>{if(c){d=!0;return}if(c=!0,[n,o]=[o,n],o.clear(),s=n.order.length,s)for(let S=0;S<s;S++){const P=n.order[S];h.has(P)&&(p.schedule(P),t()),P(y)}c=!1,d&&(d=!1,p.process(y))}};return p}const stepsOrder=["read","resolveKeyframes","update","preRender","render","postRender"],maxElapsed=40;function createRenderBatcher(t,n){let o=!1,s=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=stepsOrder.reduce((L,F)=>(L[F]=createRenderStep(()=>o=!0),L),{}),h=L=>{d[L].process(c)},p=()=>{const L=performance.now();o=!1,c.delta=s?1e3/60:Math.max(Math.min(L-c.timestamp,maxElapsed),1),c.timestamp=L,c.isProcessing=!0,stepsOrder.forEach(h),c.isProcessing=!1,o&&n&&(s=!1,t(p))},y=()=>{o=!0,s=!0,c.isProcessing||t(p)};return{schedule:stepsOrder.reduce((L,F)=>{const N=d[F];return L[F]=(W,z=!1,lt=!1)=>(o||y(),N.schedule(W,z,lt)),L},{}),cancel:L=>stepsOrder.forEach(F=>d[F].cancel(L)),state:c,steps:d}}const{schedule:microtask,cancel:cancelMicrotask}=createRenderBatcher(queueMicrotask,!1);function useVisualElement(t,n,o,s){const{visualElement:c}=React.useContext(MotionContext),d=React.useContext(LazyContext),h=React.useContext(PresenceContext),p=React.useContext(MotionConfigContext).reducedMotion,y=React.useRef();s=s||d.renderer,!y.current&&s&&(y.current=s(t,{visualState:n,parent:c,props:o,presenceContext:h,blockInitialAnimation:h?h.initial===!1:!1,reducedMotionConfig:p}));const S=y.current;React.useInsertionEffect(()=>{S&&S.update(o,h)});const P=React.useRef(!!(o[optimizedAppearDataAttribute]&&!window.HandoffComplete));return useIsomorphicLayoutEffect$1(()=>{S&&(microtask.postRender(S.render),P.current&&S.animationState&&S.animationState.animateChanges())}),React.useEffect(()=>{S&&(S.updateFeatures(),!P.current&&S.animationState&&S.animationState.animateChanges(),P.current&&(P.current=!1,window.HandoffComplete=!0))}),S}function isRefObject(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function useMotionRef(t,n,o){return React.useCallback(s=>{s&&t.mount&&t.mount(s),n&&(s?n.mount(s):n.unmount()),o&&(typeof o=="function"?o(s):isRefObject(o)&&(o.current=s))},[n])}function isVariantLabel(t){return typeof t=="string"||Array.isArray(t)}function isAnimationControls(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const variantPriorityOrder=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],variantProps=["initial",...variantPriorityOrder];function isControllingVariants(t){return isAnimationControls(t.animate)||variantProps.some(n=>isVariantLabel(t[n]))}function isVariantNode(t){return!!(isControllingVariants(t)||t.variants)}function getCurrentTreeVariants(t,n){if(isControllingVariants(t)){const{initial:o,animate:s}=t;return{initial:o===!1||isVariantLabel(o)?o:void 0,animate:isVariantLabel(s)?s:void 0}}return t.inherit!==!1?n:{}}function useCreateMotionContext(t){const{initial:n,animate:o}=getCurrentTreeVariants(t,React.useContext(MotionContext));return React.useMemo(()=>({initial:n,animate:o}),[variantLabelsAsDependency(n),variantLabelsAsDependency(o)])}function variantLabelsAsDependency(t){return Array.isArray(t)?t.join(" "):t}const featureProps={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},featureDefinitions={};for(const t in featureProps)featureDefinitions[t]={isEnabled:n=>featureProps[t].some(o=>!!n[o])};function loadFeatures(t){for(const n in t)featureDefinitions[n]={...featureDefinitions[n],...t[n]}}const LayoutGroupContext=React.createContext({}),SwitchLayoutGroupContext=React.createContext({}),motionComponentSymbol=Symbol.for("motionComponentSymbol");function createMotionComponent({preloadedFeatures:t,createVisualElement:n,useRender:o,useVisualState:s,Component:c}){t&&loadFeatures(t);function d(p,y){let S;const P={...React.useContext(MotionConfigContext),...p,layoutId:useLayoutId(p)},{isStatic:L}=P,F=useCreateMotionContext(p),N=s(p,L);if(!L&&isBrowser){F.visualElement=useVisualElement(c,N,P,n);const W=React.useContext(SwitchLayoutGroupContext),z=React.useContext(LazyContext).strict;F.visualElement&&(S=F.visualElement.loadFeatures(P,z,t,W))}return React__namespace.createElement(MotionContext.Provider,{value:F},S&&F.visualElement?React__namespace.createElement(S,{visualElement:F.visualElement,...P}):null,o(c,p,useMotionRef(N,F.visualElement,y),N,L,F.visualElement))}const h=React.forwardRef(d);return h[motionComponentSymbol]=c,h}function useLayoutId({layoutId:t}){const n=React.useContext(LayoutGroupContext).id;return n&&t!==void 0?n+"-"+t:t}function createMotionProxy(t){function n(s,c={}){return createMotionComponent(t(s,c))}if(typeof Proxy>"u")return n;const o=new Map;return new Proxy(n,{get:(s,c)=>(o.has(c)||o.set(c,n(c)),o.get(c))})}const lowercaseSVGElements=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function isSVGComponent(t){return typeof t!="string"||t.includes("-")?!1:!!(lowercaseSVGElements.indexOf(t)>-1||/[A-Z]/u.test(t))}const scaleCorrectors={};function addScaleCorrector(t){Object.assign(scaleCorrectors,t)}const transformPropOrder=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],transformProps=new Set(transformPropOrder);function isForcedMotionValue(t,{layout:n,layoutId:o}){return transformProps.has(t)||t.startsWith("origin")||(n||o!==void 0)&&(!!scaleCorrectors[t]||t==="opacity")}const isMotionValue=t=>!!(t&&t.getVelocity),translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},numTransforms=transformPropOrder.length;function buildTransform(t,{enableHardwareAcceleration:n=!0,allowTransformNone:o=!0},s,c){let d="";for(let h=0;h<numTransforms;h++){const p=transformPropOrder[h];if(t[p]!==void 0){const y=translateAlias[p]||p;d+=`${y}(${t[p]}) `}}return n&&!t.z&&(d+="translateZ(0)"),d=d.trim(),c?d=c(t,s?"":d):o&&s&&(d="none"),d}const checkStringStartsWith=t=>n=>typeof n=="string"&&n.startsWith(t),isCSSVariableName=checkStringStartsWith("--"),startsAsVariableToken=checkStringStartsWith("var(--"),isCSSVariableToken=t=>startsAsVariableToken(t)?singleCssVariableRegex.test(t.split("/*")[0].trim()):!1,singleCssVariableRegex=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,getValueAsType=(t,n)=>n&&typeof t=="number"?n.transform(t):t,clamp=(t,n,o)=>o>n?n:o<t?t:o,number={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},alpha={...number,transform:t=>clamp(0,1,t)},scale={...number,default:1},sanitize=t=>Math.round(t*1e5)/1e5,floatRegex=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,colorRegex=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,singleColorRegex=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function isString$1(t){return typeof t=="string"}const createUnitType=t=>({test:n=>isString$1(n)&&n.endsWith(t)&&n.split(" ").length===1,parse:parseFloat,transform:n=>`${n}${t}`}),degrees=createUnitType("deg"),percent=createUnitType("%"),px=createUnitType("px"),vh=createUnitType("vh"),vw=createUnitType("vw"),progressPercentage={...percent,parse:t=>percent.parse(t)/100,transform:t=>percent.transform(t*100)},int={...number,transform:Math.round},numberValueTypes={borderWidth:px,borderTopWidth:px,borderRightWidth:px,borderBottomWidth:px,borderLeftWidth:px,borderRadius:px,radius:px,borderTopLeftRadius:px,borderTopRightRadius:px,borderBottomRightRadius:px,borderBottomLeftRadius:px,width:px,maxWidth:px,height:px,maxHeight:px,size:px,top:px,right:px,bottom:px,left:px,padding:px,paddingTop:px,paddingRight:px,paddingBottom:px,paddingLeft:px,margin:px,marginTop:px,marginRight:px,marginBottom:px,marginLeft:px,rotate:degrees,rotateX:degrees,rotateY:degrees,rotateZ:degrees,scale,scaleX:scale,scaleY:scale,scaleZ:scale,skew:degrees,skewX:degrees,skewY:degrees,distance:px,translateX:px,translateY:px,translateZ:px,x:px,y:px,z:px,perspective:px,transformPerspective:px,opacity:alpha,originX:progressPercentage,originY:progressPercentage,originZ:px,zIndex:int,backgroundPositionX:px,backgroundPositionY:px,fillOpacity:alpha,strokeOpacity:alpha,numOctaves:int};function buildHTMLStyles(t,n,o,s){const{style:c,vars:d,transform:h,transformOrigin:p}=t;let y=!1,S=!1,P=!0;for(const L in n){const F=n[L];if(isCSSVariableName(L)){d[L]=F;continue}const N=numberValueTypes[L],W=getValueAsType(F,N);if(transformProps.has(L)){if(y=!0,h[L]=W,!P)continue;F!==(N.default||0)&&(P=!1)}else L.startsWith("origin")?(S=!0,p[L]=W):c[L]=W}if(n.transform||(y||s?c.transform=buildTransform(t.transform,o,P,s):c.transform&&(c.transform="none")),S){const{originX:L="50%",originY:F="50%",originZ:N=0}=p;c.transformOrigin=`${L} ${F} ${N}`}}const createHtmlRenderState=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function copyRawValuesOnly(t,n,o){for(const s in n)!isMotionValue(n[s])&&!isForcedMotionValue(s,o)&&(t[s]=n[s])}function useInitialMotionValues({transformTemplate:t},n,o){return React.useMemo(()=>{const s=createHtmlRenderState();return buildHTMLStyles(s,n,{enableHardwareAcceleration:!o},t),Object.assign({},s.vars,s.style)},[n])}function useStyle(t,n,o){const s=t.style||{},c={};return copyRawValuesOnly(c,s,t),Object.assign(c,useInitialMotionValues(t,n,o)),c}function useHTMLProps(t,n,o){const s={},c=useStyle(t,n,o);return t.drag&&t.dragListener!==!1&&(s.draggable=!1,c.userSelect=c.WebkitUserSelect=c.WebkitTouchCallout="none",c.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=c,s}const validMotionProps=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function isValidMotionProp(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||validMotionProps.has(t)}let shouldForward=t=>!isValidMotionProp(t);function loadExternalIsValidProp(t){t&&(shouldForward=n=>n.startsWith("on")?!isValidMotionProp(n):t(n))}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch(t){}function filterProps(t,n,o){const s={};for(const c in t)c==="values"&&typeof t.values=="object"||(shouldForward(c)||o===!0&&isValidMotionProp(c)||!n&&!isValidMotionProp(c)||t.draggable&&c.startsWith("onDrag"))&&(s[c]=t[c]);return s}function calcOrigin$1(t,n,o){return typeof t=="string"?t:px.transform(n+o*t)}function calcSVGTransformOrigin(t,n,o){const s=calcOrigin$1(n,t.x,t.width),c=calcOrigin$1(o,t.y,t.height);return`${s} ${c}`}const dashKeys={offset:"stroke-dashoffset",array:"stroke-dasharray"},camelKeys={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(t,n,o=1,s=0,c=!0){t.pathLength=1;const d=c?dashKeys:camelKeys;t[d.offset]=px.transform(-s);const h=px.transform(n),p=px.transform(o);t[d.array]=`${h} ${p}`}function buildSVGAttrs(t,{attrX:n,attrY:o,attrScale:s,originX:c,originY:d,pathLength:h,pathSpacing:p=1,pathOffset:y=0,...S},P,L,F){if(buildHTMLStyles(t,S,P,F),L){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:N,style:W,dimensions:z}=t;N.transform&&(z&&(W.transform=N.transform),delete N.transform),z&&(c!==void 0||d!==void 0||W.transform)&&(W.transformOrigin=calcSVGTransformOrigin(z,c!==void 0?c:.5,d!==void 0?d:.5)),n!==void 0&&(N.x=n),o!==void 0&&(N.y=o),s!==void 0&&(N.scale=s),h!==void 0&&buildSVGPath(N,h,p,y,!1)}const createSvgRenderState=()=>({...createHtmlRenderState(),attrs:{}}),isSVGTag=t=>typeof t=="string"&&t.toLowerCase()==="svg";function useSVGProps(t,n,o,s){const c=React.useMemo(()=>{const d=createSvgRenderState();return buildSVGAttrs(d,n,{enableHardwareAcceleration:!1},isSVGTag(s),t.transformTemplate),{...d.attrs,style:{...d.style}}},[n]);if(t.style){const d={};copyRawValuesOnly(d,t.style,t),c.style={...d,...c.style}}return c}function createUseRender(t=!1){return(o,s,c,{latestValues:d},h)=>{const y=(isSVGComponent(o)?useSVGProps:useHTMLProps)(s,d,h,o),S=filterProps(s,typeof o=="string",t),P=o!==React.Fragment?{...S,...y,ref:c}:{},{children:L}=s,F=React.useMemo(()=>isMotionValue(L)?L.get():L,[L]);return React.createElement(o,{...P,children:F})}}function renderHTML(t,{style:n,vars:o},s,c){Object.assign(t.style,n,c&&c.getProjectionStyles(s));for(const d in o)t.style.setProperty(d,o[d])}const camelCaseAttributes=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function renderSVG(t,n,o,s){renderHTML(t,n,void 0,s);for(const c in n.attrs)t.setAttribute(camelCaseAttributes.has(c)?c:camelToDash(c),n.attrs[c])}function scrapeMotionValuesFromProps$1(t,n,o){var s;const{style:c}=t,d={};for(const h in c)(isMotionValue(c[h])||n.style&&isMotionValue(n.style[h])||isForcedMotionValue(h,t)||((s=o==null?void 0:o.getValue(h))===null||s===void 0?void 0:s.liveStyle)!==void 0)&&(d[h]=c[h]);return d}function scrapeMotionValuesFromProps(t,n,o){const s=scrapeMotionValuesFromProps$1(t,n,o);for(const c in t)if(isMotionValue(t[c])||isMotionValue(n[c])){const d=transformPropOrder.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;s[d]=t[c]}return s}function resolveVariantFromProps(t,n,o,s={},c={}){return typeof n=="function"&&(n=n(o!==void 0?o:t.custom,s,c)),typeof n=="string"&&(n=t.variants&&t.variants[n]),typeof n=="function"&&(n=n(o!==void 0?o:t.custom,s,c)),n}function useConstant(t){const n=React.useRef(null);return n.current===null&&(n.current=t()),n.current}const isKeyframesTarget=t=>Array.isArray(t),isCustomValue=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),resolveFinalValueInKeyframes=t=>isKeyframesTarget(t)?t[t.length-1]||0:t;function resolveMotionValue(t){const n=isMotionValue(t)?t.get():t;return isCustomValue(n)?n.toValue():n}function makeState({scrapeMotionValuesFromProps:t,createRenderState:n,onMount:o},s,c,d){const h={latestValues:makeLatestValues(s,c,d,t),renderState:n()};return o&&(h.mount=p=>o(s,p,h)),h}const makeUseVisualState=t=>(n,o)=>{const s=React.useContext(MotionContext),c=React.useContext(PresenceContext),d=()=>makeState(t,n,s,c);return o?d():useConstant(d)};function makeLatestValues(t,n,o,s){const c={},d=s(t,{});for(const F in d)c[F]=resolveMotionValue(d[F]);let{initial:h,animate:p}=t;const y=isControllingVariants(t),S=isVariantNode(t);n&&S&&!y&&t.inherit!==!1&&(h===void 0&&(h=n.initial),p===void 0&&(p=n.animate));let P=o?o.initial===!1:!1;P=P||h===!1;const L=P?p:h;return L&&typeof L!="boolean"&&!isAnimationControls(L)&&(Array.isArray(L)?L:[L]).forEach(N=>{const W=resolveVariantFromProps(t,N);if(!W)return;const{transitionEnd:z,transition:lt,...Pe}=W;for(const se in Pe){let mt=Pe[se];if(Array.isArray(mt)){const kt=P?mt.length-1:0;mt=mt[kt]}mt!==null&&(c[se]=mt)}for(const se in z)c[se]=z[se]}),c}const noop$1=t=>t,{schedule:frame,cancel:cancelFrame,state:frameData,steps}=createRenderBatcher(typeof requestAnimationFrame<"u"?requestAnimationFrame:noop$1,!0),svgMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState,onMount:(t,n,{renderState:o,latestValues:s})=>{frame.read(()=>{try{o.dimensions=typeof n.getBBox=="function"?n.getBBox():n.getBoundingClientRect()}catch{o.dimensions={x:0,y:0,width:0,height:0}}}),frame.render(()=>{buildSVGAttrs(o,s,{enableHardwareAcceleration:!1},isSVGTag(n.tagName),t.transformTemplate),renderSVG(n,o)})}})},htmlMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState})};function createDomMotionConfig(t,{forwardMotionProps:n=!1},o,s){return{...isSVGComponent(t)?svgMotionConfig:htmlMotionConfig,preloadedFeatures:o,useRender:createUseRender(n),createVisualElement:s,Component:t}}function addDomEvent(t,n,o,s={passive:!0}){return t.addEventListener(n,o,s),()=>t.removeEventListener(n,o)}const isPrimaryPointer=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function extractEventInfo(t,n="page"){return{point:{x:t[n+"X"],y:t[n+"Y"]}}}const addPointerInfo=t=>n=>isPrimaryPointer(n)&&t(n,extractEventInfo(n));function addPointerEvent(t,n,o,s){return addDomEvent(t,n,addPointerInfo(o),s)}const combineFunctions=(t,n)=>o=>n(t(o)),pipe=(...t)=>t.reduce(combineFunctions);function createLock(t){let n=null;return()=>{const o=()=>{n=null};return n===null?(n=t,o):!1}}const globalHorizontalLock=createLock("dragHorizontal"),globalVerticalLock=createLock("dragVertical");function getGlobalLock(t){let n=!1;if(t==="y")n=globalVerticalLock();else if(t==="x")n=globalHorizontalLock();else{const o=globalHorizontalLock(),s=globalVerticalLock();o&&s?n=()=>{o(),s()}:(o&&o(),s&&s())}return n}function isDragActive(){const t=getGlobalLock(!0);return t?(t(),!1):!0}class Feature{constructor(n){this.isMounted=!1,this.node=n}update(){}}function addHoverEvent(t,n){const o="pointer"+(n?"enter":"leave"),s="onHover"+(n?"Start":"End"),c=(d,h)=>{if(d.pointerType==="touch"||isDragActive())return;const p=t.getProps();t.animationState&&p.whileHover&&t.animationState.setActive("whileHover",n),p[s]&&p[s](d,h)};return addPointerEvent(t.current,o,c,{passive:!t.getProps()[s]})}class HoverGesture extends Feature{mount(){this.unmount=pipe(addHoverEvent(this.node,!0),addHoverEvent(this.node,!1))}unmount(){}}class FocusGesture extends Feature{constructor(){super(...arguments),this.isActive=!1}onFocus(){let n=!1;try{n=this.node.current.matches(":focus-visible")}catch{n=!0}!n||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=pipe(addDomEvent(this.node.current,"focus",()=>this.onFocus()),addDomEvent(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const isNodeOrChild=(t,n)=>n?t===n?!0:isNodeOrChild(t,n.parentElement):!1;function fireSyntheticPointerEvent(t,n){if(!n)return;const o=new PointerEvent("pointer"+t);n(o,extractEventInfo(o))}class PressGesture extends Feature{constructor(){super(...arguments),this.removeStartListeners=noop$1,this.removeEndListeners=noop$1,this.removeAccessibleListeners=noop$1,this.startPointerPress=(n,o)=>{if(this.isPressing)return;this.removeEndListeners();const s=this.node.getProps(),d=addPointerEvent(window,"pointerup",(p,y)=>{if(!this.checkPressEnd())return;const{onTap:S,onTapCancel:P,globalTapTarget:L}=this.node.getProps();!L&&!isNodeOrChild(this.node.current,p.target)?P&&P(p,y):S&&S(p,y)},{passive:!(s.onTap||s.onPointerUp)}),h=addPointerEvent(window,"pointercancel",(p,y)=>this.cancelPress(p,y),{passive:!(s.onTapCancel||s.onPointerCancel)});this.removeEndListeners=pipe(d,h),this.startPress(n,o)},this.startAccessiblePress=()=>{const n=d=>{if(d.key!=="Enter"||this.isPressing)return;const h=p=>{p.key!=="Enter"||!this.checkPressEnd()||fireSyntheticPointerEvent("up",(y,S)=>{const{onTap:P}=this.node.getProps();P&&P(y,S)})};this.removeEndListeners(),this.removeEndListeners=addDomEvent(this.node.current,"keyup",h),fireSyntheticPointerEvent("down",(p,y)=>{this.startPress(p,y)})},o=addDomEvent(this.node.current,"keydown",n),s=()=>{this.isPressing&&fireSyntheticPointerEvent("cancel",(d,h)=>this.cancelPress(d,h))},c=addDomEvent(this.node.current,"blur",s);this.removeAccessibleListeners=pipe(o,c)}}startPress(n,o){this.isPressing=!0;const{onTapStart:s,whileTap:c}=this.node.getProps();c&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),s&&s(n,o)}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!isDragActive()}cancelPress(n,o){if(!this.checkPressEnd())return;const{onTapCancel:s}=this.node.getProps();s&&s(n,o)}mount(){const n=this.node.getProps(),o=addPointerEvent(n.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(n.onTapStart||n.onPointerStart)}),s=addDomEvent(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=pipe(o,s)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const observerCallbacks=new WeakMap,observers=new WeakMap,fireObserverCallback=t=>{const n=observerCallbacks.get(t.target);n&&n(t)},fireAllObserverCallbacks=t=>{t.forEach(fireObserverCallback)};function initIntersectionObserver({root:t,...n}){const o=t||document;observers.has(o)||observers.set(o,{});const s=observers.get(o),c=JSON.stringify(n);return s[c]||(s[c]=new IntersectionObserver(fireAllObserverCallbacks,{root:t,...n})),s[c]}function observeIntersection(t,n,o){const s=initIntersectionObserver(n);return observerCallbacks.set(t,o),s.observe(t),()=>{observerCallbacks.delete(t),s.unobserve(t)}}const thresholdNames={some:0,all:1};class InViewFeature extends Feature{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:n={}}=this.node.getProps(),{root:o,margin:s,amount:c="some",once:d}=n,h={root:o?o.current:void 0,rootMargin:s,threshold:typeof c=="number"?c:thresholdNames[c]},p=y=>{const{isIntersecting:S}=y;if(this.isInView===S||(this.isInView=S,d&&!S&&this.hasEnteredView))return;S&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",S);const{onViewportEnter:P,onViewportLeave:L}=this.node.getProps(),F=S?P:L;F&&F(y)};return observeIntersection(this.node.current,h,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:n,prevProps:o}=this.node;["amount","margin","root"].some(hasViewportOptionChanged(n,o))&&this.startObserver()}unmount(){}}function hasViewportOptionChanged({viewport:t={}},{viewport:n={}}={}){return o=>t[o]!==n[o]}const gestureAnimations={inView:{Feature:InViewFeature},tap:{Feature:PressGesture},focus:{Feature:FocusGesture},hover:{Feature:HoverGesture}};function shallowCompare(t,n){if(!Array.isArray(n))return!1;const o=n.length;if(o!==t.length)return!1;for(let s=0;s<o;s++)if(n[s]!==t[s])return!1;return!0}function getCurrent(t){const n={};return t.values.forEach((o,s)=>n[s]=o.get()),n}function getVelocity$1(t){const n={};return t.values.forEach((o,s)=>n[s]=o.getVelocity()),n}function resolveVariant(t,n,o){const s=t.getProps();return resolveVariantFromProps(s,n,o!==void 0?o:s.custom,getCurrent(t),getVelocity$1(t))}const secondsToMilliseconds=t=>t*1e3,millisecondsToSeconds=t=>t/1e3,underDampedSpring={type:"spring",stiffness:500,damping:25,restSpeed:10},criticallyDampedSpring=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),keyframesTransition={type:"keyframes",duration:.8},ease={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},getDefaultTransition=(t,{keyframes:n})=>n.length>2?keyframesTransition:transformProps.has(t)?t.startsWith("scale")?criticallyDampedSpring(n[1]):underDampedSpring:ease;function isTransitionDefined({when:t,delay:n,delayChildren:o,staggerChildren:s,staggerDirection:c,repeat:d,repeatType:h,repeatDelay:p,from:y,elapsed:S,...P}){return!!Object.keys(P).length}function getValueTransition(t,n){return t[n]||t.default||t}const isNotNull=t=>t!==null;function getFinalKeyframe(t,{repeat:n,repeatType:o="loop"},s){const c=t.filter(isNotNull),d=n&&o!=="loop"&&n%2===1?0:c.length-1;return!d||s===void 0?c[d]:s}let now;function clearTime(){now=void 0}const time={now:()=>(now===void 0&&time.set(frameData.isProcessing||MotionGlobalConfig.useManualTiming?frameData.timestamp:performance.now()),now),set:t=>{now=t,queueMicrotask(clearTime)}},isZeroValueString=t=>/^0[^.\s]+$/u.test(t);function isNone(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||isZeroValueString(t):!0}let warning=noop$1,invariant=noop$1;process.env.NODE_ENV!=="production"&&(warning=(t,n)=>{!t&&typeof console<"u"&&console.warn(n)},invariant=(t,n)=>{if(!t)throw new Error(n)});const isNumericalString=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),splitCSSVariableRegex=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function parseCSSVariable(t){const n=splitCSSVariableRegex.exec(t);if(!n)return[,];const[,o,s,c]=n;return[`--${o??s}`,c]}const maxDepth=4;function getVariableValue(t,n,o=1){invariant(o<=maxDepth,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[s,c]=parseCSSVariable(t);if(!s)return;const d=window.getComputedStyle(n).getPropertyValue(s);if(d){const h=d.trim();return isNumericalString(h)?parseFloat(h):h}return isCSSVariableToken(c)?getVariableValue(c,n,o+1):c}const positionalKeys=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),isNumOrPxType=t=>t===number||t===px,getPosFromMatrix=(t,n)=>parseFloat(t.split(", ")[n]),getTranslateFromMatrix=(t,n)=>(o,{transform:s})=>{if(s==="none"||!s)return 0;const c=s.match(/^matrix3d\((.+)\)$/u);if(c)return getPosFromMatrix(c[1],n);{const d=s.match(/^matrix\((.+)\)$/u);return d?getPosFromMatrix(d[1],t):0}},transformKeys=new Set(["x","y","z"]),nonTranslationalTransformKeys=transformPropOrder.filter(t=>!transformKeys.has(t));function removeNonTranslationalTransform(t){const n=[];return nonTranslationalTransformKeys.forEach(o=>{const s=t.getValue(o);s!==void 0&&(n.push([o,s.get()]),s.set(o.startsWith("scale")?1:0))}),n}const positionalValues={width:({x:t},{paddingLeft:n="0",paddingRight:o="0"})=>t.max-t.min-parseFloat(n)-parseFloat(o),height:({y:t},{paddingTop:n="0",paddingBottom:o="0"})=>t.max-t.min-parseFloat(n)-parseFloat(o),top:(t,{top:n})=>parseFloat(n),left:(t,{left:n})=>parseFloat(n),bottom:({y:t},{top:n})=>parseFloat(n)+(t.max-t.min),right:({x:t},{left:n})=>parseFloat(n)+(t.max-t.min),x:getTranslateFromMatrix(4,13),y:getTranslateFromMatrix(5,14)};positionalValues.translateX=positionalValues.x,positionalValues.translateY=positionalValues.y;const testValueType=t=>n=>n.test(t),auto={test:t=>t==="auto",parse:t=>t},dimensionValueTypes=[number,px,percent,degrees,vw,vh,auto],findDimensionValueType=t=>dimensionValueTypes.find(testValueType(t)),toResolve=new Set;let isScheduled=!1,anyNeedsMeasurement=!1;function measureAllKeyframes(){if(anyNeedsMeasurement){const t=Array.from(toResolve).filter(s=>s.needsMeasurement),n=new Set(t.map(s=>s.element)),o=new Map;n.forEach(s=>{removeNonTranslationalTransform(s).length&&(o.set(s,removeNonTranslationalTransform(s)),s.render())}),t.forEach(s=>s.measureInitialState()),n.forEach(s=>{s.render()}),t.forEach(s=>s.measureEndState()),t.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}anyNeedsMeasurement=!1,isScheduled=!1,toResolve.forEach(t=>t.complete()),toResolve.clear()}function readAllKeyframes(){toResolve.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(anyNeedsMeasurement=!0)})}function flushKeyframeResolvers(){readAllKeyframes(),measureAllKeyframes()}class KeyframeResolver{constructor(n,o,s,c,d,h=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...n],this.onComplete=o,this.name=s,this.motionValue=c,this.element=d,this.isAsync=h}scheduleResolve(){this.isScheduled=!0,this.isAsync?(toResolve.add(this),isScheduled||(isScheduled=!0,frame.read(readAllKeyframes),frame.resolveKeyframes(measureAllKeyframes))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:n,name:o,element:s,motionValue:c}=this;for(let d=0;d<n.length;d++)if(n[d]===null)if(d===0){const h=c==null?void 0:c.get(),p=n[n.length-1];if(h!==void 0)n[0]=h;else if(s&&o){const y=s.readValue(o,p);y!=null&&(n[0]=y)}n[0]===void 0&&(n[0]=p),c&&h===void 0&&c.set(n[0])}else n[d]=n[d-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),toResolve.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,toResolve.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const isColorString=(t,n)=>o=>!!(isString$1(o)&&singleColorRegex.test(o)&&o.startsWith(t)||n&&Object.prototype.hasOwnProperty.call(o,n)),splitColor=(t,n,o)=>s=>{if(!isString$1(s))return s;const[c,d,h,p]=s.match(floatRegex);return{[t]:parseFloat(c),[n]:parseFloat(d),[o]:parseFloat(h),alpha:p!==void 0?parseFloat(p):1}},clampRgbUnit=t=>clamp(0,255,t),rgbUnit={...number,transform:t=>Math.round(clampRgbUnit(t))},rgba={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:t,green:n,blue:o,alpha:s=1})=>"rgba("+rgbUnit.transform(t)+", "+rgbUnit.transform(n)+", "+rgbUnit.transform(o)+", "+sanitize(alpha.transform(s))+")"};function parseHex(t){let n="",o="",s="",c="";return t.length>5?(n=t.substring(1,3),o=t.substring(3,5),s=t.substring(5,7),c=t.substring(7,9)):(n=t.substring(1,2),o=t.substring(2,3),s=t.substring(3,4),c=t.substring(4,5),n+=n,o+=o,s+=s,c+=c),{red:parseInt(n,16),green:parseInt(o,16),blue:parseInt(s,16),alpha:c?parseInt(c,16)/255:1}}const hex={test:isColorString("#"),parse:parseHex,transform:rgba.transform},hsla={test:isColorString("hsl","hue"),parse:splitColor("hue","saturation","lightness"),transform:({hue:t,saturation:n,lightness:o,alpha:s=1})=>"hsla("+Math.round(t)+", "+percent.transform(sanitize(n))+", "+percent.transform(sanitize(o))+", "+sanitize(alpha.transform(s))+")"},color={test:t=>rgba.test(t)||hex.test(t)||hsla.test(t),parse:t=>rgba.test(t)?rgba.parse(t):hsla.test(t)?hsla.parse(t):hex.parse(t),transform:t=>isString$1(t)?t:t.hasOwnProperty("red")?rgba.transform(t):hsla.transform(t)};function test(t){var n,o;return isNaN(t)&&isString$1(t)&&(((n=t.match(floatRegex))===null||n===void 0?void 0:n.length)||0)+(((o=t.match(colorRegex))===null||o===void 0?void 0:o.length)||0)>0}const NUMBER_TOKEN="number",COLOR_TOKEN="color",VAR_TOKEN="var",VAR_FUNCTION_TOKEN="var(",SPLIT_TOKEN="${}",complexRegex=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function analyseComplexValue(t){const n=t.toString(),o=[],s={color:[],number:[],var:[]},c=[];let d=0;const p=n.replace(complexRegex,y=>(color.test(y)?(s.color.push(d),c.push(COLOR_TOKEN),o.push(color.parse(y))):y.startsWith(VAR_FUNCTION_TOKEN)?(s.var.push(d),c.push(VAR_TOKEN),o.push(y)):(s.number.push(d),c.push(NUMBER_TOKEN),o.push(parseFloat(y))),++d,SPLIT_TOKEN)).split(SPLIT_TOKEN);return{values:o,split:p,indexes:s,types:c}}function parseComplexValue(t){return analyseComplexValue(t).values}function createTransformer(t){const{split:n,types:o}=analyseComplexValue(t),s=n.length;return c=>{let d="";for(let h=0;h<s;h++)if(d+=n[h],c[h]!==void 0){const p=o[h];p===NUMBER_TOKEN?d+=sanitize(c[h]):p===COLOR_TOKEN?d+=color.transform(c[h]):d+=c[h]}return d}}const convertNumbersToZero=t=>typeof t=="number"?0:t;function getAnimatableNone$1(t){const n=parseComplexValue(t);return createTransformer(t)(n.map(convertNumbersToZero))}const complex={test,parse:parseComplexValue,createTransformer,getAnimatableNone:getAnimatableNone$1},maxDefaults=new Set(["brightness","contrast","saturate","opacity"]);function applyDefaultFilter(t){const[n,o]=t.slice(0,-1).split("(");if(n==="drop-shadow")return t;const[s]=o.match(floatRegex)||[];if(!s)return t;const c=o.replace(s,"");let d=maxDefaults.has(n)?1:0;return s!==o&&(d*=100),n+"("+d+c+")"}const functionRegex=/\b([a-z-]*)\(.*?\)/gu,filter={...complex,getAnimatableNone:t=>{const n=t.match(functionRegex);return n?n.map(applyDefaultFilter).join(" "):t}},defaultValueTypes={...numberValueTypes,color,backgroundColor:color,outlineColor:color,fill:color,stroke:color,borderColor:color,borderTopColor:color,borderRightColor:color,borderBottomColor:color,borderLeftColor:color,filter,WebkitFilter:filter},getDefaultValueType=t=>defaultValueTypes[t];function getAnimatableNone(t,n){let o=getDefaultValueType(t);return o!==filter&&(o=complex),o.getAnimatableNone?o.getAnimatableNone(n):void 0}function makeNoneKeyframesAnimatable(t,n,o){let s=0,c;for(;s<t.length&&!c;)typeof t[s]=="string"&&t[s]!=="none"&&t[s]!=="0"&&(c=t[s]),s++;if(c&&o)for(const d of n)t[d]=getAnimatableNone(o,c)}class DOMKeyframesResolver extends KeyframeResolver{constructor(n,o,s,c){super(n,o,s,c,c==null?void 0:c.owner,!0)}readKeyframes(){const{unresolvedKeyframes:n,element:o,name:s}=this;if(!o.current)return;super.readKeyframes();for(let y=0;y<n.length;y++){const S=n[y];if(typeof S=="string"&&isCSSVariableToken(S)){const P=getVariableValue(S,o.current);P!==void 0&&(n[y]=P)}}if(!positionalKeys.has(s)||n.length!==2)return this.resolveNoneKeyframes();const[c,d]=n,h=findDimensionValueType(c),p=findDimensionValueType(d);if(h!==p)if(isNumOrPxType(h)&&isNumOrPxType(p))for(let y=0;y<n.length;y++){const S=n[y];typeof S=="string"&&(n[y]=parseFloat(S))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:n,name:o}=this,s=[];for(let c=0;c<n.length;c++)isNone(n[c])&&s.push(c);s.length&&makeNoneKeyframesAnimatable(n,s,o)}measureInitialState(){const{element:n,unresolvedKeyframes:o,name:s}=this;if(!n.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=positionalValues[s](n.measureViewportBox(),window.getComputedStyle(n.current)),o[0]=this.measuredOrigin;const c=o[o.length-1];c!==void 0&&n.getValue(s,c).jump(c,!1)}measureEndState(){var n;const{element:o,name:s,unresolvedKeyframes:c}=this;if(!o.current)return;const d=o.getValue(s);d&&d.jump(this.measuredOrigin,!1);const h=c.length-1,p=c[h];c[h]=positionalValues[s](o.measureViewportBox(),window.getComputedStyle(o.current)),p!==null&&(this.finalKeyframe=p),!((n=this.removedTransforms)===null||n===void 0)&&n.length&&this.removedTransforms.forEach(([y,S])=>{o.getValue(y).set(S)}),this.resolveNoneKeyframes()}}function memo(t){let n;return()=>(n===void 0&&(n=t()),n)}const isAnimatable=(t,n)=>n==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(complex.test(t)||t==="0")&&!t.startsWith("url("));function hasKeyframesChanged(t){const n=t[0];if(t.length===1)return!0;for(let o=0;o<t.length;o++)if(t[o]!==n)return!0}function canAnimate(t,n,o,s){const c=t[0];if(c===null)return!1;const d=t[t.length-1],h=isAnimatable(c,n),p=isAnimatable(d,n);return warning(h===p,`You are trying to animate ${n} from "${c}" to "${d}". ${c} is not an animatable value - to enable this animation set ${c} to a value animatable to ${d} via the \`style\` property.`),!h||!p?!1:hasKeyframesChanged(t)||o==="spring"&&s}class BaseAnimation{constructor({autoplay:n=!0,delay:o=0,type:s="keyframes",repeat:c=0,repeatDelay:d=0,repeatType:h="loop",...p}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.options={autoplay:n,delay:o,type:s,repeat:c,repeatDelay:d,repeatType:h,...p},this.updateFinishedPromise()}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&flushKeyframeResolvers(),this._resolved}onKeyframesResolved(n,o){this.hasAttemptedResolve=!0;const{name:s,type:c,velocity:d,delay:h,onComplete:p,onUpdate:y,isGenerator:S}=this.options;if(!S&&!canAnimate(n,s,c,d))if(h)this.options.duration=0;else{y==null||y(getFinalKeyframe(n,this.options,o)),p==null||p(),this.resolveFinishedPromise();return}const P=this.initPlayback(n,o);P!==!1&&(this._resolved={keyframes:n,finalKeyframe:o,...P},this.onPostResolved())}onPostResolved(){}then(n,o){return this.currentFinishedPromise.then(n,o)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(n=>{this.resolveFinishedPromise=n})}}function velocityPerSecond(t,n){return n?t*(1e3/n):0}const velocitySampleDuration=5;function calcGeneratorVelocity(t,n,o){const s=Math.max(n-velocitySampleDuration,0);return velocityPerSecond(o-t(s),n-s)}const safeMin=.001,minDuration=.01,maxDuration$1=10,minDamping=.05,maxDamping=1;function findSpring({duration:t=800,bounce:n=.25,velocity:o=0,mass:s=1}){let c,d;warning(t<=secondsToMilliseconds(maxDuration$1),"Spring duration must be 10 seconds or less");let h=1-n;h=clamp(minDamping,maxDamping,h),t=clamp(minDuration,maxDuration$1,millisecondsToSeconds(t)),h<1?(c=S=>{const P=S*h,L=P*t,F=P-o,N=calcAngularFreq(S,h),W=Math.exp(-L);return safeMin-F/N*W},d=S=>{const L=S*h*t,F=L*o+o,N=Math.pow(h,2)*Math.pow(S,2)*t,W=Math.exp(-L),z=calcAngularFreq(Math.pow(S,2),h);return(-c(S)+safeMin>0?-1:1)*((F-N)*W)/z}):(c=S=>{const P=Math.exp(-S*t),L=(S-o)*t+1;return-.001+P*L},d=S=>{const P=Math.exp(-S*t),L=(o-S)*(t*t);return P*L});const p=5/t,y=approximateRoot(c,d,p);if(t=secondsToMilliseconds(t),isNaN(y))return{stiffness:100,damping:10,duration:t};{const S=Math.pow(y,2)*s;return{stiffness:S,damping:h*2*Math.sqrt(s*S),duration:t}}}const rootIterations=12;function approximateRoot(t,n,o){let s=o;for(let c=1;c<rootIterations;c++)s=s-t(s)/n(s);return s}function calcAngularFreq(t,n){return t*Math.sqrt(1-n*n)}const durationKeys=["duration","bounce"],physicsKeys=["stiffness","damping","mass"];function isSpringType(t,n){return n.some(o=>t[o]!==void 0)}function getSpringOptions(t){let n={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!isSpringType(t,physicsKeys)&&isSpringType(t,durationKeys)){const o=findSpring(t);n={...n,...o,mass:1},n.isResolvedFromDuration=!0}return n}function spring({keyframes:t,restDelta:n,restSpeed:o,...s}){const c=t[0],d=t[t.length-1],h={done:!1,value:c},{stiffness:p,damping:y,mass:S,duration:P,velocity:L,isResolvedFromDuration:F}=getSpringOptions({...s,velocity:-millisecondsToSeconds(s.velocity||0)}),N=L||0,W=y/(2*Math.sqrt(p*S)),z=d-c,lt=millisecondsToSeconds(Math.sqrt(p/S)),Pe=Math.abs(z)<5;o||(o=Pe?.01:2),n||(n=Pe?.005:.5);let se;if(W<1){const mt=calcAngularFreq(lt,W);se=kt=>{const mn=Math.exp(-W*lt*kt);return d-mn*((N+W*lt*z)/mt*Math.sin(mt*kt)+z*Math.cos(mt*kt))}}else if(W===1)se=mt=>d-Math.exp(-lt*mt)*(z+(N+lt*z)*mt);else{const mt=lt*Math.sqrt(W*W-1);se=kt=>{const mn=Math.exp(-W*lt*kt),_i=Math.min(mt*kt,300);return d-mn*((N+W*lt*z)*Math.sinh(_i)+mt*z*Math.cosh(_i))/mt}}return{calculatedDuration:F&&P||null,next:mt=>{const kt=se(mt);if(F)h.done=mt>=P;else{let mn=N;mt!==0&&(W<1?mn=calcGeneratorVelocity(se,mt,kt):mn=0);const _i=Math.abs(mn)<=o,zi=Math.abs(d-kt)<=n;h.done=_i&&zi}return h.value=h.done?d:kt,h}}}function inertia({keyframes:t,velocity:n=0,power:o=.8,timeConstant:s=325,bounceDamping:c=10,bounceStiffness:d=500,modifyTarget:h,min:p,max:y,restDelta:S=.5,restSpeed:P}){const L=t[0],F={done:!1,value:L},N=ba=>p!==void 0&&ba<p||y!==void 0&&ba>y,W=ba=>p===void 0?y:y===void 0||Math.abs(p-ba)<Math.abs(y-ba)?p:y;let z=o*n;const lt=L+z,Pe=h===void 0?lt:h(lt);Pe!==lt&&(z=Pe-L);const se=ba=>-z*Math.exp(-ba/s),mt=ba=>Pe+se(ba),kt=ba=>{const fa=se(ba),La=mt(ba);F.done=Math.abs(fa)<=S,F.value=F.done?Pe:La};let mn,_i;const zi=ba=>{N(F.value)&&(mn=ba,_i=spring({keyframes:[F.value,W(F.value)],velocity:calcGeneratorVelocity(mt,ba,F.value),damping:c,stiffness:d,restDelta:S,restSpeed:P}))};return zi(0),{calculatedDuration:null,next:ba=>{let fa=!1;return!_i&&mn===void 0&&(fa=!0,kt(ba),zi(ba)),mn!==void 0&&ba>=mn?_i.next(ba-mn):(!fa&&kt(ba),F)}}}const calcBezier=(t,n,o)=>(((1-3*o+3*n)*t+(3*o-6*n))*t+3*n)*t,subdivisionPrecision=1e-7,subdivisionMaxIterations=12;function binarySubdivide(t,n,o,s,c){let d,h,p=0;do h=n+(o-n)/2,d=calcBezier(h,s,c)-t,d>0?o=h:n=h;while(Math.abs(d)>subdivisionPrecision&&++p<subdivisionMaxIterations);return h}function cubicBezier(t,n,o,s){if(t===n&&o===s)return noop$1;const c=d=>binarySubdivide(d,0,1,t,o);return d=>d===0||d===1?d:calcBezier(c(d),n,s)}const easeIn=cubicBezier(.42,0,1,1),easeOut=cubicBezier(0,0,.58,1),easeInOut=cubicBezier(.42,0,.58,1),isEasingArray=t=>Array.isArray(t)&&typeof t[0]!="number",mirrorEasing=t=>n=>n<=.5?t(2*n)/2:(2-t(2*(1-n)))/2,reverseEasing=t=>n=>1-t(1-n),circIn=t=>1-Math.sin(Math.acos(t)),circOut=reverseEasing(circIn),circInOut=mirrorEasing(circIn),backOut=cubicBezier(.33,1.53,.69,.99),backIn=reverseEasing(backOut),backInOut=mirrorEasing(backIn),anticipate=t=>(t*=2)<1?.5*backIn(t):.5*(2-Math.pow(2,-10*(t-1))),easingLookup={linear:noop$1,easeIn,easeInOut,easeOut,circIn,circInOut,circOut,backIn,backInOut,backOut,anticipate},easingDefinitionToFunction=t=>{if(Array.isArray(t)){invariant(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[n,o,s,c]=t;return cubicBezier(n,o,s,c)}else if(typeof t=="string")return invariant(easingLookup[t]!==void 0,`Invalid easing type '${t}'`),easingLookup[t];return t},progress=(t,n,o)=>{const s=n-t;return s===0?1:(o-t)/s},mixNumber$1=(t,n,o)=>t+(n-t)*o;function hueToRgb(t,n,o){return o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+(n-t)*6*o:o<1/2?n:o<2/3?t+(n-t)*(2/3-o)*6:t}function hslaToRgba({hue:t,saturation:n,lightness:o,alpha:s}){t/=360,n/=100,o/=100;let c=0,d=0,h=0;if(!n)c=d=h=o;else{const p=o<.5?o*(1+n):o+n-o*n,y=2*o-p;c=hueToRgb(y,p,t+1/3),d=hueToRgb(y,p,t),h=hueToRgb(y,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(h*255),alpha:s}}const mixLinearColor=(t,n,o)=>{const s=t*t,c=o*(n*n-s)+s;return c<0?0:Math.sqrt(c)},colorTypes=[hex,rgba,hsla],getColorType=t=>colorTypes.find(n=>n.test(t));function asRGBA(t){const n=getColorType(t);invariant(!!n,`'${t}' is not an animatable color. Use the equivalent color code instead.`);let o=n.parse(t);return n===hsla&&(o=hslaToRgba(o)),o}const mixColor=(t,n)=>{const o=asRGBA(t),s=asRGBA(n),c={...o};return d=>(c.red=mixLinearColor(o.red,s.red,d),c.green=mixLinearColor(o.green,s.green,d),c.blue=mixLinearColor(o.blue,s.blue,d),c.alpha=mixNumber$1(o.alpha,s.alpha,d),rgba.transform(c))};function mixImmediate(t,n){return o=>o>0?n:t}function mixNumber(t,n){return o=>mixNumber$1(t,n,o)}function getMixer(t){return typeof t=="number"?mixNumber:typeof t=="string"?isCSSVariableToken(t)?mixImmediate:color.test(t)?mixColor:mixComplex:Array.isArray(t)?mixArray:typeof t=="object"?color.test(t)?mixColor:mixObject:mixImmediate}function mixArray(t,n){const o=[...t],s=o.length,c=t.map((d,h)=>getMixer(d)(d,n[h]));return d=>{for(let h=0;h<s;h++)o[h]=c[h](d);return o}}function mixObject(t,n){const o={...t,...n},s={};for(const c in o)t[c]!==void 0&&n[c]!==void 0&&(s[c]=getMixer(t[c])(t[c],n[c]));return c=>{for(const d in s)o[d]=s[d](c);return o}}function matchOrder(t,n){var o;const s=[],c={color:0,var:0,number:0};for(let d=0;d<n.values.length;d++){const h=n.types[d],p=t.indexes[h][c[h]],y=(o=t.values[p])!==null&&o!==void 0?o:0;s[d]=y,c[h]++}return s}const mixComplex=(t,n)=>{const o=complex.createTransformer(n),s=analyseComplexValue(t),c=analyseComplexValue(n);return s.indexes.var.length===c.indexes.var.length&&s.indexes.color.length===c.indexes.color.length&&s.indexes.number.length>=c.indexes.number.length?pipe(mixArray(matchOrder(s,c),c.values),o):(warning(!0,`Complex values '${t}' and '${n}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),mixImmediate(t,n))};function mix(t,n,o){return typeof t=="number"&&typeof n=="number"&&typeof o=="number"?mixNumber$1(t,n,o):getMixer(t)(t,n)}function createMixers(t,n,o){const s=[],c=o||mix,d=t.length-1;for(let h=0;h<d;h++){let p=c(t[h],t[h+1]);if(n){const y=Array.isArray(n)?n[h]||noop$1:n;p=pipe(y,p)}s.push(p)}return s}function interpolate(t,n,{clamp:o=!0,ease:s,mixer:c}={}){const d=t.length;if(invariant(d===n.length,"Both input and output ranges must be the same length"),d===1)return()=>n[0];if(d===2&&t[0]===t[1])return()=>n[1];t[0]>t[d-1]&&(t=[...t].reverse(),n=[...n].reverse());const h=createMixers(n,s,c),p=h.length,y=S=>{let P=0;if(p>1)for(;P<t.length-2&&!(S<t[P+1]);P++);const L=progress(t[P],t[P+1],S);return h[P](L)};return o?S=>y(clamp(t[0],t[d-1],S)):y}function fillOffset(t,n){const o=t[t.length-1];for(let s=1;s<=n;s++){const c=progress(0,n,s);t.push(mixNumber$1(o,1,c))}}function defaultOffset(t){const n=[0];return fillOffset(n,t.length-1),n}function convertOffsetToTimes(t,n){return t.map(o=>o*n)}function defaultEasing(t,n){return t.map(()=>n||easeInOut).splice(0,t.length-1)}function keyframes({duration:t=300,keyframes:n,times:o,ease:s="easeInOut"}){const c=isEasingArray(s)?s.map(easingDefinitionToFunction):easingDefinitionToFunction(s),d={done:!1,value:n[0]},h=convertOffsetToTimes(o&&o.length===n.length?o:defaultOffset(n),t),p=interpolate(h,n,{ease:Array.isArray(c)?c:defaultEasing(n,c)});return{calculatedDuration:t,next:y=>(d.value=p(y),d.done=y>=t,d)}}const maxGeneratorDuration=2e4;function calcGeneratorDuration(t){let n=0;const o=50;let s=t.next(n);for(;!s.done&&n<maxGeneratorDuration;)n+=o,s=t.next(n);return n>=maxGeneratorDuration?1/0:n}const frameloopDriver=t=>{const n=({timestamp:o})=>t(o);return{start:()=>frame.update(n,!0),stop:()=>cancelFrame(n),now:()=>frameData.isProcessing?frameData.timestamp:time.now()}},generators={decay:inertia,inertia,tween:keyframes,keyframes,spring},percentToProgress=t=>t/100;class MainThreadAnimation extends BaseAnimation{constructor({KeyframeResolver:n=KeyframeResolver,...o}){super(o),this.holdTime=null,this.startTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.state="idle";const{name:s,motionValue:c,keyframes:d}=this.options,h=(p,y)=>this.onKeyframesResolved(p,y);s&&c&&c.owner?this.resolver=c.owner.resolveKeyframes(d,h,s,c):this.resolver=new n(d,h,s,c),this.resolver.scheduleResolve()}initPlayback(n){const{type:o="keyframes",repeat:s=0,repeatDelay:c=0,repeatType:d,velocity:h=0}=this.options,p=generators[o]||keyframes;let y,S;p!==keyframes&&typeof n[0]!="number"&&(process.env.NODE_ENV!=="production"&&invariant(n.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${n}`),y=pipe(percentToProgress,mix(n[0],n[1])),n=[0,100]);const P=p({...this.options,keyframes:n});d==="mirror"&&(S=p({...this.options,keyframes:[...n].reverse(),velocity:-h})),P.calculatedDuration===null&&(P.calculatedDuration=calcGeneratorDuration(P));const{calculatedDuration:L}=P,F=L+c,N=F*(s+1)-c;return{generator:P,mirroredGenerator:S,mapPercentToKeyframes:y,calculatedDuration:L,resolvedDuration:F,totalDuration:N}}onPostResolved(){const{autoplay:n=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!n?this.pause():this.state=this.pendingPlayState}tick(n,o=!1){const{resolved:s}=this;if(!s){const{keyframes:ba}=this.options;return{done:!0,value:ba[ba.length-1]}}const{finalKeyframe:c,generator:d,mirroredGenerator:h,mapPercentToKeyframes:p,keyframes:y,calculatedDuration:S,totalDuration:P,resolvedDuration:L}=s;if(this.startTime===null)return d.next(0);const{delay:F,repeat:N,repeatType:W,repeatDelay:z,onUpdate:lt}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,n):this.speed<0&&(this.startTime=Math.min(n-P/this.speed,this.startTime)),o?this.currentTime=n:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(n-this.startTime)*this.speed;const Pe=this.currentTime-F*(this.speed>=0?1:-1),se=this.speed>=0?Pe<0:Pe>P;this.currentTime=Math.max(Pe,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=P);let mt=this.currentTime,kt=d;if(N){const ba=Math.min(this.currentTime,P)/L;let fa=Math.floor(ba),La=ba%1;!La&&ba>=1&&(La=1),La===1&&fa--,fa=Math.min(fa,N+1),!!(fa%2)&&(W==="reverse"?(La=1-La,z&&(La-=z/L)):W==="mirror"&&(kt=h)),mt=clamp(0,1,La)*L}const mn=se?{done:!1,value:y[0]}:kt.next(mt);p&&(mn.value=p(mn.value));let{done:_i}=mn;!se&&S!==null&&(_i=this.speed>=0?this.currentTime>=P:this.currentTime<=0);const zi=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&_i);return zi&&c!==void 0&&(mn.value=getFinalKeyframe(y,this.options,c)),lt&<(mn.value),zi&&this.finish(),mn}get duration(){const{resolved:n}=this;return n?millisecondsToSeconds(n.calculatedDuration):0}get time(){return millisecondsToSeconds(this.currentTime)}set time(n){n=secondsToMilliseconds(n),this.currentTime=n,this.holdTime!==null||this.speed===0?this.holdTime=n:this.driver&&(this.startTime=this.driver.now()-n/this.speed)}get speed(){return this.playbackSpeed}set speed(n){const o=this.playbackSpeed!==n;this.playbackSpeed=n,o&&(this.time=millisecondsToSeconds(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:n=frameloopDriver,onPlay:o}=this.options;this.driver||(this.driver=n(c=>this.tick(c))),o&&o();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:(!this.startTime||this.state==="finished")&&(this.startTime=s),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var n;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(n=this.currentTime)!==null&&n!==void 0?n:0}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:n}=this.options;n&&n()}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:n}=this.options;n&&n()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(n){return this.startTime=0,this.tick(n,!0)}}const isBezierDefinition=t=>Array.isArray(t)&&typeof t[0]=="number";function isWaapiSupportedEasing(t){return!!(!t||typeof t=="string"&&supportedWaapiEasing[t]||isBezierDefinition(t)||Array.isArray(t)&&t.every(isWaapiSupportedEasing))}const cubicBezierAsString=([t,n,o,s])=>`cubic-bezier(${t}, ${n}, ${o}, ${s})`,supportedWaapiEasing={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:cubicBezierAsString([0,.65,.55,1]),circOut:cubicBezierAsString([.55,0,1,.45]),backIn:cubicBezierAsString([.31,.01,.66,-.59]),backOut:cubicBezierAsString([.33,1.53,.69,.99])};function mapEasingToNativeEasing(t){if(t)return isBezierDefinition(t)?cubicBezierAsString(t):Array.isArray(t)?t.map(mapEasingToNativeEasing):supportedWaapiEasing[t]}function animateStyle(t,n,o,{delay:s=0,duration:c=300,repeat:d=0,repeatType:h="loop",ease:p,times:y}={}){const S={[n]:o};y&&(S.offset=y);const P=mapEasingToNativeEasing(p);return Array.isArray(P)&&(S.easing=P),t.animate(S,{delay:s,duration:c,easing:Array.isArray(P)?"linear":P,fill:"both",iterations:d+1,direction:h==="reverse"?"alternate":"normal"})}const supportsWaapi=memo(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),acceleratedValues=new Set(["opacity","clipPath","filter","transform"]),sampleDelta=10,maxDuration=2e4;function requiresPregeneratedKeyframes(t){return t.type==="spring"||t.name==="backgroundColor"||!isWaapiSupportedEasing(t.ease)}function pregenerateKeyframes(t,n){const o=new MainThreadAnimation({...n,keyframes:t,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:t[0]};const c=[];let d=0;for(;!s.done&&d<maxDuration;)s=o.sample(d),c.push(s.value),d+=sampleDelta;return{times:void 0,keyframes:c,duration:d-sampleDelta,ease:"linear"}}class AcceleratedAnimation extends BaseAnimation{constructor(n){super(n);const{name:o,motionValue:s,keyframes:c}=this.options;this.resolver=new DOMKeyframesResolver(c,(d,h)=>this.onKeyframesResolved(d,h),o,s),this.resolver.scheduleResolve()}initPlayback(n,o){var s;let{duration:c=300,times:d,ease:h,type:p,motionValue:y,name:S}=this.options;if(!(!((s=y.owner)===null||s===void 0)&&s.current))return!1;if(requiresPregeneratedKeyframes(this.options)){const{onComplete:L,onUpdate:F,motionValue:N,...W}=this.options,z=pregenerateKeyframes(n,W);n=z.keyframes,n.length===1&&(n[1]=n[0]),c=z.duration,d=z.times,h=z.ease,p="keyframes"}const P=animateStyle(y.owner.current,S,n,{...this.options,duration:c,times:d,ease:h});return P.startTime=time.now(),this.pendingTimeline?(P.timeline=this.pendingTimeline,this.pendingTimeline=void 0):P.onfinish=()=>{const{onComplete:L}=this.options;y.set(getFinalKeyframe(n,this.options,o)),L&&L(),this.cancel(),this.resolveFinishedPromise()},{animation:P,duration:c,times:d,type:p,ease:h,keyframes:n}}get duration(){const{resolved:n}=this;if(!n)return 0;const{duration:o}=n;return millisecondsToSeconds(o)}get time(){const{resolved:n}=this;if(!n)return 0;const{animation:o}=n;return millisecondsToSeconds(o.currentTime||0)}set time(n){const{resolved:o}=this;if(!o)return;const{animation:s}=o;s.currentTime=secondsToMilliseconds(n)}get speed(){const{resolved:n}=this;if(!n)return 1;const{animation:o}=n;return o.playbackRate}set speed(n){const{resolved:o}=this;if(!o)return;const{animation:s}=o;s.playbackRate=n}get state(){const{resolved:n}=this;if(!n)return"idle";const{animation:o}=n;return o.playState}attachTimeline(n){if(!this._resolved)this.pendingTimeline=n;else{const{resolved:o}=this;if(!o)return noop$1;const{animation:s}=o;s.timeline=n,s.onfinish=null}return noop$1}play(){if(this.isStopped)return;const{resolved:n}=this;if(!n)return;const{animation:o}=n;o.playState==="finished"&&this.updateFinishedPromise(),o.play()}pause(){const{resolved:n}=this;if(!n)return;const{animation:o}=n;o.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;const{resolved:n}=this;if(!n)return;const{animation:o,keyframes:s,duration:c,type:d,ease:h,times:p}=n;if(!(o.playState==="idle"||o.playState==="finished")){if(this.time){const{motionValue:y,onUpdate:S,onComplete:P,...L}=this.options,F=new MainThreadAnimation({...L,keyframes:s,duration:c,type:d,ease:h,times:p,isGenerator:!0}),N=secondsToMilliseconds(this.time);y.setWithVelocity(F.sample(N-sampleDelta).value,F.sample(N).value,sampleDelta)}this.cancel()}}complete(){const{resolved:n}=this;n&&n.animation.finish()}cancel(){const{resolved:n}=this;n&&n.animation.cancel()}static supports(n){const{motionValue:o,name:s,repeatDelay:c,repeatType:d,damping:h,type:p}=n;return supportsWaapi()&&s&&acceleratedValues.has(s)&&o&&o.owner&&o.owner.current instanceof HTMLElement&&!o.owner.getProps().onUpdate&&!c&&d!=="mirror"&&h!==0&&p!=="inertia"}}const animateMotionValue=(t,n,o,s={},c,d)=>h=>{const p=getValueTransition(s,t)||{},y=p.delay||s.delay||0;let{elapsed:S=0}=s;S=S-secondsToMilliseconds(y);let P={keyframes:Array.isArray(o)?o:[null,o],ease:"easeOut",velocity:n.getVelocity(),...p,delay:-S,onUpdate:F=>{n.set(F),p.onUpdate&&p.onUpdate(F)},onComplete:()=>{h(),p.onComplete&&p.onComplete()},name:t,motionValue:n,element:d?void 0:c};isTransitionDefined(p)||(P={...P,...getDefaultTransition(t,P)}),P.duration&&(P.duration=secondsToMilliseconds(P.duration)),P.repeatDelay&&(P.repeatDelay=secondsToMilliseconds(P.repeatDelay)),P.from!==void 0&&(P.keyframes[0]=P.from);let L=!1;if((P.type===!1||P.duration===0&&!P.repeatDelay)&&(P.duration=0,P.delay===0&&(L=!0)),L&&!d&&n.get()!==void 0){const F=getFinalKeyframe(P.keyframes,p);if(F!==void 0){frame.update(()=>{P.onUpdate(F),P.onComplete()});return}}return!d&&AcceleratedAnimation.supports(P)?new AcceleratedAnimation(P):new MainThreadAnimation(P)};function isWillChangeMotionValue(t){return!!(isMotionValue(t)&&t.add)}function addUniqueItem(t,n){t.indexOf(n)===-1&&t.push(n)}function removeItem(t,n){const o=t.indexOf(n);o>-1&&t.splice(o,1)}class SubscriptionManager{constructor(){this.subscriptions=[]}add(n){return addUniqueItem(this.subscriptions,n),()=>removeItem(this.subscriptions,n)}notify(n,o,s){const c=this.subscriptions.length;if(c)if(c===1)this.subscriptions[0](n,o,s);else for(let d=0;d<c;d++){const h=this.subscriptions[d];h&&h(n,o,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const warned=new Set;function warnOnce(t,n,o){t||warned.has(n)||(console.warn(n),warned.add(n))}const MAX_VELOCITY_DELTA=30,isFloat=t=>!isNaN(parseFloat(t));class MotionValue{constructor(n,o={}){this.version="11.0.27",this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(s,c=!0)=>{const d=time.now();this.updatedAt!==d&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(n),this.canTrackVelocity=isFloat(this.current),this.owner=o.owner}setCurrent(n){this.current=n,this.updatedAt=time.now()}setPrevFrameValue(n=this.current){this.prevFrameValue=n,this.prevUpdatedAt=this.updatedAt}onChange(n){return process.env.NODE_ENV!=="production"&&warnOnce(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",n)}on(n,o){this.events[n]||(this.events[n]=new SubscriptionManager);const s=this.events[n].add(o);return n==="change"?()=>{s(),frame.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const n in this.events)this.events[n].clear()}attach(n,o){this.passiveEffect=n,this.stopPassiveEffect=o}set(n,o=!0){!o||!this.passiveEffect?this.updateAndNotify(n,o):this.passiveEffect(n,this.updateAndNotify)}setWithVelocity(n,o,s){this.set(o),this.prev=void 0,this.prevFrameValue=n,this.prevUpdatedAt=this.updatedAt-s}jump(n,o=!0){this.updateAndNotify(n),this.prev=n,this.prevUpdatedAt=this.prevFrameValue=void 0,o&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const n=time.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||n-this.updatedAt>MAX_VELOCITY_DELTA)return 0;const o=Math.min(this.updatedAt-this.prevUpdatedAt,MAX_VELOCITY_DELTA);return velocityPerSecond(parseFloat(this.current)-parseFloat(this.prevFrameValue),o)}start(n){return this.stop(),new Promise(o=>{this.hasAnimated=!0,this.animation=n(o),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function motionValue(t,n){return new MotionValue(t,n)}function setMotionValue(t,n,o){t.hasValue(n)?t.getValue(n).set(o):t.addValue(n,motionValue(o))}function setTarget(t,n){const o=resolveVariant(t,n);let{transitionEnd:s={},transition:c={},...d}=o||{};d={...d,...s};for(const h in d){const p=resolveFinalValueInKeyframes(d[h]);setMotionValue(t,h,p)}}function shouldBlockAnimation({protectedKeys:t,needsAnimating:n},o){const s=t.hasOwnProperty(o)&&n[o]!==!0;return n[o]=!1,s}function animateTarget(t,n,{delay:o=0,transitionOverride:s,type:c}={}){var d;let{transition:h=t.getDefaultTransition(),transitionEnd:p,...y}=n;const S=t.getValue("willChange");s&&(h=s);const P=[],L=c&&t.animationState&&t.animationState.getState()[c];for(const F in y){const N=t.getValue(F,(d=t.latestValues[F])!==null&&d!==void 0?d:null),W=y[F];if(W===void 0||L&&shouldBlockAnimation(L,F))continue;const z={delay:o,elapsed:0,...getValueTransition(h||{},F)};let lt=!1;if(window.HandoffAppearAnimations){const se=t.getProps()[optimizedAppearDataAttribute];if(se){const mt=window.HandoffAppearAnimations(se,F);mt!==null&&(z.elapsed=mt,lt=!0)}}N.start(animateMotionValue(F,N,W,t.shouldReduceMotion&&transformProps.has(F)?{type:!1}:z,t,lt));const Pe=N.animation;Pe&&(isWillChangeMotionValue(S)&&(S.add(F),Pe.then(()=>S.remove(F))),P.push(Pe))}return p&&Promise.all(P).then(()=>{frame.update(()=>{p&&setTarget(t,p)})}),P}function animateVariant(t,n,o={}){var s;const c=resolveVariant(t,n,o.type==="exit"?(s=t.presenceContext)===null||s===void 0?void 0:s.custom:void 0);let{transition:d=t.getDefaultTransition()||{}}=c||{};o.transitionOverride&&(d=o.transitionOverride);const h=c?()=>Promise.all(animateTarget(t,c,o)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(S=0)=>{const{delayChildren:P=0,staggerChildren:L,staggerDirection:F}=d;return animateChildren(t,n,P+S,L,F,o)}:()=>Promise.resolve(),{when:y}=d;if(y){const[S,P]=y==="beforeChildren"?[h,p]:[p,h];return S().then(()=>P())}else return Promise.all([h(),p(o.delay)])}function animateChildren(t,n,o=0,s=0,c=1,d){const h=[],p=(t.variantChildren.size-1)*s,y=c===1?(S=0)=>S*s:(S=0)=>p-S*s;return Array.from(t.variantChildren).sort(sortByTreeOrder).forEach((S,P)=>{S.notify("AnimationStart",n),h.push(animateVariant(S,n,{...d,delay:o+y(P)}).then(()=>S.notify("AnimationComplete",n)))}),Promise.all(h)}function sortByTreeOrder(t,n){return t.sortNodePosition(n)}function animateVisualElement(t,n,o={}){t.notify("AnimationStart",n);let s;if(Array.isArray(n)){const c=n.map(d=>animateVariant(t,d,o));s=Promise.all(c)}else if(typeof n=="string")s=animateVariant(t,n,o);else{const c=typeof n=="function"?resolveVariant(t,n,o.custom):n;s=Promise.all(animateTarget(t,c,o))}return s.then(()=>{frame.postRender(()=>{t.notify("AnimationComplete",n)})})}const reversePriorityOrder=[...variantPriorityOrder].reverse(),numAnimationTypes=variantPriorityOrder.length;function animateList(t){return n=>Promise.all(n.map(({animation:o,options:s})=>animateVisualElement(t,o,s)))}function createAnimationState(t){let n=animateList(t);const o=createState();let s=!0;const c=y=>(S,P)=>{var L;const F=resolveVariant(t,P,y==="exit"?(L=t.presenceContext)===null||L===void 0?void 0:L.custom:void 0);if(F){const{transition:N,transitionEnd:W,...z}=F;S={...S,...z,...W}}return S};function d(y){n=y(t)}function h(y){const S=t.getProps(),P=t.getVariantContext(!0)||{},L=[],F=new Set;let N={},W=1/0;for(let lt=0;lt<numAnimationTypes;lt++){const Pe=reversePriorityOrder[lt],se=o[Pe],mt=S[Pe]!==void 0?S[Pe]:P[Pe],kt=isVariantLabel(mt),mn=Pe===y?se.isActive:null;mn===!1&&(W=lt);let _i=mt===P[Pe]&&mt!==S[Pe]&&kt;if(_i&&s&&t.manuallyAnimateOnMount&&(_i=!1),se.protectedKeys={...N},!se.isActive&&mn===null||!mt&&!se.prevProp||isAnimationControls(mt)||typeof mt=="boolean")continue;let ba=checkVariantsDidChange(se.prevProp,mt)||Pe===y&&se.isActive&&!_i&&kt||lt>W&&kt,fa=!1;const La=Array.isArray(mt)?mt:[mt];let Ra=La.reduce(c(Pe),{});mn===!1&&(Ra={});const{prevResolvedValues:ma={}}=se,yt={...ma,...Ra},nt=pi=>{ba=!0,F.has(pi)&&(fa=!0,F.delete(pi)),se.needsAnimating[pi]=!0;const Sa=t.getValue(pi);Sa&&(Sa.liveStyle=!1)};for(const pi in yt){const Sa=Ra[pi],Sc=ma[pi];if(N.hasOwnProperty(pi))continue;let Xs=!1;isKeyframesTarget(Sa)&&isKeyframesTarget(Sc)?Xs=!shallowCompare(Sa,Sc):Xs=Sa!==Sc,Xs?Sa!=null?nt(pi):F.add(pi):Sa!==void 0&&F.has(pi)?nt(pi):se.protectedKeys[pi]=!0}se.prevProp=mt,se.prevResolvedValues=Ra,se.isActive&&(N={...N,...Ra}),s&&t.blockInitialAnimation&&(ba=!1),ba&&(!_i||fa)&&L.push(...La.map(pi=>({animation:pi,options:{type:Pe}})))}if(F.size){const lt={};F.forEach(Pe=>{const se=t.getBaseTarget(Pe),mt=t.getValue(Pe);mt&&(mt.liveStyle=!0),lt[Pe]=se===void 0?null:se}),L.push({animation:lt})}let z=!!L.length;return s&&(S.initial===!1||S.initial===S.animate)&&!t.manuallyAnimateOnMount&&(z=!1),s=!1,z?n(L):Promise.resolve()}function p(y,S){var P;if(o[y].isActive===S)return Promise.resolve();(P=t.variantChildren)===null||P===void 0||P.forEach(F=>{var N;return(N=F.animationState)===null||N===void 0?void 0:N.setActive(y,S)}),o[y].isActive=S;const L=h(y);for(const F in o)o[F].protectedKeys={};return L}return{animateChanges:h,setActive:p,setAnimateFunction:d,getState:()=>o}}function checkVariantsDidChange(t,n){return typeof n=="string"?n!==t:Array.isArray(n)?!shallowCompare(n,t):!1}function createTypeState(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function createState(){return{animate:createTypeState(!0),whileInView:createTypeState(),whileHover:createTypeState(),whileTap:createTypeState(),whileDrag:createTypeState(),whileFocus:createTypeState(),exit:createTypeState()}}class AnimationFeature extends Feature{constructor(n){super(n),n.animationState||(n.animationState=createAnimationState(n))}updateAnimationControlsSubscription(){const{animate:n}=this.node.getProps();this.unmount(),isAnimationControls(n)&&(this.unmount=n.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:n}=this.node.getProps(),{animate:o}=this.node.prevProps||{};n!==o&&this.updateAnimationControlsSubscription()}unmount(){}}let id$1=0;class ExitAnimationFeature extends Feature{constructor(){super(...arguments),this.id=id$1++}update(){if(!this.node.presenceContext)return;const{isPresent:n,onExitComplete:o}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||n===s)return;const c=this.node.animationState.setActive("exit",!n);o&&!n&&c.then(()=>o(this.id))}mount(){const{register:n}=this.node.presenceContext||{};n&&(this.unmount=n(this.id))}unmount(){}}const animations={animation:{Feature:AnimationFeature},exit:{Feature:ExitAnimationFeature}},distance=(t,n)=>Math.abs(t-n);function distance2D(t,n){const o=distance(t.x,n.x),s=distance(t.y,n.y);return Math.sqrt(o**2+s**2)}class PanSession{constructor(n,o,{transformPagePoint:s,contextWindow:c,dragSnapToOrigin:d=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const L=getPanInfo(this.lastMoveEventInfo,this.history),F=this.startEvent!==null,N=distance2D(L.offset,{x:0,y:0})>=3;if(!F&&!N)return;const{point:W}=L,{timestamp:z}=frameData;this.history.push({...W,timestamp:z});const{onStart:lt,onMove:Pe}=this.handlers;F||(lt&<(this.lastMoveEvent,L),this.startEvent=this.lastMoveEvent),Pe&&Pe(this.lastMoveEvent,L)},this.handlePointerMove=(L,F)=>{this.lastMoveEvent=L,this.lastMoveEventInfo=transformPoint(F,this.transformPagePoint),frame.update(this.updatePoint,!0)},this.handlePointerUp=(L,F)=>{this.end();const{onEnd:N,onSessionEnd:W,resumeAnimation:z}=this.handlers;if(this.dragSnapToOrigin&&z&&z(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const lt=getPanInfo(L.type==="pointercancel"?this.lastMoveEventInfo:transformPoint(F,this.transformPagePoint),this.history);this.startEvent&&N&&N(L,lt),W&&W(L,lt)},!isPrimaryPointer(n))return;this.dragSnapToOrigin=d,this.handlers=o,this.transformPagePoint=s,this.contextWindow=c||window;const h=extractEventInfo(n),p=transformPoint(h,this.transformPagePoint),{point:y}=p,{timestamp:S}=frameData;this.history=[{...y,timestamp:S}];const{onSessionStart:P}=o;P&&P(n,getPanInfo(p,this.history)),this.removeListeners=pipe(addPointerEvent(this.contextWindow,"pointermove",this.handlePointerMove),addPointerEvent(this.contextWindow,"pointerup",this.handlePointerUp),addPointerEvent(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(n){this.handlers=n}end(){this.removeListeners&&this.removeListeners(),cancelFrame(this.updatePoint)}}function transformPoint(t,n){return n?{point:n(t.point)}:t}function subtractPoint(t,n){return{x:t.x-n.x,y:t.y-n.y}}function getPanInfo({point:t},n){return{point:t,delta:subtractPoint(t,lastDevicePoint(n)),offset:subtractPoint(t,startDevicePoint(n)),velocity:getVelocity(n,.1)}}function startDevicePoint(t){return t[0]}function lastDevicePoint(t){return t[t.length-1]}function getVelocity(t,n){if(t.length<2)return{x:0,y:0};let o=t.length-1,s=null;const c=lastDevicePoint(t);for(;o>=0&&(s=t[o],!(c.timestamp-s.timestamp>secondsToMilliseconds(n)));)o--;if(!s)return{x:0,y:0};const d=millisecondsToSeconds(c.timestamp-s.timestamp);if(d===0)return{x:0,y:0};const h={x:(c.x-s.x)/d,y:(c.y-s.y)/d};return h.x===1/0&&(h.x=0),h.y===1/0&&(h.y=0),h}function calcLength(t){return t.max-t.min}function isNear(t,n=0,o=.01){return Math.abs(t-n)<=o}function calcAxisDelta(t,n,o,s=.5){t.origin=s,t.originPoint=mixNumber$1(n.min,n.max,t.origin),t.scale=calcLength(o)/calcLength(n),(isNear(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=mixNumber$1(o.min,o.max,t.origin)-t.originPoint,(isNear(t.translate)||isNaN(t.translate))&&(t.translate=0)}function calcBoxDelta(t,n,o,s){calcAxisDelta(t.x,n.x,o.x,s?s.originX:void 0),calcAxisDelta(t.y,n.y,o.y,s?s.originY:void 0)}function calcRelativeAxis(t,n,o){t.min=o.min+n.min,t.max=t.min+calcLength(n)}function calcRelativeBox(t,n,o){calcRelativeAxis(t.x,n.x,o.x),calcRelativeAxis(t.y,n.y,o.y)}function calcRelativeAxisPosition(t,n,o){t.min=n.min-o.min,t.max=t.min+calcLength(n)}function calcRelativePosition(t,n,o){calcRelativeAxisPosition(t.x,n.x,o.x),calcRelativeAxisPosition(t.y,n.y,o.y)}function applyConstraints(t,{min:n,max:o},s){return n!==void 0&&t<n?t=s?mixNumber$1(n,t,s.min):Math.max(t,n):o!==void 0&&t>o&&(t=s?mixNumber$1(o,t,s.max):Math.min(t,o)),t}function calcRelativeAxisConstraints(t,n,o){return{min:n!==void 0?t.min+n:void 0,max:o!==void 0?t.max+o-(t.max-t.min):void 0}}function calcRelativeConstraints(t,{top:n,left:o,bottom:s,right:c}){return{x:calcRelativeAxisConstraints(t.x,o,c),y:calcRelativeAxisConstraints(t.y,n,s)}}function calcViewportAxisConstraints(t,n){let o=n.min-t.min,s=n.max-t.max;return n.max-n.min<t.max-t.min&&([o,s]=[s,o]),{min:o,max:s}}function calcViewportConstraints(t,n){return{x:calcViewportAxisConstraints(t.x,n.x),y:calcViewportAxisConstraints(t.y,n.y)}}function calcOrigin(t,n){let o=.5;const s=calcLength(t),c=calcLength(n);return c>s?o=progress(n.min,n.max-s,t.min):s>c&&(o=progress(t.min,t.max-c,n.min)),clamp(0,1,o)}function rebaseAxisConstraints(t,n){const o={};return n.min!==void 0&&(o.min=n.min-t.min),n.max!==void 0&&(o.max=n.max-t.min),o}const defaultElastic=.35;function resolveDragElastic(t=defaultElastic){return t===!1?t=0:t===!0&&(t=defaultElastic),{x:resolveAxisElastic(t,"left","right"),y:resolveAxisElastic(t,"top","bottom")}}function resolveAxisElastic(t,n,o){return{min:resolvePointElastic(t,n),max:resolvePointElastic(t,o)}}function resolvePointElastic(t,n){return typeof t=="number"?t:t[n]||0}const createAxisDelta=()=>({translate:0,scale:1,origin:0,originPoint:0}),createDelta=()=>({x:createAxisDelta(),y:createAxisDelta()}),createAxis=()=>({min:0,max:0}),createBox=()=>({x:createAxis(),y:createAxis()});function eachAxis(t){return[t("x"),t("y")]}function convertBoundingBoxToBox({top:t,left:n,right:o,bottom:s}){return{x:{min:n,max:o},y:{min:t,max:s}}}function convertBoxToBoundingBox({x:t,y:n}){return{top:n.min,right:t.max,bottom:n.max,left:t.min}}function transformBoxPoints(t,n){if(!n)return t;const o=n({x:t.left,y:t.top}),s=n({x:t.right,y:t.bottom});return{top:o.y,left:o.x,bottom:s.y,right:s.x}}function isIdentityScale(t){return t===void 0||t===1}function hasScale({scale:t,scaleX:n,scaleY:o}){return!isIdentityScale(t)||!isIdentityScale(n)||!isIdentityScale(o)}function hasTransform(t){return hasScale(t)||has2DTranslate(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function has2DTranslate(t){return is2DTranslate(t.x)||is2DTranslate(t.y)}function is2DTranslate(t){return t&&t!=="0%"}function scalePoint(t,n,o){const s=t-o,c=n*s;return o+c}function applyPointDelta(t,n,o,s,c){return c!==void 0&&(t=scalePoint(t,c,s)),scalePoint(t,o,s)+n}function applyAxisDelta(t,n=0,o=1,s,c){t.min=applyPointDelta(t.min,n,o,s,c),t.max=applyPointDelta(t.max,n,o,s,c)}function applyBoxDelta(t,{x:n,y:o}){applyAxisDelta(t.x,n.translate,n.scale,n.originPoint),applyAxisDelta(t.y,o.translate,o.scale,o.originPoint)}function applyTreeDeltas(t,n,o,s=!1){const c=o.length;if(!c)return;n.x=n.y=1;let d,h;for(let p=0;p<c;p++){d=o[p],h=d.projectionDelta;const y=d.instance;y&&y.style&&y.style.display==="contents"||(s&&d.options.layoutScroll&&d.scroll&&d!==d.root&&transformBox(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),h&&(n.x*=h.x.scale,n.y*=h.y.scale,applyBoxDelta(t,h)),s&&hasTransform(d.latestValues)&&transformBox(t,d.latestValues))}n.x=snapToDefault(n.x),n.y=snapToDefault(n.y)}function snapToDefault(t){return Number.isInteger(t)||t>1.0000000000001||t<.999999999999?t:1}function translateAxis(t,n){t.min=t.min+n,t.max=t.max+n}function transformAxis(t,n,[o,s,c]){const d=n[c]!==void 0?n[c]:.5,h=mixNumber$1(t.min,t.max,d);applyAxisDelta(t,n[o],n[s],h,n.scale)}const xKeys$1=["x","scaleX","originX"],yKeys$1=["y","scaleY","originY"];function transformBox(t,n){transformAxis(t.x,n,xKeys$1),transformAxis(t.y,n,yKeys$1)}function measureViewportBox(t,n){return convertBoundingBoxToBox(transformBoxPoints(t.getBoundingClientRect(),n))}function measurePageBox(t,n,o){const s=measureViewportBox(t,o),{scroll:c}=n;return c&&(translateAxis(s.x,c.offset.x),translateAxis(s.y,c.offset.y)),s}const getContextWindow=({current:t})=>t?t.ownerDocument.defaultView:null,elementDragControls=new WeakMap;class VisualElementDragControls{constructor(n){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=createBox(),this.visualElement=n}start(n,{snapToCursor:o=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const c=P=>{const{dragSnapToOrigin:L}=this.getProps();L?this.pauseAnimation():this.stopAnimation(),o&&this.snapToCursor(extractEventInfo(P,"page").point)},d=(P,L)=>{const{drag:F,dragPropagation:N,onDragStart:W}=this.getProps();if(F&&!N&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=getGlobalLock(F),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),eachAxis(lt=>{let Pe=this.getAxisMotionValue(lt).get()||0;if(percent.test(Pe)){const{projection:se}=this.visualElement;if(se&&se.layout){const mt=se.layout.layoutBox[lt];mt&&(Pe=calcLength(mt)*(parseFloat(Pe)/100))}}this.originPoint[lt]=Pe}),W&&W(P,L);const{animationState:z}=this.visualElement;z&&z.setActive("whileDrag",!0)},h=(P,L)=>{const{dragPropagation:F,dragDirectionLock:N,onDirectionLock:W,onDrag:z}=this.getProps();if(!F&&!this.openGlobalLock)return;const{offset:lt}=L;if(N&&this.currentDirection===null){this.currentDirection=getCurrentDirection(lt),this.currentDirection!==null&&W&&W(this.currentDirection);return}this.updateAxis("x",L.point,lt),this.updateAxis("y",L.point,lt),this.visualElement.render(),z&&z(P,L)},p=(P,L)=>this.stop(P,L),y=()=>eachAxis(P=>{var L;return this.getAnimationState(P)==="paused"&&((L=this.getAxisMotionValue(P).animation)===null||L===void 0?void 0:L.play())}),{dragSnapToOrigin:S}=this.getProps();this.panSession=new PanSession(n,{onSessionStart:c,onStart:d,onMove:h,onSessionEnd:p,resumeAnimation:y},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:S,contextWindow:getContextWindow(this.visualElement)})}stop(n,o){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:c}=o;this.startAnimation(c);const{onDragEnd:d}=this.getProps();d&&d(n,o)}cancel(){this.isDragging=!1;const{projection:n,animationState:o}=this.visualElement;n&&(n.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),o&&o.setActive("whileDrag",!1)}updateAxis(n,o,s){const{drag:c}=this.getProps();if(!s||!shouldDrag(n,c,this.currentDirection))return;const d=this.getAxisMotionValue(n);let h=this.originPoint[n]+s[n];this.constraints&&this.constraints[n]&&(h=applyConstraints(h,this.constraints[n],this.elastic[n])),d.set(h)}resolveConstraints(){var n;const{dragConstraints:o,dragElastic:s}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(n=this.visualElement.projection)===null||n===void 0?void 0:n.layout,d=this.constraints;o&&isRefObject(o)?this.constraints||(this.constraints=this.resolveRefConstraints()):o&&c?this.constraints=calcRelativeConstraints(c.layoutBox,o):this.constraints=!1,this.elastic=resolveDragElastic(s),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&eachAxis(h=>{this.getAxisMotionValue(h)&&(this.constraints[h]=rebaseAxisConstraints(c.layoutBox[h],this.constraints[h]))})}resolveRefConstraints(){const{dragConstraints:n,onMeasureDragConstraints:o}=this.getProps();if(!n||!isRefObject(n))return!1;const s=n.current;invariant(s!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=measurePageBox(s,c.root,this.visualElement.getTransformPagePoint());let h=calcViewportConstraints(c.layout.layoutBox,d);if(o){const p=o(convertBoxToBoundingBox(h));this.hasMutatedConstraints=!!p,p&&(h=convertBoundingBoxToBox(p))}return h}startAnimation(n){const{drag:o,dragMomentum:s,dragElastic:c,dragTransition:d,dragSnapToOrigin:h,onDragTransitionEnd:p}=this.getProps(),y=this.constraints||{},S=eachAxis(P=>{if(!shouldDrag(P,o,this.currentDirection))return;let L=y[P]||{};h&&(L={min:0,max:0});const F=c?200:1e6,N=c?40:1e7,W={type:"inertia",velocity:s?n[P]:0,bounceStiffness:F,bounceDamping:N,timeConstant:750,restDelta:1,restSpeed:10,...d,...L};return this.startAxisValueAnimation(P,W)});return Promise.all(S).then(p)}startAxisValueAnimation(n,o){const s=this.getAxisMotionValue(n);return s.start(animateMotionValue(n,s,0,o,this.visualElement))}stopAnimation(){eachAxis(n=>this.getAxisMotionValue(n).stop())}pauseAnimation(){eachAxis(n=>{var o;return(o=this.getAxisMotionValue(n).animation)===null||o===void 0?void 0:o.pause()})}getAnimationState(n){var o;return(o=this.getAxisMotionValue(n).animation)===null||o===void 0?void 0:o.state}getAxisMotionValue(n){const o="_drag"+n.toUpperCase(),s=this.visualElement.getProps(),c=s[o];return c||this.visualElement.getValue(n,(s.initial?s.initial[n]:void 0)||0)}snapToCursor(n){eachAxis(o=>{const{drag:s}=this.getProps();if(!shouldDrag(o,s,this.currentDirection))return;const{projection:c}=this.visualElement,d=this.getAxisMotionValue(o);if(c&&c.layout){const{min:h,max:p}=c.layout.layoutBox[o];d.set(n[o]-mixNumber$1(h,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:n,dragConstraints:o}=this.getProps(),{projection:s}=this.visualElement;if(!isRefObject(o)||!s||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};eachAxis(h=>{const p=this.getAxisMotionValue(h);if(p){const y=p.get();c[h]=calcOrigin({min:y,max:y},this.constraints[h])}});const{transformTemplate:d}=this.visualElement.getProps();this.visualElement.current.style.transform=d?d({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),eachAxis(h=>{if(!shouldDrag(h,n,null))return;const p=this.getAxisMotionValue(h),{min:y,max:S}=this.constraints[h];p.set(mixNumber$1(y,S,c[h]))})}addListeners(){if(!this.visualElement.current)return;elementDragControls.set(this.visualElement,this);const n=this.visualElement.current,o=addPointerEvent(n,"pointerdown",y=>{const{drag:S,dragListener:P=!0}=this.getProps();S&&P&&this.start(y)}),s=()=>{const{dragConstraints:y}=this.getProps();isRefObject(y)&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,d=c.addEventListener("measure",s);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),s();const h=addDomEvent(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",({delta:y,hasLayoutChanged:S})=>{this.isDragging&&S&&(eachAxis(P=>{const L=this.getAxisMotionValue(P);L&&(this.originPoint[P]+=y[P].translate,L.set(L.get()+y[P].translate))}),this.visualElement.render())});return()=>{h(),o(),d(),p&&p()}}getProps(){const n=this.visualElement.getProps(),{drag:o=!1,dragDirectionLock:s=!1,dragPropagation:c=!1,dragConstraints:d=!1,dragElastic:h=defaultElastic,dragMomentum:p=!0}=n;return{...n,drag:o,dragDirectionLock:s,dragPropagation:c,dragConstraints:d,dragElastic:h,dragMomentum:p}}}function shouldDrag(t,n,o){return(n===!0||n===t)&&(o===null||o===t)}function getCurrentDirection(t,n=10){let o=null;return Math.abs(t.y)>n?o="y":Math.abs(t.x)>n&&(o="x"),o}class DragGesture extends Feature{constructor(n){super(n),this.removeGroupControls=noop$1,this.removeListeners=noop$1,this.controls=new VisualElementDragControls(n)}mount(){const{dragControls:n}=this.node.getProps();n&&(this.removeGroupControls=n.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||noop$1}unmount(){this.removeGroupControls(),this.removeListeners()}}const asyncHandler=t=>(n,o)=>{t&&t(n,o)};class PanGesture extends Feature{constructor(){super(...arguments),this.removePointerDownListener=noop$1}onPointerDown(n){this.session=new PanSession(n,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:getContextWindow(this.node)})}createPanHandlers(){const{onPanSessionStart:n,onPanStart:o,onPan:s,onPanEnd:c}=this.node.getProps();return{onSessionStart:asyncHandler(n),onStart:asyncHandler(o),onMove:s,onEnd:(d,h)=>{delete this.session,c&&c(d,h)}}}mount(){this.removePointerDownListener=addPointerEvent(this.node.current,"pointerdown",n=>this.onPointerDown(n))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function usePresence(){const t=React.useContext(PresenceContext);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:o,register:s}=t,c=React.useId();return React.useEffect(()=>s(c),[]),!n&&o?[!1,()=>o&&o(c)]:[!0]}const globalProjectionState={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function pixelsToPercent(t,n){return n.max===n.min?0:t/(n.max-n.min)*100}const correctBorderRadius={correct:(t,n)=>{if(!n.target)return t;if(typeof t=="string")if(px.test(t))t=parseFloat(t);else return t;const o=pixelsToPercent(t,n.target.x),s=pixelsToPercent(t,n.target.y);return`${o}% ${s}%`}},correctBoxShadow={correct:(t,{treeScale:n,projectionDelta:o})=>{const s=t,c=complex.parse(t);if(c.length>5)return s;const d=complex.createTransformer(t),h=typeof c[0]!="number"?1:0,p=o.x.scale*n.x,y=o.y.scale*n.y;c[0+h]/=p,c[1+h]/=y;const S=mixNumber$1(p,y,.5);return typeof c[2+h]=="number"&&(c[2+h]/=S),typeof c[3+h]=="number"&&(c[3+h]/=S),d(c)}};class MeasureLayoutWithContext extends React.Component{componentDidMount(){const{visualElement:n,layoutGroup:o,switchLayoutGroup:s,layoutId:c}=this.props,{projection:d}=n;addScaleCorrector(defaultScaleCorrectors),d&&(o.group&&o.group.add(d),s&&s.register&&c&&s.register(d),d.root.didUpdate(),d.addEventListener("animationComplete",()=>{this.safeToRemove()}),d.setOptions({...d.options,onExitComplete:()=>this.safeToRemove()})),globalProjectionState.hasEverUpdated=!0}getSnapshotBeforeUpdate(n){const{layoutDependency:o,visualElement:s,drag:c,isPresent:d}=this.props,h=s.projection;return h&&(h.isPresent=d,c||n.layoutDependency!==o||o===void 0?h.willUpdate():this.safeToRemove(),n.isPresent!==d&&(d?h.promote():h.relegate()||frame.postRender(()=>{const p=h.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:n}=this.props.visualElement;n&&(n.root.didUpdate(),microtask.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:n,layoutGroup:o,switchLayoutGroup:s}=this.props,{projection:c}=n;c&&(c.scheduleCheckAfterUnmount(),o&&o.group&&o.group.remove(c),s&&s.deregister&&s.deregister(c))}safeToRemove(){const{safeToRemove:n}=this.props;n&&n()}render(){return null}}function MeasureLayout(t){const[n,o]=usePresence(),s=React.useContext(LayoutGroupContext);return React.createElement(MeasureLayoutWithContext,{...t,layoutGroup:s,switchLayoutGroup:React.useContext(SwitchLayoutGroupContext),isPresent:n,safeToRemove:o})}const defaultScaleCorrectors={borderRadius:{...correctBorderRadius,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:correctBorderRadius,borderTopRightRadius:correctBorderRadius,borderBottomLeftRadius:correctBorderRadius,borderBottomRightRadius:correctBorderRadius,boxShadow:correctBoxShadow},borders=["TopLeft","TopRight","BottomLeft","BottomRight"],numBorders=borders.length,asNumber=t=>typeof t=="string"?parseFloat(t):t,isPx=t=>typeof t=="number"||px.test(t);function mixValues(t,n,o,s,c,d){c?(t.opacity=mixNumber$1(0,o.opacity!==void 0?o.opacity:1,easeCrossfadeIn(s)),t.opacityExit=mixNumber$1(n.opacity!==void 0?n.opacity:1,0,easeCrossfadeOut(s))):d&&(t.opacity=mixNumber$1(n.opacity!==void 0?n.opacity:1,o.opacity!==void 0?o.opacity:1,s));for(let h=0;h<numBorders;h++){const p=`border${borders[h]}Radius`;let y=getRadius(n,p),S=getRadius(o,p);if(y===void 0&&S===void 0)continue;y||(y=0),S||(S=0),y===0||S===0||isPx(y)===isPx(S)?(t[p]=Math.max(mixNumber$1(asNumber(y),asNumber(S),s),0),(percent.test(S)||percent.test(y))&&(t[p]+="%")):t[p]=S}(n.rotate||o.rotate)&&(t.rotate=mixNumber$1(n.rotate||0,o.rotate||0,s))}function getRadius(t,n){return t[n]!==void 0?t[n]:t.borderRadius}const easeCrossfadeIn=compress(0,.5,circOut),easeCrossfadeOut=compress(.5,.95,noop$1);function compress(t,n,o){return s=>s<t?0:s>n?1:o(progress(t,n,s))}function copyAxisInto(t,n){t.min=n.min,t.max=n.max}function copyBoxInto(t,n){copyAxisInto(t.x,n.x),copyAxisInto(t.y,n.y)}function removePointDelta(t,n,o,s,c){return t-=n,t=scalePoint(t,1/o,s),c!==void 0&&(t=scalePoint(t,1/c,s)),t}function removeAxisDelta(t,n=0,o=1,s=.5,c,d=t,h=t){if(percent.test(n)&&(n=parseFloat(n),n=mixNumber$1(h.min,h.max,n/100)-h.min),typeof n!="number")return;let p=mixNumber$1(d.min,d.max,s);t===d&&(p-=n),t.min=removePointDelta(t.min,n,o,p,c),t.max=removePointDelta(t.max,n,o,p,c)}function removeAxisTransforms(t,n,[o,s,c],d,h){removeAxisDelta(t,n[o],n[s],n[c],n.scale,d,h)}const xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(t,n,o,s){removeAxisTransforms(t.x,n,xKeys,o?o.x:void 0,s?s.x:void 0),removeAxisTransforms(t.y,n,yKeys,o?o.y:void 0,s?s.y:void 0)}function isAxisDeltaZero(t){return t.translate===0&&t.scale===1}function isDeltaZero(t){return isAxisDeltaZero(t.x)&&isAxisDeltaZero(t.y)}function boxEquals(t,n){return t.x.min===n.x.min&&t.x.max===n.x.max&&t.y.min===n.y.min&&t.y.max===n.y.max}function boxEqualsRounded(t,n){return Math.round(t.x.min)===Math.round(n.x.min)&&Math.round(t.x.max)===Math.round(n.x.max)&&Math.round(t.y.min)===Math.round(n.y.min)&&Math.round(t.y.max)===Math.round(n.y.max)}function aspectRatio(t){return calcLength(t.x)/calcLength(t.y)}class NodeStack{constructor(){this.members=[]}add(n){addUniqueItem(this.members,n),n.scheduleRender()}remove(n){if(removeItem(this.members,n),n===this.prevLead&&(this.prevLead=void 0),n===this.lead){const o=this.members[this.members.length-1];o&&this.promote(o)}}relegate(n){const o=this.members.findIndex(c=>n===c);if(o===0)return!1;let s;for(let c=o;c>=0;c--){const d=this.members[c];if(d.isPresent!==!1){s=d;break}}return s?(this.promote(s),!0):!1}promote(n,o){const s=this.lead;if(n!==s&&(this.prevLead=s,this.lead=n,n.show(),s)){s.instance&&s.scheduleRender(),n.scheduleRender(),n.resumeFrom=s,o&&(n.resumeFrom.preserveOpacity=!0),s.snapshot&&(n.snapshot=s.snapshot,n.snapshot.latestValues=s.animationValues||s.latestValues),n.root&&n.root.isUpdating&&(n.isLayoutDirty=!0);const{crossfade:c}=n.options;c===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(n=>{const{options:o,resumingFrom:s}=n;o.onExitComplete&&o.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(n=>{n.instance&&n.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function buildProjectionTransform(t,n,o){let s="";const c=t.x.translate/n.x,d=t.y.translate/n.y,h=(o==null?void 0:o.z)||0;if((c||d||h)&&(s=`translate3d(${c}px, ${d}px, ${h}px) `),(n.x!==1||n.y!==1)&&(s+=`scale(${1/n.x}, ${1/n.y}) `),o){const{transformPerspective:S,rotate:P,rotateX:L,rotateY:F,skewX:N,skewY:W}=o;S&&(s=`perspective(${S}px) ${s}`),P&&(s+=`rotate(${P}deg) `),L&&(s+=`rotateX(${L}deg) `),F&&(s+=`rotateY(${F}deg) `),N&&(s+=`skewX(${N}deg) `),W&&(s+=`skewY(${W}deg) `)}const p=t.x.scale*n.x,y=t.y.scale*n.y;return(p!==1||y!==1)&&(s+=`scale(${p}, ${y})`),s||"none"}const compareByDepth=(t,n)=>t.depth-n.depth;class FlatTree{constructor(){this.children=[],this.isDirty=!1}add(n){addUniqueItem(this.children,n),this.isDirty=!0}remove(n){removeItem(this.children,n),this.isDirty=!0}forEach(n){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(n)}}function delay(t,n){const o=time.now(),s=({timestamp:c})=>{const d=c-o;d>=n&&(cancelFrame(s),t(d-n))};return frame.read(s,!0),()=>cancelFrame(s)}function record(t){window.MotionDebug&&window.MotionDebug.record(t)}function isSVGElement(t){return t instanceof SVGElement&&t.tagName!=="svg"}function animateSingleValue(t,n,o){const s=isMotionValue(t)?t:motionValue(t);return s.start(animateMotionValue("",s,n,o)),s.animation}const transformAxes=["","X","Y","Z"],hiddenVisibility={visibility:"hidden"},animationTarget=1e3;let id=0;const projectionFrameData={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function resetDistortingTransform(t,n,o,s){const{latestValues:c}=n;c[t]&&(o[t]=c[t],n.setStaticValue(t,0),s&&(s[t]=0))}function createProjectionNode({attachResizeListener:t,defaultParent:n,measureScroll:o,checkIsScrollRoot:s,resetTransform:c}){return class{constructor(h={},p=n==null?void 0:n()){this.id=id++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,projectionFrameData.totalNodes=projectionFrameData.resolvedTargetDeltas=projectionFrameData.recalculatedProjection=0,this.nodes.forEach(propagateDirtyNodes),this.nodes.forEach(resolveTargetDelta),this.nodes.forEach(calcProjection),this.nodes.forEach(cleanDirtyNodes),record(projectionFrameData)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=h,this.root=p?p.root||p:this,this.path=p?[...p.path,p]:[],this.parent=p,this.depth=p?p.depth+1:0;for(let y=0;y<this.path.length;y++)this.path[y].shouldResetTransform=!0;this.root===this&&(this.nodes=new FlatTree)}addEventListener(h,p){return this.eventHandlers.has(h)||this.eventHandlers.set(h,new SubscriptionManager),this.eventHandlers.get(h).add(p)}notifyListeners(h,...p){const y=this.eventHandlers.get(h);y&&y.notify(...p)}hasListeners(h){return this.eventHandlers.has(h)}mount(h,p=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=isSVGElement(h),this.instance=h;const{layoutId:y,layout:S,visualElement:P}=this.options;if(P&&!P.current&&P.mount(h),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),p&&(S||y)&&(this.isLayoutDirty=!0),t){let L;const F=()=>this.root.updateBlockedByResize=!1;t(h,()=>{this.root.updateBlockedByResize=!0,L&&L(),L=delay(F,250),globalProjectionState.hasAnimatedSinceResize&&(globalProjectionState.hasAnimatedSinceResize=!1,this.nodes.forEach(finishAnimation))})}y&&this.root.registerSharedNode(y,this),this.options.animate!==!1&&P&&(y||S)&&this.addEventListener("didUpdate",({delta:L,hasLayoutChanged:F,hasRelativeTargetChanged:N,layout:W})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const z=this.options.transition||P.getDefaultTransition()||defaultLayoutTransition,{onLayoutAnimationStart:lt,onLayoutAnimationComplete:Pe}=P.getProps(),se=!this.targetLayout||!boxEqualsRounded(this.targetLayout,W)||N,mt=!F&&N;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||mt||F&&(se||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(L,mt);const kt={...getValueTransition(z,"layout"),onPlay:lt,onComplete:Pe};(P.shouldReduceMotion||this.options.layoutRoot)&&(kt.delay=0,kt.type=!1),this.startAnimation(kt)}else F||finishAnimation(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=W})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const h=this.getStack();h&&h.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,cancelFrame(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(resetSkewAndRotation),this.animationId++)}getTransformTemplate(){const{visualElement:h}=this.options;return h&&h.getProps().transformTemplate}willUpdate(h=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let P=0;P<this.path.length;P++){const L=this.path[P];L.shouldResetTransform=!0,L.updateScroll("snapshot"),L.options.layoutRoot&&L.willUpdate(!1)}const{layoutId:p,layout:y}=this.options;if(p===void 0&&!y)return;const S=this.getTransformTemplate();this.prevTransformTemplateValue=S?S(this.latestValues,""):void 0,this.updateSnapshot(),h&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(clearMeasurements);return}this.isUpdating||this.nodes.forEach(clearIsLayoutDirty),this.isUpdating=!1,window.HandoffCancelAllAnimations&&window.HandoffCancelAllAnimations(),this.nodes.forEach(resetTransformStyle),this.nodes.forEach(updateLayout),this.nodes.forEach(notifyLayoutUpdate),this.clearAllSnapshots();const p=time.now();frameData.delta=clamp(0,1e3/60,p-frameData.timestamp),frameData.timestamp=p,frameData.isProcessing=!0,steps.update.process(frameData),steps.preRender.process(frameData),steps.render.process(frameData),frameData.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,microtask.read(()=>this.update()))}clearAllSnapshots(){this.nodes.forEach(clearSnapshot),this.sharedNodes.forEach(removeLeadSnapshots)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,frame.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){frame.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let y=0;y<this.path.length;y++)this.path[y].updateScroll();const h=this.layout;this.layout=this.measure(!1),this.layoutCorrected=createBox(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:p}=this.options;p&&p.notify("LayoutMeasure",this.layout.layoutBox,h?h.layoutBox:void 0)}updateScroll(h="measure"){let p=!!(this.options.layoutScroll&&this.instance);this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===h&&(p=!1),p&&(this.scroll={animationId:this.root.animationId,phase:h,isRoot:s(this.instance),offset:o(this.instance)})}resetTransform(){if(!c)return;const h=this.isLayoutDirty||this.shouldResetTransform,p=this.projectionDelta&&!isDeltaZero(this.projectionDelta),y=this.getTransformTemplate(),S=y?y(this.latestValues,""):void 0,P=S!==this.prevTransformTemplateValue;h&&(p||hasTransform(this.latestValues)||P)&&(c(this.instance,S),this.shouldResetTransform=!1,this.scheduleRender())}measure(h=!0){const p=this.measurePageBox();let y=this.removeElementScroll(p);return h&&(y=this.removeTransform(y)),roundBox(y),{animationId:this.root.animationId,measuredBox:p,layoutBox:y,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:h}=this.options;if(!h)return createBox();const p=h.measureViewportBox(),{scroll:y}=this.root;return y&&(translateAxis(p.x,y.offset.x),translateAxis(p.y,y.offset.y)),p}removeElementScroll(h){const p=createBox();copyBoxInto(p,h);for(let y=0;y<this.path.length;y++){const S=this.path[y],{scroll:P,options:L}=S;if(S!==this.root&&P&&L.layoutScroll){if(P.isRoot){copyBoxInto(p,h);const{scroll:F}=this.root;F&&(translateAxis(p.x,-F.offset.x),translateAxis(p.y,-F.offset.y))}translateAxis(p.x,P.offset.x),translateAxis(p.y,P.offset.y)}}return p}applyTransform(h,p=!1){const y=createBox();copyBoxInto(y,h);for(let S=0;S<this.path.length;S++){const P=this.path[S];!p&&P.options.layoutScroll&&P.scroll&&P!==P.root&&transformBox(y,{x:-P.scroll.offset.x,y:-P.scroll.offset.y}),hasTransform(P.latestValues)&&transformBox(y,P.latestValues)}return hasTransform(this.latestValues)&&transformBox(y,this.latestValues),y}removeTransform(h){const p=createBox();copyBoxInto(p,h);for(let y=0;y<this.path.length;y++){const S=this.path[y];if(!S.instance||!hasTransform(S.latestValues))continue;hasScale(S.latestValues)&&S.updateSnapshot();const P=createBox(),L=S.measurePageBox();copyBoxInto(P,L),removeBoxTransforms(p,S.latestValues,S.snapshot?S.snapshot.layoutBox:void 0,P)}return hasTransform(this.latestValues)&&removeBoxTransforms(p,this.latestValues),p}setTargetDelta(h){this.targetDelta=h,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(h){this.options={...this.options,...h,crossfade:h.crossfade!==void 0?h.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==frameData.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(h=!1){var p;const y=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=y.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=y.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=y.isSharedProjectionDirty);const S=!!this.resumingFrom||this!==y;if(!(h||S&&this.isSharedProjectionDirty||this.isProjectionDirty||!((p=this.parent)===null||p===void 0)&&p.isProjectionDirty||this.attemptToResolveRelativeTarget))return;const{layout:L,layoutId:F}=this.options;if(!(!this.layout||!(L||F))){if(this.resolvedRelativeTargetAt=frameData.timestamp,!this.targetDelta&&!this.relativeTarget){const N=this.getClosestProjectingParent();N&&N.layout&&this.animationProgress!==1?(this.relativeParent=N,this.forceRelativeParentToResolveTarget(),this.relativeTarget=createBox(),this.relativeTargetOrigin=createBox(),calcRelativePosition(this.relativeTargetOrigin,this.layout.layoutBox,N.layout.layoutBox),copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=createBox(),this.targetWithTransforms=createBox()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),calcRelativeBox(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):copyBoxInto(this.target,this.layout.layoutBox),applyBoxDelta(this.target,this.targetDelta)):copyBoxInto(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const N=this.getClosestProjectingParent();N&&!!N.resumingFrom==!!this.resumingFrom&&!N.options.layoutScroll&&N.target&&this.animationProgress!==1?(this.relativeParent=N,this.forceRelativeParentToResolveTarget(),this.relativeTarget=createBox(),this.relativeTargetOrigin=createBox(),calcRelativePosition(this.relativeTargetOrigin,this.target,N.target),copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}projectionFrameData.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||hasScale(this.parent.latestValues)||has2DTranslate(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var h;const p=this.getLead(),y=!!this.resumingFrom||this!==p;let S=!0;if((this.isProjectionDirty||!((h=this.parent)===null||h===void 0)&&h.isProjectionDirty)&&(S=!1),y&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(S=!1),this.resolvedRelativeTargetAt===frameData.timestamp&&(S=!1),S)return;const{layout:P,layoutId:L}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(P||L))return;copyBoxInto(this.layoutCorrected,this.layout.layoutBox);const F=this.treeScale.x,N=this.treeScale.y;applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,y),p.layout&&!p.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(p.target=p.layout.layoutBox,p.targetWithTransforms=createBox());const{target:W}=p;if(!W){this.projectionTransform&&(this.projectionDelta=createDelta(),this.projectionTransform="none",this.scheduleRender());return}this.projectionDelta||(this.projectionDelta=createDelta(),this.projectionDeltaWithTransform=createDelta());const z=this.projectionTransform;calcBoxDelta(this.projectionDelta,this.layoutCorrected,W,this.latestValues),this.projectionTransform=buildProjectionTransform(this.projectionDelta,this.treeScale),(this.projectionTransform!==z||this.treeScale.x!==F||this.treeScale.y!==N)&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",W)),projectionFrameData.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(h=!0){if(this.options.scheduleRender&&this.options.scheduleRender(),h){const p=this.getStack();p&&p.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}setAnimationOrigin(h,p=!1){const y=this.snapshot,S=y?y.latestValues:{},P={...this.latestValues},L=createDelta();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const F=createBox(),N=y?y.source:void 0,W=this.layout?this.layout.source:void 0,z=N!==W,lt=this.getStack(),Pe=!lt||lt.members.length<=1,se=!!(z&&!Pe&&this.options.crossfade===!0&&!this.path.some(hasOpacityCrossfade));this.animationProgress=0;let mt;this.mixTargetDelta=kt=>{const mn=kt/1e3;mixAxisDelta(L.x,h.x,mn),mixAxisDelta(L.y,h.y,mn),this.setTargetDelta(L),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(calcRelativePosition(F,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mixBox(this.relativeTarget,this.relativeTargetOrigin,F,mn),mt&&boxEquals(this.relativeTarget,mt)&&(this.isProjectionDirty=!1),mt||(mt=createBox()),copyBoxInto(mt,this.relativeTarget)),z&&(this.animationValues=P,mixValues(P,S,this.latestValues,mn,se,Pe)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=mn},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(h){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(cancelFrame(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=frame.update(()=>{globalProjectionState.hasAnimatedSinceResize=!0,this.currentAnimation=animateSingleValue(0,animationTarget,{...h,onUpdate:p=>{this.mixTargetDelta(p),h.onUpdate&&h.onUpdate(p)},onComplete:()=>{h.onComplete&&h.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const h=this.getStack();h&&h.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(animationTarget),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const h=this.getLead();let{targetWithTransforms:p,target:y,layout:S,latestValues:P}=h;if(!(!p||!y||!S)){if(this!==h&&this.layout&&S&&shouldAnimatePositionOnly(this.options.animationType,this.layout.layoutBox,S.layoutBox)){y=this.target||createBox();const L=calcLength(this.layout.layoutBox.x);y.x.min=h.target.x.min,y.x.max=y.x.min+L;const F=calcLength(this.layout.layoutBox.y);y.y.min=h.target.y.min,y.y.max=y.y.min+F}copyBoxInto(p,y),transformBox(p,P),calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,p,P)}}registerSharedNode(h,p){this.sharedNodes.has(h)||this.sharedNodes.set(h,new NodeStack),this.sharedNodes.get(h).add(p);const S=p.options.initialPromotionConfig;p.promote({transition:S?S.transition:void 0,preserveFollowOpacity:S&&S.shouldPreserveFollowOpacity?S.shouldPreserveFollowOpacity(p):void 0})}isLead(){const h=this.getStack();return h?h.lead===this:!0}getLead(){var h;const{layoutId:p}=this.options;return p?((h=this.getStack())===null||h===void 0?void 0:h.lead)||this:this}getPrevLead(){var h;const{layoutId:p}=this.options;return p?(h=this.getStack())===null||h===void 0?void 0:h.prevLead:void 0}getStack(){const{layoutId:h}=this.options;if(h)return this.root.sharedNodes.get(h)}promote({needsReset:h,transition:p,preserveFollowOpacity:y}={}){const S=this.getStack();S&&S.promote(this,y),h&&(this.projectionDelta=void 0,this.needsReset=!0),p&&this.setOptions({transition:p})}relegate(){const h=this.getStack();return h?h.relegate(this):!1}resetSkewAndRotation(){const{visualElement:h}=this.options;if(!h)return;let p=!1;const{latestValues:y}=h;if((y.z||y.rotate||y.rotateX||y.rotateY||y.rotateZ||y.skewX||y.skewY)&&(p=!0),!p)return;const S={};y.z&&resetDistortingTransform("z",h,S,this.animationValues);for(let P=0;P<transformAxes.length;P++)resetDistortingTransform(`rotate${transformAxes[P]}`,h,S,this.animationValues),resetDistortingTransform(`skew${transformAxes[P]}`,h,S,this.animationValues);h.render();for(const P in S)h.setStaticValue(P,S[P]),this.animationValues&&(this.animationValues[P]=S[P]);h.scheduleRender()}getProjectionStyles(h){var p,y;if(!this.instance||this.isSVG)return;if(!this.isVisible)return hiddenVisibility;const S={visibility:""},P=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,S.opacity="",S.pointerEvents=resolveMotionValue(h==null?void 0:h.pointerEvents)||"",S.transform=P?P(this.latestValues,""):"none",S;const L=this.getLead();if(!this.projectionDelta||!this.layout||!L.target){const z={};return this.options.layoutId&&(z.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,z.pointerEvents=resolveMotionValue(h==null?void 0:h.pointerEvents)||""),this.hasProjected&&!hasTransform(this.latestValues)&&(z.transform=P?P({},""):"none",this.hasProjected=!1),z}const F=L.animationValues||L.latestValues;this.applyTransformsToTarget(),S.transform=buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,F),P&&(S.transform=P(F,S.transform));const{x:N,y:W}=this.projectionDelta;S.transformOrigin=`${N.origin*100}% ${W.origin*100}% 0`,L.animationValues?S.opacity=L===this?(y=(p=F.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&y!==void 0?y:1:this.preserveOpacity?this.latestValues.opacity:F.opacityExit:S.opacity=L===this?F.opacity!==void 0?F.opacity:"":F.opacityExit!==void 0?F.opacityExit:0;for(const z in scaleCorrectors){if(F[z]===void 0)continue;const{correct:lt,applyTo:Pe}=scaleCorrectors[z],se=S.transform==="none"?F[z]:lt(F[z],L);if(Pe){const mt=Pe.length;for(let kt=0;kt<mt;kt++)S[Pe[kt]]=se}else S[z]=se}return this.options.layoutId&&(S.pointerEvents=L===this?resolveMotionValue(h==null?void 0:h.pointerEvents)||"":"none"),S}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(h=>{var p;return(p=h.currentAnimation)===null||p===void 0?void 0:p.stop()}),this.root.nodes.forEach(clearMeasurements),this.root.sharedNodes.clear()}}}function updateLayout(t){t.updateLayout()}function notifyLayoutUpdate(t){var n;const o=((n=t.resumeFrom)===null||n===void 0?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&o&&t.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:c}=t.layout,{animationType:d}=t.options,h=o.source!==t.layout.source;d==="size"?eachAxis(L=>{const F=h?o.measuredBox[L]:o.layoutBox[L],N=calcLength(F);F.min=s[L].min,F.max=F.min+N}):shouldAnimatePositionOnly(d,o.layoutBox,s)&&eachAxis(L=>{const F=h?o.measuredBox[L]:o.layoutBox[L],N=calcLength(s[L]);F.max=F.min+N,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[L].max=t.relativeTarget[L].min+N)});const p=createDelta();calcBoxDelta(p,s,o.layoutBox);const y=createDelta();h?calcBoxDelta(y,t.applyTransform(c,!0),o.measuredBox):calcBoxDelta(y,s,o.layoutBox);const S=!isDeltaZero(p);let P=!1;if(!t.resumeFrom){const L=t.getClosestProjectingParent();if(L&&!L.resumeFrom){const{snapshot:F,layout:N}=L;if(F&&N){const W=createBox();calcRelativePosition(W,o.layoutBox,F.layoutBox);const z=createBox();calcRelativePosition(z,s,N.layoutBox),boxEqualsRounded(W,z)||(P=!0),L.options.layoutRoot&&(t.relativeTarget=z,t.relativeTargetOrigin=W,t.relativeParent=L)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:o,delta:y,layoutDelta:p,hasLayoutChanged:S,hasRelativeTargetChanged:P})}else if(t.isLead()){const{onExitComplete:s}=t.options;s&&s()}t.options.transition=void 0}function propagateDirtyNodes(t){projectionFrameData.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function cleanDirtyNodes(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function clearSnapshot(t){t.clearSnapshot()}function clearMeasurements(t){t.clearMeasurements()}function clearIsLayoutDirty(t){t.isLayoutDirty=!1}function resetTransformStyle(t){const{visualElement:n}=t.options;n&&n.getProps().onBeforeLayoutMeasure&&n.notify("BeforeLayoutMeasure"),t.resetTransform()}function finishAnimation(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function resolveTargetDelta(t){t.resolveTargetDelta()}function calcProjection(t){t.calcProjection()}function resetSkewAndRotation(t){t.resetSkewAndRotation()}function removeLeadSnapshots(t){t.removeLeadSnapshot()}function mixAxisDelta(t,n,o){t.translate=mixNumber$1(n.translate,0,o),t.scale=mixNumber$1(n.scale,1,o),t.origin=n.origin,t.originPoint=n.originPoint}function mixAxis(t,n,o,s){t.min=mixNumber$1(n.min,o.min,s),t.max=mixNumber$1(n.max,o.max,s)}function mixBox(t,n,o,s){mixAxis(t.x,n.x,o.x,s),mixAxis(t.y,n.y,o.y,s)}function hasOpacityCrossfade(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const defaultLayoutTransition={duration:.45,ease:[.4,0,.1,1]},userAgentContains=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),roundPoint=userAgentContains("applewebkit/")&&!userAgentContains("chrome/")?Math.round:noop$1;function roundAxis(t){t.min=roundPoint(t.min),t.max=roundPoint(t.max)}function roundBox(t){roundAxis(t.x),roundAxis(t.y)}function shouldAnimatePositionOnly(t,n,o){return t==="position"||t==="preserve-aspect"&&!isNear(aspectRatio(n),aspectRatio(o),.2)}const DocumentProjectionNode=createProjectionNode({attachResizeListener:(t,n)=>addDomEvent(t,"resize",n),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),rootProjectionNode={current:void 0},HTMLProjectionNode=createProjectionNode({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!rootProjectionNode.current){const t=new DocumentProjectionNode({});t.mount(window),t.setOptions({layoutScroll:!0}),rootProjectionNode.current=t}return rootProjectionNode.current},resetTransform:(t,n)=>{t.style.transform=n!==void 0?n:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),drag={pan:{Feature:PanGesture},drag:{Feature:DragGesture,ProjectionNode:HTMLProjectionNode,MeasureLayout}},prefersReducedMotion={current:null},hasReducedMotionListener={current:!1};function initPrefersReducedMotion(){if(hasReducedMotionListener.current=!0,!!isBrowser)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),n=()=>prefersReducedMotion.current=t.matches;t.addListener(n),n()}else prefersReducedMotion.current=!1}function updateMotionValuesFromProps(t,n,o){const{willChange:s}=n;for(const c in n){const d=n[c],h=o[c];if(isMotionValue(d))t.addValue(c,d),isWillChangeMotionValue(s)&&s.add(c),process.env.NODE_ENV==="development"&&warnOnce(d.version==="11.0.27",`Attempting to mix Framer Motion versions ${d.version} with 11.0.27 may not work as expected.`);else if(isMotionValue(h))t.addValue(c,motionValue(d,{owner:t})),isWillChangeMotionValue(s)&&s.remove(c);else if(h!==d)if(t.hasValue(c)){const p=t.getValue(c);p.liveStyle===!0?p.jump(d):p.hasAnimated||p.set(d)}else{const p=t.getStaticValue(c);t.addValue(c,motionValue(p!==void 0?p:d,{owner:t}))}}for(const c in o)n[c]===void 0&&t.removeValue(c);return n}const visualElementStore=new WeakMap,valueTypes=[...dimensionValueTypes,color,complex],findValueType=t=>valueTypes.find(testValueType(t)),featureNames=Object.keys(featureDefinitions),numFeatures=featureNames.length,propEventHandlers=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],numVariantProps=variantProps.length;function getClosestProjectingNode(t){if(t)return t.options.allowProjection!==!1?t.projection:getClosestProjectingNode(t.parent)}class VisualElement{constructor({parent:n,props:o,presenceContext:s,reducedMotionConfig:c,blockInitialAnimation:d,visualState:h},p={}){this.resolveKeyframes=(F,N,W,z)=>new this.KeyframeResolver(F,N,W,z,this),this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=KeyframeResolver,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>frame.render(this.render,!1,!0);const{latestValues:y,renderState:S}=h;this.latestValues=y,this.baseTarget={...y},this.initialValues=o.initial?{...y}:{},this.renderState=S,this.parent=n,this.props=o,this.presenceContext=s,this.depth=n?n.depth+1:0,this.reducedMotionConfig=c,this.options=p,this.blockInitialAnimation=!!d,this.isControllingVariants=isControllingVariants(o),this.isVariantNode=isVariantNode(o),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(n&&n.current);const{willChange:P,...L}=this.scrapeMotionValuesFromProps(o,{},this);for(const F in L){const N=L[F];y[F]!==void 0&&isMotionValue(N)&&(N.set(y[F],!1),isWillChangeMotionValue(P)&&P.add(F))}}scrapeMotionValuesFromProps(n,o,s){return{}}mount(n){this.current=n,visualElementStore.set(n,this),this.projection&&!this.projection.instance&&this.projection.mount(n),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((o,s)=>this.bindToMotionValue(s,o)),hasReducedMotionListener.current||initPrefersReducedMotion(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:prefersReducedMotion.current,process.env.NODE_ENV!=="production"&&warnOnce(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){visualElementStore.delete(this.current),this.projection&&this.projection.unmount(),cancelFrame(this.notifyUpdate),cancelFrame(this.render),this.valueSubscriptions.forEach(n=>n()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const n in this.events)this.events[n].clear();for(const n in this.features)this.features[n].unmount();this.current=null}bindToMotionValue(n,o){const s=transformProps.has(n),c=o.on("change",h=>{this.latestValues[n]=h,this.props.onUpdate&&frame.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)}),d=o.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(n,()=>{c(),d(),o.owner&&o.stop()})}sortNodePosition(n){return!this.current||!this.sortInstanceNodePosition||this.type!==n.type?0:this.sortInstanceNodePosition(this.current,n.current)}loadFeatures({children:n,...o},s,c,d){let h,p;if(process.env.NODE_ENV!=="production"&&c&&s){const y="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";o.ignoreStrict?warning(!1,y):invariant(!1,y)}for(let y=0;y<numFeatures;y++){const S=featureNames[y],{isEnabled:P,Feature:L,ProjectionNode:F,MeasureLayout:N}=featureDefinitions[S];F&&(h=F),P(o)&&(!this.features[S]&&L&&(this.features[S]=new L(this)),N&&(p=N))}if((this.type==="html"||this.type==="svg")&&!this.projection&&h){this.projection=new h(this.latestValues,getClosestProjectingNode(this.parent));const{layoutId:y,layout:S,drag:P,dragConstraints:L,layoutScroll:F,layoutRoot:N}=o;this.projection.setOptions({layoutId:y,layout:S,alwaysMeasureLayout:!!P||L&&isRefObject(L),visualElement:this,scheduleRender:()=>this.scheduleRender(),animationType:typeof S=="string"?S:"both",initialPromotionConfig:d,layoutScroll:F,layoutRoot:N})}return p}updateFeatures(){for(const n in this.features){const o=this.features[n];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):createBox()}getStaticValue(n){return this.latestValues[n]}setStaticValue(n,o){this.latestValues[n]=o}update(n,o){(n.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=n,this.prevPresenceContext=this.presenceContext,this.presenceContext=o;for(let s=0;s<propEventHandlers.length;s++){const c=propEventHandlers[s];this.propEventSubscriptions[c]&&(this.propEventSubscriptions[c](),delete this.propEventSubscriptions[c]);const d=n["on"+c];d&&(this.propEventSubscriptions[c]=this.on(c,d))}this.prevMotionValues=updateMotionValuesFromProps(this,this.scrapeMotionValuesFromProps(n,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(n){return this.props.variants?this.props.variants[n]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(n=!1){if(n)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const s=this.parent?this.parent.getVariantContext()||{}:{};return this.props.initial!==void 0&&(s.initial=this.props.initial),s}const o={};for(let s=0;s<numVariantProps;s++){const c=variantProps[s],d=this.props[c];(isVariantLabel(d)||d===!1)&&(o[c]=d)}return o}addVariantChild(n){const o=this.getClosestVariantNode();if(o)return o.variantChildren&&o.variantChildren.add(n),()=>o.variantChildren.delete(n)}addValue(n,o){o!==this.values.get(n)&&(this.removeValue(n),this.bindToMotionValue(n,o)),this.values.set(n,o),this.latestValues[n]=o.get()}removeValue(n){this.values.delete(n);const o=this.valueSubscriptions.get(n);o&&(o(),this.valueSubscriptions.delete(n)),delete this.latestValues[n],this.removeValueFromRenderState(n,this.renderState)}hasValue(n){return this.values.has(n)}getValue(n,o){if(this.props.values&&this.props.values[n])return this.props.values[n];let s=this.values.get(n);return s===void 0&&o!==void 0&&(s=motionValue(o===null?void 0:o,{owner:this}),this.addValue(n,s)),s}readValue(n,o){var s;let c=this.latestValues[n]!==void 0||!this.current?this.latestValues[n]:(s=this.getBaseTargetFromProps(this.props,n))!==null&&s!==void 0?s:this.readValueFromInstance(this.current,n,this.options);return c!=null&&(typeof c=="string"&&(isNumericalString(c)||isZeroValueString(c))?c=parseFloat(c):!findValueType(c)&&complex.test(o)&&(c=getAnimatableNone(n,o)),this.setBaseTarget(n,isMotionValue(c)?c.get():c)),isMotionValue(c)?c.get():c}setBaseTarget(n,o){this.baseTarget[n]=o}getBaseTarget(n){var o,s;const{initial:c}=this.props,d=typeof c=="string"||typeof c=="object"?(s=resolveVariantFromProps(this.props,c,(o=this.presenceContext)===null||o===void 0?void 0:o.custom))===null||s===void 0?void 0:s[n]:void 0;if(c&&d!==void 0)return d;const h=this.getBaseTargetFromProps(this.props,n);return h!==void 0&&!isMotionValue(h)?h:this.initialValues[n]!==void 0&&d===void 0?void 0:this.baseTarget[n]}on(n,o){return this.events[n]||(this.events[n]=new SubscriptionManager),this.events[n].add(o)}notify(n,...o){this.events[n]&&this.events[n].notify(...o)}}class DOMVisualElement extends VisualElement{constructor(){super(...arguments),this.KeyframeResolver=DOMKeyframesResolver}sortInstanceNodePosition(n,o){return n.compareDocumentPosition(o)&2?1:-1}getBaseTargetFromProps(n,o){return n.style?n.style[o]:void 0}removeValueFromRenderState(n,{vars:o,style:s}){delete o[n],delete s[n]}}function getComputedStyle(t){return window.getComputedStyle(t)}class HTMLVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="html"}readValueFromInstance(n,o){if(transformProps.has(o)){const s=getDefaultValueType(o);return s&&s.default||0}else{const s=getComputedStyle(n),c=(isCSSVariableName(o)?s.getPropertyValue(o):s[o])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(n,{transformPagePoint:o}){return measureViewportBox(n,o)}build(n,o,s,c){buildHTMLStyles(n,o,s,c.transformTemplate)}scrapeMotionValuesFromProps(n,o,s){return scrapeMotionValuesFromProps$1(n,o,s)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:n}=this.props;isMotionValue(n)&&(this.childSubscription=n.on("change",o=>{this.current&&(this.current.textContent=`${o}`)}))}renderInstance(n,o,s,c){renderHTML(n,o,s,c)}}class SVGVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(n,o){return n[o]}readValueFromInstance(n,o){if(transformProps.has(o)){const s=getDefaultValueType(o);return s&&s.default||0}return o=camelCaseAttributes.has(o)?o:camelToDash(o),n.getAttribute(o)}measureInstanceViewportBox(){return createBox()}scrapeMotionValuesFromProps(n,o){return scrapeMotionValuesFromProps(n,o,this)}build(n,o,s,c){buildSVGAttrs(n,o,s,this.isSVGTag,c.transformTemplate)}renderInstance(n,o,s,c){renderSVG(n,o,s,c)}mount(n){this.isSVGTag=isSVGTag(n.tagName),super.mount(n)}}const createDomVisualElement=(t,n)=>isSVGComponent(t)?new SVGVisualElement(n,{enableHardwareAcceleration:!1}):new HTMLVisualElement(n,{allowProjection:t!==React.Fragment,enableHardwareAcceleration:!0}),layout={layout:{ProjectionNode:HTMLProjectionNode,MeasureLayout}},preloadedFeatures={...animations,...gestureAnimations,...drag,...layout},motion=createMotionProxy((t,n)=>createDomMotionConfig(t,n,preloadedFeatures,createDomVisualElement));function useMotionValue(t){const n=useConstant(()=>motionValue(t)),{isStatic:o}=React.useContext(MotionConfigContext);if(o){const[,s]=React.useState(t);React.useEffect(()=>n.on("change",s),[])}return n}function assignRef(t,n){return typeof t=="function"?t(n):t&&(t.current=n),t}function useCallbackRef(t,n){var o=React.useState(function(){return{value:t,callback:n,facade:{get current(){return o.value},set current(s){var c=o.value;c!==s&&(o.value=s,o.callback(s,c))}}}})[0];return o.callback=n,o.facade}var useIsomorphicLayoutEffect=typeof window<"u"?React__namespace.useLayoutEffect:React__namespace.useEffect,currentValues=new WeakMap;function useMergeRefs(t,n){var o=useCallbackRef(null,function(s){return t.forEach(function(c){return assignRef(c,s)})});return useIsomorphicLayoutEffect(function(){var s=currentValues.get(o);if(s){var c=new Set(s),d=new Set(t),h=o.current;c.forEach(function(p){d.has(p)||assignRef(p,null)}),d.forEach(function(p){c.has(p)||assignRef(p,h)})}currentValues.set(o,t)},[t]),o}const occluder=new EllipsoidalOccluder(Ellipsoid$1.WGS84,Cartesian3.ZERO),ScreenSpaceElement=React.forwardRef(({position:t,children:n,...o},s)=>{const c=useConstant$2(()=>new Cartesian3);t==null||t.clone(c);const d=useMotionValue(""),h=useMotionValue("none"),{toWindowPosition:p,getCamera:y,toXYZ:S,isPositionVisible:P}=useContext(),L=React.useRef(null);usePreRender(()=>{if(L.current==null)return;let N;try{const se=p==null?void 0:p([c.x,c.y,c.z]);N=new Cartesian2(se==null?void 0:se[0],se==null?void 0:se[1])}catch{h.set("none");return}const W=y==null?void 0:y();if(!W)return;const z=S==null?void 0:S(W==null?void 0:W.lng,W==null?void 0:W.lat,W==null?void 0:W.height);if(!z)return;if(occluder.cameraPosition=new Cartesian3(z[0],z[1],z[2]),N==null||N.x<0||N.y<0||N.x>window.innerWidth||N.y>window.innerHeight||!(P!=null&&P([c.x,c.y,c.z]))){h.set("none");return}const lt=`calc(${N.x}px - 50%)`,Pe=`calc(${N.y}px - 50%)`;d.set(`translate(${lt}, ${Pe})`),h.set("block")});const F=useMergeRefs([L,s]);return jsxRuntimeExports.jsx(motion.div,{ref:F,...o,style:{...o.style,transform:d,display:h,position:"absolute",pointerEvents:"none",left:0,top:0},children:n})});ScreenSpaceElement.displayName="ScreenSpaceElement";const MeasurementLine$1=({a:t,b:n,color:o})=>{const s=React.useRef([t,n]);s.current=[t,n];const c=useConstant$2(()=>new CallbackProperty(()=>s.current,!1)),d=React.useMemo(()=>({polyline:{positions:c,width:1.5,material:new PolylineDashMaterialProperty({color:o,dashLength:8})}}),[o,c]);return jsxRuntimeExports.jsx(Entity,{...d})},ExtrudedMeasurement=({a:t,b:n,extrudedHeight:o,color:s,showLine:c})=>{const d=useConstant$2(()=>new Cartesian3);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ScreenSpaceElement,{position:Cartesian3.midpoint(t,n,d),children:jsxRuntimeExports.jsx(MeasurementText,{children:o<1e3?`${o.toFixed(1)} m`:`${(o/1e3).toFixed(1)} km`})}),c&&jsxRuntimeExports.jsx(MeasurementLine$1,{a:t,b:n,color:s})]})},ExtrudedControlPoints=React.memo(({geometryOptions:{controlPoints:t,type:n},extrudedHeight:o,color:s,isEditing:c,extrudedPoint:d,centroidBasePoint:h,centroidExtrudedPoint:p,catchedExtrudedPoint:y,handleControlPointMouseEvent:S})=>{const P=t[t.length-1],L=d?new Cartesian3(...d):void 0,F=h?new Cartesian3(...h):void 0,N=p?new Cartesian3(...p):void 0;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[L&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ControlPoint,{index:-1,position:L,isEditing:c,isExtrudedControlPoint:!0,handleControlPointMouseEvent:S}),(!c||y)&&jsxRuntimeExports.jsx(ExtrudedMeasurement,{a:P,b:L,extrudedHeight:o,color:c?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):s,showLine:n!=="extrudedPolygon"})]}),F&&jsxRuntimeExports.jsx(ControlPoint,{index:-1,position:F,isEditing:c,isExtrudedControlPoint:!0}),N&&jsxRuntimeExports.jsx(ControlPoint,{index:-1,position:N,isEditing:c,isExtrudedControlPoint:!0})]})});ExtrudedControlPoints.displayName="ExtrudedControlPoints";const ExtrudedPolygonEntity=({id:t,hierarchy:n,extrudedHeight:o,color:s,disableShadow:c=!1,isEditing:d})=>{const h=React.useRef(n);h.current=n;const y=useConstant$2(()=>new CallbackProperty(()=>h.current,!1)),S=React.useRef(o);S.current=o;const L=useConstant$2(()=>new CallbackProperty(()=>S.current,!1)),F=React.useMemo(()=>({polygon:{hierarchy:y,heightReference:HeightReference$1.RELATIVE_TO_TERRAIN,extrudedHeight:L,extrudedHeightReference:HeightReference$1.RELATIVE_TO_TERRAIN,fill:!0,outline:!0,outlineWidth:1,outlineColor:d?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):s==null?void 0:s.withAlpha(1),material:new ColorMaterialProperty(d?s==null?void 0:s.withAlpha(.2):s),classificationType:ClassificationType$1.TERRAIN,shadows:c?ShadowMode$1.DISABLED:ShadowMode$1.ENABLED}}),[L,c,y,s,d]),{requestRender:N}=useContext();return N==null||N(),jsxRuntimeExports.jsx(Entity,{id:t,...F})},PolygonEntity=({dynamic:t=!1,hierarchy:n,color:o})=>{const s=React.useRef(n);s.current=n;const c=useConstant$2(()=>new CallbackProperty(()=>s.current,!1)),d=t?c:n,h=React.useMemo(()=>({polygon:{hierarchy:d,fill:!0,material:o==null?void 0:o.withAlpha(.5),classificationType:ClassificationType$1.TERRAIN}}),[o,d]),{requestRender:p}=useContext();return p==null||p(),jsxRuntimeExports.jsx(Entity,{...h})},PolylineEntity=({dynamic:t=!1,positions:n,color:o,isEditing:s})=>{const c=React.useRef(n);c.current=n;const d=useConstant$2(()=>new CallbackProperty(()=>c.current,!t)),h=t?d:n,p=React.useMemo(()=>({polyline:{positions:h,width:1.5,material:s?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):o,classificationType:ClassificationType$1.TERRAIN,clampToGround:!0}}),[o,h,s]),{requestRender:y}=useContext();return y==null||y(),jsxRuntimeExports.jsx(Entity,{...p})},cartesianScratch1$1=new Cartesian3,SurfaceAddingPoints=React.memo(({geometryOptions:{type:t,controlPoints:n},isEditing:o,handleAddControlPoint:s})=>{if(!["polyline","polygon","extrudedPolygon"].includes(t))return null;const c=[];for(let d=0;d<n.length-1;d++){const h=n[d+1],p=Cartesian3.midpoint(n[d],h,cartesianScratch1$1);c.push(p.clone())}if(t==="polygon"||t==="extrudedPolygon"){const d=Cartesian3.midpoint(n[n.length-1],n[0],cartesianScratch1$1);c.push(d.clone())}return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:c.map((d,h)=>jsxRuntimeExports.jsx(ControlPoint,{position:d,isAddingPoint:!0,index:h,clampToGround:!0,isEditing:o,handleControlPointMouseEvent:()=>s==null?void 0:s([d.x,d.y,d.z],h)},h))})});SurfaceAddingPoints.displayName="SurfaceAddingPoints";const MeasurementLine=({a:t,b:n,color:o})=>{const s=React.useRef([t,n]);s.current=[t,n];const c=useConstant$2(()=>new CallbackProperty(()=>s.current,!1)),d=React.useMemo(()=>({polyline:{positions:c,width:1.5,material:new PolylineDashMaterialProperty({color:o,dashLength:8}),classificationType:ClassificationType$1.TERRAIN,clampToGround:!0}}),[o,c]),{requestRender:h}=useContext();return h==null||h(),jsxRuntimeExports.jsx(Entity,{...d})},SurfaceMeasurement=({a:t,b:n,color:o,showLine:s=!1})=>{const c=useConstant$2(()=>new Cartesian3),{getSurfaceDistance:d}=useContext(),h=d==null?void 0:d(t,n);return h!==void 0?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ScreenSpaceElement,{position:Cartesian3.midpoint(t,n,c),children:jsxRuntimeExports.jsx(MeasurementText,{children:h<1e3?`${h.toFixed(1)} m`:`${(h/1e3).toFixed(1)} km`})}),s&&jsxRuntimeExports.jsx(MeasurementLine,{a:t,b:n,color:o})]}):null},cartesianScratch1=new Cartesian3,SurfaceControlPoints=React.memo(({geometryOptions:{type:t,controlPoints:n},color:o,isEditing:s,catchedControlPointIndex:c,selectedControlPointIndex:d,handleControlPointMouseEvent:h})=>{const p=[];if(n.length>=2)if(s){if(c!==void 0&&c!==-1)switch(t){case"polyline":c>0&&p.push({points:[n[c-1],n[c]],showLine:!1}),c<n.length-1&&p.push({points:[n[c],n[c+1]],showLine:!1});break;case"circle":case"extrudedCircle":c!==2&&p.push({points:[n[0],n[1]],showLine:!0});break;case"rectangle":case"extrudedRectangle":if(c<=1)p.push({points:[n[0],n[1]],showLine:!1});else if(c===2){const[y,S,P]=n,L=Cartesian3.midpoint(y,S,cartesianScratch1);p.push({points:[L,P],showLine:!0})}break;case"polygon":case"extrudedPolygon":p.push({points:[n[c],c===0?n[n.length-1]:n[c-1]],showLine:!1}),p.push({points:[n[c],c===n.length-1?n[0]:n[c+1]],showLine:!1});break}}else switch(t){case"rectangle":if(n.length===2)p.push({points:n,showLine:!0});else if(n.length===3){const[y,S,P]=n,L=Cartesian3.midpoint(y,S,cartesianScratch1);p.push({points:[L,P],showLine:!0})}break;default:p.push({points:n.slice(-2),showLine:t==="circle"});break}return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[n.map((y,S)=>jsxRuntimeExports.jsx(ControlPoint,{position:y,index:S,isSelected:d===S,clampToGround:!0,isEditing:s,handleControlPointMouseEvent:h},S)),p.map(({points:y,showLine:S},P)=>jsxRuntimeExports.jsx(SurfaceMeasurement,{a:y[0],b:y[1],color:s?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):o,showLine:S},P))]})});SurfaceControlPoints.displayName="SurfaceControlPoints";const SketchComponent=React.memo(({geometryOptions:t,extrudedHeight:n,disableShadow:o,color:s,isEditing:c,extrudedPoint:d,centroidBasePoint:h,centroidExtrudedPoint:p,catchedControlPointIndex:y,catchedExtrudedPoint:S,selectedControlPointIndex:P,handleControlPointMouseEvent:L,handleAddControlPoint:F})=>{const N=React.useMemo(()=>t?{...t,controlPoints:t==null?void 0:t.controlPoints.map(se=>new Cesium$1.Cartesian3(...se))}:null,[t]),W=React.useMemo(()=>N?createGeometry(N):null,[N]),{positionsArray:z,hierarchyArray:lt}=React.useMemo(()=>(W==null?void 0:W.type)==="Point"?{}:(W==null?void 0:W.type)==="LineString"?{positionsArray:convertGeometryToPositionsArray(W)}:W!=null?{positionsArray:convertGeometryToPositionsArray(W),hierarchyArray:convertPolygonToHierarchyArray(W)}:{},[W]),Pe=React.useMemo(()=>Color$1.fromCssColorString(s??DEFAULT_SKETCH_COLOR),[s]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[z==null?void 0:z.map((se,mt)=>jsxRuntimeExports.jsx(PolylineEntity,{dynamic:!0,positions:se,color:Pe,isEditing:c},mt)),lt==null?void 0:lt.map((se,mt)=>jsxRuntimeExports.jsx(PolygonEntity,{dynamic:!0,hierarchy:se,color:Pe},mt)),N!=null&&(!n||c)&&jsxRuntimeExports.jsx(SurfaceControlPoints,{geometryOptions:N,color:Pe,isEditing:c,catchedControlPointIndex:y,selectedControlPointIndex:P,handleControlPointMouseEvent:L}),N!=null&&c&&jsxRuntimeExports.jsx(SurfaceAddingPoints,{geometryOptions:N,isEditing:c,handleAddControlPoint:F}),N!=null&&n&&jsxRuntimeExports.jsx(ExtrudedControlPoints,{geometryOptions:N,extrudedHeight:n,extrudedPoint:d,centroidBasePoint:h,centroidExtrudedPoint:p,catchedExtrudedPoint:S,color:Pe,isEditing:c,handleControlPointMouseEvent:L}),n&&(lt==null?void 0:lt.map((se,mt)=>jsxRuntimeExports.jsx(ExtrudedPolygonEntity,{hierarchy:se,extrudedHeight:n,disableShadow:o,color:Pe,isEditing:c},mt)))]})});SketchComponent.displayName="SketchComponent";const Cesium=({className:t,style:n,property:o,time:s,camera:c,small:d,ready:h,children:p,selectedLayerId:y,isLayerDraggable:S,isLayerDragging:P,shouldRender:L,layerSelectionReason:F,meta:N,displayCredits:W,layersRef:z,featureFlags:lt,requestingRenderMode:Pe,timelineManagerRef:se,cameraForceHorizontalRoll:mt,onLayerSelect:kt,onCameraChange:mn,onLayerDrag:_i,onLayerDrop:zi,onLayerEdit:ba,onLayerSelectWithRectStart:fa,onLayerSelectWithRectMove:La,onLayerSelectWithRectEnd:Ra,onMount:ma,onLayerVisibility:yt,onLayerLoad:nt,onCreditsUpdate:pi},Sa)=>{var gd,pd,Zd,cf,of,rf,df,Cf,ff,Sf,Pf,Af,Hf,_f,wf,Yf,Nf,jf,ep,$m,jm,xf,Lf,kf,$f,_m,Am,qm,Ef,tf,gf,Mf,Wf,Uf,Om,sp,cp,fp,mp,al,nf,uf;const{cesium:Sc,mouseEventHandles:Xs,cesiumIonAccessToken:ms,context:yu,layerSelectWithRectEventHandlers:pu,sceneLight:Nl,sceneBackgroundColor:Ru,sceneMsaaSamples:Vd,sceneMode:Gd,cameraViewBoundaries:lf,cameraViewOuterBoundaries:hf,cameraViewBoundariesMaterial:pf,handleCameraChange:mf,handleCameraMoveEnd:sf,handleUpdate:yf,handleClick:Tf,handleMount:vf,handleUnmount:Wa,handleTilesChange:af,handleTerrainProviderChange:Xd}=useHooks$1({ref:Sa,property:o,time:s,selectedLayerId:y,selectionReason:F,meta:N,layersRef:z,featureFlags:lt,timelineManagerRef:se,isLayerDraggable:S,isLayerDragging:P,shouldRender:L,requestingRenderMode:Pe,camera:c,cameraForceHorizontalRoll:mt,onLayerDrag:_i,onLayerDrop:zi,onLayerSelect:kt,onLayerEdit:ba,onLayerSelectWithRectStart:fa,onLayerSelectWithRectMove:La,onLayerSelectWithRectEnd:Ra,onLayerVisibility:yt,onLayerLoad:nt,onCameraChange:mn,onMount:ma,onCreditsUpdate:pi});return jsxRuntimeExports.jsxs(Aa$1,{ref:Sc,onUpdate:yf,className:t,requestRenderMode:!0,animation:!1,timeline:!1,baseLayer:!1,fullscreenButton:!1,homeButton:!1,geocoder:!1,infoBox:!1,baseLayerPicker:!1,navigationHelpButton:!1,projectionPicker:!1,sceneModePicker:!1,creditContainer:W?void 0:creditContainer,style:{width:d?"300px":"auto",height:d?"300px":"100%",display:h?void 0:"none",cursor:P?"grab":void 0,...n},shadows:!!((pd=(gd=o==null?void 0:o.scene)==null?void 0:gd.shadow)!=null&&pd.enabled),onClick:Tf,onDoubleClick:Xs.doubleClick,onMouseDown:Xs.mouseDown,onMouseUp:Xs.mouseUp,onRightClick:Xs.rightClick,onRightDown:Xs.rightDown,onRightUp:Xs.rightUp,onMiddleClick:Xs.middleClick,onMiddleDown:Xs.middleDown,onMiddleUp:Xs.middleUp,onMouseMove:Xs.mouseMove,onMouseEnter:Xs.mouseEnter,onMouseLeave:Xs.mouseLeave,onWheel:Xs.wheel,children:[jsxRuntimeExports.jsx(Event,{onMount:vf,onUnmount:Wa}),jsxRuntimeExports.jsx(ReearthClock,{timelineManagerRef:se}),jsxRuntimeExports.jsx(ImageryLayers,{tiles:o==null?void 0:o.tiles,cesiumIonAccessToken:ms,onTilesChange:af}),jsxRuntimeExports.jsx(LabelImageryLayers,{tileLabels:o==null?void 0:o.tileLabels}),jsxRuntimeExports.jsx(Indicator,{property:o,timelineManagerRef:se}),jsxRuntimeExports.jsxs(ka$1,{useDefault:!0,children:[jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_CLICK}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOUBLE_CLICK})]}),jsxRuntimeExports.jsxs(ka$1,{children:[jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOWN,action:pu.start.handler}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOWN,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:pu.start.shift}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE,action:pu.move.handler}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:pu.move.shift}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_UP,action:pu.end.handler}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_UP,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:pu.end.shift})]}),jsxRuntimeExports.jsx(Ta$1,{maximumZoomDistance:(cf=(Zd=o==null?void 0:o.camera)==null?void 0:Zd.limiter)!=null&&cf.enabled?((df=(rf=(of=o.camera)==null?void 0:of.limiter)==null?void 0:rf.targetArea)==null?void 0:df.height)??Number.POSITIVE_INFINITY:Number.POSITIVE_INFINITY,enableCollisionDetection:!((Cf=o==null?void 0:o.camera)!=null&&Cf.allowEnterGround)}),jsxRuntimeExports.jsx(Ps$1,{percentageChanged:.2,onChange:mf,onMoveEnd:sf}),lf&&((Sf=(ff=o==null?void 0:o.camera)==null?void 0:ff.limiter)==null?void 0:Sf.showHelper)&&jsxRuntimeExports.jsx(Is$1,{children:jsxRuntimeExports.jsx(ua$1,{positions:lf,width:1,material:Cesium$1.Color.RED,arcType:Cesium$1.ArcType.RHUMB})}),hf&&((Af=(Pf=o==null?void 0:o.camera)==null?void 0:Pf.limiter)==null?void 0:Af.showHelper)&&jsxRuntimeExports.jsx(Is$1,{children:jsxRuntimeExports.jsx(ua$1,{positions:hf,width:1,material:pf,arcType:Cesium$1.ArcType.RHUMB})}),jsxRuntimeExports.jsx($a$1,{backgroundColor:Ru,light:Nl,mode:Gd,msaaSamples:Vd,useDepthPicking:!1,useWebVR:!!((Hf=o==null?void 0:o.scene)!=null&&Hf.vr)||void 0,debugShowFramesPerSecond:!!((_f=o==null?void 0:o.debug)!=null&&_f.showFramesPerSecond),verticalExaggerationRelativeHeight:(wf=o==null?void 0:o.scene)==null?void 0:wf.verticalExaggerationRelativeHeight,verticalExaggeration:(Yf=o==null?void 0:o.scene)==null?void 0:Yf.verticalExaggeration}),jsxRuntimeExports.jsx(Oa$1,{show:((jf=(Nf=o==null?void 0:o.sky)==null?void 0:Nf.skyBox)==null?void 0:jf.show)??!0}),jsxRuntimeExports.jsx(Vs,{enabled:(($m=(ep=o==null?void 0:o.sky)==null?void 0:ep.fog)==null?void 0:$m.enabled)??!0,density:(xf=(jm=o==null?void 0:o.sky)==null?void 0:jm.fog)==null?void 0:xf.density}),jsxRuntimeExports.jsx(Ga$1,{show:((kf=(Lf=o==null?void 0:o.sky)==null?void 0:Lf.sun)==null?void 0:kf.show)??!0}),jsxRuntimeExports.jsx(ea,{show:((_m=($f=o==null?void 0:o.sky)==null?void 0:$f.moon)==null?void 0:_m.show)??!0}),jsxRuntimeExports.jsx(_a$2,{show:((qm=(Am=o==null?void 0:o.sky)==null?void 0:Am.skyAtmosphere)==null?void 0:qm.show)??!0,atmosphereLightIntensity:(tf=(Ef=o==null?void 0:o.sky)==null?void 0:Ef.skyAtmosphere)==null?void 0:tf.lightIntensity,saturationShift:(Mf=(gf=o==null?void 0:o.sky)==null?void 0:gf.skyAtmosphere)==null?void 0:Mf.saturationShift,brightnessShift:(Uf=(Wf=o==null?void 0:o.sky)==null?void 0:Wf.skyAtmosphere)==null?void 0:Uf.brightnessShift}),jsxRuntimeExports.jsx(Globe,{property:o,cesiumIonAccessToken:ms,onTerrainProviderChange:Xd}),jsxRuntimeExports.jsx(context.Provider,{value:yu,children:h?p:null}),jsxRuntimeExports.jsx(AmbientOcclusion,{...AMBIENT_OCCLUSION_QUALITY[((sp=(Om=o==null?void 0:o.render)==null?void 0:Om.ambientOcclusion)==null?void 0:sp.quality)||"low"],enabled:!!((fp=(cp=o==null?void 0:o.render)==null?void 0:cp.ambientOcclusion)!=null&&fp.enabled),intensity:((al=(mp=o==null?void 0:o.render)==null?void 0:mp.ambientOcclusion)==null?void 0:al.intensity)??100,outputType:(uf=(nf=o==null?void 0:o.render)==null?void 0:nf.ambientOcclusion)!=null&&uf.ambientOcclusionOnly?AmbientOcclusionOutputType.Occlusion:null})]})},creditContainer=document.createElement("div"),Component=React.forwardRef(Cesium),engine={component:Component,featureComponent:Feature$1,clusterComponent:Cluster,sketchComponent:SketchComponent,delegatedDataTypes:["czml","wms","mvt","3dtiles","osm-buildings","kml"]},engines={cesium:engine};function Error$1({error:t,resetErrorBoundary:n}){return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h1",{children:"Oops! An Error Occurred"}),jsxRuntimeExports.jsx("p",{children:t.message}),jsxRuntimeExports.jsx("p",{children:jsxRuntimeExports.jsx("button",{style:{color:"#fff"},onClick:n,children:"Retry"})})]})}const version$1="0.0.7-alpha.47",useCoreAPI=({viewerProperty:t})=>{const n=React.useRef(t);n.current=t;const o=React.useMemo(()=>({get version(){return version$1},get viewerProperty(){return n.current}}),[]);React.useEffect(()=>{window.reearth_core=o},[o])},viewportMobileMaxWidth=768,useViewport=({wrapperRef:t})=>{const n=React.useMemo(()=>paramsToObject(new URLSearchParams(window.location.search)),[]),[o,s]=React.useState({width:void 0,height:void 0,isMobile:void 0,query:n});return React.useEffect(()=>{const c=new ResizeObserver(d=>{var S,P;const[h]=d;let p,y;if(h.contentBoxSize){const L=Array.isArray(h.contentBoxSize)?h.contentBoxSize[0]:h.contentBoxSize;p=L.inlineSize,y=L.blockSize}else h.contentRect?(p=h.contentRect.width,y=h.contentRect.height):(p=(S=t.current)==null?void 0:S.clientWidth,y=(P=t.current)==null?void 0:P.clientHeight);s(L=>({width:p,height:y,isMobile:p?p<=viewportMobileMaxWidth:void 0,query:L.query}))});return t.current&&c.observe(t.current),()=>{c.disconnect()}},[t]),o};function paramsToObject(t){const n={};for(const[o,s]of t)n[o]=s;return n}function useHooks({camera:t,interactionMode:n,zoomedLayerId:o,viewerProperty:s,onLayerSelect:c,onCameraChange:d,onInteractionModeChange:h,onZoomToLayer:p,onLayerDrop:y,onSketchTypeChangeProp:S},P){const L=React.useRef(null);React.useImperativeHandle(P,()=>L.current,[]);const F=React.useRef(null),N=useViewport({wrapperRef:F}),[W,z]=React.useState({}),[lt,Pe]=React.useState(),[se,mt]=React.useState(),kt=React.useCallback(async(_f,wf,Yf,Nf,jf)=>{var xf,Lf,kf,$f,_m,Am,qm,Ef,tf,gf,Mf,Wf;const ep=((Lf=(xf=W.layer)==null?void 0:xf.layer)==null?void 0:Lf.type)==="simple"&&((_m=($f=(kf=W.layer)==null?void 0:kf.layer)==null?void 0:$f.data)==null?void 0:_m.isSketchLayer);if(W.layerId===_f&&W.featureId===wf&&!ep)return;const $m=await(Yf==null?void 0:Yf()),jm=_f&&wf?(ep?(Am=$m==null?void 0:$m.features)==null?void 0:Am.find(Uf=>Uf.id===wf):(tf=(qm=L.current)==null?void 0:(Ef=qm.engine).findComputedFeatureById)==null?void 0:tf.call(Ef,_f,wf))??(jf==null?void 0:jf.feature):void 0;Pe(_f&&wf?(Wf=(gf=L.current)==null?void 0:(Mf=gf.engine).findFeatureById)==null?void 0:Wf.call(Mf,_f,wf):void 0),mt(jm),z(Uf=>Uf.layerId===_f&&Uf.featureId===wf?Uf:{layerId:_f,featureId:wf,layer:$m,reason:Nf}),c==null||c(_f,Yf,jm,Nf)},[W,c]),mn=React.useRef(),[_i,zi]=useValue(t,d),[ba,fa]=React.useState(!1),La=React.useCallback(_f=>{fa(!!_f)},[]),[Ra,ma]=useValue(n||"default",h);React.useEffect(()=>{var _f,wf;Ra==="default"&&((wf=(_f=L==null?void 0:L.current)==null?void 0:_f.engine)==null||wf.setCursor("auto"))},[Ra]);const yt=INTERACTION_MODES[Ra??"default"],nt=React.useRef(),pi=React.useCallback(_f=>{nt.current=_f},[]),Sa=React.useCallback(_f=>{var wf;(wf=nt.current)==null||wf.call(nt,_f)},[]),Sc=React.useRef(),Xs=React.useCallback(_f=>{Sc.current=_f},[]),ms=React.useCallback(_f=>{var wf;(wf=Sc.current)==null||wf.call(Sc,_f)},[]),yu=React.useRef(),pu=React.useCallback(_f=>{yu.current=_f},[]),Nl=React.useCallback(_f=>{var wf;(wf=yu.current)==null||wf.call(yu,_f)},[]),Ru=React.useRef(),Vd=React.useCallback(_f=>{Ru.current=_f},[]),Gd=React.useCallback(_f=>{var wf;(wf=Ru.current)==null||wf.call(Ru,_f)},[]),lf=React.useRef(),hf=React.useCallback(_f=>{lf.current=_f},[]),pf=React.useCallback(_f=>{var wf;(wf=lf.current)==null||wf.call(lf,_f)},[]),mf=React.useRef(),sf=React.useCallback(_f=>{mf.current=_f},[]),yf=React.useCallback(_f=>{var wf;(wf=mf.current)==null||wf.call(mf,_f)},[]),Tf=React.useRef([]),vf=React.useCallback(_f=>{Tf.current.push(_f)},[]),Wa=React.useCallback(_f=>{Tf.current.forEach(wf=>wf(_f))},[]),af=React.useRef([]),Xd=React.useCallback(_f=>{af.current.push(_f)},[]),gd=React.useCallback(_f=>{af.current.forEach(wf=>wf(_f))},[]),pd=React.useRef([]),Zd=React.useCallback(_f=>{pd.current.push(_f)},[]),cf=React.useCallback(_f=>{pd.current.forEach(wf=>wf(_f))},[]),of=React.useRef([]),rf=React.useCallback(_f=>{of.current.push(_f)},[]),df=React.useCallback((_f,wf)=>{of.current.forEach(Yf=>Yf(_f)),S==null||S(_f,wf)},[S]);React.useEffect(()=>{var _f,wf;o&&((wf=(_f=L.current)==null?void 0:_f.engine)==null||wf.lookAtLayer(o),p==null||p(void 0))},[o,p]);const[Cf,ff]=React.useState(!1),Sf=React.useCallback(()=>{ff(!0)},[]),Pf=React.useCallback((_f,wf,Yf)=>{var ep;ff(!1);const Nf=(ep=L.current)==null?void 0:ep.layers.findById(_f),jf=Nf!=null&&Nf.property.default.location?"default.location":Nf!=null&&Nf.property.default.position?"default.position":void 0;Yf&&Nf&&Nf.propertyId&&jf&&(y==null||y(Nf.propertyId,jf,Yf))},[y,L]),Af=React.useMemo(()=>({interactionMode:Ra,selectedLayer:W,selectedComputedFeature:se,viewport:N,handleCameraForceHorizontalRollChange:La,handleInteractionModeChange:ma,onSketchPluginFeatureCreate:vf,onSketchPluginFeatureUpdate:Xd,onSketchPluginFeatureDelete:Zd,onSketchTypeChange:rf,onLayerVisibility:Xs,onLayerLoad:pu,onLayerEdit:pi,onLayerSelectWithRectStart:Vd,onLayerSelectWithRectMove:hf,onLayerSelectWithRectEnd:sf}),[Ra,W,se,N,ma,La,pi,vf,Xd,Zd,rf,Xs,pu,Vd,hf,sf]),Hf=React.useMemo(()=>({position:"relative",width:"100%",height:"100%",overflow:"hidden"}),[]);return useCoreAPI({viewerProperty:s}),{mapRef:L,wrapperRef:F,selectedFeature:lt,camera:_i,featureFlags:yt,isLayerDragging:Cf,timelineManagerRef:mn,cameraForceHorizontalRoll:ba,coreContextValue:Af,containerStyle:Hf,overriddenInteractionMode:Ra,handleLayerSelect:kt,handleLayerDrag:Sf,handleLayerDrop:Pf,handleLayerEdit:Sa,handleCameraChange:zi,handleInteractionModeChange:ma,handleSketchPluginFeatureCreate:Wa,handleSketchPluginFeatureUpdate:gd,handleSketchPluginFeatureDelete:cf,handleSketchTypeChange:df,handleLayerVisibility:ms,handleLayerLoad:Nl,handleLayerSelectWithRectStart:Gd,handleLayerSelectWithRectMove:pf,handleLayerSelectWithRectEnd:yf}}function useValue(t,n){const[o,s]=React.useState(t),c=React.useCallback(d=>{d&&(s(d),n==null||n(d))},[n]);return React.useEffect(()=>{s(t)},[t]),[o,c]}const CoreVisualizer=React.memo(React.forwardRef(({engine:t,isBuilt:n,isEditable:o,viewerProperty:s,layers:c,clusters:d,small:h,ready:p,hiddenLayers:y,camera:S,time:P,interactionMode:L,shouldRender:F,meta:N,displayCredits:W=!0,style:z,zoomedLayerId:lt,children:Pe,onLayerDrop:se,onLayerSelect:mt,onCameraChange:kt,onZoomToLayer:mn,onInteractionModeChange:_i,onMount:zi,onSketchTypeChangeProp:ba,onSketchFeatureCreate:fa,onSketchFeatureUpdate:La,onSketchFeatureDelete:Ra,onAPIReady:ma,onCreditsUpdate:yt},nt)=>{const{mapRef:pi,wrapperRef:Sa,selectedFeature:Sc,camera:Xs,featureFlags:ms,isLayerDragging:yu,timelineManagerRef:pu,cameraForceHorizontalRoll:Nl,coreContextValue:Ru,containerStyle:Vd,overriddenInteractionMode:Gd,handleLayerSelect:lf,handleLayerDrag:hf,handleLayerDrop:pf,handleLayerEdit:mf,handleCameraChange:sf,handleInteractionModeChange:yf,handleSketchPluginFeatureCreate:Tf,handleSketchPluginFeatureUpdate:vf,handleSketchPluginFeatureDelete:Wa,handleSketchTypeChange:af,handleLayerVisibility:Xd,handleLayerLoad:gd,handleLayerSelectWithRectStart:pd,handleLayerSelectWithRectMove:Zd,handleLayerSelectWithRectEnd:cf}=useHooks({camera:S,interactionMode:L,zoomedLayerId:lt,viewerProperty:s,onLayerSelect:mt,onCameraChange:kt,onZoomToLayer:mn,onLayerDrop:se,onInteractionModeChange:_i,onSketchTypeChangeProp:ba},nt);return jsxRuntimeExports.jsx(ErrorBoundary,{FallbackComponent:Error$1,children:jsxRuntimeExports.jsx(VisualizerProvider,{mapRef:pi,children:jsxRuntimeExports.jsxs("div",{ref:Sa,style:Vd,children:[jsxRuntimeExports.jsx(Map$1,{ref:pi,isBuilt:n,isEditable:o,engine:t,layers:c,engines,camera:Xs,cameraForceHorizontalRoll:Nl,clusters:d,hiddenLayers:y,isLayerDragging:yu,isLayerDraggable:o,meta:N,displayCredits:W,style:z,featureFlags:ms,shouldRender:F,property:s,time:P,small:h,ready:p,timelineManagerRef:pu,interactionMode:Gd,selectedFeature:Sc,onCameraChange:sf,onLayerDrag:hf,onLayerDrop:pf,onLayerSelect:lf,onLayerEdit:mf,overrideInteractionMode:yf,onSketchFeatureCreate:fa,onSketchPluginFeatureCreate:Tf,onSketchFeatureUpdate:La,onSketchPluginFeatureUpdate:vf,onSketchFeatureDelete:Ra,onSketchPluginFeatureDelete:Wa,onSketchTypeChange:af,onMount:zi,onLayerVisibility:Xd,onLayerLoad:gd,onLayerSelectWithRectStart:pd,onLayerSelectWithRectMove:Zd,onLayerSelectWithRectEnd:cf,onAPIReady:ma,onCreditsUpdate:yt}),jsxRuntimeExports.jsx(coreContext.Provider,{value:Ru,children:Pe})]})})})}));var global$1=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,inited=!1;function init(){inited=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=t.length;n<o;++n)lookup[n]=t[n],revLookup[t.charCodeAt(n)]=n;revLookup[45]=62,revLookup[95]=63}function toByteArray(t){inited||init();var n,o,s,c,d,h,p=t.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");d=t[p-2]==="="?2:t[p-1]==="="?1:0,h=new Arr(p*3/4-d),s=d>0?p-4:p;var y=0;for(n=0,o=0;n<s;n+=4,o+=3)c=revLookup[t.charCodeAt(n)]<<18|revLookup[t.charCodeAt(n+1)]<<12|revLookup[t.charCodeAt(n+2)]<<6|revLookup[t.charCodeAt(n+3)],h[y++]=c>>16&255,h[y++]=c>>8&255,h[y++]=c&255;return d===2?(c=revLookup[t.charCodeAt(n)]<<2|revLookup[t.charCodeAt(n+1)]>>4,h[y++]=c&255):d===1&&(c=revLookup[t.charCodeAt(n)]<<10|revLookup[t.charCodeAt(n+1)]<<4|revLookup[t.charCodeAt(n+2)]>>2,h[y++]=c>>8&255,h[y++]=c&255),h}function tripletToBase64(t){return lookup[t>>18&63]+lookup[t>>12&63]+lookup[t>>6&63]+lookup[t&63]}function encodeChunk(t,n,o){for(var s,c=[],d=n;d<o;d+=3)s=(t[d]<<16)+(t[d+1]<<8)+t[d+2],c.push(tripletToBase64(s));return c.join("")}function fromByteArray(t){inited||init();for(var n,o=t.length,s=o%3,c="",d=[],h=16383,p=0,y=o-s;p<y;p+=h)d.push(encodeChunk(t,p,p+h>y?y:p+h));return s===1?(n=t[o-1],c+=lookup[n>>2],c+=lookup[n<<4&63],c+="=="):s===2&&(n=(t[o-2]<<8)+t[o-1],c+=lookup[n>>10],c+=lookup[n>>4&63],c+=lookup[n<<2&63],c+="="),d.push(c),d.join("")}function read(t,n,o,s,c){var d,h,p=c*8-s-1,y=(1<<p)-1,S=y>>1,P=-7,L=o?c-1:0,F=o?-1:1,N=t[n+L];for(L+=F,d=N&(1<<-P)-1,N>>=-P,P+=p;P>0;d=d*256+t[n+L],L+=F,P-=8);for(h=d&(1<<-P)-1,d>>=-P,P+=s;P>0;h=h*256+t[n+L],L+=F,P-=8);if(d===0)d=1-S;else{if(d===y)return h?NaN:(N?-1:1)*(1/0);h=h+Math.pow(2,s),d=d-S}return(N?-1:1)*h*Math.pow(2,d-s)}function write(t,n,o,s,c,d){var h,p,y,S=d*8-c-1,P=(1<<S)-1,L=P>>1,F=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,N=s?0:d-1,W=s?1:-1,z=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(p=isNaN(n)?1:0,h=P):(h=Math.floor(Math.log(n)/Math.LN2),n*(y=Math.pow(2,-h))<1&&(h--,y*=2),h+L>=1?n+=F/y:n+=F*Math.pow(2,1-L),n*y>=2&&(h++,y/=2),h+L>=P?(p=0,h=P):h+L>=1?(p=(n*y-1)*Math.pow(2,c),h=h+L):(p=n*Math.pow(2,L-1)*Math.pow(2,c),h=0));c>=8;t[o+N]=p&255,N+=W,p/=256,c-=8);for(h=h<<c|p,S+=c;S>0;t[o+N]=h&255,N+=W,h/=256,S-=8);t[o+N-W]|=z*128}var toString={}.toString,isArray$1=Array.isArray||function(t){return toString.call(t)=="[object Array]"},INSPECT_MAX_BYTES=50;Buffer$1.TYPED_ARRAY_SUPPORT=global$1.TYPED_ARRAY_SUPPORT!==void 0?global$1.TYPED_ARRAY_SUPPORT:!0,kMaxLength();function kMaxLength(){return Buffer$1.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(t,n){if(kMaxLength()<n)throw new RangeError("Invalid typed array length");return Buffer$1.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(n),t.__proto__=Buffer$1.prototype):(t===null&&(t=new Buffer$1(n)),t.length=n),t}function Buffer$1(t,n,o){if(!Buffer$1.TYPED_ARRAY_SUPPORT&&!(this instanceof Buffer$1))return new Buffer$1(t,n,o);if(typeof t=="number"){if(typeof n=="string")throw new Error("If encoding is specified then the first argument must be a string");return allocUnsafe(this,t)}return from(this,t,n,o)}Buffer$1.poolSize=8192,Buffer$1._augment=function(t){return t.__proto__=Buffer$1.prototype,t};function from(t,n,o,s){if(typeof n=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&n instanceof ArrayBuffer?fromArrayBuffer(t,n,o,s):typeof n=="string"?fromString(t,n,o):fromObject(t,n)}Buffer$1.from=function(t,n,o){return from(null,t,n,o)},Buffer$1.TYPED_ARRAY_SUPPORT&&(Buffer$1.prototype.__proto__=Uint8Array.prototype,Buffer$1.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&Buffer$1[Symbol.species]);function assertSize(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function alloc(t,n,o,s){return assertSize(n),n<=0?createBuffer(t,n):o!==void 0?typeof s=="string"?createBuffer(t,n).fill(o,s):createBuffer(t,n).fill(o):createBuffer(t,n)}Buffer$1.alloc=function(t,n,o){return alloc(null,t,n,o)};function allocUnsafe(t,n){if(assertSize(n),t=createBuffer(t,n<0?0:checked(n)|0),!Buffer$1.TYPED_ARRAY_SUPPORT)for(var o=0;o<n;++o)t[o]=0;return t}Buffer$1.allocUnsafe=function(t){return allocUnsafe(null,t)},Buffer$1.allocUnsafeSlow=function(t){return allocUnsafe(null,t)};function fromString(t,n,o){if((typeof o!="string"||o==="")&&(o="utf8"),!Buffer$1.isEncoding(o))throw new TypeError('"encoding" must be a valid string encoding');var s=byteLength(n,o)|0;t=createBuffer(t,s);var c=t.write(n,o);return c!==s&&(t=t.slice(0,c)),t}function fromArrayLike(t,n){var o=n.length<0?0:checked(n.length)|0;t=createBuffer(t,o);for(var s=0;s<o;s+=1)t[s]=n[s]&255;return t}function fromArrayBuffer(t,n,o,s){if(n.byteLength,o<0||n.byteLength<o)throw new RangeError("'offset' is out of bounds");if(n.byteLength<o+(s||0))throw new RangeError("'length' is out of bounds");return o===void 0&&s===void 0?n=new Uint8Array(n):s===void 0?n=new Uint8Array(n,o):n=new Uint8Array(n,o,s),Buffer$1.TYPED_ARRAY_SUPPORT?(t=n,t.__proto__=Buffer$1.prototype):t=fromArrayLike(t,n),t}function fromObject(t,n){if(internalIsBuffer(n)){var o=checked(n.length)|0;return t=createBuffer(t,o),t.length===0||n.copy(t,0,0,o),t}if(n){if(typeof ArrayBuffer<"u"&&n.buffer instanceof ArrayBuffer||"length"in n)return typeof n.length!="number"||isnan(n.length)?createBuffer(t,0):fromArrayLike(t,n);if(n.type==="Buffer"&&isArray$1(n.data))return fromArrayLike(t,n.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function checked(t){if(t>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return t|0}Buffer$1.isBuffer=isBuffer;function internalIsBuffer(t){return!!(t!=null&&t._isBuffer)}Buffer$1.compare=function t(n,o){if(!internalIsBuffer(n)||!internalIsBuffer(o))throw new TypeError("Arguments must be Buffers");if(n===o)return 0;for(var s=n.length,c=o.length,d=0,h=Math.min(s,c);d<h;++d)if(n[d]!==o[d]){s=n[d],c=o[d];break}return s<c?-1:c<s?1:0},Buffer$1.isEncoding=function t(n){switch(String(n).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer$1.concat=function t(n,o){if(!isArray$1(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return Buffer$1.alloc(0);var s;if(o===void 0)for(o=0,s=0;s<n.length;++s)o+=n[s].length;var c=Buffer$1.allocUnsafe(o),d=0;for(s=0;s<n.length;++s){var h=n[s];if(!internalIsBuffer(h))throw new TypeError('"list" argument must be an Array of Buffers');h.copy(c,d),d+=h.length}return c};function byteLength(t,n){if(internalIsBuffer(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var o=t.length;if(o===0)return 0;for(var s=!1;;)switch(n){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":case void 0:return utf8ToBytes(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return base64ToBytes(t).length;default:if(s)return utf8ToBytes(t).length;n=(""+n).toLowerCase(),s=!0}}Buffer$1.byteLength=byteLength;function slowToString(t,n,o){var s=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,n>>>=0,o<=n))return"";for(t||(t="utf8");;)switch(t){case"hex":return hexSlice(this,n,o);case"utf8":case"utf-8":return utf8Slice(this,n,o);case"ascii":return asciiSlice(this,n,o);case"latin1":case"binary":return latin1Slice(this,n,o);case"base64":return base64Slice(this,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,n,o);default:if(s)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),s=!0}}Buffer$1.prototype._isBuffer=!0;function swap(t,n,o){var s=t[n];t[n]=t[o],t[o]=s}Buffer$1.prototype.swap16=function t(){var n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var o=0;o<n;o+=2)swap(this,o,o+1);return this},Buffer$1.prototype.swap32=function t(){var n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var o=0;o<n;o+=4)swap(this,o,o+3),swap(this,o+1,o+2);return this},Buffer$1.prototype.swap64=function t(){var n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var o=0;o<n;o+=8)swap(this,o,o+7),swap(this,o+1,o+6),swap(this,o+2,o+5),swap(this,o+3,o+4);return this},Buffer$1.prototype.toString=function t(){var n=this.length|0;return n===0?"":arguments.length===0?utf8Slice(this,0,n):slowToString.apply(this,arguments)},Buffer$1.prototype.equals=function t(n){if(!internalIsBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:Buffer$1.compare(this,n)===0},Buffer$1.prototype.inspect=function t(){var n="",o=INSPECT_MAX_BYTES;return this.length>0&&(n=this.toString("hex",0,o).match(/.{2}/g).join(" "),this.length>o&&(n+=" ... ")),"<Buffer "+n+">"},Buffer$1.prototype.compare=function t(n,o,s,c,d){if(!internalIsBuffer(n))throw new TypeError("Argument must be a Buffer");if(o===void 0&&(o=0),s===void 0&&(s=n?n.length:0),c===void 0&&(c=0),d===void 0&&(d=this.length),o<0||s>n.length||c<0||d>this.length)throw new RangeError("out of range index");if(c>=d&&o>=s)return 0;if(c>=d)return-1;if(o>=s)return 1;if(o>>>=0,s>>>=0,c>>>=0,d>>>=0,this===n)return 0;for(var h=d-c,p=s-o,y=Math.min(h,p),S=this.slice(c,d),P=n.slice(o,s),L=0;L<y;++L)if(S[L]!==P[L]){h=S[L],p=P[L];break}return h<p?-1:p<h?1:0};function bidirectionalIndexOf(t,n,o,s,c){if(t.length===0)return-1;if(typeof o=="string"?(s=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,isNaN(o)&&(o=c?0:t.length-1),o<0&&(o=t.length+o),o>=t.length){if(c)return-1;o=t.length-1}else if(o<0)if(c)o=0;else return-1;if(typeof n=="string"&&(n=Buffer$1.from(n,s)),internalIsBuffer(n))return n.length===0?-1:arrayIndexOf(t,n,o,s,c);if(typeof n=="number")return n=n&255,Buffer$1.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?c?Uint8Array.prototype.indexOf.call(t,n,o):Uint8Array.prototype.lastIndexOf.call(t,n,o):arrayIndexOf(t,[n],o,s,c);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(t,n,o,s,c){var d=1,h=t.length,p=n.length;if(s!==void 0&&(s=String(s).toLowerCase(),s==="ucs2"||s==="ucs-2"||s==="utf16le"||s==="utf-16le")){if(t.length<2||n.length<2)return-1;d=2,h/=2,p/=2,o/=2}function y(N,W){return d===1?N[W]:N.readUInt16BE(W*d)}var S;if(c){var P=-1;for(S=o;S<h;S++)if(y(t,S)===y(n,P===-1?0:S-P)){if(P===-1&&(P=S),S-P+1===p)return P*d}else P!==-1&&(S-=S-P),P=-1}else for(o+p>h&&(o=h-p),S=o;S>=0;S--){for(var L=!0,F=0;F<p;F++)if(y(t,S+F)!==y(n,F)){L=!1;break}if(L)return S}return-1}Buffer$1.prototype.includes=function t(n,o,s){return this.indexOf(n,o,s)!==-1},Buffer$1.prototype.indexOf=function t(n,o,s){return bidirectionalIndexOf(this,n,o,s,!0)},Buffer$1.prototype.lastIndexOf=function t(n,o,s){return bidirectionalIndexOf(this,n,o,s,!1)};function hexWrite(t,n,o,s){o=Number(o)||0;var c=t.length-o;s?(s=Number(s),s>c&&(s=c)):s=c;var d=n.length;if(d%2!==0)throw new TypeError("Invalid hex string");s>d/2&&(s=d/2);for(var h=0;h<s;++h){var p=parseInt(n.substr(h*2,2),16);if(isNaN(p))return h;t[o+h]=p}return h}function utf8Write(t,n,o,s){return blitBuffer(utf8ToBytes(n,t.length-o),t,o,s)}function asciiWrite(t,n,o,s){return blitBuffer(asciiToBytes(n),t,o,s)}function latin1Write(t,n,o,s){return asciiWrite(t,n,o,s)}function base64Write(t,n,o,s){return blitBuffer(base64ToBytes(n),t,o,s)}function ucs2Write(t,n,o,s){return blitBuffer(utf16leToBytes(n,t.length-o),t,o,s)}Buffer$1.prototype.write=function t(n,o,s,c){if(o===void 0)c="utf8",s=this.length,o=0;else if(s===void 0&&typeof o=="string")c=o,s=this.length,o=0;else if(isFinite(o))o=o|0,isFinite(s)?(s=s|0,c===void 0&&(c="utf8")):(c=s,s=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var d=this.length-o;if((s===void 0||s>d)&&(s=d),n.length>0&&(s<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");c||(c="utf8");for(var h=!1;;)switch(c){case"hex":return hexWrite(this,n,o,s);case"utf8":case"utf-8":return utf8Write(this,n,o,s);case"ascii":return asciiWrite(this,n,o,s);case"latin1":case"binary":return latin1Write(this,n,o,s);case"base64":return base64Write(this,n,o,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,n,o,s);default:if(h)throw new TypeError("Unknown encoding: "+c);c=(""+c).toLowerCase(),h=!0}},Buffer$1.prototype.toJSON=function t(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(t,n,o){return n===0&&o===t.length?fromByteArray(t):fromByteArray(t.slice(n,o))}function utf8Slice(t,n,o){o=Math.min(t.length,o);for(var s=[],c=n;c<o;){var d=t[c],h=null,p=d>239?4:d>223?3:d>191?2:1;if(c+p<=o){var y,S,P,L;switch(p){case 1:d<128&&(h=d);break;case 2:y=t[c+1],(y&192)===128&&(L=(d&31)<<6|y&63,L>127&&(h=L));break;case 3:y=t[c+1],S=t[c+2],(y&192)===128&&(S&192)===128&&(L=(d&15)<<12|(y&63)<<6|S&63,L>2047&&(L<55296||L>57343)&&(h=L));break;case 4:y=t[c+1],S=t[c+2],P=t[c+3],(y&192)===128&&(S&192)===128&&(P&192)===128&&(L=(d&15)<<18|(y&63)<<12|(S&63)<<6|P&63,L>65535&&L<1114112&&(h=L))}}h===null?(h=65533,p=1):h>65535&&(h-=65536,s.push(h>>>10&1023|55296),h=56320|h&1023),s.push(h),c+=p}return decodeCodePointsArray(s)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(t){var n=t.length;if(n<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,t);for(var o="",s=0;s<n;)o+=String.fromCharCode.apply(String,t.slice(s,s+=MAX_ARGUMENTS_LENGTH));return o}function asciiSlice(t,n,o){var s="";o=Math.min(t.length,o);for(var c=n;c<o;++c)s+=String.fromCharCode(t[c]&127);return s}function latin1Slice(t,n,o){var s="";o=Math.min(t.length,o);for(var c=n;c<o;++c)s+=String.fromCharCode(t[c]);return s}function hexSlice(t,n,o){var s=t.length;(!n||n<0)&&(n=0),(!o||o<0||o>s)&&(o=s);for(var c="",d=n;d<o;++d)c+=toHex(t[d]);return c}function utf16leSlice(t,n,o){for(var s=t.slice(n,o),c="",d=0;d<s.length;d+=2)c+=String.fromCharCode(s[d]+s[d+1]*256);return c}Buffer$1.prototype.slice=function t(n,o){var s=this.length;n=~~n,o=o===void 0?s:~~o,n<0?(n+=s,n<0&&(n=0)):n>s&&(n=s),o<0?(o+=s,o<0&&(o=0)):o>s&&(o=s),o<n&&(o=n);var c;if(Buffer$1.TYPED_ARRAY_SUPPORT)c=this.subarray(n,o),c.__proto__=Buffer$1.prototype;else{var d=o-n;c=new Buffer$1(d,void 0);for(var h=0;h<d;++h)c[h]=this[h+n]}return c};function checkOffset(t,n,o){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+n>o)throw new RangeError("Trying to access beyond buffer length")}Buffer$1.prototype.readUIntLE=function t(n,o,s){n=n|0,o=o|0,s||checkOffset(n,o,this.length);for(var c=this[n],d=1,h=0;++h<o&&(d*=256);)c+=this[n+h]*d;return c},Buffer$1.prototype.readUIntBE=function t(n,o,s){n=n|0,o=o|0,s||checkOffset(n,o,this.length);for(var c=this[n+--o],d=1;o>0&&(d*=256);)c+=this[n+--o]*d;return c},Buffer$1.prototype.readUInt8=function t(n,o){return o||checkOffset(n,1,this.length),this[n]},Buffer$1.prototype.readUInt16LE=function t(n,o){return o||checkOffset(n,2,this.length),this[n]|this[n+1]<<8},Buffer$1.prototype.readUInt16BE=function t(n,o){return o||checkOffset(n,2,this.length),this[n]<<8|this[n+1]},Buffer$1.prototype.readUInt32LE=function t(n,o){return o||checkOffset(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},Buffer$1.prototype.readUInt32BE=function t(n,o){return o||checkOffset(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},Buffer$1.prototype.readIntLE=function t(n,o,s){n=n|0,o=o|0,s||checkOffset(n,o,this.length);for(var c=this[n],d=1,h=0;++h<o&&(d*=256);)c+=this[n+h]*d;return d*=128,c>=d&&(c-=Math.pow(2,8*o)),c},Buffer$1.prototype.readIntBE=function t(n,o,s){n=n|0,o=o|0,s||checkOffset(n,o,this.length);for(var c=o,d=1,h=this[n+--c];c>0&&(d*=256);)h+=this[n+--c]*d;return d*=128,h>=d&&(h-=Math.pow(2,8*o)),h},Buffer$1.prototype.readInt8=function t(n,o){return o||checkOffset(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},Buffer$1.prototype.readInt16LE=function t(n,o){o||checkOffset(n,2,this.length);var s=this[n]|this[n+1]<<8;return s&32768?s|4294901760:s},Buffer$1.prototype.readInt16BE=function t(n,o){o||checkOffset(n,2,this.length);var s=this[n+1]|this[n]<<8;return s&32768?s|4294901760:s},Buffer$1.prototype.readInt32LE=function t(n,o){return o||checkOffset(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},Buffer$1.prototype.readInt32BE=function t(n,o){return o||checkOffset(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},Buffer$1.prototype.readFloatLE=function t(n,o){return o||checkOffset(n,4,this.length),read(this,n,!0,23,4)},Buffer$1.prototype.readFloatBE=function t(n,o){return o||checkOffset(n,4,this.length),read(this,n,!1,23,4)},Buffer$1.prototype.readDoubleLE=function t(n,o){return o||checkOffset(n,8,this.length),read(this,n,!0,52,8)},Buffer$1.prototype.readDoubleBE=function t(n,o){return o||checkOffset(n,8,this.length),read(this,n,!1,52,8)};function checkInt(t,n,o,s,c,d){if(!internalIsBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>c||n<d)throw new RangeError('"value" argument is out of bounds');if(o+s>t.length)throw new RangeError("Index out of range")}Buffer$1.prototype.writeUIntLE=function t(n,o,s,c){if(n=+n,o=o|0,s=s|0,!c){var d=Math.pow(2,8*s)-1;checkInt(this,n,o,s,d,0)}var h=1,p=0;for(this[o]=n&255;++p<s&&(h*=256);)this[o+p]=n/h&255;return o+s},Buffer$1.prototype.writeUIntBE=function t(n,o,s,c){if(n=+n,o=o|0,s=s|0,!c){var d=Math.pow(2,8*s)-1;checkInt(this,n,o,s,d,0)}var h=s-1,p=1;for(this[o+h]=n&255;--h>=0&&(p*=256);)this[o+h]=n/p&255;return o+s},Buffer$1.prototype.writeUInt8=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,1,255,0),Buffer$1.TYPED_ARRAY_SUPPORT||(n=Math.floor(n)),this[o]=n&255,o+1};function objectWriteUInt16(t,n,o,s){n<0&&(n=65535+n+1);for(var c=0,d=Math.min(t.length-o,2);c<d;++c)t[o+c]=(n&255<<8*(s?c:1-c))>>>(s?c:1-c)*8}Buffer$1.prototype.writeUInt16LE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n&255,this[o+1]=n>>>8):objectWriteUInt16(this,n,o,!0),o+2},Buffer$1.prototype.writeUInt16BE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n>>>8,this[o+1]=n&255):objectWriteUInt16(this,n,o,!1),o+2};function objectWriteUInt32(t,n,o,s){n<0&&(n=4294967295+n+1);for(var c=0,d=Math.min(t.length-o,4);c<d;++c)t[o+c]=n>>>(s?c:3-c)*8&255}Buffer$1.prototype.writeUInt32LE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o+3]=n>>>24,this[o+2]=n>>>16,this[o+1]=n>>>8,this[o]=n&255):objectWriteUInt32(this,n,o,!0),o+4},Buffer$1.prototype.writeUInt32BE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255):objectWriteUInt32(this,n,o,!1),o+4},Buffer$1.prototype.writeIntLE=function t(n,o,s,c){if(n=+n,o=o|0,!c){var d=Math.pow(2,8*s-1);checkInt(this,n,o,s,d-1,-d)}var h=0,p=1,y=0;for(this[o]=n&255;++h<s&&(p*=256);)n<0&&y===0&&this[o+h-1]!==0&&(y=1),this[o+h]=(n/p>>0)-y&255;return o+s},Buffer$1.prototype.writeIntBE=function t(n,o,s,c){if(n=+n,o=o|0,!c){var d=Math.pow(2,8*s-1);checkInt(this,n,o,s,d-1,-d)}var h=s-1,p=1,y=0;for(this[o+h]=n&255;--h>=0&&(p*=256);)n<0&&y===0&&this[o+h+1]!==0&&(y=1),this[o+h]=(n/p>>0)-y&255;return o+s},Buffer$1.prototype.writeInt8=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,1,127,-128),Buffer$1.TYPED_ARRAY_SUPPORT||(n=Math.floor(n)),n<0&&(n=255+n+1),this[o]=n&255,o+1},Buffer$1.prototype.writeInt16LE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n&255,this[o+1]=n>>>8):objectWriteUInt16(this,n,o,!0),o+2},Buffer$1.prototype.writeInt16BE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n>>>8,this[o+1]=n&255):objectWriteUInt16(this,n,o,!1),o+2},Buffer$1.prototype.writeInt32LE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,4,2147483647,-2147483648),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n&255,this[o+1]=n>>>8,this[o+2]=n>>>16,this[o+3]=n>>>24):objectWriteUInt32(this,n,o,!0),o+4},Buffer$1.prototype.writeInt32BE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255):objectWriteUInt32(this,n,o,!1),o+4};function checkIEEE754(t,n,o,s,c,d){if(o+s>t.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function writeFloat(t,n,o,s,c){return c||checkIEEE754(t,n,o,4),write(t,n,o,s,23,4),o+4}Buffer$1.prototype.writeFloatLE=function t(n,o,s){return writeFloat(this,n,o,!0,s)},Buffer$1.prototype.writeFloatBE=function t(n,o,s){return writeFloat(this,n,o,!1,s)};function writeDouble(t,n,o,s,c){return c||checkIEEE754(t,n,o,8),write(t,n,o,s,52,8),o+8}Buffer$1.prototype.writeDoubleLE=function t(n,o,s){return writeDouble(this,n,o,!0,s)},Buffer$1.prototype.writeDoubleBE=function t(n,o,s){return writeDouble(this,n,o,!1,s)},Buffer$1.prototype.copy=function t(n,o,s,c){if(s||(s=0),!c&&c!==0&&(c=this.length),o>=n.length&&(o=n.length),o||(o=0),c>0&&c<s&&(c=s),c===s||n.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(s<0||s>=this.length)throw new RangeError("sourceStart out of bounds");if(c<0)throw new RangeError("sourceEnd out of bounds");c>this.length&&(c=this.length),n.length-o<c-s&&(c=n.length-o+s);var d=c-s,h;if(this===n&&s<o&&o<c)for(h=d-1;h>=0;--h)n[h+o]=this[h+s];else if(d<1e3||!Buffer$1.TYPED_ARRAY_SUPPORT)for(h=0;h<d;++h)n[h+o]=this[h+s];else Uint8Array.prototype.set.call(n,this.subarray(s,s+d),o);return d},Buffer$1.prototype.fill=function t(n,o,s,c){if(typeof n=="string"){if(typeof o=="string"?(c=o,o=0,s=this.length):typeof s=="string"&&(c=s,s=this.length),n.length===1){var d=n.charCodeAt(0);d<256&&(n=d)}if(c!==void 0&&typeof c!="string")throw new TypeError("encoding must be a string");if(typeof c=="string"&&!Buffer$1.isEncoding(c))throw new TypeError("Unknown encoding: "+c)}else typeof n=="number"&&(n=n&255);if(o<0||this.length<o||this.length<s)throw new RangeError("Out of range index");if(s<=o)return this;o=o>>>0,s=s===void 0?this.length:s>>>0,n||(n=0);var h;if(typeof n=="number")for(h=o;h<s;++h)this[h]=n;else{var p=internalIsBuffer(n)?n:utf8ToBytes(new Buffer$1(n,c).toString()),y=p.length;for(h=0;h<s-o;++h)this[h+o]=p[h%y]}return this};var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g;function base64clean(t){if(t=stringtrim(t).replace(INVALID_BASE64_RE,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function stringtrim(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function toHex(t){return t<16?"0"+t.toString(16):t.toString(16)}function utf8ToBytes(t,n){n=n||1/0;for(var o,s=t.length,c=null,d=[],h=0;h<s;++h){if(o=t.charCodeAt(h),o>55295&&o<57344){if(!c){if(o>56319){(n-=3)>-1&&d.push(239,191,189);continue}else if(h+1===s){(n-=3)>-1&&d.push(239,191,189);continue}c=o;continue}if(o<56320){(n-=3)>-1&&d.push(239,191,189),c=o;continue}o=(c-55296<<10|o-56320)+65536}else c&&(n-=3)>-1&&d.push(239,191,189);if(c=null,o<128){if((n-=1)<0)break;d.push(o)}else if(o<2048){if((n-=2)<0)break;d.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;d.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;d.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return d}function asciiToBytes(t){for(var n=[],o=0;o<t.length;++o)n.push(t.charCodeAt(o)&255);return n}function utf16leToBytes(t,n){for(var o,s,c,d=[],h=0;h<t.length&&!((n-=2)<0);++h)o=t.charCodeAt(h),s=o>>8,c=o%256,d.push(c),d.push(s);return d}function base64ToBytes(t){return toByteArray(base64clean(t))}function blitBuffer(t,n,o,s){for(var c=0;c<s&&!(c+o>=n.length||c>=t.length);++c)n[c+o]=t[c];return c}function isnan(t){return t!==t}function isBuffer(t){return t!=null&&(!!t._isBuffer||isFastBuffer(t)||isSlowBuffer(t))}function isFastBuffer(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function isSlowBuffer(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&isFastBuffer(t.slice(0,0))}var domain;function EventHandlers(){}EventHandlers.prototype=Object.create(null);function EventEmitter(){EventEmitter.init.call(this)}EventEmitter.EventEmitter=EventEmitter,EventEmitter.usingDomains=!1,EventEmitter.prototype.domain=void 0,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.init=function(){this.domain=null,EventEmitter.usingDomains&&domain.active,(!this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=new EventHandlers,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},EventEmitter.prototype.setMaxListeners=function t(n){if(typeof n!="number"||n<0||isNaN(n))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=n,this};function $getMaxListeners(t){return t._maxListeners===void 0?EventEmitter.defaultMaxListeners:t._maxListeners}EventEmitter.prototype.getMaxListeners=function t(){return $getMaxListeners(this)};function emitNone(t,n,o){if(n)t.call(o);else for(var s=t.length,c=arrayClone(t,s),d=0;d<s;++d)c[d].call(o)}function emitOne(t,n,o,s){if(n)t.call(o,s);else for(var c=t.length,d=arrayClone(t,c),h=0;h<c;++h)d[h].call(o,s)}function emitTwo(t,n,o,s,c){if(n)t.call(o,s,c);else for(var d=t.length,h=arrayClone(t,d),p=0;p<d;++p)h[p].call(o,s,c)}function emitThree(t,n,o,s,c,d){if(n)t.call(o,s,c,d);else for(var h=t.length,p=arrayClone(t,h),y=0;y<h;++y)p[y].call(o,s,c,d)}function emitMany(t,n,o,s){if(n)t.apply(o,s);else for(var c=t.length,d=arrayClone(t,c),h=0;h<c;++h)d[h].apply(o,s)}EventEmitter.prototype.emit=function t(n){var o,s,c,d,h,p,y,S=n==="error";if(p=this._events,p)S=S&&p.error==null;else if(!S)return!1;if(y=this.domain,S){if(o=arguments[1],y)o||(o=new Error('Uncaught, unspecified "error" event')),o.domainEmitter=this,o.domain=y,o.domainThrown=!1,y.emit("error",o);else{if(o instanceof Error)throw o;var P=new Error('Uncaught, unspecified "error" event. ('+o+")");throw P.context=o,P}return!1}if(s=p[n],!s)return!1;var L=typeof s=="function";switch(c=arguments.length,c){case 1:emitNone(s,L,this);break;case 2:emitOne(s,L,this,arguments[1]);break;case 3:emitTwo(s,L,this,arguments[1],arguments[2]);break;case 4:emitThree(s,L,this,arguments[1],arguments[2],arguments[3]);break;default:for(d=new Array(c-1),h=1;h<c;h++)d[h-1]=arguments[h];emitMany(s,L,this,d)}return!0};function _addListener(t,n,o,s){var c,d,h;if(typeof o!="function")throw new TypeError('"listener" argument must be a function');if(d=t._events,d?(d.newListener&&(t.emit("newListener",n,o.listener?o.listener:o),d=t._events),h=d[n]):(d=t._events=new EventHandlers,t._eventsCount=0),!h)h=d[n]=o,++t._eventsCount;else if(typeof h=="function"?h=d[n]=s?[o,h]:[h,o]:s?h.unshift(o):h.push(o),!h.warned&&(c=$getMaxListeners(t),c&&c>0&&h.length>c)){h.warned=!0;var p=new Error("Possible EventEmitter memory leak detected. "+h.length+" "+n+" listeners added. Use emitter.setMaxListeners() to increase limit");p.name="MaxListenersExceededWarning",p.emitter=t,p.type=n,p.count=h.length,emitWarning(p)}return t}function emitWarning(t){typeof console.warn=="function"?console.warn(t):console.log(t)}EventEmitter.prototype.addListener=function t(n,o){return _addListener(this,n,o,!1)},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.prependListener=function t(n,o){return _addListener(this,n,o,!0)};function _onceWrap(t,n,o){var s=!1;function c(){t.removeListener(n,c),s||(s=!0,o.apply(t,arguments))}return c.listener=o,c}EventEmitter.prototype.once=function t(n,o){if(typeof o!="function")throw new TypeError('"listener" argument must be a function');return this.on(n,_onceWrap(this,n,o)),this},EventEmitter.prototype.prependOnceListener=function t(n,o){if(typeof o!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(n,_onceWrap(this,n,o)),this},EventEmitter.prototype.removeListener=function t(n,o){var s,c,d,h,p;if(typeof o!="function")throw new TypeError('"listener" argument must be a function');if(c=this._events,!c)return this;if(s=c[n],!s)return this;if(s===o||s.listener&&s.listener===o)--this._eventsCount===0?this._events=new EventHandlers:(delete c[n],c.removeListener&&this.emit("removeListener",n,s.listener||o));else if(typeof s!="function"){for(d=-1,h=s.length;h-- >0;)if(s[h]===o||s[h].listener&&s[h].listener===o){p=s[h].listener,d=h;break}if(d<0)return this;if(s.length===1){if(s[0]=void 0,--this._eventsCount===0)return this._events=new EventHandlers,this;delete c[n]}else spliceOne(s,d);c.removeListener&&this.emit("removeListener",n,p||o)}return this},EventEmitter.prototype.removeAllListeners=function t(n){var o,s;if(s=this._events,!s)return this;if(!s.removeListener)return arguments.length===0?(this._events=new EventHandlers,this._eventsCount=0):s[n]&&(--this._eventsCount===0?this._events=new EventHandlers:delete s[n]),this;if(arguments.length===0){for(var c=Object.keys(s),d=0,h;d<c.length;++d)h=c[d],h!=="removeListener"&&this.removeAllListeners(h);return this.removeAllListeners("removeListener"),this._events=new EventHandlers,this._eventsCount=0,this}if(o=s[n],typeof o=="function")this.removeListener(n,o);else if(o)do this.removeListener(n,o[o.length-1]);while(o[0]);return this},EventEmitter.prototype.listeners=function t(n){var o,s,c=this._events;return c?(o=c[n],o?typeof o=="function"?s=[o.listener||o]:s=unwrapListeners(o):s=[]):s=[],s},EventEmitter.listenerCount=function(t,n){return typeof t.listenerCount=="function"?t.listenerCount(n):listenerCount$1.call(t,n)},EventEmitter.prototype.listenerCount=listenerCount$1;function listenerCount$1(t){var n=this._events;if(n){var o=n[t];if(typeof o=="function")return 1;if(o)return o.length}return 0}EventEmitter.prototype.eventNames=function t(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function spliceOne(t,n){for(var o=n,s=o+1,c=t.length;s<c;o+=1,s+=1)t[o]=t[s];t.pop()}function arrayClone(t,n){for(var o=new Array(n);n--;)o[n]=t[n];return o}function unwrapListeners(t){for(var n=new Array(t.length),o=0;o<n.length;++o)n[o]=t[o].listener||t[o];return n}function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}var cachedSetTimeout=defaultSetTimout,cachedClearTimeout=defaultClearTimeout;typeof global$1.setTimeout=="function"&&(cachedSetTimeout=setTimeout),typeof global$1.clearTimeout=="function"&&(cachedClearTimeout=clearTimeout);function runTimeout(t){if(cachedSetTimeout===setTimeout)return setTimeout(t,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(t,0);try{return cachedSetTimeout(t,0)}catch{try{return cachedSetTimeout.call(null,t,0)}catch{return cachedSetTimeout.call(this,t,0)}}}function runClearTimeout(t){if(cachedClearTimeout===clearTimeout)return clearTimeout(t);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(t);try{return cachedClearTimeout(t)}catch{try{return cachedClearTimeout.call(null,t)}catch{return cachedClearTimeout.call(this,t)}}}var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){!draining||!currentQueue||(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var t=runTimeout(cleanUpNextTick);draining=!0;for(var n=queue.length;n;){for(currentQueue=queue,queue=[];++queueIndex<n;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,n=queue.length}currentQueue=null,draining=!1,runClearTimeout(t)}}function nextTick(t){var n=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)n[o-1]=arguments[o];queue.push(new Item(t,n)),queue.length===1&&!draining&&runTimeout(drainQueue)}function Item(t,n){this.fun=t,this.array=n}Item.prototype.run=function(){this.fun.apply(null,this.array)};var title="browser",platform="browser",browser=!0,env={},argv=[],version="",versions={},release={},config={};function noop(){}var on=noop,addListener=noop,once=noop,off=noop,removeListener=noop,removeAllListeners=noop,emit=noop;function binding(t){throw new Error("process.binding is not supported")}function cwd(){return"/"}function chdir(t){throw new Error("process.chdir is not supported")}function umask(){return 0}var performance$1=global$1.performance||{},performanceNow=performance$1.now||performance$1.mozNow||performance$1.msNow||performance$1.oNow||performance$1.webkitNow||function(){return new Date().getTime()};function hrtime(t){var n=performanceNow.call(performance$1)*.001,o=Math.floor(n),s=Math.floor(n%1*1e9);return t&&(o=o-t[0],s=s-t[1],s<0&&(o--,s+=1e9)),[o,s]}var startTime=new Date;function uptime(){var t=new Date,n=t-startTime;return n/1e3}var process$1={nextTick,title,browser,env,argv,version,versions,on,addListener,once,off,removeListener,removeAllListeners,emit,binding,cwd,chdir,umask,hrtime,platform,release,config,uptime},inherits;typeof Object.create=="function"?inherits=function(n,o){n.super_=o,n.prototype=Object.create(o.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}})}:inherits=function(n,o){n.super_=o;var s=function(){};s.prototype=o.prototype,n.prototype=new s,n.prototype.constructor=n};var inherits$1=inherits,formatRegExp=/%[sdj%]/g;function format(t){if(!isString(t)){for(var n=[],o=0;o<arguments.length;o++)n.push(inspect(arguments[o]));return n.join(" ")}for(var o=1,s=arguments,c=s.length,d=String(t).replace(formatRegExp,function(p){if(p==="%%")return"%";if(o>=c)return p;switch(p){case"%s":return String(s[o++]);case"%d":return Number(s[o++]);case"%j":try{return JSON.stringify(s[o++])}catch{return"[Circular]"}default:return p}}),h=s[o];o<c;h=s[++o])isNull(h)||!isObject(h)?d+=" "+h:d+=" "+inspect(h);return d}function deprecate(t,n){if(isUndefined(global$1.process))return function(){return deprecate(t,n).apply(this,arguments)};if(process$1.noDeprecation===!0)return t;var o=!1;function s(){if(!o){if(process$1.throwDeprecation)throw new Error(n);process$1.traceDeprecation?console.trace(n):console.error(n),o=!0}return t.apply(this,arguments)}return s}var debugs={},debugEnviron;function debuglog(t){if(isUndefined(debugEnviron)&&(debugEnviron=process$1.env.NODE_DEBUG||""),t=t.toUpperCase(),!debugs[t])if(new RegExp("\\b"+t+"\\b","i").test(debugEnviron)){var n=0;debugs[t]=function(){var o=format.apply(null,arguments);console.error("%s %d: %s",t,n,o)}}else debugs[t]=function(){};return debugs[t]}function inspect(t,n){var o={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(o.depth=arguments[2]),arguments.length>=4&&(o.colors=arguments[3]),isBoolean(n)?o.showHidden=n:n&&_extend(o,n),isUndefined(o.showHidden)&&(o.showHidden=!1),isUndefined(o.depth)&&(o.depth=2),isUndefined(o.colors)&&(o.colors=!1),isUndefined(o.customInspect)&&(o.customInspect=!0),o.colors&&(o.stylize=stylizeWithColor),formatValue(o,t,o.depth)}inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(t,n){var o=inspect.styles[n];return o?"\x1B["+inspect.colors[o][0]+"m"+t+"\x1B["+inspect.colors[o][1]+"m":t}function stylizeNoColor(t,n){return t}function arrayToHash(t){var n={};return t.forEach(function(o,s){n[o]=!0}),n}function formatValue(t,n,o){if(t.customInspect&&n&&isFunction(n.inspect)&&n.inspect!==inspect&&!(n.constructor&&n.constructor.prototype===n)){var s=n.inspect(o,t);return isString(s)||(s=formatValue(t,s,o)),s}var c=formatPrimitive(t,n);if(c)return c;var d=Object.keys(n),h=arrayToHash(d);if(t.showHidden&&(d=Object.getOwnPropertyNames(n)),isError(n)&&(d.indexOf("message")>=0||d.indexOf("description")>=0))return formatError(n);if(d.length===0){if(isFunction(n)){var p=n.name?": "+n.name:"";return t.stylize("[Function"+p+"]","special")}if(isRegExp(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(isDate(n))return t.stylize(Date.prototype.toString.call(n),"date");if(isError(n))return formatError(n)}var y="",S=!1,P=["{","}"];if(isArray(n)&&(S=!0,P=["[","]"]),isFunction(n)){var L=n.name?": "+n.name:"";y=" [Function"+L+"]"}if(isRegExp(n)&&(y=" "+RegExp.prototype.toString.call(n)),isDate(n)&&(y=" "+Date.prototype.toUTCString.call(n)),isError(n)&&(y=" "+formatError(n)),d.length===0&&(!S||n.length==0))return P[0]+y+P[1];if(o<0)return isRegExp(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special");t.seen.push(n);var F;return S?F=formatArray(t,n,o,h,d):F=d.map(function(N){return formatProperty(t,n,o,h,N,S)}),t.seen.pop(),reduceToSingleString(F,y,P)}function formatPrimitive(t,n){if(isUndefined(n))return t.stylize("undefined","undefined");if(isString(n)){var o="'"+JSON.stringify(n).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(o,"string")}if(isNumber(n))return t.stylize(""+n,"number");if(isBoolean(n))return t.stylize(""+n,"boolean");if(isNull(n))return t.stylize("null","null")}function formatError(t){return"["+Error.prototype.toString.call(t)+"]"}function formatArray(t,n,o,s,c){for(var d=[],h=0,p=n.length;h<p;++h)hasOwnProperty(n,String(h))?d.push(formatProperty(t,n,o,s,String(h),!0)):d.push("");return c.forEach(function(y){y.match(/^\d+$/)||d.push(formatProperty(t,n,o,s,y,!0))}),d}function formatProperty(t,n,o,s,c,d){var h,p,y;if(y=Object.getOwnPropertyDescriptor(n,c)||{value:n[c]},y.get?y.set?p=t.stylize("[Getter/Setter]","special"):p=t.stylize("[Getter]","special"):y.set&&(p=t.stylize("[Setter]","special")),hasOwnProperty(s,c)||(h="["+c+"]"),p||(t.seen.indexOf(y.value)<0?(isNull(o)?p=formatValue(t,y.value,null):p=formatValue(t,y.value,o-1),p.indexOf(`
|
|
6745
|
+
`,uniforms:{...pick(P,["color","frustumLength","blackPoint","whitePoint","gamma"]),globeDepthTexture:()=>(y==null?void 0:y())??F._depthTexture}});if(c){const N=createBilateralFilterStage({prefix:t,outputType:h,useGlobeDepth:p,getGlobeDepthTexture:y,uniforms:{textureScale:n,...pick(P,["frustumLength","normalExponent","depthExponent"])}}),W=new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion_generate_and_filter`,stages:[L,N]});return F.uniforms.ambientOcclusionTexture=W.name,new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion`,stages:[W,F],inputPreviousStageTexture:!1,uniforms:createUniforms([{stage:L,uniforms:["intensity","maxRadius","bias","frustumLength","focalLength"]},{stage:N,uniforms:["frustumLength","normalExponent","depthExponent"]},{stage:F,uniforms:["color","blackPoint","whitePoint","gamma"]}])})}else return F.uniforms.ambientOcclusionTexture=L.name,new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion`,stages:[L,F],inputPreviousStageTexture:!1,uniforms:createUniforms([{stage:L,uniforms:["intensity","maxRadius","bias","frustumLength","focalLength"]},{stage:F,uniforms:["color","blackPoint","whitePoint","gamma"]}])})}const AmbientOcclusionStage=({enabled:t=!0,textureScale:n,directions:o,steps:s,denoise:c,accurateNormalReconstruction:d,outputType:h,useGlobeDepth:p,...y})=>{const{viewer:S}=$e$1(),P=S==null?void 0:S.scene,L=useInstance({owner:P==null?void 0:P.postProcessStages,keys:[n,s,o,c,d,h,p],create:()=>{const F=createAmbientOcclusionStage({textureScale:n,steps:s,directions:o,denoise:c,accurateNormalReconstruction:d,outputType:h,useGlobeDepth:p,getGlobeDepthTexture:()=>P.context.uniformState.globeDepthTexture,uniforms:y});return F.enabled=t,F},transferOwnership:(F,N)=>(N==null||N.add(F),()=>{N==null||N.remove(F)})});return L.enabled=t,Object.assign(L.uniforms,y),P==null||P.requestRender(),usePreRender(()=>{const F=P==null?void 0:P.camera.frustum;if(F instanceof Cesium$1.PerspectiveFrustum){const N=1/Math.tan(F.fovy/2);L.uniforms.focalLength.x=N*F.aspectRatio,L.uniforms.focalLength.y=N}}),null},AmbientOcclusion=t=>{const n=$e$1(),[o,s]=React.useState(!1);return usePreRender(()=>{const c=n.scene;s(!(c!=null&&c.globe.depthTestAgainstTerrain));const{globeHeight:d}=c;if(!c||d==null)return;const h=c.camera.positionCartographic.height-d,p=c==null?void 0:c.camera.frustum;p instanceof Cesium$1.PerspectiveFrustum&&(c.camera.frustum.near=Cesium$1.Math.clamp(h-1,1,5)/Math.tan(p.fov/2))}),jsxRuntimeExports.jsx(AmbientOcclusionStage,{...t,useGlobeDepth:o})};var AmbientOcclusionOutputType=(t=>(t[t.Occlusion=1]="Occlusion",t[t.Normal=2]="Normal",t[t.Depth=3]="Depth",t[t.Weight=4]="Weight",t[t.Shade=5]="Shade",t))(AmbientOcclusionOutputType||{});const AMBIENT_OCCLUSION_QUALITY={low:{directions:4,steps:4,textureScale:.5,maxRadius:30},medium:{directions:4,steps:8,textureScale:.5,maxRadius:40},high:{directions:8,steps:8,textureScale:1,maxRadius:40},extreme:{directions:16,steps:16,textureScale:1,maxRadius:40}},DEFAULT_SKETCH_COLOR="#00bebe",DEFAULT_EDIT_COLOR="#3B3CD0",SELECTED_EDIT_COLOR="#FF9900",ADDING_POINT_COLOR="#3B3CD0";let drawPointImage,editPointImage,selectedPointImage,addingPointImage;const ControlPoint=({position:t,clampToGround:n=!1,index:o,isEditing:s,isSelected:c,isAddingPoint:d,isExtrudedControlPoint:h,handleControlPointMouseEvent:p})=>{const y=React.useRef(t);y.current=t;const S=useConstant$2(()=>new CallbackProperty((N,W)=>"getValue"in y.current?y.current.getValue(N,W):y.current,!1)),P=React.useMemo(()=>({position:S,billboard:{image:s?d?getAddingPointImage():c?getSelectedPointImage():getEditPointImage():getDrawPointImage(),width:s?16:8,height:s?16:8,heightReference:n?HeightReference$1.CLAMP_TO_GROUND:HeightReference$1.NONE,disableDepthTestDistance:1/0}}),[n,S,d,s,c]),L=React.useCallback(()=>{p==null||p(o,!!h,"mousedown")},[o,h,p]),F=React.useCallback(()=>{p==null||p(o,!!h,"click")},[o,h,p]);return jsxRuntimeExports.jsx(Is$1,{...P,onMouseDown:L,onClick:F})};function getDrawPointImage(){if(drawPointImage!=null)return drawPointImage;drawPointImage=document.createElement("canvas"),drawPointImage.width=16,drawPointImage.height=16;const t=drawPointImage.getContext("2d");return invariant$1(t!=null),t.fillStyle="white",t.fillRect(3,3,10,10),t.strokeStyle="black",t.lineWidth=2,t.strokeRect(3,3,10,10),drawPointImage}function getEditPointImage(){return getImage(editPointImage,{size:32,color:"white",strokeColor:DEFAULT_EDIT_COLOR})}function getSelectedPointImage(){return getImage(selectedPointImage,{size:32,color:"white",strokeColor:SELECTED_EDIT_COLOR})}function getAddingPointImage(){if(addingPointImage!=null)return addingPointImage;addingPointImage=document.createElement("canvas"),addingPointImage.width=32,addingPointImage.height=32;const t=addingPointImage.getContext("2d");return invariant$1(t!=null),t.beginPath(),t.arc(16,16,12,0,2*Math.PI),t.fillStyle="white",t.fill(),t.strokeStyle=ADDING_POINT_COLOR,t.lineWidth=4,t.stroke(),t.beginPath(),t.moveTo(16,8),t.lineTo(16,24),t.stroke(),t.moveTo(8,16),t.lineTo(24,16),t.stroke(),addingPointImage}function getImage(t,n){if(t!=null)return t;t=document.createElement("canvas"),t.width=n.size,t.height=n.size;const o=t.getContext("2d");return invariant$1(o!=null),o.beginPath(),o.arc(n.size/2,n.size/2,n.size/2-4,0,2*Math.PI),o.fillStyle=n.color,o.fill(),o.strokeStyle=n.strokeColor,o.lineWidth=4,o.stroke(),t}function assignForwardedRef(t,n){if(typeof t=="function")return t(n),()=>{t(null)};if(t!=null)return t.current=n,()=>{t.current=null}}const Entity=React.memo(React.forwardRef(({entities:t,...n},o)=>{const{viewer:s}=$e$1(),c=s==null?void 0:s.scene,d=s==null?void 0:s.entities,h=t??d,[p,y]=React.useState(()=>new Entity$1(n));return React.useEffect(()=>{y(new Entity$1(n))},[n.id]),React.useEffect(()=>(h==null||h.add(p),()=>{h==null||h.remove(p),c==null||c.requestRender()}),[c,h,p]),React.useEffect(()=>assignForwardedRef(o,p),[o,p]),Object.assign(p,omit(n,"id")),c==null||c.requestRender(),null})),textStyle={padding:"5px",color:"#fff",backgroundColor:"#000",borderRadius:"5px",lineHeight:1},MeasurementText=({children:t})=>jsxRuntimeExports.jsx("div",{style:textStyle,children:t}),MotionConfigContext=React.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),MotionContext=React.createContext({}),PresenceContext=React.createContext(null),isBrowser=typeof document<"u",useIsomorphicLayoutEffect$1=isBrowser?React.useLayoutEffect:React.useEffect,LazyContext=React.createContext({strict:!1}),camelToDash=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),optimizedAppearDataId="framerAppearId",optimizedAppearDataAttribute="data-"+camelToDash(optimizedAppearDataId),MotionGlobalConfig={skipAnimations:!1,useManualTiming:!1};class Queue{constructor(){this.order=[],this.scheduled=new Set}add(n){if(!this.scheduled.has(n))return this.scheduled.add(n),this.order.push(n),!0}remove(n){const o=this.order.indexOf(n);o!==-1&&(this.order.splice(o,1),this.scheduled.delete(n))}clear(){this.order.length=0,this.scheduled.clear()}}function createRenderStep(t){let n=new Queue,o=new Queue,s=0,c=!1,d=!1;const h=new WeakSet,p={schedule:(y,S=!1,P=!1)=>{const L=P&&c,F=L?n:o;return S&&h.add(y),F.add(y)&&L&&c&&(s=n.order.length),y},cancel:y=>{o.remove(y),h.delete(y)},process:y=>{if(c){d=!0;return}if(c=!0,[n,o]=[o,n],o.clear(),s=n.order.length,s)for(let S=0;S<s;S++){const P=n.order[S];h.has(P)&&(p.schedule(P),t()),P(y)}c=!1,d&&(d=!1,p.process(y))}};return p}const stepsOrder=["read","resolveKeyframes","update","preRender","render","postRender"],maxElapsed=40;function createRenderBatcher(t,n){let o=!1,s=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=stepsOrder.reduce((L,F)=>(L[F]=createRenderStep(()=>o=!0),L),{}),h=L=>{d[L].process(c)},p=()=>{const L=performance.now();o=!1,c.delta=s?1e3/60:Math.max(Math.min(L-c.timestamp,maxElapsed),1),c.timestamp=L,c.isProcessing=!0,stepsOrder.forEach(h),c.isProcessing=!1,o&&n&&(s=!1,t(p))},y=()=>{o=!0,s=!0,c.isProcessing||t(p)};return{schedule:stepsOrder.reduce((L,F)=>{const N=d[F];return L[F]=(W,z=!1,lt=!1)=>(o||y(),N.schedule(W,z,lt)),L},{}),cancel:L=>stepsOrder.forEach(F=>d[F].cancel(L)),state:c,steps:d}}const{schedule:microtask,cancel:cancelMicrotask}=createRenderBatcher(queueMicrotask,!1);function useVisualElement(t,n,o,s){const{visualElement:c}=React.useContext(MotionContext),d=React.useContext(LazyContext),h=React.useContext(PresenceContext),p=React.useContext(MotionConfigContext).reducedMotion,y=React.useRef();s=s||d.renderer,!y.current&&s&&(y.current=s(t,{visualState:n,parent:c,props:o,presenceContext:h,blockInitialAnimation:h?h.initial===!1:!1,reducedMotionConfig:p}));const S=y.current;React.useInsertionEffect(()=>{S&&S.update(o,h)});const P=React.useRef(!!(o[optimizedAppearDataAttribute]&&!window.HandoffComplete));return useIsomorphicLayoutEffect$1(()=>{S&&(microtask.postRender(S.render),P.current&&S.animationState&&S.animationState.animateChanges())}),React.useEffect(()=>{S&&(S.updateFeatures(),!P.current&&S.animationState&&S.animationState.animateChanges(),P.current&&(P.current=!1,window.HandoffComplete=!0))}),S}function isRefObject(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function useMotionRef(t,n,o){return React.useCallback(s=>{s&&t.mount&&t.mount(s),n&&(s?n.mount(s):n.unmount()),o&&(typeof o=="function"?o(s):isRefObject(o)&&(o.current=s))},[n])}function isVariantLabel(t){return typeof t=="string"||Array.isArray(t)}function isAnimationControls(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const variantPriorityOrder=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],variantProps=["initial",...variantPriorityOrder];function isControllingVariants(t){return isAnimationControls(t.animate)||variantProps.some(n=>isVariantLabel(t[n]))}function isVariantNode(t){return!!(isControllingVariants(t)||t.variants)}function getCurrentTreeVariants(t,n){if(isControllingVariants(t)){const{initial:o,animate:s}=t;return{initial:o===!1||isVariantLabel(o)?o:void 0,animate:isVariantLabel(s)?s:void 0}}return t.inherit!==!1?n:{}}function useCreateMotionContext(t){const{initial:n,animate:o}=getCurrentTreeVariants(t,React.useContext(MotionContext));return React.useMemo(()=>({initial:n,animate:o}),[variantLabelsAsDependency(n),variantLabelsAsDependency(o)])}function variantLabelsAsDependency(t){return Array.isArray(t)?t.join(" "):t}const featureProps={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},featureDefinitions={};for(const t in featureProps)featureDefinitions[t]={isEnabled:n=>featureProps[t].some(o=>!!n[o])};function loadFeatures(t){for(const n in t)featureDefinitions[n]={...featureDefinitions[n],...t[n]}}const LayoutGroupContext=React.createContext({}),SwitchLayoutGroupContext=React.createContext({}),motionComponentSymbol=Symbol.for("motionComponentSymbol");function createMotionComponent({preloadedFeatures:t,createVisualElement:n,useRender:o,useVisualState:s,Component:c}){t&&loadFeatures(t);function d(p,y){let S;const P={...React.useContext(MotionConfigContext),...p,layoutId:useLayoutId(p)},{isStatic:L}=P,F=useCreateMotionContext(p),N=s(p,L);if(!L&&isBrowser){F.visualElement=useVisualElement(c,N,P,n);const W=React.useContext(SwitchLayoutGroupContext),z=React.useContext(LazyContext).strict;F.visualElement&&(S=F.visualElement.loadFeatures(P,z,t,W))}return React__namespace.createElement(MotionContext.Provider,{value:F},S&&F.visualElement?React__namespace.createElement(S,{visualElement:F.visualElement,...P}):null,o(c,p,useMotionRef(N,F.visualElement,y),N,L,F.visualElement))}const h=React.forwardRef(d);return h[motionComponentSymbol]=c,h}function useLayoutId({layoutId:t}){const n=React.useContext(LayoutGroupContext).id;return n&&t!==void 0?n+"-"+t:t}function createMotionProxy(t){function n(s,c={}){return createMotionComponent(t(s,c))}if(typeof Proxy>"u")return n;const o=new Map;return new Proxy(n,{get:(s,c)=>(o.has(c)||o.set(c,n(c)),o.get(c))})}const lowercaseSVGElements=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function isSVGComponent(t){return typeof t!="string"||t.includes("-")?!1:!!(lowercaseSVGElements.indexOf(t)>-1||/[A-Z]/u.test(t))}const scaleCorrectors={};function addScaleCorrector(t){Object.assign(scaleCorrectors,t)}const transformPropOrder=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],transformProps=new Set(transformPropOrder);function isForcedMotionValue(t,{layout:n,layoutId:o}){return transformProps.has(t)||t.startsWith("origin")||(n||o!==void 0)&&(!!scaleCorrectors[t]||t==="opacity")}const isMotionValue=t=>!!(t&&t.getVelocity),translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},numTransforms=transformPropOrder.length;function buildTransform(t,{enableHardwareAcceleration:n=!0,allowTransformNone:o=!0},s,c){let d="";for(let h=0;h<numTransforms;h++){const p=transformPropOrder[h];if(t[p]!==void 0){const y=translateAlias[p]||p;d+=`${y}(${t[p]}) `}}return n&&!t.z&&(d+="translateZ(0)"),d=d.trim(),c?d=c(t,s?"":d):o&&s&&(d="none"),d}const checkStringStartsWith=t=>n=>typeof n=="string"&&n.startsWith(t),isCSSVariableName=checkStringStartsWith("--"),startsAsVariableToken=checkStringStartsWith("var(--"),isCSSVariableToken=t=>startsAsVariableToken(t)?singleCssVariableRegex.test(t.split("/*")[0].trim()):!1,singleCssVariableRegex=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,getValueAsType=(t,n)=>n&&typeof t=="number"?n.transform(t):t,clamp=(t,n,o)=>o>n?n:o<t?t:o,number={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},alpha={...number,transform:t=>clamp(0,1,t)},scale={...number,default:1},sanitize=t=>Math.round(t*1e5)/1e5,floatRegex=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,colorRegex=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,singleColorRegex=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function isString$1(t){return typeof t=="string"}const createUnitType=t=>({test:n=>isString$1(n)&&n.endsWith(t)&&n.split(" ").length===1,parse:parseFloat,transform:n=>`${n}${t}`}),degrees=createUnitType("deg"),percent=createUnitType("%"),px=createUnitType("px"),vh=createUnitType("vh"),vw=createUnitType("vw"),progressPercentage={...percent,parse:t=>percent.parse(t)/100,transform:t=>percent.transform(t*100)},int={...number,transform:Math.round},numberValueTypes={borderWidth:px,borderTopWidth:px,borderRightWidth:px,borderBottomWidth:px,borderLeftWidth:px,borderRadius:px,radius:px,borderTopLeftRadius:px,borderTopRightRadius:px,borderBottomRightRadius:px,borderBottomLeftRadius:px,width:px,maxWidth:px,height:px,maxHeight:px,size:px,top:px,right:px,bottom:px,left:px,padding:px,paddingTop:px,paddingRight:px,paddingBottom:px,paddingLeft:px,margin:px,marginTop:px,marginRight:px,marginBottom:px,marginLeft:px,rotate:degrees,rotateX:degrees,rotateY:degrees,rotateZ:degrees,scale,scaleX:scale,scaleY:scale,scaleZ:scale,skew:degrees,skewX:degrees,skewY:degrees,distance:px,translateX:px,translateY:px,translateZ:px,x:px,y:px,z:px,perspective:px,transformPerspective:px,opacity:alpha,originX:progressPercentage,originY:progressPercentage,originZ:px,zIndex:int,backgroundPositionX:px,backgroundPositionY:px,fillOpacity:alpha,strokeOpacity:alpha,numOctaves:int};function buildHTMLStyles(t,n,o,s){const{style:c,vars:d,transform:h,transformOrigin:p}=t;let y=!1,S=!1,P=!0;for(const L in n){const F=n[L];if(isCSSVariableName(L)){d[L]=F;continue}const N=numberValueTypes[L],W=getValueAsType(F,N);if(transformProps.has(L)){if(y=!0,h[L]=W,!P)continue;F!==(N.default||0)&&(P=!1)}else L.startsWith("origin")?(S=!0,p[L]=W):c[L]=W}if(n.transform||(y||s?c.transform=buildTransform(t.transform,o,P,s):c.transform&&(c.transform="none")),S){const{originX:L="50%",originY:F="50%",originZ:N=0}=p;c.transformOrigin=`${L} ${F} ${N}`}}const createHtmlRenderState=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function copyRawValuesOnly(t,n,o){for(const s in n)!isMotionValue(n[s])&&!isForcedMotionValue(s,o)&&(t[s]=n[s])}function useInitialMotionValues({transformTemplate:t},n,o){return React.useMemo(()=>{const s=createHtmlRenderState();return buildHTMLStyles(s,n,{enableHardwareAcceleration:!o},t),Object.assign({},s.vars,s.style)},[n])}function useStyle(t,n,o){const s=t.style||{},c={};return copyRawValuesOnly(c,s,t),Object.assign(c,useInitialMotionValues(t,n,o)),c}function useHTMLProps(t,n,o){const s={},c=useStyle(t,n,o);return t.drag&&t.dragListener!==!1&&(s.draggable=!1,c.userSelect=c.WebkitUserSelect=c.WebkitTouchCallout="none",c.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=c,s}const validMotionProps=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function isValidMotionProp(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||validMotionProps.has(t)}let shouldForward=t=>!isValidMotionProp(t);function loadExternalIsValidProp(t){t&&(shouldForward=n=>n.startsWith("on")?!isValidMotionProp(n):t(n))}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch(t){}function filterProps(t,n,o){const s={};for(const c in t)c==="values"&&typeof t.values=="object"||(shouldForward(c)||o===!0&&isValidMotionProp(c)||!n&&!isValidMotionProp(c)||t.draggable&&c.startsWith("onDrag"))&&(s[c]=t[c]);return s}function calcOrigin$1(t,n,o){return typeof t=="string"?t:px.transform(n+o*t)}function calcSVGTransformOrigin(t,n,o){const s=calcOrigin$1(n,t.x,t.width),c=calcOrigin$1(o,t.y,t.height);return`${s} ${c}`}const dashKeys={offset:"stroke-dashoffset",array:"stroke-dasharray"},camelKeys={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(t,n,o=1,s=0,c=!0){t.pathLength=1;const d=c?dashKeys:camelKeys;t[d.offset]=px.transform(-s);const h=px.transform(n),p=px.transform(o);t[d.array]=`${h} ${p}`}function buildSVGAttrs(t,{attrX:n,attrY:o,attrScale:s,originX:c,originY:d,pathLength:h,pathSpacing:p=1,pathOffset:y=0,...S},P,L,F){if(buildHTMLStyles(t,S,P,F),L){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:N,style:W,dimensions:z}=t;N.transform&&(z&&(W.transform=N.transform),delete N.transform),z&&(c!==void 0||d!==void 0||W.transform)&&(W.transformOrigin=calcSVGTransformOrigin(z,c!==void 0?c:.5,d!==void 0?d:.5)),n!==void 0&&(N.x=n),o!==void 0&&(N.y=o),s!==void 0&&(N.scale=s),h!==void 0&&buildSVGPath(N,h,p,y,!1)}const createSvgRenderState=()=>({...createHtmlRenderState(),attrs:{}}),isSVGTag=t=>typeof t=="string"&&t.toLowerCase()==="svg";function useSVGProps(t,n,o,s){const c=React.useMemo(()=>{const d=createSvgRenderState();return buildSVGAttrs(d,n,{enableHardwareAcceleration:!1},isSVGTag(s),t.transformTemplate),{...d.attrs,style:{...d.style}}},[n]);if(t.style){const d={};copyRawValuesOnly(d,t.style,t),c.style={...d,...c.style}}return c}function createUseRender(t=!1){return(o,s,c,{latestValues:d},h)=>{const y=(isSVGComponent(o)?useSVGProps:useHTMLProps)(s,d,h,o),S=filterProps(s,typeof o=="string",t),P=o!==React.Fragment?{...S,...y,ref:c}:{},{children:L}=s,F=React.useMemo(()=>isMotionValue(L)?L.get():L,[L]);return React.createElement(o,{...P,children:F})}}function renderHTML(t,{style:n,vars:o},s,c){Object.assign(t.style,n,c&&c.getProjectionStyles(s));for(const d in o)t.style.setProperty(d,o[d])}const camelCaseAttributes=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function renderSVG(t,n,o,s){renderHTML(t,n,void 0,s);for(const c in n.attrs)t.setAttribute(camelCaseAttributes.has(c)?c:camelToDash(c),n.attrs[c])}function scrapeMotionValuesFromProps$1(t,n,o){var s;const{style:c}=t,d={};for(const h in c)(isMotionValue(c[h])||n.style&&isMotionValue(n.style[h])||isForcedMotionValue(h,t)||((s=o==null?void 0:o.getValue(h))===null||s===void 0?void 0:s.liveStyle)!==void 0)&&(d[h]=c[h]);return d}function scrapeMotionValuesFromProps(t,n,o){const s=scrapeMotionValuesFromProps$1(t,n,o);for(const c in t)if(isMotionValue(t[c])||isMotionValue(n[c])){const d=transformPropOrder.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;s[d]=t[c]}return s}function resolveVariantFromProps(t,n,o,s={},c={}){return typeof n=="function"&&(n=n(o!==void 0?o:t.custom,s,c)),typeof n=="string"&&(n=t.variants&&t.variants[n]),typeof n=="function"&&(n=n(o!==void 0?o:t.custom,s,c)),n}function useConstant(t){const n=React.useRef(null);return n.current===null&&(n.current=t()),n.current}const isKeyframesTarget=t=>Array.isArray(t),isCustomValue=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),resolveFinalValueInKeyframes=t=>isKeyframesTarget(t)?t[t.length-1]||0:t;function resolveMotionValue(t){const n=isMotionValue(t)?t.get():t;return isCustomValue(n)?n.toValue():n}function makeState({scrapeMotionValuesFromProps:t,createRenderState:n,onMount:o},s,c,d){const h={latestValues:makeLatestValues(s,c,d,t),renderState:n()};return o&&(h.mount=p=>o(s,p,h)),h}const makeUseVisualState=t=>(n,o)=>{const s=React.useContext(MotionContext),c=React.useContext(PresenceContext),d=()=>makeState(t,n,s,c);return o?d():useConstant(d)};function makeLatestValues(t,n,o,s){const c={},d=s(t,{});for(const F in d)c[F]=resolveMotionValue(d[F]);let{initial:h,animate:p}=t;const y=isControllingVariants(t),S=isVariantNode(t);n&&S&&!y&&t.inherit!==!1&&(h===void 0&&(h=n.initial),p===void 0&&(p=n.animate));let P=o?o.initial===!1:!1;P=P||h===!1;const L=P?p:h;return L&&typeof L!="boolean"&&!isAnimationControls(L)&&(Array.isArray(L)?L:[L]).forEach(N=>{const W=resolveVariantFromProps(t,N);if(!W)return;const{transitionEnd:z,transition:lt,...Pe}=W;for(const se in Pe){let mt=Pe[se];if(Array.isArray(mt)){const kt=P?mt.length-1:0;mt=mt[kt]}mt!==null&&(c[se]=mt)}for(const se in z)c[se]=z[se]}),c}const noop$1=t=>t,{schedule:frame,cancel:cancelFrame,state:frameData,steps}=createRenderBatcher(typeof requestAnimationFrame<"u"?requestAnimationFrame:noop$1,!0),svgMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState,onMount:(t,n,{renderState:o,latestValues:s})=>{frame.read(()=>{try{o.dimensions=typeof n.getBBox=="function"?n.getBBox():n.getBoundingClientRect()}catch{o.dimensions={x:0,y:0,width:0,height:0}}}),frame.render(()=>{buildSVGAttrs(o,s,{enableHardwareAcceleration:!1},isSVGTag(n.tagName),t.transformTemplate),renderSVG(n,o)})}})},htmlMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState})};function createDomMotionConfig(t,{forwardMotionProps:n=!1},o,s){return{...isSVGComponent(t)?svgMotionConfig:htmlMotionConfig,preloadedFeatures:o,useRender:createUseRender(n),createVisualElement:s,Component:t}}function addDomEvent(t,n,o,s={passive:!0}){return t.addEventListener(n,o,s),()=>t.removeEventListener(n,o)}const isPrimaryPointer=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function extractEventInfo(t,n="page"){return{point:{x:t[n+"X"],y:t[n+"Y"]}}}const addPointerInfo=t=>n=>isPrimaryPointer(n)&&t(n,extractEventInfo(n));function addPointerEvent(t,n,o,s){return addDomEvent(t,n,addPointerInfo(o),s)}const combineFunctions=(t,n)=>o=>n(t(o)),pipe=(...t)=>t.reduce(combineFunctions);function createLock(t){let n=null;return()=>{const o=()=>{n=null};return n===null?(n=t,o):!1}}const globalHorizontalLock=createLock("dragHorizontal"),globalVerticalLock=createLock("dragVertical");function getGlobalLock(t){let n=!1;if(t==="y")n=globalVerticalLock();else if(t==="x")n=globalHorizontalLock();else{const o=globalHorizontalLock(),s=globalVerticalLock();o&&s?n=()=>{o(),s()}:(o&&o(),s&&s())}return n}function isDragActive(){const t=getGlobalLock(!0);return t?(t(),!1):!0}class Feature{constructor(n){this.isMounted=!1,this.node=n}update(){}}function addHoverEvent(t,n){const o="pointer"+(n?"enter":"leave"),s="onHover"+(n?"Start":"End"),c=(d,h)=>{if(d.pointerType==="touch"||isDragActive())return;const p=t.getProps();t.animationState&&p.whileHover&&t.animationState.setActive("whileHover",n),p[s]&&p[s](d,h)};return addPointerEvent(t.current,o,c,{passive:!t.getProps()[s]})}class HoverGesture extends Feature{mount(){this.unmount=pipe(addHoverEvent(this.node,!0),addHoverEvent(this.node,!1))}unmount(){}}class FocusGesture extends Feature{constructor(){super(...arguments),this.isActive=!1}onFocus(){let n=!1;try{n=this.node.current.matches(":focus-visible")}catch{n=!0}!n||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=pipe(addDomEvent(this.node.current,"focus",()=>this.onFocus()),addDomEvent(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const isNodeOrChild=(t,n)=>n?t===n?!0:isNodeOrChild(t,n.parentElement):!1;function fireSyntheticPointerEvent(t,n){if(!n)return;const o=new PointerEvent("pointer"+t);n(o,extractEventInfo(o))}class PressGesture extends Feature{constructor(){super(...arguments),this.removeStartListeners=noop$1,this.removeEndListeners=noop$1,this.removeAccessibleListeners=noop$1,this.startPointerPress=(n,o)=>{if(this.isPressing)return;this.removeEndListeners();const s=this.node.getProps(),d=addPointerEvent(window,"pointerup",(p,y)=>{if(!this.checkPressEnd())return;const{onTap:S,onTapCancel:P,globalTapTarget:L}=this.node.getProps();!L&&!isNodeOrChild(this.node.current,p.target)?P&&P(p,y):S&&S(p,y)},{passive:!(s.onTap||s.onPointerUp)}),h=addPointerEvent(window,"pointercancel",(p,y)=>this.cancelPress(p,y),{passive:!(s.onTapCancel||s.onPointerCancel)});this.removeEndListeners=pipe(d,h),this.startPress(n,o)},this.startAccessiblePress=()=>{const n=d=>{if(d.key!=="Enter"||this.isPressing)return;const h=p=>{p.key!=="Enter"||!this.checkPressEnd()||fireSyntheticPointerEvent("up",(y,S)=>{const{onTap:P}=this.node.getProps();P&&P(y,S)})};this.removeEndListeners(),this.removeEndListeners=addDomEvent(this.node.current,"keyup",h),fireSyntheticPointerEvent("down",(p,y)=>{this.startPress(p,y)})},o=addDomEvent(this.node.current,"keydown",n),s=()=>{this.isPressing&&fireSyntheticPointerEvent("cancel",(d,h)=>this.cancelPress(d,h))},c=addDomEvent(this.node.current,"blur",s);this.removeAccessibleListeners=pipe(o,c)}}startPress(n,o){this.isPressing=!0;const{onTapStart:s,whileTap:c}=this.node.getProps();c&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),s&&s(n,o)}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!isDragActive()}cancelPress(n,o){if(!this.checkPressEnd())return;const{onTapCancel:s}=this.node.getProps();s&&s(n,o)}mount(){const n=this.node.getProps(),o=addPointerEvent(n.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(n.onTapStart||n.onPointerStart)}),s=addDomEvent(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=pipe(o,s)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const observerCallbacks=new WeakMap,observers=new WeakMap,fireObserverCallback=t=>{const n=observerCallbacks.get(t.target);n&&n(t)},fireAllObserverCallbacks=t=>{t.forEach(fireObserverCallback)};function initIntersectionObserver({root:t,...n}){const o=t||document;observers.has(o)||observers.set(o,{});const s=observers.get(o),c=JSON.stringify(n);return s[c]||(s[c]=new IntersectionObserver(fireAllObserverCallbacks,{root:t,...n})),s[c]}function observeIntersection(t,n,o){const s=initIntersectionObserver(n);return observerCallbacks.set(t,o),s.observe(t),()=>{observerCallbacks.delete(t),s.unobserve(t)}}const thresholdNames={some:0,all:1};class InViewFeature extends Feature{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:n={}}=this.node.getProps(),{root:o,margin:s,amount:c="some",once:d}=n,h={root:o?o.current:void 0,rootMargin:s,threshold:typeof c=="number"?c:thresholdNames[c]},p=y=>{const{isIntersecting:S}=y;if(this.isInView===S||(this.isInView=S,d&&!S&&this.hasEnteredView))return;S&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",S);const{onViewportEnter:P,onViewportLeave:L}=this.node.getProps(),F=S?P:L;F&&F(y)};return observeIntersection(this.node.current,h,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:n,prevProps:o}=this.node;["amount","margin","root"].some(hasViewportOptionChanged(n,o))&&this.startObserver()}unmount(){}}function hasViewportOptionChanged({viewport:t={}},{viewport:n={}}={}){return o=>t[o]!==n[o]}const gestureAnimations={inView:{Feature:InViewFeature},tap:{Feature:PressGesture},focus:{Feature:FocusGesture},hover:{Feature:HoverGesture}};function shallowCompare(t,n){if(!Array.isArray(n))return!1;const o=n.length;if(o!==t.length)return!1;for(let s=0;s<o;s++)if(n[s]!==t[s])return!1;return!0}function getCurrent(t){const n={};return t.values.forEach((o,s)=>n[s]=o.get()),n}function getVelocity$1(t){const n={};return t.values.forEach((o,s)=>n[s]=o.getVelocity()),n}function resolveVariant(t,n,o){const s=t.getProps();return resolveVariantFromProps(s,n,o!==void 0?o:s.custom,getCurrent(t),getVelocity$1(t))}const secondsToMilliseconds=t=>t*1e3,millisecondsToSeconds=t=>t/1e3,underDampedSpring={type:"spring",stiffness:500,damping:25,restSpeed:10},criticallyDampedSpring=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),keyframesTransition={type:"keyframes",duration:.8},ease={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},getDefaultTransition=(t,{keyframes:n})=>n.length>2?keyframesTransition:transformProps.has(t)?t.startsWith("scale")?criticallyDampedSpring(n[1]):underDampedSpring:ease;function isTransitionDefined({when:t,delay:n,delayChildren:o,staggerChildren:s,staggerDirection:c,repeat:d,repeatType:h,repeatDelay:p,from:y,elapsed:S,...P}){return!!Object.keys(P).length}function getValueTransition(t,n){return t[n]||t.default||t}const isNotNull=t=>t!==null;function getFinalKeyframe(t,{repeat:n,repeatType:o="loop"},s){const c=t.filter(isNotNull),d=n&&o!=="loop"&&n%2===1?0:c.length-1;return!d||s===void 0?c[d]:s}let now;function clearTime(){now=void 0}const time={now:()=>(now===void 0&&time.set(frameData.isProcessing||MotionGlobalConfig.useManualTiming?frameData.timestamp:performance.now()),now),set:t=>{now=t,queueMicrotask(clearTime)}},isZeroValueString=t=>/^0[^.\s]+$/u.test(t);function isNone(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||isZeroValueString(t):!0}let warning=noop$1,invariant=noop$1;process.env.NODE_ENV!=="production"&&(warning=(t,n)=>{!t&&typeof console<"u"&&console.warn(n)},invariant=(t,n)=>{if(!t)throw new Error(n)});const isNumericalString=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),splitCSSVariableRegex=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function parseCSSVariable(t){const n=splitCSSVariableRegex.exec(t);if(!n)return[,];const[,o,s,c]=n;return[`--${o??s}`,c]}const maxDepth=4;function getVariableValue(t,n,o=1){invariant(o<=maxDepth,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[s,c]=parseCSSVariable(t);if(!s)return;const d=window.getComputedStyle(n).getPropertyValue(s);if(d){const h=d.trim();return isNumericalString(h)?parseFloat(h):h}return isCSSVariableToken(c)?getVariableValue(c,n,o+1):c}const positionalKeys=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),isNumOrPxType=t=>t===number||t===px,getPosFromMatrix=(t,n)=>parseFloat(t.split(", ")[n]),getTranslateFromMatrix=(t,n)=>(o,{transform:s})=>{if(s==="none"||!s)return 0;const c=s.match(/^matrix3d\((.+)\)$/u);if(c)return getPosFromMatrix(c[1],n);{const d=s.match(/^matrix\((.+)\)$/u);return d?getPosFromMatrix(d[1],t):0}},transformKeys=new Set(["x","y","z"]),nonTranslationalTransformKeys=transformPropOrder.filter(t=>!transformKeys.has(t));function removeNonTranslationalTransform(t){const n=[];return nonTranslationalTransformKeys.forEach(o=>{const s=t.getValue(o);s!==void 0&&(n.push([o,s.get()]),s.set(o.startsWith("scale")?1:0))}),n}const positionalValues={width:({x:t},{paddingLeft:n="0",paddingRight:o="0"})=>t.max-t.min-parseFloat(n)-parseFloat(o),height:({y:t},{paddingTop:n="0",paddingBottom:o="0"})=>t.max-t.min-parseFloat(n)-parseFloat(o),top:(t,{top:n})=>parseFloat(n),left:(t,{left:n})=>parseFloat(n),bottom:({y:t},{top:n})=>parseFloat(n)+(t.max-t.min),right:({x:t},{left:n})=>parseFloat(n)+(t.max-t.min),x:getTranslateFromMatrix(4,13),y:getTranslateFromMatrix(5,14)};positionalValues.translateX=positionalValues.x,positionalValues.translateY=positionalValues.y;const testValueType=t=>n=>n.test(t),auto={test:t=>t==="auto",parse:t=>t},dimensionValueTypes=[number,px,percent,degrees,vw,vh,auto],findDimensionValueType=t=>dimensionValueTypes.find(testValueType(t)),toResolve=new Set;let isScheduled=!1,anyNeedsMeasurement=!1;function measureAllKeyframes(){if(anyNeedsMeasurement){const t=Array.from(toResolve).filter(s=>s.needsMeasurement),n=new Set(t.map(s=>s.element)),o=new Map;n.forEach(s=>{removeNonTranslationalTransform(s).length&&(o.set(s,removeNonTranslationalTransform(s)),s.render())}),t.forEach(s=>s.measureInitialState()),n.forEach(s=>{s.render()}),t.forEach(s=>s.measureEndState()),t.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}anyNeedsMeasurement=!1,isScheduled=!1,toResolve.forEach(t=>t.complete()),toResolve.clear()}function readAllKeyframes(){toResolve.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(anyNeedsMeasurement=!0)})}function flushKeyframeResolvers(){readAllKeyframes(),measureAllKeyframes()}class KeyframeResolver{constructor(n,o,s,c,d,h=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...n],this.onComplete=o,this.name=s,this.motionValue=c,this.element=d,this.isAsync=h}scheduleResolve(){this.isScheduled=!0,this.isAsync?(toResolve.add(this),isScheduled||(isScheduled=!0,frame.read(readAllKeyframes),frame.resolveKeyframes(measureAllKeyframes))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:n,name:o,element:s,motionValue:c}=this;for(let d=0;d<n.length;d++)if(n[d]===null)if(d===0){const h=c==null?void 0:c.get(),p=n[n.length-1];if(h!==void 0)n[0]=h;else if(s&&o){const y=s.readValue(o,p);y!=null&&(n[0]=y)}n[0]===void 0&&(n[0]=p),c&&h===void 0&&c.set(n[0])}else n[d]=n[d-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),toResolve.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,toResolve.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const isColorString=(t,n)=>o=>!!(isString$1(o)&&singleColorRegex.test(o)&&o.startsWith(t)||n&&Object.prototype.hasOwnProperty.call(o,n)),splitColor=(t,n,o)=>s=>{if(!isString$1(s))return s;const[c,d,h,p]=s.match(floatRegex);return{[t]:parseFloat(c),[n]:parseFloat(d),[o]:parseFloat(h),alpha:p!==void 0?parseFloat(p):1}},clampRgbUnit=t=>clamp(0,255,t),rgbUnit={...number,transform:t=>Math.round(clampRgbUnit(t))},rgba={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:t,green:n,blue:o,alpha:s=1})=>"rgba("+rgbUnit.transform(t)+", "+rgbUnit.transform(n)+", "+rgbUnit.transform(o)+", "+sanitize(alpha.transform(s))+")"};function parseHex(t){let n="",o="",s="",c="";return t.length>5?(n=t.substring(1,3),o=t.substring(3,5),s=t.substring(5,7),c=t.substring(7,9)):(n=t.substring(1,2),o=t.substring(2,3),s=t.substring(3,4),c=t.substring(4,5),n+=n,o+=o,s+=s,c+=c),{red:parseInt(n,16),green:parseInt(o,16),blue:parseInt(s,16),alpha:c?parseInt(c,16)/255:1}}const hex={test:isColorString("#"),parse:parseHex,transform:rgba.transform},hsla={test:isColorString("hsl","hue"),parse:splitColor("hue","saturation","lightness"),transform:({hue:t,saturation:n,lightness:o,alpha:s=1})=>"hsla("+Math.round(t)+", "+percent.transform(sanitize(n))+", "+percent.transform(sanitize(o))+", "+sanitize(alpha.transform(s))+")"},color={test:t=>rgba.test(t)||hex.test(t)||hsla.test(t),parse:t=>rgba.test(t)?rgba.parse(t):hsla.test(t)?hsla.parse(t):hex.parse(t),transform:t=>isString$1(t)?t:t.hasOwnProperty("red")?rgba.transform(t):hsla.transform(t)};function test(t){var n,o;return isNaN(t)&&isString$1(t)&&(((n=t.match(floatRegex))===null||n===void 0?void 0:n.length)||0)+(((o=t.match(colorRegex))===null||o===void 0?void 0:o.length)||0)>0}const NUMBER_TOKEN="number",COLOR_TOKEN="color",VAR_TOKEN="var",VAR_FUNCTION_TOKEN="var(",SPLIT_TOKEN="${}",complexRegex=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function analyseComplexValue(t){const n=t.toString(),o=[],s={color:[],number:[],var:[]},c=[];let d=0;const p=n.replace(complexRegex,y=>(color.test(y)?(s.color.push(d),c.push(COLOR_TOKEN),o.push(color.parse(y))):y.startsWith(VAR_FUNCTION_TOKEN)?(s.var.push(d),c.push(VAR_TOKEN),o.push(y)):(s.number.push(d),c.push(NUMBER_TOKEN),o.push(parseFloat(y))),++d,SPLIT_TOKEN)).split(SPLIT_TOKEN);return{values:o,split:p,indexes:s,types:c}}function parseComplexValue(t){return analyseComplexValue(t).values}function createTransformer(t){const{split:n,types:o}=analyseComplexValue(t),s=n.length;return c=>{let d="";for(let h=0;h<s;h++)if(d+=n[h],c[h]!==void 0){const p=o[h];p===NUMBER_TOKEN?d+=sanitize(c[h]):p===COLOR_TOKEN?d+=color.transform(c[h]):d+=c[h]}return d}}const convertNumbersToZero=t=>typeof t=="number"?0:t;function getAnimatableNone$1(t){const n=parseComplexValue(t);return createTransformer(t)(n.map(convertNumbersToZero))}const complex={test,parse:parseComplexValue,createTransformer,getAnimatableNone:getAnimatableNone$1},maxDefaults=new Set(["brightness","contrast","saturate","opacity"]);function applyDefaultFilter(t){const[n,o]=t.slice(0,-1).split("(");if(n==="drop-shadow")return t;const[s]=o.match(floatRegex)||[];if(!s)return t;const c=o.replace(s,"");let d=maxDefaults.has(n)?1:0;return s!==o&&(d*=100),n+"("+d+c+")"}const functionRegex=/\b([a-z-]*)\(.*?\)/gu,filter={...complex,getAnimatableNone:t=>{const n=t.match(functionRegex);return n?n.map(applyDefaultFilter).join(" "):t}},defaultValueTypes={...numberValueTypes,color,backgroundColor:color,outlineColor:color,fill:color,stroke:color,borderColor:color,borderTopColor:color,borderRightColor:color,borderBottomColor:color,borderLeftColor:color,filter,WebkitFilter:filter},getDefaultValueType=t=>defaultValueTypes[t];function getAnimatableNone(t,n){let o=getDefaultValueType(t);return o!==filter&&(o=complex),o.getAnimatableNone?o.getAnimatableNone(n):void 0}function makeNoneKeyframesAnimatable(t,n,o){let s=0,c;for(;s<t.length&&!c;)typeof t[s]=="string"&&t[s]!=="none"&&t[s]!=="0"&&(c=t[s]),s++;if(c&&o)for(const d of n)t[d]=getAnimatableNone(o,c)}class DOMKeyframesResolver extends KeyframeResolver{constructor(n,o,s,c){super(n,o,s,c,c==null?void 0:c.owner,!0)}readKeyframes(){const{unresolvedKeyframes:n,element:o,name:s}=this;if(!o.current)return;super.readKeyframes();for(let y=0;y<n.length;y++){const S=n[y];if(typeof S=="string"&&isCSSVariableToken(S)){const P=getVariableValue(S,o.current);P!==void 0&&(n[y]=P)}}if(!positionalKeys.has(s)||n.length!==2)return this.resolveNoneKeyframes();const[c,d]=n,h=findDimensionValueType(c),p=findDimensionValueType(d);if(h!==p)if(isNumOrPxType(h)&&isNumOrPxType(p))for(let y=0;y<n.length;y++){const S=n[y];typeof S=="string"&&(n[y]=parseFloat(S))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:n,name:o}=this,s=[];for(let c=0;c<n.length;c++)isNone(n[c])&&s.push(c);s.length&&makeNoneKeyframesAnimatable(n,s,o)}measureInitialState(){const{element:n,unresolvedKeyframes:o,name:s}=this;if(!n.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=positionalValues[s](n.measureViewportBox(),window.getComputedStyle(n.current)),o[0]=this.measuredOrigin;const c=o[o.length-1];c!==void 0&&n.getValue(s,c).jump(c,!1)}measureEndState(){var n;const{element:o,name:s,unresolvedKeyframes:c}=this;if(!o.current)return;const d=o.getValue(s);d&&d.jump(this.measuredOrigin,!1);const h=c.length-1,p=c[h];c[h]=positionalValues[s](o.measureViewportBox(),window.getComputedStyle(o.current)),p!==null&&(this.finalKeyframe=p),!((n=this.removedTransforms)===null||n===void 0)&&n.length&&this.removedTransforms.forEach(([y,S])=>{o.getValue(y).set(S)}),this.resolveNoneKeyframes()}}function memo(t){let n;return()=>(n===void 0&&(n=t()),n)}const isAnimatable=(t,n)=>n==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(complex.test(t)||t==="0")&&!t.startsWith("url("));function hasKeyframesChanged(t){const n=t[0];if(t.length===1)return!0;for(let o=0;o<t.length;o++)if(t[o]!==n)return!0}function canAnimate(t,n,o,s){const c=t[0];if(c===null)return!1;const d=t[t.length-1],h=isAnimatable(c,n),p=isAnimatable(d,n);return warning(h===p,`You are trying to animate ${n} from "${c}" to "${d}". ${c} is not an animatable value - to enable this animation set ${c} to a value animatable to ${d} via the \`style\` property.`),!h||!p?!1:hasKeyframesChanged(t)||o==="spring"&&s}class BaseAnimation{constructor({autoplay:n=!0,delay:o=0,type:s="keyframes",repeat:c=0,repeatDelay:d=0,repeatType:h="loop",...p}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.options={autoplay:n,delay:o,type:s,repeat:c,repeatDelay:d,repeatType:h,...p},this.updateFinishedPromise()}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&flushKeyframeResolvers(),this._resolved}onKeyframesResolved(n,o){this.hasAttemptedResolve=!0;const{name:s,type:c,velocity:d,delay:h,onComplete:p,onUpdate:y,isGenerator:S}=this.options;if(!S&&!canAnimate(n,s,c,d))if(h)this.options.duration=0;else{y==null||y(getFinalKeyframe(n,this.options,o)),p==null||p(),this.resolveFinishedPromise();return}const P=this.initPlayback(n,o);P!==!1&&(this._resolved={keyframes:n,finalKeyframe:o,...P},this.onPostResolved())}onPostResolved(){}then(n,o){return this.currentFinishedPromise.then(n,o)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(n=>{this.resolveFinishedPromise=n})}}function velocityPerSecond(t,n){return n?t*(1e3/n):0}const velocitySampleDuration=5;function calcGeneratorVelocity(t,n,o){const s=Math.max(n-velocitySampleDuration,0);return velocityPerSecond(o-t(s),n-s)}const safeMin=.001,minDuration=.01,maxDuration$1=10,minDamping=.05,maxDamping=1;function findSpring({duration:t=800,bounce:n=.25,velocity:o=0,mass:s=1}){let c,d;warning(t<=secondsToMilliseconds(maxDuration$1),"Spring duration must be 10 seconds or less");let h=1-n;h=clamp(minDamping,maxDamping,h),t=clamp(minDuration,maxDuration$1,millisecondsToSeconds(t)),h<1?(c=S=>{const P=S*h,L=P*t,F=P-o,N=calcAngularFreq(S,h),W=Math.exp(-L);return safeMin-F/N*W},d=S=>{const L=S*h*t,F=L*o+o,N=Math.pow(h,2)*Math.pow(S,2)*t,W=Math.exp(-L),z=calcAngularFreq(Math.pow(S,2),h);return(-c(S)+safeMin>0?-1:1)*((F-N)*W)/z}):(c=S=>{const P=Math.exp(-S*t),L=(S-o)*t+1;return-.001+P*L},d=S=>{const P=Math.exp(-S*t),L=(o-S)*(t*t);return P*L});const p=5/t,y=approximateRoot(c,d,p);if(t=secondsToMilliseconds(t),isNaN(y))return{stiffness:100,damping:10,duration:t};{const S=Math.pow(y,2)*s;return{stiffness:S,damping:h*2*Math.sqrt(s*S),duration:t}}}const rootIterations=12;function approximateRoot(t,n,o){let s=o;for(let c=1;c<rootIterations;c++)s=s-t(s)/n(s);return s}function calcAngularFreq(t,n){return t*Math.sqrt(1-n*n)}const durationKeys=["duration","bounce"],physicsKeys=["stiffness","damping","mass"];function isSpringType(t,n){return n.some(o=>t[o]!==void 0)}function getSpringOptions(t){let n={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!isSpringType(t,physicsKeys)&&isSpringType(t,durationKeys)){const o=findSpring(t);n={...n,...o,mass:1},n.isResolvedFromDuration=!0}return n}function spring({keyframes:t,restDelta:n,restSpeed:o,...s}){const c=t[0],d=t[t.length-1],h={done:!1,value:c},{stiffness:p,damping:y,mass:S,duration:P,velocity:L,isResolvedFromDuration:F}=getSpringOptions({...s,velocity:-millisecondsToSeconds(s.velocity||0)}),N=L||0,W=y/(2*Math.sqrt(p*S)),z=d-c,lt=millisecondsToSeconds(Math.sqrt(p/S)),Pe=Math.abs(z)<5;o||(o=Pe?.01:2),n||(n=Pe?.005:.5);let se;if(W<1){const mt=calcAngularFreq(lt,W);se=kt=>{const mn=Math.exp(-W*lt*kt);return d-mn*((N+W*lt*z)/mt*Math.sin(mt*kt)+z*Math.cos(mt*kt))}}else if(W===1)se=mt=>d-Math.exp(-lt*mt)*(z+(N+lt*z)*mt);else{const mt=lt*Math.sqrt(W*W-1);se=kt=>{const mn=Math.exp(-W*lt*kt),_i=Math.min(mt*kt,300);return d-mn*((N+W*lt*z)*Math.sinh(_i)+mt*z*Math.cosh(_i))/mt}}return{calculatedDuration:F&&P||null,next:mt=>{const kt=se(mt);if(F)h.done=mt>=P;else{let mn=N;mt!==0&&(W<1?mn=calcGeneratorVelocity(se,mt,kt):mn=0);const _i=Math.abs(mn)<=o,zi=Math.abs(d-kt)<=n;h.done=_i&&zi}return h.value=h.done?d:kt,h}}}function inertia({keyframes:t,velocity:n=0,power:o=.8,timeConstant:s=325,bounceDamping:c=10,bounceStiffness:d=500,modifyTarget:h,min:p,max:y,restDelta:S=.5,restSpeed:P}){const L=t[0],F={done:!1,value:L},N=ba=>p!==void 0&&ba<p||y!==void 0&&ba>y,W=ba=>p===void 0?y:y===void 0||Math.abs(p-ba)<Math.abs(y-ba)?p:y;let z=o*n;const lt=L+z,Pe=h===void 0?lt:h(lt);Pe!==lt&&(z=Pe-L);const se=ba=>-z*Math.exp(-ba/s),mt=ba=>Pe+se(ba),kt=ba=>{const fa=se(ba),La=mt(ba);F.done=Math.abs(fa)<=S,F.value=F.done?Pe:La};let mn,_i;const zi=ba=>{N(F.value)&&(mn=ba,_i=spring({keyframes:[F.value,W(F.value)],velocity:calcGeneratorVelocity(mt,ba,F.value),damping:c,stiffness:d,restDelta:S,restSpeed:P}))};return zi(0),{calculatedDuration:null,next:ba=>{let fa=!1;return!_i&&mn===void 0&&(fa=!0,kt(ba),zi(ba)),mn!==void 0&&ba>=mn?_i.next(ba-mn):(!fa&&kt(ba),F)}}}const calcBezier=(t,n,o)=>(((1-3*o+3*n)*t+(3*o-6*n))*t+3*n)*t,subdivisionPrecision=1e-7,subdivisionMaxIterations=12;function binarySubdivide(t,n,o,s,c){let d,h,p=0;do h=n+(o-n)/2,d=calcBezier(h,s,c)-t,d>0?o=h:n=h;while(Math.abs(d)>subdivisionPrecision&&++p<subdivisionMaxIterations);return h}function cubicBezier(t,n,o,s){if(t===n&&o===s)return noop$1;const c=d=>binarySubdivide(d,0,1,t,o);return d=>d===0||d===1?d:calcBezier(c(d),n,s)}const easeIn=cubicBezier(.42,0,1,1),easeOut=cubicBezier(0,0,.58,1),easeInOut=cubicBezier(.42,0,.58,1),isEasingArray=t=>Array.isArray(t)&&typeof t[0]!="number",mirrorEasing=t=>n=>n<=.5?t(2*n)/2:(2-t(2*(1-n)))/2,reverseEasing=t=>n=>1-t(1-n),circIn=t=>1-Math.sin(Math.acos(t)),circOut=reverseEasing(circIn),circInOut=mirrorEasing(circIn),backOut=cubicBezier(.33,1.53,.69,.99),backIn=reverseEasing(backOut),backInOut=mirrorEasing(backIn),anticipate=t=>(t*=2)<1?.5*backIn(t):.5*(2-Math.pow(2,-10*(t-1))),easingLookup={linear:noop$1,easeIn,easeInOut,easeOut,circIn,circInOut,circOut,backIn,backInOut,backOut,anticipate},easingDefinitionToFunction=t=>{if(Array.isArray(t)){invariant(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[n,o,s,c]=t;return cubicBezier(n,o,s,c)}else if(typeof t=="string")return invariant(easingLookup[t]!==void 0,`Invalid easing type '${t}'`),easingLookup[t];return t},progress=(t,n,o)=>{const s=n-t;return s===0?1:(o-t)/s},mixNumber$1=(t,n,o)=>t+(n-t)*o;function hueToRgb(t,n,o){return o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+(n-t)*6*o:o<1/2?n:o<2/3?t+(n-t)*(2/3-o)*6:t}function hslaToRgba({hue:t,saturation:n,lightness:o,alpha:s}){t/=360,n/=100,o/=100;let c=0,d=0,h=0;if(!n)c=d=h=o;else{const p=o<.5?o*(1+n):o+n-o*n,y=2*o-p;c=hueToRgb(y,p,t+1/3),d=hueToRgb(y,p,t),h=hueToRgb(y,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(h*255),alpha:s}}const mixLinearColor=(t,n,o)=>{const s=t*t,c=o*(n*n-s)+s;return c<0?0:Math.sqrt(c)},colorTypes=[hex,rgba,hsla],getColorType=t=>colorTypes.find(n=>n.test(t));function asRGBA(t){const n=getColorType(t);invariant(!!n,`'${t}' is not an animatable color. Use the equivalent color code instead.`);let o=n.parse(t);return n===hsla&&(o=hslaToRgba(o)),o}const mixColor=(t,n)=>{const o=asRGBA(t),s=asRGBA(n),c={...o};return d=>(c.red=mixLinearColor(o.red,s.red,d),c.green=mixLinearColor(o.green,s.green,d),c.blue=mixLinearColor(o.blue,s.blue,d),c.alpha=mixNumber$1(o.alpha,s.alpha,d),rgba.transform(c))};function mixImmediate(t,n){return o=>o>0?n:t}function mixNumber(t,n){return o=>mixNumber$1(t,n,o)}function getMixer(t){return typeof t=="number"?mixNumber:typeof t=="string"?isCSSVariableToken(t)?mixImmediate:color.test(t)?mixColor:mixComplex:Array.isArray(t)?mixArray:typeof t=="object"?color.test(t)?mixColor:mixObject:mixImmediate}function mixArray(t,n){const o=[...t],s=o.length,c=t.map((d,h)=>getMixer(d)(d,n[h]));return d=>{for(let h=0;h<s;h++)o[h]=c[h](d);return o}}function mixObject(t,n){const o={...t,...n},s={};for(const c in o)t[c]!==void 0&&n[c]!==void 0&&(s[c]=getMixer(t[c])(t[c],n[c]));return c=>{for(const d in s)o[d]=s[d](c);return o}}function matchOrder(t,n){var o;const s=[],c={color:0,var:0,number:0};for(let d=0;d<n.values.length;d++){const h=n.types[d],p=t.indexes[h][c[h]],y=(o=t.values[p])!==null&&o!==void 0?o:0;s[d]=y,c[h]++}return s}const mixComplex=(t,n)=>{const o=complex.createTransformer(n),s=analyseComplexValue(t),c=analyseComplexValue(n);return s.indexes.var.length===c.indexes.var.length&&s.indexes.color.length===c.indexes.color.length&&s.indexes.number.length>=c.indexes.number.length?pipe(mixArray(matchOrder(s,c),c.values),o):(warning(!0,`Complex values '${t}' and '${n}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),mixImmediate(t,n))};function mix(t,n,o){return typeof t=="number"&&typeof n=="number"&&typeof o=="number"?mixNumber$1(t,n,o):getMixer(t)(t,n)}function createMixers(t,n,o){const s=[],c=o||mix,d=t.length-1;for(let h=0;h<d;h++){let p=c(t[h],t[h+1]);if(n){const y=Array.isArray(n)?n[h]||noop$1:n;p=pipe(y,p)}s.push(p)}return s}function interpolate(t,n,{clamp:o=!0,ease:s,mixer:c}={}){const d=t.length;if(invariant(d===n.length,"Both input and output ranges must be the same length"),d===1)return()=>n[0];if(d===2&&t[0]===t[1])return()=>n[1];t[0]>t[d-1]&&(t=[...t].reverse(),n=[...n].reverse());const h=createMixers(n,s,c),p=h.length,y=S=>{let P=0;if(p>1)for(;P<t.length-2&&!(S<t[P+1]);P++);const L=progress(t[P],t[P+1],S);return h[P](L)};return o?S=>y(clamp(t[0],t[d-1],S)):y}function fillOffset(t,n){const o=t[t.length-1];for(let s=1;s<=n;s++){const c=progress(0,n,s);t.push(mixNumber$1(o,1,c))}}function defaultOffset(t){const n=[0];return fillOffset(n,t.length-1),n}function convertOffsetToTimes(t,n){return t.map(o=>o*n)}function defaultEasing(t,n){return t.map(()=>n||easeInOut).splice(0,t.length-1)}function keyframes({duration:t=300,keyframes:n,times:o,ease:s="easeInOut"}){const c=isEasingArray(s)?s.map(easingDefinitionToFunction):easingDefinitionToFunction(s),d={done:!1,value:n[0]},h=convertOffsetToTimes(o&&o.length===n.length?o:defaultOffset(n),t),p=interpolate(h,n,{ease:Array.isArray(c)?c:defaultEasing(n,c)});return{calculatedDuration:t,next:y=>(d.value=p(y),d.done=y>=t,d)}}const maxGeneratorDuration=2e4;function calcGeneratorDuration(t){let n=0;const o=50;let s=t.next(n);for(;!s.done&&n<maxGeneratorDuration;)n+=o,s=t.next(n);return n>=maxGeneratorDuration?1/0:n}const frameloopDriver=t=>{const n=({timestamp:o})=>t(o);return{start:()=>frame.update(n,!0),stop:()=>cancelFrame(n),now:()=>frameData.isProcessing?frameData.timestamp:time.now()}},generators={decay:inertia,inertia,tween:keyframes,keyframes,spring},percentToProgress=t=>t/100;class MainThreadAnimation extends BaseAnimation{constructor({KeyframeResolver:n=KeyframeResolver,...o}){super(o),this.holdTime=null,this.startTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.state="idle";const{name:s,motionValue:c,keyframes:d}=this.options,h=(p,y)=>this.onKeyframesResolved(p,y);s&&c&&c.owner?this.resolver=c.owner.resolveKeyframes(d,h,s,c):this.resolver=new n(d,h,s,c),this.resolver.scheduleResolve()}initPlayback(n){const{type:o="keyframes",repeat:s=0,repeatDelay:c=0,repeatType:d,velocity:h=0}=this.options,p=generators[o]||keyframes;let y,S;p!==keyframes&&typeof n[0]!="number"&&(process.env.NODE_ENV!=="production"&&invariant(n.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${n}`),y=pipe(percentToProgress,mix(n[0],n[1])),n=[0,100]);const P=p({...this.options,keyframes:n});d==="mirror"&&(S=p({...this.options,keyframes:[...n].reverse(),velocity:-h})),P.calculatedDuration===null&&(P.calculatedDuration=calcGeneratorDuration(P));const{calculatedDuration:L}=P,F=L+c,N=F*(s+1)-c;return{generator:P,mirroredGenerator:S,mapPercentToKeyframes:y,calculatedDuration:L,resolvedDuration:F,totalDuration:N}}onPostResolved(){const{autoplay:n=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!n?this.pause():this.state=this.pendingPlayState}tick(n,o=!1){const{resolved:s}=this;if(!s){const{keyframes:ba}=this.options;return{done:!0,value:ba[ba.length-1]}}const{finalKeyframe:c,generator:d,mirroredGenerator:h,mapPercentToKeyframes:p,keyframes:y,calculatedDuration:S,totalDuration:P,resolvedDuration:L}=s;if(this.startTime===null)return d.next(0);const{delay:F,repeat:N,repeatType:W,repeatDelay:z,onUpdate:lt}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,n):this.speed<0&&(this.startTime=Math.min(n-P/this.speed,this.startTime)),o?this.currentTime=n:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(n-this.startTime)*this.speed;const Pe=this.currentTime-F*(this.speed>=0?1:-1),se=this.speed>=0?Pe<0:Pe>P;this.currentTime=Math.max(Pe,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=P);let mt=this.currentTime,kt=d;if(N){const ba=Math.min(this.currentTime,P)/L;let fa=Math.floor(ba),La=ba%1;!La&&ba>=1&&(La=1),La===1&&fa--,fa=Math.min(fa,N+1),!!(fa%2)&&(W==="reverse"?(La=1-La,z&&(La-=z/L)):W==="mirror"&&(kt=h)),mt=clamp(0,1,La)*L}const mn=se?{done:!1,value:y[0]}:kt.next(mt);p&&(mn.value=p(mn.value));let{done:_i}=mn;!se&&S!==null&&(_i=this.speed>=0?this.currentTime>=P:this.currentTime<=0);const zi=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&_i);return zi&&c!==void 0&&(mn.value=getFinalKeyframe(y,this.options,c)),lt&<(mn.value),zi&&this.finish(),mn}get duration(){const{resolved:n}=this;return n?millisecondsToSeconds(n.calculatedDuration):0}get time(){return millisecondsToSeconds(this.currentTime)}set time(n){n=secondsToMilliseconds(n),this.currentTime=n,this.holdTime!==null||this.speed===0?this.holdTime=n:this.driver&&(this.startTime=this.driver.now()-n/this.speed)}get speed(){return this.playbackSpeed}set speed(n){const o=this.playbackSpeed!==n;this.playbackSpeed=n,o&&(this.time=millisecondsToSeconds(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:n=frameloopDriver,onPlay:o}=this.options;this.driver||(this.driver=n(c=>this.tick(c))),o&&o();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:(!this.startTime||this.state==="finished")&&(this.startTime=s),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var n;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(n=this.currentTime)!==null&&n!==void 0?n:0}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:n}=this.options;n&&n()}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:n}=this.options;n&&n()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(n){return this.startTime=0,this.tick(n,!0)}}const isBezierDefinition=t=>Array.isArray(t)&&typeof t[0]=="number";function isWaapiSupportedEasing(t){return!!(!t||typeof t=="string"&&supportedWaapiEasing[t]||isBezierDefinition(t)||Array.isArray(t)&&t.every(isWaapiSupportedEasing))}const cubicBezierAsString=([t,n,o,s])=>`cubic-bezier(${t}, ${n}, ${o}, ${s})`,supportedWaapiEasing={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:cubicBezierAsString([0,.65,.55,1]),circOut:cubicBezierAsString([.55,0,1,.45]),backIn:cubicBezierAsString([.31,.01,.66,-.59]),backOut:cubicBezierAsString([.33,1.53,.69,.99])};function mapEasingToNativeEasing(t){if(t)return isBezierDefinition(t)?cubicBezierAsString(t):Array.isArray(t)?t.map(mapEasingToNativeEasing):supportedWaapiEasing[t]}function animateStyle(t,n,o,{delay:s=0,duration:c=300,repeat:d=0,repeatType:h="loop",ease:p,times:y}={}){const S={[n]:o};y&&(S.offset=y);const P=mapEasingToNativeEasing(p);return Array.isArray(P)&&(S.easing=P),t.animate(S,{delay:s,duration:c,easing:Array.isArray(P)?"linear":P,fill:"both",iterations:d+1,direction:h==="reverse"?"alternate":"normal"})}const supportsWaapi=memo(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),acceleratedValues=new Set(["opacity","clipPath","filter","transform"]),sampleDelta=10,maxDuration=2e4;function requiresPregeneratedKeyframes(t){return t.type==="spring"||t.name==="backgroundColor"||!isWaapiSupportedEasing(t.ease)}function pregenerateKeyframes(t,n){const o=new MainThreadAnimation({...n,keyframes:t,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:t[0]};const c=[];let d=0;for(;!s.done&&d<maxDuration;)s=o.sample(d),c.push(s.value),d+=sampleDelta;return{times:void 0,keyframes:c,duration:d-sampleDelta,ease:"linear"}}class AcceleratedAnimation extends BaseAnimation{constructor(n){super(n);const{name:o,motionValue:s,keyframes:c}=this.options;this.resolver=new DOMKeyframesResolver(c,(d,h)=>this.onKeyframesResolved(d,h),o,s),this.resolver.scheduleResolve()}initPlayback(n,o){var s;let{duration:c=300,times:d,ease:h,type:p,motionValue:y,name:S}=this.options;if(!(!((s=y.owner)===null||s===void 0)&&s.current))return!1;if(requiresPregeneratedKeyframes(this.options)){const{onComplete:L,onUpdate:F,motionValue:N,...W}=this.options,z=pregenerateKeyframes(n,W);n=z.keyframes,n.length===1&&(n[1]=n[0]),c=z.duration,d=z.times,h=z.ease,p="keyframes"}const P=animateStyle(y.owner.current,S,n,{...this.options,duration:c,times:d,ease:h});return P.startTime=time.now(),this.pendingTimeline?(P.timeline=this.pendingTimeline,this.pendingTimeline=void 0):P.onfinish=()=>{const{onComplete:L}=this.options;y.set(getFinalKeyframe(n,this.options,o)),L&&L(),this.cancel(),this.resolveFinishedPromise()},{animation:P,duration:c,times:d,type:p,ease:h,keyframes:n}}get duration(){const{resolved:n}=this;if(!n)return 0;const{duration:o}=n;return millisecondsToSeconds(o)}get time(){const{resolved:n}=this;if(!n)return 0;const{animation:o}=n;return millisecondsToSeconds(o.currentTime||0)}set time(n){const{resolved:o}=this;if(!o)return;const{animation:s}=o;s.currentTime=secondsToMilliseconds(n)}get speed(){const{resolved:n}=this;if(!n)return 1;const{animation:o}=n;return o.playbackRate}set speed(n){const{resolved:o}=this;if(!o)return;const{animation:s}=o;s.playbackRate=n}get state(){const{resolved:n}=this;if(!n)return"idle";const{animation:o}=n;return o.playState}attachTimeline(n){if(!this._resolved)this.pendingTimeline=n;else{const{resolved:o}=this;if(!o)return noop$1;const{animation:s}=o;s.timeline=n,s.onfinish=null}return noop$1}play(){if(this.isStopped)return;const{resolved:n}=this;if(!n)return;const{animation:o}=n;o.playState==="finished"&&this.updateFinishedPromise(),o.play()}pause(){const{resolved:n}=this;if(!n)return;const{animation:o}=n;o.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;const{resolved:n}=this;if(!n)return;const{animation:o,keyframes:s,duration:c,type:d,ease:h,times:p}=n;if(!(o.playState==="idle"||o.playState==="finished")){if(this.time){const{motionValue:y,onUpdate:S,onComplete:P,...L}=this.options,F=new MainThreadAnimation({...L,keyframes:s,duration:c,type:d,ease:h,times:p,isGenerator:!0}),N=secondsToMilliseconds(this.time);y.setWithVelocity(F.sample(N-sampleDelta).value,F.sample(N).value,sampleDelta)}this.cancel()}}complete(){const{resolved:n}=this;n&&n.animation.finish()}cancel(){const{resolved:n}=this;n&&n.animation.cancel()}static supports(n){const{motionValue:o,name:s,repeatDelay:c,repeatType:d,damping:h,type:p}=n;return supportsWaapi()&&s&&acceleratedValues.has(s)&&o&&o.owner&&o.owner.current instanceof HTMLElement&&!o.owner.getProps().onUpdate&&!c&&d!=="mirror"&&h!==0&&p!=="inertia"}}const animateMotionValue=(t,n,o,s={},c,d)=>h=>{const p=getValueTransition(s,t)||{},y=p.delay||s.delay||0;let{elapsed:S=0}=s;S=S-secondsToMilliseconds(y);let P={keyframes:Array.isArray(o)?o:[null,o],ease:"easeOut",velocity:n.getVelocity(),...p,delay:-S,onUpdate:F=>{n.set(F),p.onUpdate&&p.onUpdate(F)},onComplete:()=>{h(),p.onComplete&&p.onComplete()},name:t,motionValue:n,element:d?void 0:c};isTransitionDefined(p)||(P={...P,...getDefaultTransition(t,P)}),P.duration&&(P.duration=secondsToMilliseconds(P.duration)),P.repeatDelay&&(P.repeatDelay=secondsToMilliseconds(P.repeatDelay)),P.from!==void 0&&(P.keyframes[0]=P.from);let L=!1;if((P.type===!1||P.duration===0&&!P.repeatDelay)&&(P.duration=0,P.delay===0&&(L=!0)),L&&!d&&n.get()!==void 0){const F=getFinalKeyframe(P.keyframes,p);if(F!==void 0){frame.update(()=>{P.onUpdate(F),P.onComplete()});return}}return!d&&AcceleratedAnimation.supports(P)?new AcceleratedAnimation(P):new MainThreadAnimation(P)};function isWillChangeMotionValue(t){return!!(isMotionValue(t)&&t.add)}function addUniqueItem(t,n){t.indexOf(n)===-1&&t.push(n)}function removeItem(t,n){const o=t.indexOf(n);o>-1&&t.splice(o,1)}class SubscriptionManager{constructor(){this.subscriptions=[]}add(n){return addUniqueItem(this.subscriptions,n),()=>removeItem(this.subscriptions,n)}notify(n,o,s){const c=this.subscriptions.length;if(c)if(c===1)this.subscriptions[0](n,o,s);else for(let d=0;d<c;d++){const h=this.subscriptions[d];h&&h(n,o,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const warned=new Set;function warnOnce(t,n,o){t||warned.has(n)||(console.warn(n),warned.add(n))}const MAX_VELOCITY_DELTA=30,isFloat=t=>!isNaN(parseFloat(t));class MotionValue{constructor(n,o={}){this.version="11.0.27",this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(s,c=!0)=>{const d=time.now();this.updatedAt!==d&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(n),this.canTrackVelocity=isFloat(this.current),this.owner=o.owner}setCurrent(n){this.current=n,this.updatedAt=time.now()}setPrevFrameValue(n=this.current){this.prevFrameValue=n,this.prevUpdatedAt=this.updatedAt}onChange(n){return process.env.NODE_ENV!=="production"&&warnOnce(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",n)}on(n,o){this.events[n]||(this.events[n]=new SubscriptionManager);const s=this.events[n].add(o);return n==="change"?()=>{s(),frame.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const n in this.events)this.events[n].clear()}attach(n,o){this.passiveEffect=n,this.stopPassiveEffect=o}set(n,o=!0){!o||!this.passiveEffect?this.updateAndNotify(n,o):this.passiveEffect(n,this.updateAndNotify)}setWithVelocity(n,o,s){this.set(o),this.prev=void 0,this.prevFrameValue=n,this.prevUpdatedAt=this.updatedAt-s}jump(n,o=!0){this.updateAndNotify(n),this.prev=n,this.prevUpdatedAt=this.prevFrameValue=void 0,o&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const n=time.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||n-this.updatedAt>MAX_VELOCITY_DELTA)return 0;const o=Math.min(this.updatedAt-this.prevUpdatedAt,MAX_VELOCITY_DELTA);return velocityPerSecond(parseFloat(this.current)-parseFloat(this.prevFrameValue),o)}start(n){return this.stop(),new Promise(o=>{this.hasAnimated=!0,this.animation=n(o),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function motionValue(t,n){return new MotionValue(t,n)}function setMotionValue(t,n,o){t.hasValue(n)?t.getValue(n).set(o):t.addValue(n,motionValue(o))}function setTarget(t,n){const o=resolveVariant(t,n);let{transitionEnd:s={},transition:c={},...d}=o||{};d={...d,...s};for(const h in d){const p=resolveFinalValueInKeyframes(d[h]);setMotionValue(t,h,p)}}function shouldBlockAnimation({protectedKeys:t,needsAnimating:n},o){const s=t.hasOwnProperty(o)&&n[o]!==!0;return n[o]=!1,s}function animateTarget(t,n,{delay:o=0,transitionOverride:s,type:c}={}){var d;let{transition:h=t.getDefaultTransition(),transitionEnd:p,...y}=n;const S=t.getValue("willChange");s&&(h=s);const P=[],L=c&&t.animationState&&t.animationState.getState()[c];for(const F in y){const N=t.getValue(F,(d=t.latestValues[F])!==null&&d!==void 0?d:null),W=y[F];if(W===void 0||L&&shouldBlockAnimation(L,F))continue;const z={delay:o,elapsed:0,...getValueTransition(h||{},F)};let lt=!1;if(window.HandoffAppearAnimations){const se=t.getProps()[optimizedAppearDataAttribute];if(se){const mt=window.HandoffAppearAnimations(se,F);mt!==null&&(z.elapsed=mt,lt=!0)}}N.start(animateMotionValue(F,N,W,t.shouldReduceMotion&&transformProps.has(F)?{type:!1}:z,t,lt));const Pe=N.animation;Pe&&(isWillChangeMotionValue(S)&&(S.add(F),Pe.then(()=>S.remove(F))),P.push(Pe))}return p&&Promise.all(P).then(()=>{frame.update(()=>{p&&setTarget(t,p)})}),P}function animateVariant(t,n,o={}){var s;const c=resolveVariant(t,n,o.type==="exit"?(s=t.presenceContext)===null||s===void 0?void 0:s.custom:void 0);let{transition:d=t.getDefaultTransition()||{}}=c||{};o.transitionOverride&&(d=o.transitionOverride);const h=c?()=>Promise.all(animateTarget(t,c,o)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(S=0)=>{const{delayChildren:P=0,staggerChildren:L,staggerDirection:F}=d;return animateChildren(t,n,P+S,L,F,o)}:()=>Promise.resolve(),{when:y}=d;if(y){const[S,P]=y==="beforeChildren"?[h,p]:[p,h];return S().then(()=>P())}else return Promise.all([h(),p(o.delay)])}function animateChildren(t,n,o=0,s=0,c=1,d){const h=[],p=(t.variantChildren.size-1)*s,y=c===1?(S=0)=>S*s:(S=0)=>p-S*s;return Array.from(t.variantChildren).sort(sortByTreeOrder).forEach((S,P)=>{S.notify("AnimationStart",n),h.push(animateVariant(S,n,{...d,delay:o+y(P)}).then(()=>S.notify("AnimationComplete",n)))}),Promise.all(h)}function sortByTreeOrder(t,n){return t.sortNodePosition(n)}function animateVisualElement(t,n,o={}){t.notify("AnimationStart",n);let s;if(Array.isArray(n)){const c=n.map(d=>animateVariant(t,d,o));s=Promise.all(c)}else if(typeof n=="string")s=animateVariant(t,n,o);else{const c=typeof n=="function"?resolveVariant(t,n,o.custom):n;s=Promise.all(animateTarget(t,c,o))}return s.then(()=>{frame.postRender(()=>{t.notify("AnimationComplete",n)})})}const reversePriorityOrder=[...variantPriorityOrder].reverse(),numAnimationTypes=variantPriorityOrder.length;function animateList(t){return n=>Promise.all(n.map(({animation:o,options:s})=>animateVisualElement(t,o,s)))}function createAnimationState(t){let n=animateList(t);const o=createState();let s=!0;const c=y=>(S,P)=>{var L;const F=resolveVariant(t,P,y==="exit"?(L=t.presenceContext)===null||L===void 0?void 0:L.custom:void 0);if(F){const{transition:N,transitionEnd:W,...z}=F;S={...S,...z,...W}}return S};function d(y){n=y(t)}function h(y){const S=t.getProps(),P=t.getVariantContext(!0)||{},L=[],F=new Set;let N={},W=1/0;for(let lt=0;lt<numAnimationTypes;lt++){const Pe=reversePriorityOrder[lt],se=o[Pe],mt=S[Pe]!==void 0?S[Pe]:P[Pe],kt=isVariantLabel(mt),mn=Pe===y?se.isActive:null;mn===!1&&(W=lt);let _i=mt===P[Pe]&&mt!==S[Pe]&&kt;if(_i&&s&&t.manuallyAnimateOnMount&&(_i=!1),se.protectedKeys={...N},!se.isActive&&mn===null||!mt&&!se.prevProp||isAnimationControls(mt)||typeof mt=="boolean")continue;let ba=checkVariantsDidChange(se.prevProp,mt)||Pe===y&&se.isActive&&!_i&&kt||lt>W&&kt,fa=!1;const La=Array.isArray(mt)?mt:[mt];let Ra=La.reduce(c(Pe),{});mn===!1&&(Ra={});const{prevResolvedValues:ma={}}=se,yt={...ma,...Ra},nt=pi=>{ba=!0,F.has(pi)&&(fa=!0,F.delete(pi)),se.needsAnimating[pi]=!0;const Sa=t.getValue(pi);Sa&&(Sa.liveStyle=!1)};for(const pi in yt){const Sa=Ra[pi],Sc=ma[pi];if(N.hasOwnProperty(pi))continue;let Xs=!1;isKeyframesTarget(Sa)&&isKeyframesTarget(Sc)?Xs=!shallowCompare(Sa,Sc):Xs=Sa!==Sc,Xs?Sa!=null?nt(pi):F.add(pi):Sa!==void 0&&F.has(pi)?nt(pi):se.protectedKeys[pi]=!0}se.prevProp=mt,se.prevResolvedValues=Ra,se.isActive&&(N={...N,...Ra}),s&&t.blockInitialAnimation&&(ba=!1),ba&&(!_i||fa)&&L.push(...La.map(pi=>({animation:pi,options:{type:Pe}})))}if(F.size){const lt={};F.forEach(Pe=>{const se=t.getBaseTarget(Pe),mt=t.getValue(Pe);mt&&(mt.liveStyle=!0),lt[Pe]=se===void 0?null:se}),L.push({animation:lt})}let z=!!L.length;return s&&(S.initial===!1||S.initial===S.animate)&&!t.manuallyAnimateOnMount&&(z=!1),s=!1,z?n(L):Promise.resolve()}function p(y,S){var P;if(o[y].isActive===S)return Promise.resolve();(P=t.variantChildren)===null||P===void 0||P.forEach(F=>{var N;return(N=F.animationState)===null||N===void 0?void 0:N.setActive(y,S)}),o[y].isActive=S;const L=h(y);for(const F in o)o[F].protectedKeys={};return L}return{animateChanges:h,setActive:p,setAnimateFunction:d,getState:()=>o}}function checkVariantsDidChange(t,n){return typeof n=="string"?n!==t:Array.isArray(n)?!shallowCompare(n,t):!1}function createTypeState(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function createState(){return{animate:createTypeState(!0),whileInView:createTypeState(),whileHover:createTypeState(),whileTap:createTypeState(),whileDrag:createTypeState(),whileFocus:createTypeState(),exit:createTypeState()}}class AnimationFeature extends Feature{constructor(n){super(n),n.animationState||(n.animationState=createAnimationState(n))}updateAnimationControlsSubscription(){const{animate:n}=this.node.getProps();this.unmount(),isAnimationControls(n)&&(this.unmount=n.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:n}=this.node.getProps(),{animate:o}=this.node.prevProps||{};n!==o&&this.updateAnimationControlsSubscription()}unmount(){}}let id$1=0;class ExitAnimationFeature extends Feature{constructor(){super(...arguments),this.id=id$1++}update(){if(!this.node.presenceContext)return;const{isPresent:n,onExitComplete:o}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||n===s)return;const c=this.node.animationState.setActive("exit",!n);o&&!n&&c.then(()=>o(this.id))}mount(){const{register:n}=this.node.presenceContext||{};n&&(this.unmount=n(this.id))}unmount(){}}const animations={animation:{Feature:AnimationFeature},exit:{Feature:ExitAnimationFeature}},distance=(t,n)=>Math.abs(t-n);function distance2D(t,n){const o=distance(t.x,n.x),s=distance(t.y,n.y);return Math.sqrt(o**2+s**2)}class PanSession{constructor(n,o,{transformPagePoint:s,contextWindow:c,dragSnapToOrigin:d=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const L=getPanInfo(this.lastMoveEventInfo,this.history),F=this.startEvent!==null,N=distance2D(L.offset,{x:0,y:0})>=3;if(!F&&!N)return;const{point:W}=L,{timestamp:z}=frameData;this.history.push({...W,timestamp:z});const{onStart:lt,onMove:Pe}=this.handlers;F||(lt&<(this.lastMoveEvent,L),this.startEvent=this.lastMoveEvent),Pe&&Pe(this.lastMoveEvent,L)},this.handlePointerMove=(L,F)=>{this.lastMoveEvent=L,this.lastMoveEventInfo=transformPoint(F,this.transformPagePoint),frame.update(this.updatePoint,!0)},this.handlePointerUp=(L,F)=>{this.end();const{onEnd:N,onSessionEnd:W,resumeAnimation:z}=this.handlers;if(this.dragSnapToOrigin&&z&&z(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const lt=getPanInfo(L.type==="pointercancel"?this.lastMoveEventInfo:transformPoint(F,this.transformPagePoint),this.history);this.startEvent&&N&&N(L,lt),W&&W(L,lt)},!isPrimaryPointer(n))return;this.dragSnapToOrigin=d,this.handlers=o,this.transformPagePoint=s,this.contextWindow=c||window;const h=extractEventInfo(n),p=transformPoint(h,this.transformPagePoint),{point:y}=p,{timestamp:S}=frameData;this.history=[{...y,timestamp:S}];const{onSessionStart:P}=o;P&&P(n,getPanInfo(p,this.history)),this.removeListeners=pipe(addPointerEvent(this.contextWindow,"pointermove",this.handlePointerMove),addPointerEvent(this.contextWindow,"pointerup",this.handlePointerUp),addPointerEvent(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(n){this.handlers=n}end(){this.removeListeners&&this.removeListeners(),cancelFrame(this.updatePoint)}}function transformPoint(t,n){return n?{point:n(t.point)}:t}function subtractPoint(t,n){return{x:t.x-n.x,y:t.y-n.y}}function getPanInfo({point:t},n){return{point:t,delta:subtractPoint(t,lastDevicePoint(n)),offset:subtractPoint(t,startDevicePoint(n)),velocity:getVelocity(n,.1)}}function startDevicePoint(t){return t[0]}function lastDevicePoint(t){return t[t.length-1]}function getVelocity(t,n){if(t.length<2)return{x:0,y:0};let o=t.length-1,s=null;const c=lastDevicePoint(t);for(;o>=0&&(s=t[o],!(c.timestamp-s.timestamp>secondsToMilliseconds(n)));)o--;if(!s)return{x:0,y:0};const d=millisecondsToSeconds(c.timestamp-s.timestamp);if(d===0)return{x:0,y:0};const h={x:(c.x-s.x)/d,y:(c.y-s.y)/d};return h.x===1/0&&(h.x=0),h.y===1/0&&(h.y=0),h}function calcLength(t){return t.max-t.min}function isNear(t,n=0,o=.01){return Math.abs(t-n)<=o}function calcAxisDelta(t,n,o,s=.5){t.origin=s,t.originPoint=mixNumber$1(n.min,n.max,t.origin),t.scale=calcLength(o)/calcLength(n),(isNear(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=mixNumber$1(o.min,o.max,t.origin)-t.originPoint,(isNear(t.translate)||isNaN(t.translate))&&(t.translate=0)}function calcBoxDelta(t,n,o,s){calcAxisDelta(t.x,n.x,o.x,s?s.originX:void 0),calcAxisDelta(t.y,n.y,o.y,s?s.originY:void 0)}function calcRelativeAxis(t,n,o){t.min=o.min+n.min,t.max=t.min+calcLength(n)}function calcRelativeBox(t,n,o){calcRelativeAxis(t.x,n.x,o.x),calcRelativeAxis(t.y,n.y,o.y)}function calcRelativeAxisPosition(t,n,o){t.min=n.min-o.min,t.max=t.min+calcLength(n)}function calcRelativePosition(t,n,o){calcRelativeAxisPosition(t.x,n.x,o.x),calcRelativeAxisPosition(t.y,n.y,o.y)}function applyConstraints(t,{min:n,max:o},s){return n!==void 0&&t<n?t=s?mixNumber$1(n,t,s.min):Math.max(t,n):o!==void 0&&t>o&&(t=s?mixNumber$1(o,t,s.max):Math.min(t,o)),t}function calcRelativeAxisConstraints(t,n,o){return{min:n!==void 0?t.min+n:void 0,max:o!==void 0?t.max+o-(t.max-t.min):void 0}}function calcRelativeConstraints(t,{top:n,left:o,bottom:s,right:c}){return{x:calcRelativeAxisConstraints(t.x,o,c),y:calcRelativeAxisConstraints(t.y,n,s)}}function calcViewportAxisConstraints(t,n){let o=n.min-t.min,s=n.max-t.max;return n.max-n.min<t.max-t.min&&([o,s]=[s,o]),{min:o,max:s}}function calcViewportConstraints(t,n){return{x:calcViewportAxisConstraints(t.x,n.x),y:calcViewportAxisConstraints(t.y,n.y)}}function calcOrigin(t,n){let o=.5;const s=calcLength(t),c=calcLength(n);return c>s?o=progress(n.min,n.max-s,t.min):s>c&&(o=progress(t.min,t.max-c,n.min)),clamp(0,1,o)}function rebaseAxisConstraints(t,n){const o={};return n.min!==void 0&&(o.min=n.min-t.min),n.max!==void 0&&(o.max=n.max-t.min),o}const defaultElastic=.35;function resolveDragElastic(t=defaultElastic){return t===!1?t=0:t===!0&&(t=defaultElastic),{x:resolveAxisElastic(t,"left","right"),y:resolveAxisElastic(t,"top","bottom")}}function resolveAxisElastic(t,n,o){return{min:resolvePointElastic(t,n),max:resolvePointElastic(t,o)}}function resolvePointElastic(t,n){return typeof t=="number"?t:t[n]||0}const createAxisDelta=()=>({translate:0,scale:1,origin:0,originPoint:0}),createDelta=()=>({x:createAxisDelta(),y:createAxisDelta()}),createAxis=()=>({min:0,max:0}),createBox=()=>({x:createAxis(),y:createAxis()});function eachAxis(t){return[t("x"),t("y")]}function convertBoundingBoxToBox({top:t,left:n,right:o,bottom:s}){return{x:{min:n,max:o},y:{min:t,max:s}}}function convertBoxToBoundingBox({x:t,y:n}){return{top:n.min,right:t.max,bottom:n.max,left:t.min}}function transformBoxPoints(t,n){if(!n)return t;const o=n({x:t.left,y:t.top}),s=n({x:t.right,y:t.bottom});return{top:o.y,left:o.x,bottom:s.y,right:s.x}}function isIdentityScale(t){return t===void 0||t===1}function hasScale({scale:t,scaleX:n,scaleY:o}){return!isIdentityScale(t)||!isIdentityScale(n)||!isIdentityScale(o)}function hasTransform(t){return hasScale(t)||has2DTranslate(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function has2DTranslate(t){return is2DTranslate(t.x)||is2DTranslate(t.y)}function is2DTranslate(t){return t&&t!=="0%"}function scalePoint(t,n,o){const s=t-o,c=n*s;return o+c}function applyPointDelta(t,n,o,s,c){return c!==void 0&&(t=scalePoint(t,c,s)),scalePoint(t,o,s)+n}function applyAxisDelta(t,n=0,o=1,s,c){t.min=applyPointDelta(t.min,n,o,s,c),t.max=applyPointDelta(t.max,n,o,s,c)}function applyBoxDelta(t,{x:n,y:o}){applyAxisDelta(t.x,n.translate,n.scale,n.originPoint),applyAxisDelta(t.y,o.translate,o.scale,o.originPoint)}function applyTreeDeltas(t,n,o,s=!1){const c=o.length;if(!c)return;n.x=n.y=1;let d,h;for(let p=0;p<c;p++){d=o[p],h=d.projectionDelta;const y=d.instance;y&&y.style&&y.style.display==="contents"||(s&&d.options.layoutScroll&&d.scroll&&d!==d.root&&transformBox(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),h&&(n.x*=h.x.scale,n.y*=h.y.scale,applyBoxDelta(t,h)),s&&hasTransform(d.latestValues)&&transformBox(t,d.latestValues))}n.x=snapToDefault(n.x),n.y=snapToDefault(n.y)}function snapToDefault(t){return Number.isInteger(t)||t>1.0000000000001||t<.999999999999?t:1}function translateAxis(t,n){t.min=t.min+n,t.max=t.max+n}function transformAxis(t,n,[o,s,c]){const d=n[c]!==void 0?n[c]:.5,h=mixNumber$1(t.min,t.max,d);applyAxisDelta(t,n[o],n[s],h,n.scale)}const xKeys$1=["x","scaleX","originX"],yKeys$1=["y","scaleY","originY"];function transformBox(t,n){transformAxis(t.x,n,xKeys$1),transformAxis(t.y,n,yKeys$1)}function measureViewportBox(t,n){return convertBoundingBoxToBox(transformBoxPoints(t.getBoundingClientRect(),n))}function measurePageBox(t,n,o){const s=measureViewportBox(t,o),{scroll:c}=n;return c&&(translateAxis(s.x,c.offset.x),translateAxis(s.y,c.offset.y)),s}const getContextWindow=({current:t})=>t?t.ownerDocument.defaultView:null,elementDragControls=new WeakMap;class VisualElementDragControls{constructor(n){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=createBox(),this.visualElement=n}start(n,{snapToCursor:o=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const c=P=>{const{dragSnapToOrigin:L}=this.getProps();L?this.pauseAnimation():this.stopAnimation(),o&&this.snapToCursor(extractEventInfo(P,"page").point)},d=(P,L)=>{const{drag:F,dragPropagation:N,onDragStart:W}=this.getProps();if(F&&!N&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=getGlobalLock(F),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),eachAxis(lt=>{let Pe=this.getAxisMotionValue(lt).get()||0;if(percent.test(Pe)){const{projection:se}=this.visualElement;if(se&&se.layout){const mt=se.layout.layoutBox[lt];mt&&(Pe=calcLength(mt)*(parseFloat(Pe)/100))}}this.originPoint[lt]=Pe}),W&&W(P,L);const{animationState:z}=this.visualElement;z&&z.setActive("whileDrag",!0)},h=(P,L)=>{const{dragPropagation:F,dragDirectionLock:N,onDirectionLock:W,onDrag:z}=this.getProps();if(!F&&!this.openGlobalLock)return;const{offset:lt}=L;if(N&&this.currentDirection===null){this.currentDirection=getCurrentDirection(lt),this.currentDirection!==null&&W&&W(this.currentDirection);return}this.updateAxis("x",L.point,lt),this.updateAxis("y",L.point,lt),this.visualElement.render(),z&&z(P,L)},p=(P,L)=>this.stop(P,L),y=()=>eachAxis(P=>{var L;return this.getAnimationState(P)==="paused"&&((L=this.getAxisMotionValue(P).animation)===null||L===void 0?void 0:L.play())}),{dragSnapToOrigin:S}=this.getProps();this.panSession=new PanSession(n,{onSessionStart:c,onStart:d,onMove:h,onSessionEnd:p,resumeAnimation:y},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:S,contextWindow:getContextWindow(this.visualElement)})}stop(n,o){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:c}=o;this.startAnimation(c);const{onDragEnd:d}=this.getProps();d&&d(n,o)}cancel(){this.isDragging=!1;const{projection:n,animationState:o}=this.visualElement;n&&(n.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),o&&o.setActive("whileDrag",!1)}updateAxis(n,o,s){const{drag:c}=this.getProps();if(!s||!shouldDrag(n,c,this.currentDirection))return;const d=this.getAxisMotionValue(n);let h=this.originPoint[n]+s[n];this.constraints&&this.constraints[n]&&(h=applyConstraints(h,this.constraints[n],this.elastic[n])),d.set(h)}resolveConstraints(){var n;const{dragConstraints:o,dragElastic:s}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(n=this.visualElement.projection)===null||n===void 0?void 0:n.layout,d=this.constraints;o&&isRefObject(o)?this.constraints||(this.constraints=this.resolveRefConstraints()):o&&c?this.constraints=calcRelativeConstraints(c.layoutBox,o):this.constraints=!1,this.elastic=resolveDragElastic(s),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&eachAxis(h=>{this.getAxisMotionValue(h)&&(this.constraints[h]=rebaseAxisConstraints(c.layoutBox[h],this.constraints[h]))})}resolveRefConstraints(){const{dragConstraints:n,onMeasureDragConstraints:o}=this.getProps();if(!n||!isRefObject(n))return!1;const s=n.current;invariant(s!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=measurePageBox(s,c.root,this.visualElement.getTransformPagePoint());let h=calcViewportConstraints(c.layout.layoutBox,d);if(o){const p=o(convertBoxToBoundingBox(h));this.hasMutatedConstraints=!!p,p&&(h=convertBoundingBoxToBox(p))}return h}startAnimation(n){const{drag:o,dragMomentum:s,dragElastic:c,dragTransition:d,dragSnapToOrigin:h,onDragTransitionEnd:p}=this.getProps(),y=this.constraints||{},S=eachAxis(P=>{if(!shouldDrag(P,o,this.currentDirection))return;let L=y[P]||{};h&&(L={min:0,max:0});const F=c?200:1e6,N=c?40:1e7,W={type:"inertia",velocity:s?n[P]:0,bounceStiffness:F,bounceDamping:N,timeConstant:750,restDelta:1,restSpeed:10,...d,...L};return this.startAxisValueAnimation(P,W)});return Promise.all(S).then(p)}startAxisValueAnimation(n,o){const s=this.getAxisMotionValue(n);return s.start(animateMotionValue(n,s,0,o,this.visualElement))}stopAnimation(){eachAxis(n=>this.getAxisMotionValue(n).stop())}pauseAnimation(){eachAxis(n=>{var o;return(o=this.getAxisMotionValue(n).animation)===null||o===void 0?void 0:o.pause()})}getAnimationState(n){var o;return(o=this.getAxisMotionValue(n).animation)===null||o===void 0?void 0:o.state}getAxisMotionValue(n){const o="_drag"+n.toUpperCase(),s=this.visualElement.getProps(),c=s[o];return c||this.visualElement.getValue(n,(s.initial?s.initial[n]:void 0)||0)}snapToCursor(n){eachAxis(o=>{const{drag:s}=this.getProps();if(!shouldDrag(o,s,this.currentDirection))return;const{projection:c}=this.visualElement,d=this.getAxisMotionValue(o);if(c&&c.layout){const{min:h,max:p}=c.layout.layoutBox[o];d.set(n[o]-mixNumber$1(h,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:n,dragConstraints:o}=this.getProps(),{projection:s}=this.visualElement;if(!isRefObject(o)||!s||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};eachAxis(h=>{const p=this.getAxisMotionValue(h);if(p){const y=p.get();c[h]=calcOrigin({min:y,max:y},this.constraints[h])}});const{transformTemplate:d}=this.visualElement.getProps();this.visualElement.current.style.transform=d?d({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),eachAxis(h=>{if(!shouldDrag(h,n,null))return;const p=this.getAxisMotionValue(h),{min:y,max:S}=this.constraints[h];p.set(mixNumber$1(y,S,c[h]))})}addListeners(){if(!this.visualElement.current)return;elementDragControls.set(this.visualElement,this);const n=this.visualElement.current,o=addPointerEvent(n,"pointerdown",y=>{const{drag:S,dragListener:P=!0}=this.getProps();S&&P&&this.start(y)}),s=()=>{const{dragConstraints:y}=this.getProps();isRefObject(y)&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,d=c.addEventListener("measure",s);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),s();const h=addDomEvent(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",({delta:y,hasLayoutChanged:S})=>{this.isDragging&&S&&(eachAxis(P=>{const L=this.getAxisMotionValue(P);L&&(this.originPoint[P]+=y[P].translate,L.set(L.get()+y[P].translate))}),this.visualElement.render())});return()=>{h(),o(),d(),p&&p()}}getProps(){const n=this.visualElement.getProps(),{drag:o=!1,dragDirectionLock:s=!1,dragPropagation:c=!1,dragConstraints:d=!1,dragElastic:h=defaultElastic,dragMomentum:p=!0}=n;return{...n,drag:o,dragDirectionLock:s,dragPropagation:c,dragConstraints:d,dragElastic:h,dragMomentum:p}}}function shouldDrag(t,n,o){return(n===!0||n===t)&&(o===null||o===t)}function getCurrentDirection(t,n=10){let o=null;return Math.abs(t.y)>n?o="y":Math.abs(t.x)>n&&(o="x"),o}class DragGesture extends Feature{constructor(n){super(n),this.removeGroupControls=noop$1,this.removeListeners=noop$1,this.controls=new VisualElementDragControls(n)}mount(){const{dragControls:n}=this.node.getProps();n&&(this.removeGroupControls=n.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||noop$1}unmount(){this.removeGroupControls(),this.removeListeners()}}const asyncHandler=t=>(n,o)=>{t&&t(n,o)};class PanGesture extends Feature{constructor(){super(...arguments),this.removePointerDownListener=noop$1}onPointerDown(n){this.session=new PanSession(n,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:getContextWindow(this.node)})}createPanHandlers(){const{onPanSessionStart:n,onPanStart:o,onPan:s,onPanEnd:c}=this.node.getProps();return{onSessionStart:asyncHandler(n),onStart:asyncHandler(o),onMove:s,onEnd:(d,h)=>{delete this.session,c&&c(d,h)}}}mount(){this.removePointerDownListener=addPointerEvent(this.node.current,"pointerdown",n=>this.onPointerDown(n))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function usePresence(){const t=React.useContext(PresenceContext);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:o,register:s}=t,c=React.useId();return React.useEffect(()=>s(c),[]),!n&&o?[!1,()=>o&&o(c)]:[!0]}const globalProjectionState={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function pixelsToPercent(t,n){return n.max===n.min?0:t/(n.max-n.min)*100}const correctBorderRadius={correct:(t,n)=>{if(!n.target)return t;if(typeof t=="string")if(px.test(t))t=parseFloat(t);else return t;const o=pixelsToPercent(t,n.target.x),s=pixelsToPercent(t,n.target.y);return`${o}% ${s}%`}},correctBoxShadow={correct:(t,{treeScale:n,projectionDelta:o})=>{const s=t,c=complex.parse(t);if(c.length>5)return s;const d=complex.createTransformer(t),h=typeof c[0]!="number"?1:0,p=o.x.scale*n.x,y=o.y.scale*n.y;c[0+h]/=p,c[1+h]/=y;const S=mixNumber$1(p,y,.5);return typeof c[2+h]=="number"&&(c[2+h]/=S),typeof c[3+h]=="number"&&(c[3+h]/=S),d(c)}};class MeasureLayoutWithContext extends React.Component{componentDidMount(){const{visualElement:n,layoutGroup:o,switchLayoutGroup:s,layoutId:c}=this.props,{projection:d}=n;addScaleCorrector(defaultScaleCorrectors),d&&(o.group&&o.group.add(d),s&&s.register&&c&&s.register(d),d.root.didUpdate(),d.addEventListener("animationComplete",()=>{this.safeToRemove()}),d.setOptions({...d.options,onExitComplete:()=>this.safeToRemove()})),globalProjectionState.hasEverUpdated=!0}getSnapshotBeforeUpdate(n){const{layoutDependency:o,visualElement:s,drag:c,isPresent:d}=this.props,h=s.projection;return h&&(h.isPresent=d,c||n.layoutDependency!==o||o===void 0?h.willUpdate():this.safeToRemove(),n.isPresent!==d&&(d?h.promote():h.relegate()||frame.postRender(()=>{const p=h.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:n}=this.props.visualElement;n&&(n.root.didUpdate(),microtask.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:n,layoutGroup:o,switchLayoutGroup:s}=this.props,{projection:c}=n;c&&(c.scheduleCheckAfterUnmount(),o&&o.group&&o.group.remove(c),s&&s.deregister&&s.deregister(c))}safeToRemove(){const{safeToRemove:n}=this.props;n&&n()}render(){return null}}function MeasureLayout(t){const[n,o]=usePresence(),s=React.useContext(LayoutGroupContext);return React.createElement(MeasureLayoutWithContext,{...t,layoutGroup:s,switchLayoutGroup:React.useContext(SwitchLayoutGroupContext),isPresent:n,safeToRemove:o})}const defaultScaleCorrectors={borderRadius:{...correctBorderRadius,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:correctBorderRadius,borderTopRightRadius:correctBorderRadius,borderBottomLeftRadius:correctBorderRadius,borderBottomRightRadius:correctBorderRadius,boxShadow:correctBoxShadow},borders=["TopLeft","TopRight","BottomLeft","BottomRight"],numBorders=borders.length,asNumber=t=>typeof t=="string"?parseFloat(t):t,isPx=t=>typeof t=="number"||px.test(t);function mixValues(t,n,o,s,c,d){c?(t.opacity=mixNumber$1(0,o.opacity!==void 0?o.opacity:1,easeCrossfadeIn(s)),t.opacityExit=mixNumber$1(n.opacity!==void 0?n.opacity:1,0,easeCrossfadeOut(s))):d&&(t.opacity=mixNumber$1(n.opacity!==void 0?n.opacity:1,o.opacity!==void 0?o.opacity:1,s));for(let h=0;h<numBorders;h++){const p=`border${borders[h]}Radius`;let y=getRadius(n,p),S=getRadius(o,p);if(y===void 0&&S===void 0)continue;y||(y=0),S||(S=0),y===0||S===0||isPx(y)===isPx(S)?(t[p]=Math.max(mixNumber$1(asNumber(y),asNumber(S),s),0),(percent.test(S)||percent.test(y))&&(t[p]+="%")):t[p]=S}(n.rotate||o.rotate)&&(t.rotate=mixNumber$1(n.rotate||0,o.rotate||0,s))}function getRadius(t,n){return t[n]!==void 0?t[n]:t.borderRadius}const easeCrossfadeIn=compress(0,.5,circOut),easeCrossfadeOut=compress(.5,.95,noop$1);function compress(t,n,o){return s=>s<t?0:s>n?1:o(progress(t,n,s))}function copyAxisInto(t,n){t.min=n.min,t.max=n.max}function copyBoxInto(t,n){copyAxisInto(t.x,n.x),copyAxisInto(t.y,n.y)}function removePointDelta(t,n,o,s,c){return t-=n,t=scalePoint(t,1/o,s),c!==void 0&&(t=scalePoint(t,1/c,s)),t}function removeAxisDelta(t,n=0,o=1,s=.5,c,d=t,h=t){if(percent.test(n)&&(n=parseFloat(n),n=mixNumber$1(h.min,h.max,n/100)-h.min),typeof n!="number")return;let p=mixNumber$1(d.min,d.max,s);t===d&&(p-=n),t.min=removePointDelta(t.min,n,o,p,c),t.max=removePointDelta(t.max,n,o,p,c)}function removeAxisTransforms(t,n,[o,s,c],d,h){removeAxisDelta(t,n[o],n[s],n[c],n.scale,d,h)}const xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(t,n,o,s){removeAxisTransforms(t.x,n,xKeys,o?o.x:void 0,s?s.x:void 0),removeAxisTransforms(t.y,n,yKeys,o?o.y:void 0,s?s.y:void 0)}function isAxisDeltaZero(t){return t.translate===0&&t.scale===1}function isDeltaZero(t){return isAxisDeltaZero(t.x)&&isAxisDeltaZero(t.y)}function boxEquals(t,n){return t.x.min===n.x.min&&t.x.max===n.x.max&&t.y.min===n.y.min&&t.y.max===n.y.max}function boxEqualsRounded(t,n){return Math.round(t.x.min)===Math.round(n.x.min)&&Math.round(t.x.max)===Math.round(n.x.max)&&Math.round(t.y.min)===Math.round(n.y.min)&&Math.round(t.y.max)===Math.round(n.y.max)}function aspectRatio(t){return calcLength(t.x)/calcLength(t.y)}class NodeStack{constructor(){this.members=[]}add(n){addUniqueItem(this.members,n),n.scheduleRender()}remove(n){if(removeItem(this.members,n),n===this.prevLead&&(this.prevLead=void 0),n===this.lead){const o=this.members[this.members.length-1];o&&this.promote(o)}}relegate(n){const o=this.members.findIndex(c=>n===c);if(o===0)return!1;let s;for(let c=o;c>=0;c--){const d=this.members[c];if(d.isPresent!==!1){s=d;break}}return s?(this.promote(s),!0):!1}promote(n,o){const s=this.lead;if(n!==s&&(this.prevLead=s,this.lead=n,n.show(),s)){s.instance&&s.scheduleRender(),n.scheduleRender(),n.resumeFrom=s,o&&(n.resumeFrom.preserveOpacity=!0),s.snapshot&&(n.snapshot=s.snapshot,n.snapshot.latestValues=s.animationValues||s.latestValues),n.root&&n.root.isUpdating&&(n.isLayoutDirty=!0);const{crossfade:c}=n.options;c===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(n=>{const{options:o,resumingFrom:s}=n;o.onExitComplete&&o.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(n=>{n.instance&&n.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function buildProjectionTransform(t,n,o){let s="";const c=t.x.translate/n.x,d=t.y.translate/n.y,h=(o==null?void 0:o.z)||0;if((c||d||h)&&(s=`translate3d(${c}px, ${d}px, ${h}px) `),(n.x!==1||n.y!==1)&&(s+=`scale(${1/n.x}, ${1/n.y}) `),o){const{transformPerspective:S,rotate:P,rotateX:L,rotateY:F,skewX:N,skewY:W}=o;S&&(s=`perspective(${S}px) ${s}`),P&&(s+=`rotate(${P}deg) `),L&&(s+=`rotateX(${L}deg) `),F&&(s+=`rotateY(${F}deg) `),N&&(s+=`skewX(${N}deg) `),W&&(s+=`skewY(${W}deg) `)}const p=t.x.scale*n.x,y=t.y.scale*n.y;return(p!==1||y!==1)&&(s+=`scale(${p}, ${y})`),s||"none"}const compareByDepth=(t,n)=>t.depth-n.depth;class FlatTree{constructor(){this.children=[],this.isDirty=!1}add(n){addUniqueItem(this.children,n),this.isDirty=!0}remove(n){removeItem(this.children,n),this.isDirty=!0}forEach(n){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(n)}}function delay(t,n){const o=time.now(),s=({timestamp:c})=>{const d=c-o;d>=n&&(cancelFrame(s),t(d-n))};return frame.read(s,!0),()=>cancelFrame(s)}function record(t){window.MotionDebug&&window.MotionDebug.record(t)}function isSVGElement(t){return t instanceof SVGElement&&t.tagName!=="svg"}function animateSingleValue(t,n,o){const s=isMotionValue(t)?t:motionValue(t);return s.start(animateMotionValue("",s,n,o)),s.animation}const transformAxes=["","X","Y","Z"],hiddenVisibility={visibility:"hidden"},animationTarget=1e3;let id=0;const projectionFrameData={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function resetDistortingTransform(t,n,o,s){const{latestValues:c}=n;c[t]&&(o[t]=c[t],n.setStaticValue(t,0),s&&(s[t]=0))}function createProjectionNode({attachResizeListener:t,defaultParent:n,measureScroll:o,checkIsScrollRoot:s,resetTransform:c}){return class{constructor(h={},p=n==null?void 0:n()){this.id=id++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,projectionFrameData.totalNodes=projectionFrameData.resolvedTargetDeltas=projectionFrameData.recalculatedProjection=0,this.nodes.forEach(propagateDirtyNodes),this.nodes.forEach(resolveTargetDelta),this.nodes.forEach(calcProjection),this.nodes.forEach(cleanDirtyNodes),record(projectionFrameData)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=h,this.root=p?p.root||p:this,this.path=p?[...p.path,p]:[],this.parent=p,this.depth=p?p.depth+1:0;for(let y=0;y<this.path.length;y++)this.path[y].shouldResetTransform=!0;this.root===this&&(this.nodes=new FlatTree)}addEventListener(h,p){return this.eventHandlers.has(h)||this.eventHandlers.set(h,new SubscriptionManager),this.eventHandlers.get(h).add(p)}notifyListeners(h,...p){const y=this.eventHandlers.get(h);y&&y.notify(...p)}hasListeners(h){return this.eventHandlers.has(h)}mount(h,p=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=isSVGElement(h),this.instance=h;const{layoutId:y,layout:S,visualElement:P}=this.options;if(P&&!P.current&&P.mount(h),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),p&&(S||y)&&(this.isLayoutDirty=!0),t){let L;const F=()=>this.root.updateBlockedByResize=!1;t(h,()=>{this.root.updateBlockedByResize=!0,L&&L(),L=delay(F,250),globalProjectionState.hasAnimatedSinceResize&&(globalProjectionState.hasAnimatedSinceResize=!1,this.nodes.forEach(finishAnimation))})}y&&this.root.registerSharedNode(y,this),this.options.animate!==!1&&P&&(y||S)&&this.addEventListener("didUpdate",({delta:L,hasLayoutChanged:F,hasRelativeTargetChanged:N,layout:W})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const z=this.options.transition||P.getDefaultTransition()||defaultLayoutTransition,{onLayoutAnimationStart:lt,onLayoutAnimationComplete:Pe}=P.getProps(),se=!this.targetLayout||!boxEqualsRounded(this.targetLayout,W)||N,mt=!F&&N;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||mt||F&&(se||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(L,mt);const kt={...getValueTransition(z,"layout"),onPlay:lt,onComplete:Pe};(P.shouldReduceMotion||this.options.layoutRoot)&&(kt.delay=0,kt.type=!1),this.startAnimation(kt)}else F||finishAnimation(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=W})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const h=this.getStack();h&&h.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,cancelFrame(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(resetSkewAndRotation),this.animationId++)}getTransformTemplate(){const{visualElement:h}=this.options;return h&&h.getProps().transformTemplate}willUpdate(h=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let P=0;P<this.path.length;P++){const L=this.path[P];L.shouldResetTransform=!0,L.updateScroll("snapshot"),L.options.layoutRoot&&L.willUpdate(!1)}const{layoutId:p,layout:y}=this.options;if(p===void 0&&!y)return;const S=this.getTransformTemplate();this.prevTransformTemplateValue=S?S(this.latestValues,""):void 0,this.updateSnapshot(),h&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(clearMeasurements);return}this.isUpdating||this.nodes.forEach(clearIsLayoutDirty),this.isUpdating=!1,window.HandoffCancelAllAnimations&&window.HandoffCancelAllAnimations(),this.nodes.forEach(resetTransformStyle),this.nodes.forEach(updateLayout),this.nodes.forEach(notifyLayoutUpdate),this.clearAllSnapshots();const p=time.now();frameData.delta=clamp(0,1e3/60,p-frameData.timestamp),frameData.timestamp=p,frameData.isProcessing=!0,steps.update.process(frameData),steps.preRender.process(frameData),steps.render.process(frameData),frameData.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,microtask.read(()=>this.update()))}clearAllSnapshots(){this.nodes.forEach(clearSnapshot),this.sharedNodes.forEach(removeLeadSnapshots)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,frame.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){frame.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let y=0;y<this.path.length;y++)this.path[y].updateScroll();const h=this.layout;this.layout=this.measure(!1),this.layoutCorrected=createBox(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:p}=this.options;p&&p.notify("LayoutMeasure",this.layout.layoutBox,h?h.layoutBox:void 0)}updateScroll(h="measure"){let p=!!(this.options.layoutScroll&&this.instance);this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===h&&(p=!1),p&&(this.scroll={animationId:this.root.animationId,phase:h,isRoot:s(this.instance),offset:o(this.instance)})}resetTransform(){if(!c)return;const h=this.isLayoutDirty||this.shouldResetTransform,p=this.projectionDelta&&!isDeltaZero(this.projectionDelta),y=this.getTransformTemplate(),S=y?y(this.latestValues,""):void 0,P=S!==this.prevTransformTemplateValue;h&&(p||hasTransform(this.latestValues)||P)&&(c(this.instance,S),this.shouldResetTransform=!1,this.scheduleRender())}measure(h=!0){const p=this.measurePageBox();let y=this.removeElementScroll(p);return h&&(y=this.removeTransform(y)),roundBox(y),{animationId:this.root.animationId,measuredBox:p,layoutBox:y,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:h}=this.options;if(!h)return createBox();const p=h.measureViewportBox(),{scroll:y}=this.root;return y&&(translateAxis(p.x,y.offset.x),translateAxis(p.y,y.offset.y)),p}removeElementScroll(h){const p=createBox();copyBoxInto(p,h);for(let y=0;y<this.path.length;y++){const S=this.path[y],{scroll:P,options:L}=S;if(S!==this.root&&P&&L.layoutScroll){if(P.isRoot){copyBoxInto(p,h);const{scroll:F}=this.root;F&&(translateAxis(p.x,-F.offset.x),translateAxis(p.y,-F.offset.y))}translateAxis(p.x,P.offset.x),translateAxis(p.y,P.offset.y)}}return p}applyTransform(h,p=!1){const y=createBox();copyBoxInto(y,h);for(let S=0;S<this.path.length;S++){const P=this.path[S];!p&&P.options.layoutScroll&&P.scroll&&P!==P.root&&transformBox(y,{x:-P.scroll.offset.x,y:-P.scroll.offset.y}),hasTransform(P.latestValues)&&transformBox(y,P.latestValues)}return hasTransform(this.latestValues)&&transformBox(y,this.latestValues),y}removeTransform(h){const p=createBox();copyBoxInto(p,h);for(let y=0;y<this.path.length;y++){const S=this.path[y];if(!S.instance||!hasTransform(S.latestValues))continue;hasScale(S.latestValues)&&S.updateSnapshot();const P=createBox(),L=S.measurePageBox();copyBoxInto(P,L),removeBoxTransforms(p,S.latestValues,S.snapshot?S.snapshot.layoutBox:void 0,P)}return hasTransform(this.latestValues)&&removeBoxTransforms(p,this.latestValues),p}setTargetDelta(h){this.targetDelta=h,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(h){this.options={...this.options,...h,crossfade:h.crossfade!==void 0?h.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==frameData.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(h=!1){var p;const y=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=y.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=y.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=y.isSharedProjectionDirty);const S=!!this.resumingFrom||this!==y;if(!(h||S&&this.isSharedProjectionDirty||this.isProjectionDirty||!((p=this.parent)===null||p===void 0)&&p.isProjectionDirty||this.attemptToResolveRelativeTarget))return;const{layout:L,layoutId:F}=this.options;if(!(!this.layout||!(L||F))){if(this.resolvedRelativeTargetAt=frameData.timestamp,!this.targetDelta&&!this.relativeTarget){const N=this.getClosestProjectingParent();N&&N.layout&&this.animationProgress!==1?(this.relativeParent=N,this.forceRelativeParentToResolveTarget(),this.relativeTarget=createBox(),this.relativeTargetOrigin=createBox(),calcRelativePosition(this.relativeTargetOrigin,this.layout.layoutBox,N.layout.layoutBox),copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=createBox(),this.targetWithTransforms=createBox()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),calcRelativeBox(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):copyBoxInto(this.target,this.layout.layoutBox),applyBoxDelta(this.target,this.targetDelta)):copyBoxInto(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const N=this.getClosestProjectingParent();N&&!!N.resumingFrom==!!this.resumingFrom&&!N.options.layoutScroll&&N.target&&this.animationProgress!==1?(this.relativeParent=N,this.forceRelativeParentToResolveTarget(),this.relativeTarget=createBox(),this.relativeTargetOrigin=createBox(),calcRelativePosition(this.relativeTargetOrigin,this.target,N.target),copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}projectionFrameData.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||hasScale(this.parent.latestValues)||has2DTranslate(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var h;const p=this.getLead(),y=!!this.resumingFrom||this!==p;let S=!0;if((this.isProjectionDirty||!((h=this.parent)===null||h===void 0)&&h.isProjectionDirty)&&(S=!1),y&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(S=!1),this.resolvedRelativeTargetAt===frameData.timestamp&&(S=!1),S)return;const{layout:P,layoutId:L}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(P||L))return;copyBoxInto(this.layoutCorrected,this.layout.layoutBox);const F=this.treeScale.x,N=this.treeScale.y;applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,y),p.layout&&!p.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(p.target=p.layout.layoutBox,p.targetWithTransforms=createBox());const{target:W}=p;if(!W){this.projectionTransform&&(this.projectionDelta=createDelta(),this.projectionTransform="none",this.scheduleRender());return}this.projectionDelta||(this.projectionDelta=createDelta(),this.projectionDeltaWithTransform=createDelta());const z=this.projectionTransform;calcBoxDelta(this.projectionDelta,this.layoutCorrected,W,this.latestValues),this.projectionTransform=buildProjectionTransform(this.projectionDelta,this.treeScale),(this.projectionTransform!==z||this.treeScale.x!==F||this.treeScale.y!==N)&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",W)),projectionFrameData.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(h=!0){if(this.options.scheduleRender&&this.options.scheduleRender(),h){const p=this.getStack();p&&p.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}setAnimationOrigin(h,p=!1){const y=this.snapshot,S=y?y.latestValues:{},P={...this.latestValues},L=createDelta();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const F=createBox(),N=y?y.source:void 0,W=this.layout?this.layout.source:void 0,z=N!==W,lt=this.getStack(),Pe=!lt||lt.members.length<=1,se=!!(z&&!Pe&&this.options.crossfade===!0&&!this.path.some(hasOpacityCrossfade));this.animationProgress=0;let mt;this.mixTargetDelta=kt=>{const mn=kt/1e3;mixAxisDelta(L.x,h.x,mn),mixAxisDelta(L.y,h.y,mn),this.setTargetDelta(L),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(calcRelativePosition(F,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mixBox(this.relativeTarget,this.relativeTargetOrigin,F,mn),mt&&boxEquals(this.relativeTarget,mt)&&(this.isProjectionDirty=!1),mt||(mt=createBox()),copyBoxInto(mt,this.relativeTarget)),z&&(this.animationValues=P,mixValues(P,S,this.latestValues,mn,se,Pe)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=mn},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(h){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(cancelFrame(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=frame.update(()=>{globalProjectionState.hasAnimatedSinceResize=!0,this.currentAnimation=animateSingleValue(0,animationTarget,{...h,onUpdate:p=>{this.mixTargetDelta(p),h.onUpdate&&h.onUpdate(p)},onComplete:()=>{h.onComplete&&h.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const h=this.getStack();h&&h.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(animationTarget),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const h=this.getLead();let{targetWithTransforms:p,target:y,layout:S,latestValues:P}=h;if(!(!p||!y||!S)){if(this!==h&&this.layout&&S&&shouldAnimatePositionOnly(this.options.animationType,this.layout.layoutBox,S.layoutBox)){y=this.target||createBox();const L=calcLength(this.layout.layoutBox.x);y.x.min=h.target.x.min,y.x.max=y.x.min+L;const F=calcLength(this.layout.layoutBox.y);y.y.min=h.target.y.min,y.y.max=y.y.min+F}copyBoxInto(p,y),transformBox(p,P),calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,p,P)}}registerSharedNode(h,p){this.sharedNodes.has(h)||this.sharedNodes.set(h,new NodeStack),this.sharedNodes.get(h).add(p);const S=p.options.initialPromotionConfig;p.promote({transition:S?S.transition:void 0,preserveFollowOpacity:S&&S.shouldPreserveFollowOpacity?S.shouldPreserveFollowOpacity(p):void 0})}isLead(){const h=this.getStack();return h?h.lead===this:!0}getLead(){var h;const{layoutId:p}=this.options;return p?((h=this.getStack())===null||h===void 0?void 0:h.lead)||this:this}getPrevLead(){var h;const{layoutId:p}=this.options;return p?(h=this.getStack())===null||h===void 0?void 0:h.prevLead:void 0}getStack(){const{layoutId:h}=this.options;if(h)return this.root.sharedNodes.get(h)}promote({needsReset:h,transition:p,preserveFollowOpacity:y}={}){const S=this.getStack();S&&S.promote(this,y),h&&(this.projectionDelta=void 0,this.needsReset=!0),p&&this.setOptions({transition:p})}relegate(){const h=this.getStack();return h?h.relegate(this):!1}resetSkewAndRotation(){const{visualElement:h}=this.options;if(!h)return;let p=!1;const{latestValues:y}=h;if((y.z||y.rotate||y.rotateX||y.rotateY||y.rotateZ||y.skewX||y.skewY)&&(p=!0),!p)return;const S={};y.z&&resetDistortingTransform("z",h,S,this.animationValues);for(let P=0;P<transformAxes.length;P++)resetDistortingTransform(`rotate${transformAxes[P]}`,h,S,this.animationValues),resetDistortingTransform(`skew${transformAxes[P]}`,h,S,this.animationValues);h.render();for(const P in S)h.setStaticValue(P,S[P]),this.animationValues&&(this.animationValues[P]=S[P]);h.scheduleRender()}getProjectionStyles(h){var p,y;if(!this.instance||this.isSVG)return;if(!this.isVisible)return hiddenVisibility;const S={visibility:""},P=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,S.opacity="",S.pointerEvents=resolveMotionValue(h==null?void 0:h.pointerEvents)||"",S.transform=P?P(this.latestValues,""):"none",S;const L=this.getLead();if(!this.projectionDelta||!this.layout||!L.target){const z={};return this.options.layoutId&&(z.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,z.pointerEvents=resolveMotionValue(h==null?void 0:h.pointerEvents)||""),this.hasProjected&&!hasTransform(this.latestValues)&&(z.transform=P?P({},""):"none",this.hasProjected=!1),z}const F=L.animationValues||L.latestValues;this.applyTransformsToTarget(),S.transform=buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,F),P&&(S.transform=P(F,S.transform));const{x:N,y:W}=this.projectionDelta;S.transformOrigin=`${N.origin*100}% ${W.origin*100}% 0`,L.animationValues?S.opacity=L===this?(y=(p=F.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&y!==void 0?y:1:this.preserveOpacity?this.latestValues.opacity:F.opacityExit:S.opacity=L===this?F.opacity!==void 0?F.opacity:"":F.opacityExit!==void 0?F.opacityExit:0;for(const z in scaleCorrectors){if(F[z]===void 0)continue;const{correct:lt,applyTo:Pe}=scaleCorrectors[z],se=S.transform==="none"?F[z]:lt(F[z],L);if(Pe){const mt=Pe.length;for(let kt=0;kt<mt;kt++)S[Pe[kt]]=se}else S[z]=se}return this.options.layoutId&&(S.pointerEvents=L===this?resolveMotionValue(h==null?void 0:h.pointerEvents)||"":"none"),S}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(h=>{var p;return(p=h.currentAnimation)===null||p===void 0?void 0:p.stop()}),this.root.nodes.forEach(clearMeasurements),this.root.sharedNodes.clear()}}}function updateLayout(t){t.updateLayout()}function notifyLayoutUpdate(t){var n;const o=((n=t.resumeFrom)===null||n===void 0?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&o&&t.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:c}=t.layout,{animationType:d}=t.options,h=o.source!==t.layout.source;d==="size"?eachAxis(L=>{const F=h?o.measuredBox[L]:o.layoutBox[L],N=calcLength(F);F.min=s[L].min,F.max=F.min+N}):shouldAnimatePositionOnly(d,o.layoutBox,s)&&eachAxis(L=>{const F=h?o.measuredBox[L]:o.layoutBox[L],N=calcLength(s[L]);F.max=F.min+N,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[L].max=t.relativeTarget[L].min+N)});const p=createDelta();calcBoxDelta(p,s,o.layoutBox);const y=createDelta();h?calcBoxDelta(y,t.applyTransform(c,!0),o.measuredBox):calcBoxDelta(y,s,o.layoutBox);const S=!isDeltaZero(p);let P=!1;if(!t.resumeFrom){const L=t.getClosestProjectingParent();if(L&&!L.resumeFrom){const{snapshot:F,layout:N}=L;if(F&&N){const W=createBox();calcRelativePosition(W,o.layoutBox,F.layoutBox);const z=createBox();calcRelativePosition(z,s,N.layoutBox),boxEqualsRounded(W,z)||(P=!0),L.options.layoutRoot&&(t.relativeTarget=z,t.relativeTargetOrigin=W,t.relativeParent=L)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:o,delta:y,layoutDelta:p,hasLayoutChanged:S,hasRelativeTargetChanged:P})}else if(t.isLead()){const{onExitComplete:s}=t.options;s&&s()}t.options.transition=void 0}function propagateDirtyNodes(t){projectionFrameData.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function cleanDirtyNodes(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function clearSnapshot(t){t.clearSnapshot()}function clearMeasurements(t){t.clearMeasurements()}function clearIsLayoutDirty(t){t.isLayoutDirty=!1}function resetTransformStyle(t){const{visualElement:n}=t.options;n&&n.getProps().onBeforeLayoutMeasure&&n.notify("BeforeLayoutMeasure"),t.resetTransform()}function finishAnimation(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function resolveTargetDelta(t){t.resolveTargetDelta()}function calcProjection(t){t.calcProjection()}function resetSkewAndRotation(t){t.resetSkewAndRotation()}function removeLeadSnapshots(t){t.removeLeadSnapshot()}function mixAxisDelta(t,n,o){t.translate=mixNumber$1(n.translate,0,o),t.scale=mixNumber$1(n.scale,1,o),t.origin=n.origin,t.originPoint=n.originPoint}function mixAxis(t,n,o,s){t.min=mixNumber$1(n.min,o.min,s),t.max=mixNumber$1(n.max,o.max,s)}function mixBox(t,n,o,s){mixAxis(t.x,n.x,o.x,s),mixAxis(t.y,n.y,o.y,s)}function hasOpacityCrossfade(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const defaultLayoutTransition={duration:.45,ease:[.4,0,.1,1]},userAgentContains=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),roundPoint=userAgentContains("applewebkit/")&&!userAgentContains("chrome/")?Math.round:noop$1;function roundAxis(t){t.min=roundPoint(t.min),t.max=roundPoint(t.max)}function roundBox(t){roundAxis(t.x),roundAxis(t.y)}function shouldAnimatePositionOnly(t,n,o){return t==="position"||t==="preserve-aspect"&&!isNear(aspectRatio(n),aspectRatio(o),.2)}const DocumentProjectionNode=createProjectionNode({attachResizeListener:(t,n)=>addDomEvent(t,"resize",n),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),rootProjectionNode={current:void 0},HTMLProjectionNode=createProjectionNode({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!rootProjectionNode.current){const t=new DocumentProjectionNode({});t.mount(window),t.setOptions({layoutScroll:!0}),rootProjectionNode.current=t}return rootProjectionNode.current},resetTransform:(t,n)=>{t.style.transform=n!==void 0?n:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),drag={pan:{Feature:PanGesture},drag:{Feature:DragGesture,ProjectionNode:HTMLProjectionNode,MeasureLayout}},prefersReducedMotion={current:null},hasReducedMotionListener={current:!1};function initPrefersReducedMotion(){if(hasReducedMotionListener.current=!0,!!isBrowser)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),n=()=>prefersReducedMotion.current=t.matches;t.addListener(n),n()}else prefersReducedMotion.current=!1}function updateMotionValuesFromProps(t,n,o){const{willChange:s}=n;for(const c in n){const d=n[c],h=o[c];if(isMotionValue(d))t.addValue(c,d),isWillChangeMotionValue(s)&&s.add(c),process.env.NODE_ENV==="development"&&warnOnce(d.version==="11.0.27",`Attempting to mix Framer Motion versions ${d.version} with 11.0.27 may not work as expected.`);else if(isMotionValue(h))t.addValue(c,motionValue(d,{owner:t})),isWillChangeMotionValue(s)&&s.remove(c);else if(h!==d)if(t.hasValue(c)){const p=t.getValue(c);p.liveStyle===!0?p.jump(d):p.hasAnimated||p.set(d)}else{const p=t.getStaticValue(c);t.addValue(c,motionValue(p!==void 0?p:d,{owner:t}))}}for(const c in o)n[c]===void 0&&t.removeValue(c);return n}const visualElementStore=new WeakMap,valueTypes=[...dimensionValueTypes,color,complex],findValueType=t=>valueTypes.find(testValueType(t)),featureNames=Object.keys(featureDefinitions),numFeatures=featureNames.length,propEventHandlers=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],numVariantProps=variantProps.length;function getClosestProjectingNode(t){if(t)return t.options.allowProjection!==!1?t.projection:getClosestProjectingNode(t.parent)}class VisualElement{constructor({parent:n,props:o,presenceContext:s,reducedMotionConfig:c,blockInitialAnimation:d,visualState:h},p={}){this.resolveKeyframes=(F,N,W,z)=>new this.KeyframeResolver(F,N,W,z,this),this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=KeyframeResolver,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>frame.render(this.render,!1,!0);const{latestValues:y,renderState:S}=h;this.latestValues=y,this.baseTarget={...y},this.initialValues=o.initial?{...y}:{},this.renderState=S,this.parent=n,this.props=o,this.presenceContext=s,this.depth=n?n.depth+1:0,this.reducedMotionConfig=c,this.options=p,this.blockInitialAnimation=!!d,this.isControllingVariants=isControllingVariants(o),this.isVariantNode=isVariantNode(o),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(n&&n.current);const{willChange:P,...L}=this.scrapeMotionValuesFromProps(o,{},this);for(const F in L){const N=L[F];y[F]!==void 0&&isMotionValue(N)&&(N.set(y[F],!1),isWillChangeMotionValue(P)&&P.add(F))}}scrapeMotionValuesFromProps(n,o,s){return{}}mount(n){this.current=n,visualElementStore.set(n,this),this.projection&&!this.projection.instance&&this.projection.mount(n),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((o,s)=>this.bindToMotionValue(s,o)),hasReducedMotionListener.current||initPrefersReducedMotion(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:prefersReducedMotion.current,process.env.NODE_ENV!=="production"&&warnOnce(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){visualElementStore.delete(this.current),this.projection&&this.projection.unmount(),cancelFrame(this.notifyUpdate),cancelFrame(this.render),this.valueSubscriptions.forEach(n=>n()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const n in this.events)this.events[n].clear();for(const n in this.features)this.features[n].unmount();this.current=null}bindToMotionValue(n,o){const s=transformProps.has(n),c=o.on("change",h=>{this.latestValues[n]=h,this.props.onUpdate&&frame.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)}),d=o.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(n,()=>{c(),d(),o.owner&&o.stop()})}sortNodePosition(n){return!this.current||!this.sortInstanceNodePosition||this.type!==n.type?0:this.sortInstanceNodePosition(this.current,n.current)}loadFeatures({children:n,...o},s,c,d){let h,p;if(process.env.NODE_ENV!=="production"&&c&&s){const y="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";o.ignoreStrict?warning(!1,y):invariant(!1,y)}for(let y=0;y<numFeatures;y++){const S=featureNames[y],{isEnabled:P,Feature:L,ProjectionNode:F,MeasureLayout:N}=featureDefinitions[S];F&&(h=F),P(o)&&(!this.features[S]&&L&&(this.features[S]=new L(this)),N&&(p=N))}if((this.type==="html"||this.type==="svg")&&!this.projection&&h){this.projection=new h(this.latestValues,getClosestProjectingNode(this.parent));const{layoutId:y,layout:S,drag:P,dragConstraints:L,layoutScroll:F,layoutRoot:N}=o;this.projection.setOptions({layoutId:y,layout:S,alwaysMeasureLayout:!!P||L&&isRefObject(L),visualElement:this,scheduleRender:()=>this.scheduleRender(),animationType:typeof S=="string"?S:"both",initialPromotionConfig:d,layoutScroll:F,layoutRoot:N})}return p}updateFeatures(){for(const n in this.features){const o=this.features[n];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):createBox()}getStaticValue(n){return this.latestValues[n]}setStaticValue(n,o){this.latestValues[n]=o}update(n,o){(n.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=n,this.prevPresenceContext=this.presenceContext,this.presenceContext=o;for(let s=0;s<propEventHandlers.length;s++){const c=propEventHandlers[s];this.propEventSubscriptions[c]&&(this.propEventSubscriptions[c](),delete this.propEventSubscriptions[c]);const d=n["on"+c];d&&(this.propEventSubscriptions[c]=this.on(c,d))}this.prevMotionValues=updateMotionValuesFromProps(this,this.scrapeMotionValuesFromProps(n,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(n){return this.props.variants?this.props.variants[n]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(n=!1){if(n)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const s=this.parent?this.parent.getVariantContext()||{}:{};return this.props.initial!==void 0&&(s.initial=this.props.initial),s}const o={};for(let s=0;s<numVariantProps;s++){const c=variantProps[s],d=this.props[c];(isVariantLabel(d)||d===!1)&&(o[c]=d)}return o}addVariantChild(n){const o=this.getClosestVariantNode();if(o)return o.variantChildren&&o.variantChildren.add(n),()=>o.variantChildren.delete(n)}addValue(n,o){o!==this.values.get(n)&&(this.removeValue(n),this.bindToMotionValue(n,o)),this.values.set(n,o),this.latestValues[n]=o.get()}removeValue(n){this.values.delete(n);const o=this.valueSubscriptions.get(n);o&&(o(),this.valueSubscriptions.delete(n)),delete this.latestValues[n],this.removeValueFromRenderState(n,this.renderState)}hasValue(n){return this.values.has(n)}getValue(n,o){if(this.props.values&&this.props.values[n])return this.props.values[n];let s=this.values.get(n);return s===void 0&&o!==void 0&&(s=motionValue(o===null?void 0:o,{owner:this}),this.addValue(n,s)),s}readValue(n,o){var s;let c=this.latestValues[n]!==void 0||!this.current?this.latestValues[n]:(s=this.getBaseTargetFromProps(this.props,n))!==null&&s!==void 0?s:this.readValueFromInstance(this.current,n,this.options);return c!=null&&(typeof c=="string"&&(isNumericalString(c)||isZeroValueString(c))?c=parseFloat(c):!findValueType(c)&&complex.test(o)&&(c=getAnimatableNone(n,o)),this.setBaseTarget(n,isMotionValue(c)?c.get():c)),isMotionValue(c)?c.get():c}setBaseTarget(n,o){this.baseTarget[n]=o}getBaseTarget(n){var o,s;const{initial:c}=this.props,d=typeof c=="string"||typeof c=="object"?(s=resolveVariantFromProps(this.props,c,(o=this.presenceContext)===null||o===void 0?void 0:o.custom))===null||s===void 0?void 0:s[n]:void 0;if(c&&d!==void 0)return d;const h=this.getBaseTargetFromProps(this.props,n);return h!==void 0&&!isMotionValue(h)?h:this.initialValues[n]!==void 0&&d===void 0?void 0:this.baseTarget[n]}on(n,o){return this.events[n]||(this.events[n]=new SubscriptionManager),this.events[n].add(o)}notify(n,...o){this.events[n]&&this.events[n].notify(...o)}}class DOMVisualElement extends VisualElement{constructor(){super(...arguments),this.KeyframeResolver=DOMKeyframesResolver}sortInstanceNodePosition(n,o){return n.compareDocumentPosition(o)&2?1:-1}getBaseTargetFromProps(n,o){return n.style?n.style[o]:void 0}removeValueFromRenderState(n,{vars:o,style:s}){delete o[n],delete s[n]}}function getComputedStyle(t){return window.getComputedStyle(t)}class HTMLVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="html"}readValueFromInstance(n,o){if(transformProps.has(o)){const s=getDefaultValueType(o);return s&&s.default||0}else{const s=getComputedStyle(n),c=(isCSSVariableName(o)?s.getPropertyValue(o):s[o])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(n,{transformPagePoint:o}){return measureViewportBox(n,o)}build(n,o,s,c){buildHTMLStyles(n,o,s,c.transformTemplate)}scrapeMotionValuesFromProps(n,o,s){return scrapeMotionValuesFromProps$1(n,o,s)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:n}=this.props;isMotionValue(n)&&(this.childSubscription=n.on("change",o=>{this.current&&(this.current.textContent=`${o}`)}))}renderInstance(n,o,s,c){renderHTML(n,o,s,c)}}class SVGVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(n,o){return n[o]}readValueFromInstance(n,o){if(transformProps.has(o)){const s=getDefaultValueType(o);return s&&s.default||0}return o=camelCaseAttributes.has(o)?o:camelToDash(o),n.getAttribute(o)}measureInstanceViewportBox(){return createBox()}scrapeMotionValuesFromProps(n,o){return scrapeMotionValuesFromProps(n,o,this)}build(n,o,s,c){buildSVGAttrs(n,o,s,this.isSVGTag,c.transformTemplate)}renderInstance(n,o,s,c){renderSVG(n,o,s,c)}mount(n){this.isSVGTag=isSVGTag(n.tagName),super.mount(n)}}const createDomVisualElement=(t,n)=>isSVGComponent(t)?new SVGVisualElement(n,{enableHardwareAcceleration:!1}):new HTMLVisualElement(n,{allowProjection:t!==React.Fragment,enableHardwareAcceleration:!0}),layout={layout:{ProjectionNode:HTMLProjectionNode,MeasureLayout}},preloadedFeatures={...animations,...gestureAnimations,...drag,...layout},motion=createMotionProxy((t,n)=>createDomMotionConfig(t,n,preloadedFeatures,createDomVisualElement));function useMotionValue(t){const n=useConstant(()=>motionValue(t)),{isStatic:o}=React.useContext(MotionConfigContext);if(o){const[,s]=React.useState(t);React.useEffect(()=>n.on("change",s),[])}return n}function assignRef(t,n){return typeof t=="function"?t(n):t&&(t.current=n),t}function useCallbackRef(t,n){var o=React.useState(function(){return{value:t,callback:n,facade:{get current(){return o.value},set current(s){var c=o.value;c!==s&&(o.value=s,o.callback(s,c))}}}})[0];return o.callback=n,o.facade}var useIsomorphicLayoutEffect=typeof window<"u"?React__namespace.useLayoutEffect:React__namespace.useEffect,currentValues=new WeakMap;function useMergeRefs(t,n){var o=useCallbackRef(null,function(s){return t.forEach(function(c){return assignRef(c,s)})});return useIsomorphicLayoutEffect(function(){var s=currentValues.get(o);if(s){var c=new Set(s),d=new Set(t),h=o.current;c.forEach(function(p){d.has(p)||assignRef(p,null)}),d.forEach(function(p){c.has(p)||assignRef(p,h)})}currentValues.set(o,t)},[t]),o}const occluder=new EllipsoidalOccluder(Ellipsoid$1.WGS84,Cartesian3.ZERO),ScreenSpaceElement=React.forwardRef(({position:t,children:n,...o},s)=>{const c=useConstant$2(()=>new Cartesian3);t==null||t.clone(c);const d=useMotionValue(""),h=useMotionValue("none"),{toWindowPosition:p,getCamera:y,toXYZ:S,isPositionVisible:P}=useContext(),L=React.useRef(null);usePreRender(()=>{if(L.current==null)return;let N;try{const se=p==null?void 0:p([c.x,c.y,c.z]);N=new Cartesian2(se==null?void 0:se[0],se==null?void 0:se[1])}catch{h.set("none");return}const W=y==null?void 0:y();if(!W)return;const z=S==null?void 0:S(W==null?void 0:W.lng,W==null?void 0:W.lat,W==null?void 0:W.height);if(!z)return;if(occluder.cameraPosition=new Cartesian3(z[0],z[1],z[2]),N==null||N.x<0||N.y<0||N.x>window.innerWidth||N.y>window.innerHeight||!(P!=null&&P([c.x,c.y,c.z]))){h.set("none");return}const lt=`calc(${N.x}px - 50%)`,Pe=`calc(${N.y}px - 50%)`;d.set(`translate(${lt}, ${Pe})`),h.set("block")});const F=useMergeRefs([L,s]);return jsxRuntimeExports.jsx(motion.div,{ref:F,...o,style:{...o.style,transform:d,display:h,position:"absolute",pointerEvents:"none",left:0,top:0},children:n})});ScreenSpaceElement.displayName="ScreenSpaceElement";const MeasurementLine$1=({a:t,b:n,color:o})=>{const s=React.useRef([t,n]);s.current=[t,n];const c=useConstant$2(()=>new CallbackProperty(()=>s.current,!1)),d=React.useMemo(()=>({polyline:{positions:c,width:1.5,material:new PolylineDashMaterialProperty({color:o,dashLength:8})}}),[o,c]);return jsxRuntimeExports.jsx(Entity,{...d})},ExtrudedMeasurement=({a:t,b:n,extrudedHeight:o,color:s,showLine:c})=>{const d=useConstant$2(()=>new Cartesian3);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ScreenSpaceElement,{position:Cartesian3.midpoint(t,n,d),children:jsxRuntimeExports.jsx(MeasurementText,{children:o<1e3?`${o.toFixed(1)} m`:`${(o/1e3).toFixed(1)} km`})}),c&&jsxRuntimeExports.jsx(MeasurementLine$1,{a:t,b:n,color:s})]})},ExtrudedControlPoints=React.memo(({geometryOptions:{controlPoints:t,type:n},extrudedHeight:o,color:s,isEditing:c,extrudedPoint:d,centroidBasePoint:h,centroidExtrudedPoint:p,catchedExtrudedPoint:y,handleControlPointMouseEvent:S})=>{const P=t[t.length-1],L=d?new Cartesian3(...d):void 0,F=h?new Cartesian3(...h):void 0,N=p?new Cartesian3(...p):void 0;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[L&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ControlPoint,{index:-1,position:L,isEditing:c,isExtrudedControlPoint:!0,handleControlPointMouseEvent:S}),(!c||y)&&jsxRuntimeExports.jsx(ExtrudedMeasurement,{a:P,b:L,extrudedHeight:o,color:c?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):s,showLine:n!=="extrudedPolygon"})]}),F&&jsxRuntimeExports.jsx(ControlPoint,{index:-1,position:F,isEditing:c,isExtrudedControlPoint:!0}),N&&jsxRuntimeExports.jsx(ControlPoint,{index:-1,position:N,isEditing:c,isExtrudedControlPoint:!0})]})});ExtrudedControlPoints.displayName="ExtrudedControlPoints";const ExtrudedPolygonEntity=({id:t,hierarchy:n,extrudedHeight:o,color:s,disableShadow:c=!1,isEditing:d})=>{const h=React.useRef(n);h.current=n;const y=useConstant$2(()=>new CallbackProperty(()=>h.current,!1)),S=React.useRef(o);S.current=o;const L=useConstant$2(()=>new CallbackProperty(()=>S.current,!1)),F=React.useMemo(()=>({polygon:{hierarchy:y,heightReference:HeightReference$1.RELATIVE_TO_TERRAIN,extrudedHeight:L,extrudedHeightReference:HeightReference$1.RELATIVE_TO_TERRAIN,fill:!0,outline:!0,outlineWidth:1,outlineColor:d?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):s==null?void 0:s.withAlpha(1),material:new ColorMaterialProperty(d?s==null?void 0:s.withAlpha(.2):s),classificationType:ClassificationType$1.TERRAIN,shadows:c?ShadowMode$1.DISABLED:ShadowMode$1.ENABLED}}),[L,c,y,s,d]),{requestRender:N}=useContext();return N==null||N(),jsxRuntimeExports.jsx(Entity,{id:t,...F})},PolygonEntity=({dynamic:t=!1,hierarchy:n,color:o})=>{const s=React.useRef(n);s.current=n;const c=useConstant$2(()=>new CallbackProperty(()=>s.current,!1)),d=t?c:n,h=React.useMemo(()=>({polygon:{hierarchy:d,fill:!0,material:o==null?void 0:o.withAlpha(.5),classificationType:ClassificationType$1.TERRAIN}}),[o,d]),{requestRender:p}=useContext();return p==null||p(),jsxRuntimeExports.jsx(Entity,{...h})},PolylineEntity=({dynamic:t=!1,positions:n,color:o,isEditing:s})=>{const c=React.useRef(n);c.current=n;const d=useConstant$2(()=>new CallbackProperty(()=>c.current,!t)),h=t?d:n,p=React.useMemo(()=>({polyline:{positions:h,width:1.5,material:s?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):o,classificationType:ClassificationType$1.TERRAIN,clampToGround:!0}}),[o,h,s]),{requestRender:y}=useContext();return y==null||y(),jsxRuntimeExports.jsx(Entity,{...p})},cartesianScratch1$1=new Cartesian3,SurfaceAddingPoints=React.memo(({geometryOptions:{type:t,controlPoints:n},isEditing:o,handleAddControlPoint:s})=>{if(!["polyline","polygon","extrudedPolygon"].includes(t))return null;const c=[];for(let d=0;d<n.length-1;d++){const h=n[d+1],p=Cartesian3.midpoint(n[d],h,cartesianScratch1$1);c.push(p.clone())}if(t==="polygon"||t==="extrudedPolygon"){const d=Cartesian3.midpoint(n[n.length-1],n[0],cartesianScratch1$1);c.push(d.clone())}return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:c.map((d,h)=>jsxRuntimeExports.jsx(ControlPoint,{position:d,isAddingPoint:!0,index:h,clampToGround:!0,isEditing:o,handleControlPointMouseEvent:()=>s==null?void 0:s([d.x,d.y,d.z],h)},h))})});SurfaceAddingPoints.displayName="SurfaceAddingPoints";const MeasurementLine=({a:t,b:n,color:o})=>{const s=React.useRef([t,n]);s.current=[t,n];const c=useConstant$2(()=>new CallbackProperty(()=>s.current,!1)),d=React.useMemo(()=>({polyline:{positions:c,width:1.5,material:new PolylineDashMaterialProperty({color:o,dashLength:8}),classificationType:ClassificationType$1.TERRAIN,clampToGround:!0}}),[o,c]),{requestRender:h}=useContext();return h==null||h(),jsxRuntimeExports.jsx(Entity,{...d})},SurfaceMeasurement=({a:t,b:n,color:o,showLine:s=!1})=>{const c=useConstant$2(()=>new Cartesian3),{getSurfaceDistance:d}=useContext(),h=d==null?void 0:d(t,n);return h!==void 0?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ScreenSpaceElement,{position:Cartesian3.midpoint(t,n,c),children:jsxRuntimeExports.jsx(MeasurementText,{children:h<1e3?`${h.toFixed(1)} m`:`${(h/1e3).toFixed(1)} km`})}),s&&jsxRuntimeExports.jsx(MeasurementLine,{a:t,b:n,color:o})]}):null},cartesianScratch1=new Cartesian3,SurfaceControlPoints=React.memo(({geometryOptions:{type:t,controlPoints:n},color:o,isEditing:s,catchedControlPointIndex:c,selectedControlPointIndex:d,handleControlPointMouseEvent:h})=>{const p=[];if(n.length>=2)if(s){if(c!==void 0&&c!==-1)switch(t){case"polyline":c>0&&p.push({points:[n[c-1],n[c]],showLine:!1}),c<n.length-1&&p.push({points:[n[c],n[c+1]],showLine:!1});break;case"circle":case"extrudedCircle":c!==2&&p.push({points:[n[0],n[1]],showLine:!0});break;case"rectangle":case"extrudedRectangle":if(c<=1)p.push({points:[n[0],n[1]],showLine:!1});else if(c===2){const[y,S,P]=n,L=Cartesian3.midpoint(y,S,cartesianScratch1);p.push({points:[L,P],showLine:!0})}break;case"polygon":case"extrudedPolygon":p.push({points:[n[c],c===0?n[n.length-1]:n[c-1]],showLine:!1}),p.push({points:[n[c],c===n.length-1?n[0]:n[c+1]],showLine:!1});break}}else switch(t){case"rectangle":if(n.length===2)p.push({points:n,showLine:!0});else if(n.length===3){const[y,S,P]=n,L=Cartesian3.midpoint(y,S,cartesianScratch1);p.push({points:[L,P],showLine:!0})}break;default:p.push({points:n.slice(-2),showLine:t==="circle"});break}return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[n.map((y,S)=>jsxRuntimeExports.jsx(ControlPoint,{position:y,index:S,isSelected:d===S,clampToGround:!0,isEditing:s,handleControlPointMouseEvent:h},S)),p.map(({points:y,showLine:S},P)=>jsxRuntimeExports.jsx(SurfaceMeasurement,{a:y[0],b:y[1],color:s?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):o,showLine:S},P))]})});SurfaceControlPoints.displayName="SurfaceControlPoints";const SketchComponent=React.memo(({geometryOptions:t,extrudedHeight:n,disableShadow:o,color:s,isEditing:c,extrudedPoint:d,centroidBasePoint:h,centroidExtrudedPoint:p,catchedControlPointIndex:y,catchedExtrudedPoint:S,selectedControlPointIndex:P,handleControlPointMouseEvent:L,handleAddControlPoint:F})=>{const N=React.useMemo(()=>t?{...t,controlPoints:t==null?void 0:t.controlPoints.map(se=>new Cesium$1.Cartesian3(...se))}:null,[t]),W=React.useMemo(()=>N?createGeometry(N):null,[N]),{positionsArray:z,hierarchyArray:lt}=React.useMemo(()=>(W==null?void 0:W.type)==="Point"?{}:(W==null?void 0:W.type)==="LineString"?{positionsArray:convertGeometryToPositionsArray(W)}:W!=null?{positionsArray:convertGeometryToPositionsArray(W),hierarchyArray:convertPolygonToHierarchyArray(W)}:{},[W]),Pe=React.useMemo(()=>Color$1.fromCssColorString(s??DEFAULT_SKETCH_COLOR),[s]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[z==null?void 0:z.map((se,mt)=>jsxRuntimeExports.jsx(PolylineEntity,{dynamic:!0,positions:se,color:Pe,isEditing:c},mt)),lt==null?void 0:lt.map((se,mt)=>jsxRuntimeExports.jsx(PolygonEntity,{dynamic:!0,hierarchy:se,color:Pe},mt)),N!=null&&(!n||c)&&jsxRuntimeExports.jsx(SurfaceControlPoints,{geometryOptions:N,color:Pe,isEditing:c,catchedControlPointIndex:y,selectedControlPointIndex:P,handleControlPointMouseEvent:L}),N!=null&&c&&jsxRuntimeExports.jsx(SurfaceAddingPoints,{geometryOptions:N,isEditing:c,handleAddControlPoint:F}),N!=null&&n&&jsxRuntimeExports.jsx(ExtrudedControlPoints,{geometryOptions:N,extrudedHeight:n,extrudedPoint:d,centroidBasePoint:h,centroidExtrudedPoint:p,catchedExtrudedPoint:S,color:Pe,isEditing:c,handleControlPointMouseEvent:L}),n&&(lt==null?void 0:lt.map((se,mt)=>jsxRuntimeExports.jsx(ExtrudedPolygonEntity,{hierarchy:se,extrudedHeight:n,disableShadow:o,color:Pe,isEditing:c},mt)))]})});SketchComponent.displayName="SketchComponent";const Cesium=({className:t,style:n,property:o,time:s,camera:c,small:d,ready:h,children:p,selectedLayerId:y,isLayerDraggable:S,isLayerDragging:P,shouldRender:L,layerSelectionReason:F,meta:N,displayCredits:W,layersRef:z,featureFlags:lt,requestingRenderMode:Pe,timelineManagerRef:se,cameraForceHorizontalRoll:mt,onLayerSelect:kt,onCameraChange:mn,onLayerDrag:_i,onLayerDrop:zi,onLayerEdit:ba,onLayerSelectWithRectStart:fa,onLayerSelectWithRectMove:La,onLayerSelectWithRectEnd:Ra,onMount:ma,onLayerVisibility:yt,onLayerLoad:nt,onCreditsUpdate:pi},Sa)=>{var gd,pd,Zd,cf,of,rf,df,Cf,ff,Sf,Pf,Af,Hf,_f,wf,Yf,Nf,jf,ep,$m,jm,xf,Lf,kf,$f,_m,Am,qm,Ef,tf,gf,Mf,Wf,Uf,Om,sp,cp,fp,mp,al,nf,uf;const{cesium:Sc,mouseEventHandles:Xs,cesiumIonAccessToken:ms,context:yu,layerSelectWithRectEventHandlers:pu,sceneLight:Nl,sceneBackgroundColor:Ru,sceneMsaaSamples:Vd,sceneMode:Gd,cameraViewBoundaries:lf,cameraViewOuterBoundaries:hf,cameraViewBoundariesMaterial:pf,handleCameraChange:mf,handleCameraMoveEnd:sf,handleUpdate:yf,handleClick:Tf,handleMount:vf,handleUnmount:Wa,handleTilesChange:af,handleTerrainProviderChange:Xd}=useHooks$1({ref:Sa,property:o,time:s,selectedLayerId:y,selectionReason:F,meta:N,layersRef:z,featureFlags:lt,timelineManagerRef:se,isLayerDraggable:S,isLayerDragging:P,shouldRender:L,requestingRenderMode:Pe,camera:c,cameraForceHorizontalRoll:mt,onLayerDrag:_i,onLayerDrop:zi,onLayerSelect:kt,onLayerEdit:ba,onLayerSelectWithRectStart:fa,onLayerSelectWithRectMove:La,onLayerSelectWithRectEnd:Ra,onLayerVisibility:yt,onLayerLoad:nt,onCameraChange:mn,onMount:ma,onCreditsUpdate:pi});return jsxRuntimeExports.jsxs(Aa$1,{ref:Sc,onUpdate:yf,className:t,requestRenderMode:!0,animation:!1,timeline:!1,baseLayer:!1,fullscreenButton:!1,homeButton:!1,geocoder:!1,infoBox:!1,baseLayerPicker:!1,navigationHelpButton:!1,projectionPicker:!1,sceneModePicker:!1,creditContainer:W?void 0:creditContainer,style:{width:d?"300px":"auto",height:d?"300px":"100%",display:h?void 0:"none",cursor:P?"grab":void 0,...n},shadows:!!((pd=(gd=o==null?void 0:o.scene)==null?void 0:gd.shadow)!=null&&pd.enabled),onClick:Tf,onDoubleClick:Xs.doubleClick,onMouseDown:Xs.mouseDown,onMouseUp:Xs.mouseUp,onRightClick:Xs.rightClick,onRightDown:Xs.rightDown,onRightUp:Xs.rightUp,onMiddleClick:Xs.middleClick,onMiddleDown:Xs.middleDown,onMiddleUp:Xs.middleUp,onMouseMove:Xs.mouseMove,onMouseEnter:Xs.mouseEnter,onMouseLeave:Xs.mouseLeave,onWheel:Xs.wheel,children:[jsxRuntimeExports.jsx(Event,{onMount:vf,onUnmount:Wa}),jsxRuntimeExports.jsx(ReearthClock,{timelineManagerRef:se}),jsxRuntimeExports.jsx(ImageryLayers,{tiles:o==null?void 0:o.tiles,cesiumIonAccessToken:ms,onTilesChange:af}),jsxRuntimeExports.jsx(LabelImageryLayers,{tileLabels:o==null?void 0:o.tileLabels}),jsxRuntimeExports.jsx(Indicator,{property:o,timelineManagerRef:se}),jsxRuntimeExports.jsxs(ka$1,{useDefault:!0,children:[jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_CLICK}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOUBLE_CLICK})]}),jsxRuntimeExports.jsxs(ka$1,{children:[jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOWN,action:pu.start.handler}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOWN,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:pu.start.shift}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE,action:pu.move.handler}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:pu.move.shift}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_UP,action:pu.end.handler}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_UP,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:pu.end.shift})]}),jsxRuntimeExports.jsx(Ta$1,{maximumZoomDistance:(cf=(Zd=o==null?void 0:o.camera)==null?void 0:Zd.limiter)!=null&&cf.enabled?((df=(rf=(of=o.camera)==null?void 0:of.limiter)==null?void 0:rf.targetArea)==null?void 0:df.height)??Number.POSITIVE_INFINITY:Number.POSITIVE_INFINITY,enableCollisionDetection:!((Cf=o==null?void 0:o.camera)!=null&&Cf.allowEnterGround)}),jsxRuntimeExports.jsx(Ps$1,{percentageChanged:.2,onChange:mf,onMoveEnd:sf}),lf&&((Sf=(ff=o==null?void 0:o.camera)==null?void 0:ff.limiter)==null?void 0:Sf.showHelper)&&jsxRuntimeExports.jsx(Is$1,{children:jsxRuntimeExports.jsx(ua$1,{positions:lf,width:1,material:Cesium$1.Color.RED,arcType:Cesium$1.ArcType.RHUMB})}),hf&&((Af=(Pf=o==null?void 0:o.camera)==null?void 0:Pf.limiter)==null?void 0:Af.showHelper)&&jsxRuntimeExports.jsx(Is$1,{children:jsxRuntimeExports.jsx(ua$1,{positions:hf,width:1,material:pf,arcType:Cesium$1.ArcType.RHUMB})}),jsxRuntimeExports.jsx($a$1,{backgroundColor:Ru,light:Nl,mode:Gd,msaaSamples:Vd,useDepthPicking:!1,useWebVR:!!((Hf=o==null?void 0:o.scene)!=null&&Hf.vr)||void 0,debugShowFramesPerSecond:!!((_f=o==null?void 0:o.debug)!=null&&_f.showFramesPerSecond),verticalExaggerationRelativeHeight:(wf=o==null?void 0:o.scene)==null?void 0:wf.verticalExaggerationRelativeHeight,verticalExaggeration:(Yf=o==null?void 0:o.scene)==null?void 0:Yf.verticalExaggeration}),jsxRuntimeExports.jsx(Oa$1,{show:((jf=(Nf=o==null?void 0:o.sky)==null?void 0:Nf.skyBox)==null?void 0:jf.show)??!0}),jsxRuntimeExports.jsx(Vs,{enabled:(($m=(ep=o==null?void 0:o.sky)==null?void 0:ep.fog)==null?void 0:$m.enabled)??!0,density:(xf=(jm=o==null?void 0:o.sky)==null?void 0:jm.fog)==null?void 0:xf.density}),jsxRuntimeExports.jsx(Ga$1,{show:((kf=(Lf=o==null?void 0:o.sky)==null?void 0:Lf.sun)==null?void 0:kf.show)??!0}),jsxRuntimeExports.jsx(ea,{show:((_m=($f=o==null?void 0:o.sky)==null?void 0:$f.moon)==null?void 0:_m.show)??!0}),jsxRuntimeExports.jsx(_a$2,{show:((qm=(Am=o==null?void 0:o.sky)==null?void 0:Am.skyAtmosphere)==null?void 0:qm.show)??!0,atmosphereLightIntensity:(tf=(Ef=o==null?void 0:o.sky)==null?void 0:Ef.skyAtmosphere)==null?void 0:tf.lightIntensity,saturationShift:(Mf=(gf=o==null?void 0:o.sky)==null?void 0:gf.skyAtmosphere)==null?void 0:Mf.saturationShift,brightnessShift:(Uf=(Wf=o==null?void 0:o.sky)==null?void 0:Wf.skyAtmosphere)==null?void 0:Uf.brightnessShift}),jsxRuntimeExports.jsx(Globe,{property:o,cesiumIonAccessToken:ms,onTerrainProviderChange:Xd}),jsxRuntimeExports.jsx(context.Provider,{value:yu,children:h?p:null}),jsxRuntimeExports.jsx(AmbientOcclusion,{...AMBIENT_OCCLUSION_QUALITY[((sp=(Om=o==null?void 0:o.render)==null?void 0:Om.ambientOcclusion)==null?void 0:sp.quality)||"low"],enabled:!!((fp=(cp=o==null?void 0:o.render)==null?void 0:cp.ambientOcclusion)!=null&&fp.enabled),intensity:((al=(mp=o==null?void 0:o.render)==null?void 0:mp.ambientOcclusion)==null?void 0:al.intensity)??100,outputType:(uf=(nf=o==null?void 0:o.render)==null?void 0:nf.ambientOcclusion)!=null&&uf.ambientOcclusionOnly?AmbientOcclusionOutputType.Occlusion:null})]})},creditContainer=document.createElement("div"),Component=React.forwardRef(Cesium),engine={component:Component,featureComponent:Feature$1,clusterComponent:Cluster,sketchComponent:SketchComponent,delegatedDataTypes:["czml","wms","mvt","3dtiles","osm-buildings","kml"]},engines={cesium:engine};function Error$1({error:t,resetErrorBoundary:n}){return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h1",{children:"Oops! An Error Occurred"}),jsxRuntimeExports.jsx("p",{children:t.message}),jsxRuntimeExports.jsx("p",{children:jsxRuntimeExports.jsx("button",{style:{color:"#fff"},onClick:n,children:"Retry"})})]})}const version$1="0.0.7-alpha.48",useCoreAPI=({viewerProperty:t})=>{const n=React.useRef(t);n.current=t;const o=React.useMemo(()=>({get version(){return version$1},get viewerProperty(){return n.current}}),[]);React.useEffect(()=>{window.reearth_core=o},[o])},viewportMobileMaxWidth=768,useViewport=({wrapperRef:t})=>{const n=React.useMemo(()=>paramsToObject(new URLSearchParams(window.location.search)),[]),[o,s]=React.useState({width:void 0,height:void 0,isMobile:void 0,query:n});return React.useEffect(()=>{const c=new ResizeObserver(d=>{var S,P;const[h]=d;let p,y;if(h.contentBoxSize){const L=Array.isArray(h.contentBoxSize)?h.contentBoxSize[0]:h.contentBoxSize;p=L.inlineSize,y=L.blockSize}else h.contentRect?(p=h.contentRect.width,y=h.contentRect.height):(p=(S=t.current)==null?void 0:S.clientWidth,y=(P=t.current)==null?void 0:P.clientHeight);s(L=>({width:p,height:y,isMobile:p?p<=viewportMobileMaxWidth:void 0,query:L.query}))});return t.current&&c.observe(t.current),()=>{c.disconnect()}},[t]),o};function paramsToObject(t){const n={};for(const[o,s]of t)n[o]=s;return n}function useHooks({camera:t,interactionMode:n,zoomedLayerId:o,viewerProperty:s,onLayerSelect:c,onCameraChange:d,onInteractionModeChange:h,onZoomToLayer:p,onLayerDrop:y,onSketchTypeChangeProp:S},P){const L=React.useRef(null);React.useImperativeHandle(P,()=>L.current,[]);const F=React.useRef(null),N=useViewport({wrapperRef:F}),[W,z]=React.useState({}),[lt,Pe]=React.useState(),[se,mt]=React.useState(),kt=React.useCallback(async(_f,wf,Yf,Nf,jf)=>{var xf,Lf,kf,$f,_m,Am,qm,Ef,tf,gf,Mf,Wf;const ep=((Lf=(xf=W.layer)==null?void 0:xf.layer)==null?void 0:Lf.type)==="simple"&&((_m=($f=(kf=W.layer)==null?void 0:kf.layer)==null?void 0:$f.data)==null?void 0:_m.isSketchLayer);if(W.layerId===_f&&W.featureId===wf&&!ep)return;const $m=await(Yf==null?void 0:Yf()),jm=_f&&wf?(ep?(Am=$m==null?void 0:$m.features)==null?void 0:Am.find(Uf=>Uf.id===wf):(tf=(qm=L.current)==null?void 0:(Ef=qm.engine).findComputedFeatureById)==null?void 0:tf.call(Ef,_f,wf))??(jf==null?void 0:jf.feature):void 0;Pe(_f&&wf?(Wf=(gf=L.current)==null?void 0:(Mf=gf.engine).findFeatureById)==null?void 0:Wf.call(Mf,_f,wf):void 0),mt(jm),z(Uf=>Uf.layerId===_f&&Uf.featureId===wf?Uf:{layerId:_f,featureId:wf,layer:$m,reason:Nf}),c==null||c(_f,Yf,jm,Nf)},[W,c]),mn=React.useRef(),[_i,zi]=useValue(t,d),[ba,fa]=React.useState(!1),La=React.useCallback(_f=>{fa(!!_f)},[]),[Ra,ma]=useValue(n||"default",h);React.useEffect(()=>{var _f,wf;Ra==="default"&&((wf=(_f=L==null?void 0:L.current)==null?void 0:_f.engine)==null||wf.setCursor("auto"))},[Ra]);const yt=INTERACTION_MODES[Ra??"default"],nt=React.useRef(),pi=React.useCallback(_f=>{nt.current=_f},[]),Sa=React.useCallback(_f=>{var wf;(wf=nt.current)==null||wf.call(nt,_f)},[]),Sc=React.useRef(),Xs=React.useCallback(_f=>{Sc.current=_f},[]),ms=React.useCallback(_f=>{var wf;(wf=Sc.current)==null||wf.call(Sc,_f)},[]),yu=React.useRef(),pu=React.useCallback(_f=>{yu.current=_f},[]),Nl=React.useCallback(_f=>{var wf;(wf=yu.current)==null||wf.call(yu,_f)},[]),Ru=React.useRef(),Vd=React.useCallback(_f=>{Ru.current=_f},[]),Gd=React.useCallback(_f=>{var wf;(wf=Ru.current)==null||wf.call(Ru,_f)},[]),lf=React.useRef(),hf=React.useCallback(_f=>{lf.current=_f},[]),pf=React.useCallback(_f=>{var wf;(wf=lf.current)==null||wf.call(lf,_f)},[]),mf=React.useRef(),sf=React.useCallback(_f=>{mf.current=_f},[]),yf=React.useCallback(_f=>{var wf;(wf=mf.current)==null||wf.call(mf,_f)},[]),Tf=React.useRef([]),vf=React.useCallback(_f=>{Tf.current.push(_f)},[]),Wa=React.useCallback(_f=>{Tf.current.forEach(wf=>wf(_f))},[]),af=React.useRef([]),Xd=React.useCallback(_f=>{af.current.push(_f)},[]),gd=React.useCallback(_f=>{af.current.forEach(wf=>wf(_f))},[]),pd=React.useRef([]),Zd=React.useCallback(_f=>{pd.current.push(_f)},[]),cf=React.useCallback(_f=>{pd.current.forEach(wf=>wf(_f))},[]),of=React.useRef([]),rf=React.useCallback(_f=>{of.current.push(_f)},[]),df=React.useCallback((_f,wf)=>{of.current.forEach(Yf=>Yf(_f)),S==null||S(_f,wf)},[S]);React.useEffect(()=>{var _f,wf;o&&((wf=(_f=L.current)==null?void 0:_f.engine)==null||wf.lookAtLayer(o),p==null||p(void 0))},[o,p]);const[Cf,ff]=React.useState(!1),Sf=React.useCallback(()=>{ff(!0)},[]),Pf=React.useCallback((_f,wf,Yf)=>{var ep;ff(!1);const Nf=(ep=L.current)==null?void 0:ep.layers.findById(_f),jf=Nf!=null&&Nf.property.default.location?"default.location":Nf!=null&&Nf.property.default.position?"default.position":void 0;Yf&&Nf&&Nf.propertyId&&jf&&(y==null||y(Nf.propertyId,jf,Yf))},[y,L]),Af=React.useMemo(()=>({interactionMode:Ra,selectedLayer:W,selectedComputedFeature:se,viewport:N,handleCameraForceHorizontalRollChange:La,handleInteractionModeChange:ma,onSketchPluginFeatureCreate:vf,onSketchPluginFeatureUpdate:Xd,onSketchPluginFeatureDelete:Zd,onSketchTypeChange:rf,onLayerVisibility:Xs,onLayerLoad:pu,onLayerEdit:pi,onLayerSelectWithRectStart:Vd,onLayerSelectWithRectMove:hf,onLayerSelectWithRectEnd:sf}),[Ra,W,se,N,ma,La,pi,vf,Xd,Zd,rf,Xs,pu,Vd,hf,sf]),Hf=React.useMemo(()=>({position:"relative",width:"100%",height:"100%",overflow:"hidden"}),[]);return useCoreAPI({viewerProperty:s}),{mapRef:L,wrapperRef:F,selectedFeature:lt,camera:_i,featureFlags:yt,isLayerDragging:Cf,timelineManagerRef:mn,cameraForceHorizontalRoll:ba,coreContextValue:Af,containerStyle:Hf,overriddenInteractionMode:Ra,handleLayerSelect:kt,handleLayerDrag:Sf,handleLayerDrop:Pf,handleLayerEdit:Sa,handleCameraChange:zi,handleInteractionModeChange:ma,handleSketchPluginFeatureCreate:Wa,handleSketchPluginFeatureUpdate:gd,handleSketchPluginFeatureDelete:cf,handleSketchTypeChange:df,handleLayerVisibility:ms,handleLayerLoad:Nl,handleLayerSelectWithRectStart:Gd,handleLayerSelectWithRectMove:pf,handleLayerSelectWithRectEnd:yf}}function useValue(t,n){const[o,s]=React.useState(t),c=React.useCallback(d=>{d&&(s(d),n==null||n(d))},[n]);return React.useEffect(()=>{s(t)},[t]),[o,c]}const CoreVisualizer=React.memo(React.forwardRef(({engine:t,isBuilt:n,isEditable:o,viewerProperty:s,layers:c,clusters:d,small:h,ready:p,hiddenLayers:y,camera:S,time:P,interactionMode:L,shouldRender:F,meta:N,displayCredits:W=!0,style:z,zoomedLayerId:lt,children:Pe,onLayerDrop:se,onLayerSelect:mt,onCameraChange:kt,onZoomToLayer:mn,onInteractionModeChange:_i,onMount:zi,onSketchTypeChangeProp:ba,onSketchFeatureCreate:fa,onSketchFeatureUpdate:La,onSketchFeatureDelete:Ra,onAPIReady:ma,onCreditsUpdate:yt},nt)=>{const{mapRef:pi,wrapperRef:Sa,selectedFeature:Sc,camera:Xs,featureFlags:ms,isLayerDragging:yu,timelineManagerRef:pu,cameraForceHorizontalRoll:Nl,coreContextValue:Ru,containerStyle:Vd,overriddenInteractionMode:Gd,handleLayerSelect:lf,handleLayerDrag:hf,handleLayerDrop:pf,handleLayerEdit:mf,handleCameraChange:sf,handleInteractionModeChange:yf,handleSketchPluginFeatureCreate:Tf,handleSketchPluginFeatureUpdate:vf,handleSketchPluginFeatureDelete:Wa,handleSketchTypeChange:af,handleLayerVisibility:Xd,handleLayerLoad:gd,handleLayerSelectWithRectStart:pd,handleLayerSelectWithRectMove:Zd,handleLayerSelectWithRectEnd:cf}=useHooks({camera:S,interactionMode:L,zoomedLayerId:lt,viewerProperty:s,onLayerSelect:mt,onCameraChange:kt,onZoomToLayer:mn,onLayerDrop:se,onInteractionModeChange:_i,onSketchTypeChangeProp:ba},nt);return jsxRuntimeExports.jsx(ErrorBoundary,{FallbackComponent:Error$1,children:jsxRuntimeExports.jsx(VisualizerProvider,{mapRef:pi,children:jsxRuntimeExports.jsxs("div",{ref:Sa,style:Vd,children:[jsxRuntimeExports.jsx(Map$1,{ref:pi,isBuilt:n,isEditable:o,engine:t,layers:c,engines,camera:Xs,cameraForceHorizontalRoll:Nl,clusters:d,hiddenLayers:y,isLayerDragging:yu,isLayerDraggable:o,meta:N,displayCredits:W,style:z,featureFlags:ms,shouldRender:F,property:s,time:P,small:h,ready:p,timelineManagerRef:pu,interactionMode:Gd,selectedFeature:Sc,onCameraChange:sf,onLayerDrag:hf,onLayerDrop:pf,onLayerSelect:lf,onLayerEdit:mf,overrideInteractionMode:yf,onSketchFeatureCreate:fa,onSketchPluginFeatureCreate:Tf,onSketchFeatureUpdate:La,onSketchPluginFeatureUpdate:vf,onSketchFeatureDelete:Ra,onSketchPluginFeatureDelete:Wa,onSketchTypeChange:af,onMount:zi,onLayerVisibility:Xd,onLayerLoad:gd,onLayerSelectWithRectStart:pd,onLayerSelectWithRectMove:Zd,onLayerSelectWithRectEnd:cf,onAPIReady:ma,onCreditsUpdate:yt}),jsxRuntimeExports.jsx(coreContext.Provider,{value:Ru,children:Pe})]})})})}));var global$1=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,inited=!1;function init(){inited=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=t.length;n<o;++n)lookup[n]=t[n],revLookup[t.charCodeAt(n)]=n;revLookup[45]=62,revLookup[95]=63}function toByteArray(t){inited||init();var n,o,s,c,d,h,p=t.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");d=t[p-2]==="="?2:t[p-1]==="="?1:0,h=new Arr(p*3/4-d),s=d>0?p-4:p;var y=0;for(n=0,o=0;n<s;n+=4,o+=3)c=revLookup[t.charCodeAt(n)]<<18|revLookup[t.charCodeAt(n+1)]<<12|revLookup[t.charCodeAt(n+2)]<<6|revLookup[t.charCodeAt(n+3)],h[y++]=c>>16&255,h[y++]=c>>8&255,h[y++]=c&255;return d===2?(c=revLookup[t.charCodeAt(n)]<<2|revLookup[t.charCodeAt(n+1)]>>4,h[y++]=c&255):d===1&&(c=revLookup[t.charCodeAt(n)]<<10|revLookup[t.charCodeAt(n+1)]<<4|revLookup[t.charCodeAt(n+2)]>>2,h[y++]=c>>8&255,h[y++]=c&255),h}function tripletToBase64(t){return lookup[t>>18&63]+lookup[t>>12&63]+lookup[t>>6&63]+lookup[t&63]}function encodeChunk(t,n,o){for(var s,c=[],d=n;d<o;d+=3)s=(t[d]<<16)+(t[d+1]<<8)+t[d+2],c.push(tripletToBase64(s));return c.join("")}function fromByteArray(t){inited||init();for(var n,o=t.length,s=o%3,c="",d=[],h=16383,p=0,y=o-s;p<y;p+=h)d.push(encodeChunk(t,p,p+h>y?y:p+h));return s===1?(n=t[o-1],c+=lookup[n>>2],c+=lookup[n<<4&63],c+="=="):s===2&&(n=(t[o-2]<<8)+t[o-1],c+=lookup[n>>10],c+=lookup[n>>4&63],c+=lookup[n<<2&63],c+="="),d.push(c),d.join("")}function read(t,n,o,s,c){var d,h,p=c*8-s-1,y=(1<<p)-1,S=y>>1,P=-7,L=o?c-1:0,F=o?-1:1,N=t[n+L];for(L+=F,d=N&(1<<-P)-1,N>>=-P,P+=p;P>0;d=d*256+t[n+L],L+=F,P-=8);for(h=d&(1<<-P)-1,d>>=-P,P+=s;P>0;h=h*256+t[n+L],L+=F,P-=8);if(d===0)d=1-S;else{if(d===y)return h?NaN:(N?-1:1)*(1/0);h=h+Math.pow(2,s),d=d-S}return(N?-1:1)*h*Math.pow(2,d-s)}function write(t,n,o,s,c,d){var h,p,y,S=d*8-c-1,P=(1<<S)-1,L=P>>1,F=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,N=s?0:d-1,W=s?1:-1,z=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(p=isNaN(n)?1:0,h=P):(h=Math.floor(Math.log(n)/Math.LN2),n*(y=Math.pow(2,-h))<1&&(h--,y*=2),h+L>=1?n+=F/y:n+=F*Math.pow(2,1-L),n*y>=2&&(h++,y/=2),h+L>=P?(p=0,h=P):h+L>=1?(p=(n*y-1)*Math.pow(2,c),h=h+L):(p=n*Math.pow(2,L-1)*Math.pow(2,c),h=0));c>=8;t[o+N]=p&255,N+=W,p/=256,c-=8);for(h=h<<c|p,S+=c;S>0;t[o+N]=h&255,N+=W,h/=256,S-=8);t[o+N-W]|=z*128}var toString={}.toString,isArray$1=Array.isArray||function(t){return toString.call(t)=="[object Array]"},INSPECT_MAX_BYTES=50;Buffer$1.TYPED_ARRAY_SUPPORT=global$1.TYPED_ARRAY_SUPPORT!==void 0?global$1.TYPED_ARRAY_SUPPORT:!0,kMaxLength();function kMaxLength(){return Buffer$1.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(t,n){if(kMaxLength()<n)throw new RangeError("Invalid typed array length");return Buffer$1.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(n),t.__proto__=Buffer$1.prototype):(t===null&&(t=new Buffer$1(n)),t.length=n),t}function Buffer$1(t,n,o){if(!Buffer$1.TYPED_ARRAY_SUPPORT&&!(this instanceof Buffer$1))return new Buffer$1(t,n,o);if(typeof t=="number"){if(typeof n=="string")throw new Error("If encoding is specified then the first argument must be a string");return allocUnsafe(this,t)}return from(this,t,n,o)}Buffer$1.poolSize=8192,Buffer$1._augment=function(t){return t.__proto__=Buffer$1.prototype,t};function from(t,n,o,s){if(typeof n=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&n instanceof ArrayBuffer?fromArrayBuffer(t,n,o,s):typeof n=="string"?fromString(t,n,o):fromObject(t,n)}Buffer$1.from=function(t,n,o){return from(null,t,n,o)},Buffer$1.TYPED_ARRAY_SUPPORT&&(Buffer$1.prototype.__proto__=Uint8Array.prototype,Buffer$1.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&Buffer$1[Symbol.species]);function assertSize(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function alloc(t,n,o,s){return assertSize(n),n<=0?createBuffer(t,n):o!==void 0?typeof s=="string"?createBuffer(t,n).fill(o,s):createBuffer(t,n).fill(o):createBuffer(t,n)}Buffer$1.alloc=function(t,n,o){return alloc(null,t,n,o)};function allocUnsafe(t,n){if(assertSize(n),t=createBuffer(t,n<0?0:checked(n)|0),!Buffer$1.TYPED_ARRAY_SUPPORT)for(var o=0;o<n;++o)t[o]=0;return t}Buffer$1.allocUnsafe=function(t){return allocUnsafe(null,t)},Buffer$1.allocUnsafeSlow=function(t){return allocUnsafe(null,t)};function fromString(t,n,o){if((typeof o!="string"||o==="")&&(o="utf8"),!Buffer$1.isEncoding(o))throw new TypeError('"encoding" must be a valid string encoding');var s=byteLength(n,o)|0;t=createBuffer(t,s);var c=t.write(n,o);return c!==s&&(t=t.slice(0,c)),t}function fromArrayLike(t,n){var o=n.length<0?0:checked(n.length)|0;t=createBuffer(t,o);for(var s=0;s<o;s+=1)t[s]=n[s]&255;return t}function fromArrayBuffer(t,n,o,s){if(n.byteLength,o<0||n.byteLength<o)throw new RangeError("'offset' is out of bounds");if(n.byteLength<o+(s||0))throw new RangeError("'length' is out of bounds");return o===void 0&&s===void 0?n=new Uint8Array(n):s===void 0?n=new Uint8Array(n,o):n=new Uint8Array(n,o,s),Buffer$1.TYPED_ARRAY_SUPPORT?(t=n,t.__proto__=Buffer$1.prototype):t=fromArrayLike(t,n),t}function fromObject(t,n){if(internalIsBuffer(n)){var o=checked(n.length)|0;return t=createBuffer(t,o),t.length===0||n.copy(t,0,0,o),t}if(n){if(typeof ArrayBuffer<"u"&&n.buffer instanceof ArrayBuffer||"length"in n)return typeof n.length!="number"||isnan(n.length)?createBuffer(t,0):fromArrayLike(t,n);if(n.type==="Buffer"&&isArray$1(n.data))return fromArrayLike(t,n.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function checked(t){if(t>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return t|0}Buffer$1.isBuffer=isBuffer;function internalIsBuffer(t){return!!(t!=null&&t._isBuffer)}Buffer$1.compare=function t(n,o){if(!internalIsBuffer(n)||!internalIsBuffer(o))throw new TypeError("Arguments must be Buffers");if(n===o)return 0;for(var s=n.length,c=o.length,d=0,h=Math.min(s,c);d<h;++d)if(n[d]!==o[d]){s=n[d],c=o[d];break}return s<c?-1:c<s?1:0},Buffer$1.isEncoding=function t(n){switch(String(n).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer$1.concat=function t(n,o){if(!isArray$1(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return Buffer$1.alloc(0);var s;if(o===void 0)for(o=0,s=0;s<n.length;++s)o+=n[s].length;var c=Buffer$1.allocUnsafe(o),d=0;for(s=0;s<n.length;++s){var h=n[s];if(!internalIsBuffer(h))throw new TypeError('"list" argument must be an Array of Buffers');h.copy(c,d),d+=h.length}return c};function byteLength(t,n){if(internalIsBuffer(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var o=t.length;if(o===0)return 0;for(var s=!1;;)switch(n){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":case void 0:return utf8ToBytes(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return base64ToBytes(t).length;default:if(s)return utf8ToBytes(t).length;n=(""+n).toLowerCase(),s=!0}}Buffer$1.byteLength=byteLength;function slowToString(t,n,o){var s=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,n>>>=0,o<=n))return"";for(t||(t="utf8");;)switch(t){case"hex":return hexSlice(this,n,o);case"utf8":case"utf-8":return utf8Slice(this,n,o);case"ascii":return asciiSlice(this,n,o);case"latin1":case"binary":return latin1Slice(this,n,o);case"base64":return base64Slice(this,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,n,o);default:if(s)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),s=!0}}Buffer$1.prototype._isBuffer=!0;function swap(t,n,o){var s=t[n];t[n]=t[o],t[o]=s}Buffer$1.prototype.swap16=function t(){var n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var o=0;o<n;o+=2)swap(this,o,o+1);return this},Buffer$1.prototype.swap32=function t(){var n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var o=0;o<n;o+=4)swap(this,o,o+3),swap(this,o+1,o+2);return this},Buffer$1.prototype.swap64=function t(){var n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var o=0;o<n;o+=8)swap(this,o,o+7),swap(this,o+1,o+6),swap(this,o+2,o+5),swap(this,o+3,o+4);return this},Buffer$1.prototype.toString=function t(){var n=this.length|0;return n===0?"":arguments.length===0?utf8Slice(this,0,n):slowToString.apply(this,arguments)},Buffer$1.prototype.equals=function t(n){if(!internalIsBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:Buffer$1.compare(this,n)===0},Buffer$1.prototype.inspect=function t(){var n="",o=INSPECT_MAX_BYTES;return this.length>0&&(n=this.toString("hex",0,o).match(/.{2}/g).join(" "),this.length>o&&(n+=" ... ")),"<Buffer "+n+">"},Buffer$1.prototype.compare=function t(n,o,s,c,d){if(!internalIsBuffer(n))throw new TypeError("Argument must be a Buffer");if(o===void 0&&(o=0),s===void 0&&(s=n?n.length:0),c===void 0&&(c=0),d===void 0&&(d=this.length),o<0||s>n.length||c<0||d>this.length)throw new RangeError("out of range index");if(c>=d&&o>=s)return 0;if(c>=d)return-1;if(o>=s)return 1;if(o>>>=0,s>>>=0,c>>>=0,d>>>=0,this===n)return 0;for(var h=d-c,p=s-o,y=Math.min(h,p),S=this.slice(c,d),P=n.slice(o,s),L=0;L<y;++L)if(S[L]!==P[L]){h=S[L],p=P[L];break}return h<p?-1:p<h?1:0};function bidirectionalIndexOf(t,n,o,s,c){if(t.length===0)return-1;if(typeof o=="string"?(s=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,isNaN(o)&&(o=c?0:t.length-1),o<0&&(o=t.length+o),o>=t.length){if(c)return-1;o=t.length-1}else if(o<0)if(c)o=0;else return-1;if(typeof n=="string"&&(n=Buffer$1.from(n,s)),internalIsBuffer(n))return n.length===0?-1:arrayIndexOf(t,n,o,s,c);if(typeof n=="number")return n=n&255,Buffer$1.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?c?Uint8Array.prototype.indexOf.call(t,n,o):Uint8Array.prototype.lastIndexOf.call(t,n,o):arrayIndexOf(t,[n],o,s,c);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(t,n,o,s,c){var d=1,h=t.length,p=n.length;if(s!==void 0&&(s=String(s).toLowerCase(),s==="ucs2"||s==="ucs-2"||s==="utf16le"||s==="utf-16le")){if(t.length<2||n.length<2)return-1;d=2,h/=2,p/=2,o/=2}function y(N,W){return d===1?N[W]:N.readUInt16BE(W*d)}var S;if(c){var P=-1;for(S=o;S<h;S++)if(y(t,S)===y(n,P===-1?0:S-P)){if(P===-1&&(P=S),S-P+1===p)return P*d}else P!==-1&&(S-=S-P),P=-1}else for(o+p>h&&(o=h-p),S=o;S>=0;S--){for(var L=!0,F=0;F<p;F++)if(y(t,S+F)!==y(n,F)){L=!1;break}if(L)return S}return-1}Buffer$1.prototype.includes=function t(n,o,s){return this.indexOf(n,o,s)!==-1},Buffer$1.prototype.indexOf=function t(n,o,s){return bidirectionalIndexOf(this,n,o,s,!0)},Buffer$1.prototype.lastIndexOf=function t(n,o,s){return bidirectionalIndexOf(this,n,o,s,!1)};function hexWrite(t,n,o,s){o=Number(o)||0;var c=t.length-o;s?(s=Number(s),s>c&&(s=c)):s=c;var d=n.length;if(d%2!==0)throw new TypeError("Invalid hex string");s>d/2&&(s=d/2);for(var h=0;h<s;++h){var p=parseInt(n.substr(h*2,2),16);if(isNaN(p))return h;t[o+h]=p}return h}function utf8Write(t,n,o,s){return blitBuffer(utf8ToBytes(n,t.length-o),t,o,s)}function asciiWrite(t,n,o,s){return blitBuffer(asciiToBytes(n),t,o,s)}function latin1Write(t,n,o,s){return asciiWrite(t,n,o,s)}function base64Write(t,n,o,s){return blitBuffer(base64ToBytes(n),t,o,s)}function ucs2Write(t,n,o,s){return blitBuffer(utf16leToBytes(n,t.length-o),t,o,s)}Buffer$1.prototype.write=function t(n,o,s,c){if(o===void 0)c="utf8",s=this.length,o=0;else if(s===void 0&&typeof o=="string")c=o,s=this.length,o=0;else if(isFinite(o))o=o|0,isFinite(s)?(s=s|0,c===void 0&&(c="utf8")):(c=s,s=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var d=this.length-o;if((s===void 0||s>d)&&(s=d),n.length>0&&(s<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");c||(c="utf8");for(var h=!1;;)switch(c){case"hex":return hexWrite(this,n,o,s);case"utf8":case"utf-8":return utf8Write(this,n,o,s);case"ascii":return asciiWrite(this,n,o,s);case"latin1":case"binary":return latin1Write(this,n,o,s);case"base64":return base64Write(this,n,o,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,n,o,s);default:if(h)throw new TypeError("Unknown encoding: "+c);c=(""+c).toLowerCase(),h=!0}},Buffer$1.prototype.toJSON=function t(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(t,n,o){return n===0&&o===t.length?fromByteArray(t):fromByteArray(t.slice(n,o))}function utf8Slice(t,n,o){o=Math.min(t.length,o);for(var s=[],c=n;c<o;){var d=t[c],h=null,p=d>239?4:d>223?3:d>191?2:1;if(c+p<=o){var y,S,P,L;switch(p){case 1:d<128&&(h=d);break;case 2:y=t[c+1],(y&192)===128&&(L=(d&31)<<6|y&63,L>127&&(h=L));break;case 3:y=t[c+1],S=t[c+2],(y&192)===128&&(S&192)===128&&(L=(d&15)<<12|(y&63)<<6|S&63,L>2047&&(L<55296||L>57343)&&(h=L));break;case 4:y=t[c+1],S=t[c+2],P=t[c+3],(y&192)===128&&(S&192)===128&&(P&192)===128&&(L=(d&15)<<18|(y&63)<<12|(S&63)<<6|P&63,L>65535&&L<1114112&&(h=L))}}h===null?(h=65533,p=1):h>65535&&(h-=65536,s.push(h>>>10&1023|55296),h=56320|h&1023),s.push(h),c+=p}return decodeCodePointsArray(s)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(t){var n=t.length;if(n<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,t);for(var o="",s=0;s<n;)o+=String.fromCharCode.apply(String,t.slice(s,s+=MAX_ARGUMENTS_LENGTH));return o}function asciiSlice(t,n,o){var s="";o=Math.min(t.length,o);for(var c=n;c<o;++c)s+=String.fromCharCode(t[c]&127);return s}function latin1Slice(t,n,o){var s="";o=Math.min(t.length,o);for(var c=n;c<o;++c)s+=String.fromCharCode(t[c]);return s}function hexSlice(t,n,o){var s=t.length;(!n||n<0)&&(n=0),(!o||o<0||o>s)&&(o=s);for(var c="",d=n;d<o;++d)c+=toHex(t[d]);return c}function utf16leSlice(t,n,o){for(var s=t.slice(n,o),c="",d=0;d<s.length;d+=2)c+=String.fromCharCode(s[d]+s[d+1]*256);return c}Buffer$1.prototype.slice=function t(n,o){var s=this.length;n=~~n,o=o===void 0?s:~~o,n<0?(n+=s,n<0&&(n=0)):n>s&&(n=s),o<0?(o+=s,o<0&&(o=0)):o>s&&(o=s),o<n&&(o=n);var c;if(Buffer$1.TYPED_ARRAY_SUPPORT)c=this.subarray(n,o),c.__proto__=Buffer$1.prototype;else{var d=o-n;c=new Buffer$1(d,void 0);for(var h=0;h<d;++h)c[h]=this[h+n]}return c};function checkOffset(t,n,o){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+n>o)throw new RangeError("Trying to access beyond buffer length")}Buffer$1.prototype.readUIntLE=function t(n,o,s){n=n|0,o=o|0,s||checkOffset(n,o,this.length);for(var c=this[n],d=1,h=0;++h<o&&(d*=256);)c+=this[n+h]*d;return c},Buffer$1.prototype.readUIntBE=function t(n,o,s){n=n|0,o=o|0,s||checkOffset(n,o,this.length);for(var c=this[n+--o],d=1;o>0&&(d*=256);)c+=this[n+--o]*d;return c},Buffer$1.prototype.readUInt8=function t(n,o){return o||checkOffset(n,1,this.length),this[n]},Buffer$1.prototype.readUInt16LE=function t(n,o){return o||checkOffset(n,2,this.length),this[n]|this[n+1]<<8},Buffer$1.prototype.readUInt16BE=function t(n,o){return o||checkOffset(n,2,this.length),this[n]<<8|this[n+1]},Buffer$1.prototype.readUInt32LE=function t(n,o){return o||checkOffset(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},Buffer$1.prototype.readUInt32BE=function t(n,o){return o||checkOffset(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},Buffer$1.prototype.readIntLE=function t(n,o,s){n=n|0,o=o|0,s||checkOffset(n,o,this.length);for(var c=this[n],d=1,h=0;++h<o&&(d*=256);)c+=this[n+h]*d;return d*=128,c>=d&&(c-=Math.pow(2,8*o)),c},Buffer$1.prototype.readIntBE=function t(n,o,s){n=n|0,o=o|0,s||checkOffset(n,o,this.length);for(var c=o,d=1,h=this[n+--c];c>0&&(d*=256);)h+=this[n+--c]*d;return d*=128,h>=d&&(h-=Math.pow(2,8*o)),h},Buffer$1.prototype.readInt8=function t(n,o){return o||checkOffset(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},Buffer$1.prototype.readInt16LE=function t(n,o){o||checkOffset(n,2,this.length);var s=this[n]|this[n+1]<<8;return s&32768?s|4294901760:s},Buffer$1.prototype.readInt16BE=function t(n,o){o||checkOffset(n,2,this.length);var s=this[n+1]|this[n]<<8;return s&32768?s|4294901760:s},Buffer$1.prototype.readInt32LE=function t(n,o){return o||checkOffset(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},Buffer$1.prototype.readInt32BE=function t(n,o){return o||checkOffset(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},Buffer$1.prototype.readFloatLE=function t(n,o){return o||checkOffset(n,4,this.length),read(this,n,!0,23,4)},Buffer$1.prototype.readFloatBE=function t(n,o){return o||checkOffset(n,4,this.length),read(this,n,!1,23,4)},Buffer$1.prototype.readDoubleLE=function t(n,o){return o||checkOffset(n,8,this.length),read(this,n,!0,52,8)},Buffer$1.prototype.readDoubleBE=function t(n,o){return o||checkOffset(n,8,this.length),read(this,n,!1,52,8)};function checkInt(t,n,o,s,c,d){if(!internalIsBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>c||n<d)throw new RangeError('"value" argument is out of bounds');if(o+s>t.length)throw new RangeError("Index out of range")}Buffer$1.prototype.writeUIntLE=function t(n,o,s,c){if(n=+n,o=o|0,s=s|0,!c){var d=Math.pow(2,8*s)-1;checkInt(this,n,o,s,d,0)}var h=1,p=0;for(this[o]=n&255;++p<s&&(h*=256);)this[o+p]=n/h&255;return o+s},Buffer$1.prototype.writeUIntBE=function t(n,o,s,c){if(n=+n,o=o|0,s=s|0,!c){var d=Math.pow(2,8*s)-1;checkInt(this,n,o,s,d,0)}var h=s-1,p=1;for(this[o+h]=n&255;--h>=0&&(p*=256);)this[o+h]=n/p&255;return o+s},Buffer$1.prototype.writeUInt8=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,1,255,0),Buffer$1.TYPED_ARRAY_SUPPORT||(n=Math.floor(n)),this[o]=n&255,o+1};function objectWriteUInt16(t,n,o,s){n<0&&(n=65535+n+1);for(var c=0,d=Math.min(t.length-o,2);c<d;++c)t[o+c]=(n&255<<8*(s?c:1-c))>>>(s?c:1-c)*8}Buffer$1.prototype.writeUInt16LE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n&255,this[o+1]=n>>>8):objectWriteUInt16(this,n,o,!0),o+2},Buffer$1.prototype.writeUInt16BE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n>>>8,this[o+1]=n&255):objectWriteUInt16(this,n,o,!1),o+2};function objectWriteUInt32(t,n,o,s){n<0&&(n=4294967295+n+1);for(var c=0,d=Math.min(t.length-o,4);c<d;++c)t[o+c]=n>>>(s?c:3-c)*8&255}Buffer$1.prototype.writeUInt32LE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o+3]=n>>>24,this[o+2]=n>>>16,this[o+1]=n>>>8,this[o]=n&255):objectWriteUInt32(this,n,o,!0),o+4},Buffer$1.prototype.writeUInt32BE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255):objectWriteUInt32(this,n,o,!1),o+4},Buffer$1.prototype.writeIntLE=function t(n,o,s,c){if(n=+n,o=o|0,!c){var d=Math.pow(2,8*s-1);checkInt(this,n,o,s,d-1,-d)}var h=0,p=1,y=0;for(this[o]=n&255;++h<s&&(p*=256);)n<0&&y===0&&this[o+h-1]!==0&&(y=1),this[o+h]=(n/p>>0)-y&255;return o+s},Buffer$1.prototype.writeIntBE=function t(n,o,s,c){if(n=+n,o=o|0,!c){var d=Math.pow(2,8*s-1);checkInt(this,n,o,s,d-1,-d)}var h=s-1,p=1,y=0;for(this[o+h]=n&255;--h>=0&&(p*=256);)n<0&&y===0&&this[o+h+1]!==0&&(y=1),this[o+h]=(n/p>>0)-y&255;return o+s},Buffer$1.prototype.writeInt8=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,1,127,-128),Buffer$1.TYPED_ARRAY_SUPPORT||(n=Math.floor(n)),n<0&&(n=255+n+1),this[o]=n&255,o+1},Buffer$1.prototype.writeInt16LE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n&255,this[o+1]=n>>>8):objectWriteUInt16(this,n,o,!0),o+2},Buffer$1.prototype.writeInt16BE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n>>>8,this[o+1]=n&255):objectWriteUInt16(this,n,o,!1),o+2},Buffer$1.prototype.writeInt32LE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,4,2147483647,-2147483648),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n&255,this[o+1]=n>>>8,this[o+2]=n>>>16,this[o+3]=n>>>24):objectWriteUInt32(this,n,o,!0),o+4},Buffer$1.prototype.writeInt32BE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255):objectWriteUInt32(this,n,o,!1),o+4};function checkIEEE754(t,n,o,s,c,d){if(o+s>t.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function writeFloat(t,n,o,s,c){return c||checkIEEE754(t,n,o,4),write(t,n,o,s,23,4),o+4}Buffer$1.prototype.writeFloatLE=function t(n,o,s){return writeFloat(this,n,o,!0,s)},Buffer$1.prototype.writeFloatBE=function t(n,o,s){return writeFloat(this,n,o,!1,s)};function writeDouble(t,n,o,s,c){return c||checkIEEE754(t,n,o,8),write(t,n,o,s,52,8),o+8}Buffer$1.prototype.writeDoubleLE=function t(n,o,s){return writeDouble(this,n,o,!0,s)},Buffer$1.prototype.writeDoubleBE=function t(n,o,s){return writeDouble(this,n,o,!1,s)},Buffer$1.prototype.copy=function t(n,o,s,c){if(s||(s=0),!c&&c!==0&&(c=this.length),o>=n.length&&(o=n.length),o||(o=0),c>0&&c<s&&(c=s),c===s||n.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(s<0||s>=this.length)throw new RangeError("sourceStart out of bounds");if(c<0)throw new RangeError("sourceEnd out of bounds");c>this.length&&(c=this.length),n.length-o<c-s&&(c=n.length-o+s);var d=c-s,h;if(this===n&&s<o&&o<c)for(h=d-1;h>=0;--h)n[h+o]=this[h+s];else if(d<1e3||!Buffer$1.TYPED_ARRAY_SUPPORT)for(h=0;h<d;++h)n[h+o]=this[h+s];else Uint8Array.prototype.set.call(n,this.subarray(s,s+d),o);return d},Buffer$1.prototype.fill=function t(n,o,s,c){if(typeof n=="string"){if(typeof o=="string"?(c=o,o=0,s=this.length):typeof s=="string"&&(c=s,s=this.length),n.length===1){var d=n.charCodeAt(0);d<256&&(n=d)}if(c!==void 0&&typeof c!="string")throw new TypeError("encoding must be a string");if(typeof c=="string"&&!Buffer$1.isEncoding(c))throw new TypeError("Unknown encoding: "+c)}else typeof n=="number"&&(n=n&255);if(o<0||this.length<o||this.length<s)throw new RangeError("Out of range index");if(s<=o)return this;o=o>>>0,s=s===void 0?this.length:s>>>0,n||(n=0);var h;if(typeof n=="number")for(h=o;h<s;++h)this[h]=n;else{var p=internalIsBuffer(n)?n:utf8ToBytes(new Buffer$1(n,c).toString()),y=p.length;for(h=0;h<s-o;++h)this[h+o]=p[h%y]}return this};var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g;function base64clean(t){if(t=stringtrim(t).replace(INVALID_BASE64_RE,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function stringtrim(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function toHex(t){return t<16?"0"+t.toString(16):t.toString(16)}function utf8ToBytes(t,n){n=n||1/0;for(var o,s=t.length,c=null,d=[],h=0;h<s;++h){if(o=t.charCodeAt(h),o>55295&&o<57344){if(!c){if(o>56319){(n-=3)>-1&&d.push(239,191,189);continue}else if(h+1===s){(n-=3)>-1&&d.push(239,191,189);continue}c=o;continue}if(o<56320){(n-=3)>-1&&d.push(239,191,189),c=o;continue}o=(c-55296<<10|o-56320)+65536}else c&&(n-=3)>-1&&d.push(239,191,189);if(c=null,o<128){if((n-=1)<0)break;d.push(o)}else if(o<2048){if((n-=2)<0)break;d.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;d.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;d.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return d}function asciiToBytes(t){for(var n=[],o=0;o<t.length;++o)n.push(t.charCodeAt(o)&255);return n}function utf16leToBytes(t,n){for(var o,s,c,d=[],h=0;h<t.length&&!((n-=2)<0);++h)o=t.charCodeAt(h),s=o>>8,c=o%256,d.push(c),d.push(s);return d}function base64ToBytes(t){return toByteArray(base64clean(t))}function blitBuffer(t,n,o,s){for(var c=0;c<s&&!(c+o>=n.length||c>=t.length);++c)n[c+o]=t[c];return c}function isnan(t){return t!==t}function isBuffer(t){return t!=null&&(!!t._isBuffer||isFastBuffer(t)||isSlowBuffer(t))}function isFastBuffer(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function isSlowBuffer(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&isFastBuffer(t.slice(0,0))}var domain;function EventHandlers(){}EventHandlers.prototype=Object.create(null);function EventEmitter(){EventEmitter.init.call(this)}EventEmitter.EventEmitter=EventEmitter,EventEmitter.usingDomains=!1,EventEmitter.prototype.domain=void 0,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.init=function(){this.domain=null,EventEmitter.usingDomains&&domain.active,(!this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=new EventHandlers,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},EventEmitter.prototype.setMaxListeners=function t(n){if(typeof n!="number"||n<0||isNaN(n))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=n,this};function $getMaxListeners(t){return t._maxListeners===void 0?EventEmitter.defaultMaxListeners:t._maxListeners}EventEmitter.prototype.getMaxListeners=function t(){return $getMaxListeners(this)};function emitNone(t,n,o){if(n)t.call(o);else for(var s=t.length,c=arrayClone(t,s),d=0;d<s;++d)c[d].call(o)}function emitOne(t,n,o,s){if(n)t.call(o,s);else for(var c=t.length,d=arrayClone(t,c),h=0;h<c;++h)d[h].call(o,s)}function emitTwo(t,n,o,s,c){if(n)t.call(o,s,c);else for(var d=t.length,h=arrayClone(t,d),p=0;p<d;++p)h[p].call(o,s,c)}function emitThree(t,n,o,s,c,d){if(n)t.call(o,s,c,d);else for(var h=t.length,p=arrayClone(t,h),y=0;y<h;++y)p[y].call(o,s,c,d)}function emitMany(t,n,o,s){if(n)t.apply(o,s);else for(var c=t.length,d=arrayClone(t,c),h=0;h<c;++h)d[h].apply(o,s)}EventEmitter.prototype.emit=function t(n){var o,s,c,d,h,p,y,S=n==="error";if(p=this._events,p)S=S&&p.error==null;else if(!S)return!1;if(y=this.domain,S){if(o=arguments[1],y)o||(o=new Error('Uncaught, unspecified "error" event')),o.domainEmitter=this,o.domain=y,o.domainThrown=!1,y.emit("error",o);else{if(o instanceof Error)throw o;var P=new Error('Uncaught, unspecified "error" event. ('+o+")");throw P.context=o,P}return!1}if(s=p[n],!s)return!1;var L=typeof s=="function";switch(c=arguments.length,c){case 1:emitNone(s,L,this);break;case 2:emitOne(s,L,this,arguments[1]);break;case 3:emitTwo(s,L,this,arguments[1],arguments[2]);break;case 4:emitThree(s,L,this,arguments[1],arguments[2],arguments[3]);break;default:for(d=new Array(c-1),h=1;h<c;h++)d[h-1]=arguments[h];emitMany(s,L,this,d)}return!0};function _addListener(t,n,o,s){var c,d,h;if(typeof o!="function")throw new TypeError('"listener" argument must be a function');if(d=t._events,d?(d.newListener&&(t.emit("newListener",n,o.listener?o.listener:o),d=t._events),h=d[n]):(d=t._events=new EventHandlers,t._eventsCount=0),!h)h=d[n]=o,++t._eventsCount;else if(typeof h=="function"?h=d[n]=s?[o,h]:[h,o]:s?h.unshift(o):h.push(o),!h.warned&&(c=$getMaxListeners(t),c&&c>0&&h.length>c)){h.warned=!0;var p=new Error("Possible EventEmitter memory leak detected. "+h.length+" "+n+" listeners added. Use emitter.setMaxListeners() to increase limit");p.name="MaxListenersExceededWarning",p.emitter=t,p.type=n,p.count=h.length,emitWarning(p)}return t}function emitWarning(t){typeof console.warn=="function"?console.warn(t):console.log(t)}EventEmitter.prototype.addListener=function t(n,o){return _addListener(this,n,o,!1)},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.prependListener=function t(n,o){return _addListener(this,n,o,!0)};function _onceWrap(t,n,o){var s=!1;function c(){t.removeListener(n,c),s||(s=!0,o.apply(t,arguments))}return c.listener=o,c}EventEmitter.prototype.once=function t(n,o){if(typeof o!="function")throw new TypeError('"listener" argument must be a function');return this.on(n,_onceWrap(this,n,o)),this},EventEmitter.prototype.prependOnceListener=function t(n,o){if(typeof o!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(n,_onceWrap(this,n,o)),this},EventEmitter.prototype.removeListener=function t(n,o){var s,c,d,h,p;if(typeof o!="function")throw new TypeError('"listener" argument must be a function');if(c=this._events,!c)return this;if(s=c[n],!s)return this;if(s===o||s.listener&&s.listener===o)--this._eventsCount===0?this._events=new EventHandlers:(delete c[n],c.removeListener&&this.emit("removeListener",n,s.listener||o));else if(typeof s!="function"){for(d=-1,h=s.length;h-- >0;)if(s[h]===o||s[h].listener&&s[h].listener===o){p=s[h].listener,d=h;break}if(d<0)return this;if(s.length===1){if(s[0]=void 0,--this._eventsCount===0)return this._events=new EventHandlers,this;delete c[n]}else spliceOne(s,d);c.removeListener&&this.emit("removeListener",n,p||o)}return this},EventEmitter.prototype.removeAllListeners=function t(n){var o,s;if(s=this._events,!s)return this;if(!s.removeListener)return arguments.length===0?(this._events=new EventHandlers,this._eventsCount=0):s[n]&&(--this._eventsCount===0?this._events=new EventHandlers:delete s[n]),this;if(arguments.length===0){for(var c=Object.keys(s),d=0,h;d<c.length;++d)h=c[d],h!=="removeListener"&&this.removeAllListeners(h);return this.removeAllListeners("removeListener"),this._events=new EventHandlers,this._eventsCount=0,this}if(o=s[n],typeof o=="function")this.removeListener(n,o);else if(o)do this.removeListener(n,o[o.length-1]);while(o[0]);return this},EventEmitter.prototype.listeners=function t(n){var o,s,c=this._events;return c?(o=c[n],o?typeof o=="function"?s=[o.listener||o]:s=unwrapListeners(o):s=[]):s=[],s},EventEmitter.listenerCount=function(t,n){return typeof t.listenerCount=="function"?t.listenerCount(n):listenerCount$1.call(t,n)},EventEmitter.prototype.listenerCount=listenerCount$1;function listenerCount$1(t){var n=this._events;if(n){var o=n[t];if(typeof o=="function")return 1;if(o)return o.length}return 0}EventEmitter.prototype.eventNames=function t(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function spliceOne(t,n){for(var o=n,s=o+1,c=t.length;s<c;o+=1,s+=1)t[o]=t[s];t.pop()}function arrayClone(t,n){for(var o=new Array(n);n--;)o[n]=t[n];return o}function unwrapListeners(t){for(var n=new Array(t.length),o=0;o<n.length;++o)n[o]=t[o].listener||t[o];return n}function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}var cachedSetTimeout=defaultSetTimout,cachedClearTimeout=defaultClearTimeout;typeof global$1.setTimeout=="function"&&(cachedSetTimeout=setTimeout),typeof global$1.clearTimeout=="function"&&(cachedClearTimeout=clearTimeout);function runTimeout(t){if(cachedSetTimeout===setTimeout)return setTimeout(t,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(t,0);try{return cachedSetTimeout(t,0)}catch{try{return cachedSetTimeout.call(null,t,0)}catch{return cachedSetTimeout.call(this,t,0)}}}function runClearTimeout(t){if(cachedClearTimeout===clearTimeout)return clearTimeout(t);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(t);try{return cachedClearTimeout(t)}catch{try{return cachedClearTimeout.call(null,t)}catch{return cachedClearTimeout.call(this,t)}}}var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){!draining||!currentQueue||(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var t=runTimeout(cleanUpNextTick);draining=!0;for(var n=queue.length;n;){for(currentQueue=queue,queue=[];++queueIndex<n;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,n=queue.length}currentQueue=null,draining=!1,runClearTimeout(t)}}function nextTick(t){var n=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)n[o-1]=arguments[o];queue.push(new Item(t,n)),queue.length===1&&!draining&&runTimeout(drainQueue)}function Item(t,n){this.fun=t,this.array=n}Item.prototype.run=function(){this.fun.apply(null,this.array)};var title="browser",platform="browser",browser=!0,env={},argv=[],version="",versions={},release={},config={};function noop(){}var on=noop,addListener=noop,once=noop,off=noop,removeListener=noop,removeAllListeners=noop,emit=noop;function binding(t){throw new Error("process.binding is not supported")}function cwd(){return"/"}function chdir(t){throw new Error("process.chdir is not supported")}function umask(){return 0}var performance$1=global$1.performance||{},performanceNow=performance$1.now||performance$1.mozNow||performance$1.msNow||performance$1.oNow||performance$1.webkitNow||function(){return new Date().getTime()};function hrtime(t){var n=performanceNow.call(performance$1)*.001,o=Math.floor(n),s=Math.floor(n%1*1e9);return t&&(o=o-t[0],s=s-t[1],s<0&&(o--,s+=1e9)),[o,s]}var startTime=new Date;function uptime(){var t=new Date,n=t-startTime;return n/1e3}var process$1={nextTick,title,browser,env,argv,version,versions,on,addListener,once,off,removeListener,removeAllListeners,emit,binding,cwd,chdir,umask,hrtime,platform,release,config,uptime},inherits;typeof Object.create=="function"?inherits=function(n,o){n.super_=o,n.prototype=Object.create(o.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}})}:inherits=function(n,o){n.super_=o;var s=function(){};s.prototype=o.prototype,n.prototype=new s,n.prototype.constructor=n};var inherits$1=inherits,formatRegExp=/%[sdj%]/g;function format(t){if(!isString(t)){for(var n=[],o=0;o<arguments.length;o++)n.push(inspect(arguments[o]));return n.join(" ")}for(var o=1,s=arguments,c=s.length,d=String(t).replace(formatRegExp,function(p){if(p==="%%")return"%";if(o>=c)return p;switch(p){case"%s":return String(s[o++]);case"%d":return Number(s[o++]);case"%j":try{return JSON.stringify(s[o++])}catch{return"[Circular]"}default:return p}}),h=s[o];o<c;h=s[++o])isNull(h)||!isObject(h)?d+=" "+h:d+=" "+inspect(h);return d}function deprecate(t,n){if(isUndefined(global$1.process))return function(){return deprecate(t,n).apply(this,arguments)};if(process$1.noDeprecation===!0)return t;var o=!1;function s(){if(!o){if(process$1.throwDeprecation)throw new Error(n);process$1.traceDeprecation?console.trace(n):console.error(n),o=!0}return t.apply(this,arguments)}return s}var debugs={},debugEnviron;function debuglog(t){if(isUndefined(debugEnviron)&&(debugEnviron=process$1.env.NODE_DEBUG||""),t=t.toUpperCase(),!debugs[t])if(new RegExp("\\b"+t+"\\b","i").test(debugEnviron)){var n=0;debugs[t]=function(){var o=format.apply(null,arguments);console.error("%s %d: %s",t,n,o)}}else debugs[t]=function(){};return debugs[t]}function inspect(t,n){var o={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(o.depth=arguments[2]),arguments.length>=4&&(o.colors=arguments[3]),isBoolean(n)?o.showHidden=n:n&&_extend(o,n),isUndefined(o.showHidden)&&(o.showHidden=!1),isUndefined(o.depth)&&(o.depth=2),isUndefined(o.colors)&&(o.colors=!1),isUndefined(o.customInspect)&&(o.customInspect=!0),o.colors&&(o.stylize=stylizeWithColor),formatValue(o,t,o.depth)}inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(t,n){var o=inspect.styles[n];return o?"\x1B["+inspect.colors[o][0]+"m"+t+"\x1B["+inspect.colors[o][1]+"m":t}function stylizeNoColor(t,n){return t}function arrayToHash(t){var n={};return t.forEach(function(o,s){n[o]=!0}),n}function formatValue(t,n,o){if(t.customInspect&&n&&isFunction(n.inspect)&&n.inspect!==inspect&&!(n.constructor&&n.constructor.prototype===n)){var s=n.inspect(o,t);return isString(s)||(s=formatValue(t,s,o)),s}var c=formatPrimitive(t,n);if(c)return c;var d=Object.keys(n),h=arrayToHash(d);if(t.showHidden&&(d=Object.getOwnPropertyNames(n)),isError(n)&&(d.indexOf("message")>=0||d.indexOf("description")>=0))return formatError(n);if(d.length===0){if(isFunction(n)){var p=n.name?": "+n.name:"";return t.stylize("[Function"+p+"]","special")}if(isRegExp(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(isDate(n))return t.stylize(Date.prototype.toString.call(n),"date");if(isError(n))return formatError(n)}var y="",S=!1,P=["{","}"];if(isArray(n)&&(S=!0,P=["[","]"]),isFunction(n)){var L=n.name?": "+n.name:"";y=" [Function"+L+"]"}if(isRegExp(n)&&(y=" "+RegExp.prototype.toString.call(n)),isDate(n)&&(y=" "+Date.prototype.toUTCString.call(n)),isError(n)&&(y=" "+formatError(n)),d.length===0&&(!S||n.length==0))return P[0]+y+P[1];if(o<0)return isRegExp(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special");t.seen.push(n);var F;return S?F=formatArray(t,n,o,h,d):F=d.map(function(N){return formatProperty(t,n,o,h,N,S)}),t.seen.pop(),reduceToSingleString(F,y,P)}function formatPrimitive(t,n){if(isUndefined(n))return t.stylize("undefined","undefined");if(isString(n)){var o="'"+JSON.stringify(n).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(o,"string")}if(isNumber(n))return t.stylize(""+n,"number");if(isBoolean(n))return t.stylize(""+n,"boolean");if(isNull(n))return t.stylize("null","null")}function formatError(t){return"["+Error.prototype.toString.call(t)+"]"}function formatArray(t,n,o,s,c){for(var d=[],h=0,p=n.length;h<p;++h)hasOwnProperty(n,String(h))?d.push(formatProperty(t,n,o,s,String(h),!0)):d.push("");return c.forEach(function(y){y.match(/^\d+$/)||d.push(formatProperty(t,n,o,s,y,!0))}),d}function formatProperty(t,n,o,s,c,d){var h,p,y;if(y=Object.getOwnPropertyDescriptor(n,c)||{value:n[c]},y.get?y.set?p=t.stylize("[Getter/Setter]","special"):p=t.stylize("[Getter]","special"):y.set&&(p=t.stylize("[Setter]","special")),hasOwnProperty(s,c)||(h="["+c+"]"),p||(t.seen.indexOf(y.value)<0?(isNull(o)?p=formatValue(t,y.value,null):p=formatValue(t,y.value,o-1),p.indexOf(`
|
|
6746
6746
|
`)>-1&&(d?p=p.split(`
|
|
6747
6747
|
`).map(function(S){return" "+S}).join(`
|
|
6748
6748
|
`).substr(2):p=`
|