@visio-io/design-system 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +3 -4
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -95,5 +95,5 @@ const theme2 = createTheme({ palette: {
|
|
|
95
95
|
${S}px !important;
|
|
96
96
|
${y}px !important;
|
|
97
97
|
}
|
|
98
|
-
`),()=>{T.contains(C)&&T.removeChild(C)}},[t]),g.jsx(B1,{isPresent:t,childRef:i,sizeRef:a,children:Fe.cloneElement(e,{ref:l})})}const z1=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:o,presenceAffectsLayout:s,mode:i,anchorX:a,anchorY:c,root:u})=>{const l=Es(W1),d=x.useId();let f=!0,p=x.useMemo(()=>(f=!1,{id:d,initial:t,isPresent:n,custom:o,onExitComplete:m=>{l.set(m,!0);for(const h of l.values())if(!h)return;r&&r()},register:m=>(l.set(m,!1),()=>l.delete(m))}),[n,l,r]);return s&&f&&(p={...p}),x.useMemo(()=>{l.forEach((m,h)=>l.set(h,!1))},[n]),Fe.useEffect(()=>{!n&&!l.size&&r&&r()},[n]),i==="popLayout"&&(e=g.jsx(F1,{isPresent:n,anchorX:a,anchorY:c,root:u,children:e})),g.jsx(Hr.Provider,{value:p,children:e})};function W1(){return new Map}function Iu(e=!0){const t=x.useContext(Hr);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=t,s=x.useId();x.useEffect(()=>{if(e)return o(s)},[e]);const i=x.useCallback(()=>e&&r&&r(s),[s,r,e]);return!n&&r?[!1,i]:[!0]}const tr=e=>e.key||"";function Za(e){const t=[];return x.Children.forEach(e,n=>{x.isValidElement(n)&&t.push(n)}),t}const U1=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:o=!0,mode:s="sync",propagate:i=!1,anchorX:a="left",anchorY:c="top",root:u})=>{const[l,d]=Iu(i),f=x.useMemo(()=>Za(e),[e]),p=i&&!l?[]:f.map(tr),m=x.useRef(!0),h=x.useRef(f),v=Es(()=>new Map),b=x.useRef(new Set),[S,y]=x.useState(f),[C,T]=x.useState(f);dl(()=>{m.current=!1,h.current=f;for(let A=0;A<C.length;A++){const M=tr(C[A]);p.includes(M)?(v.delete(M),b.current.delete(M)):v.get(M)!==!0&&v.set(M,!1)}},[C,p.length,p.join("-")]);const E=[];if(f!==S){let A=[...f];for(let M=0;M<C.length;M++){const L=C[M],$=tr(L);p.includes($)||(A.splice(M,0,L),E.push(L))}return s==="wait"&&E.length&&(A=E),T(Za(A)),y(f),null}process.env.NODE_ENV!=="production"&&s==="wait"&&C.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:P}=x.useContext(_s);return g.jsx(g.Fragment,{children:C.map(A=>{const M=tr(A),L=i&&!l?!1:f===C||p.includes(M),$=()=>{if(b.current.has(M))return;if(b.current.add(M),v.has(M))v.set(M,!0);else return;let W=!0;v.forEach(H=>{H||(W=!1)}),W&&(P==null||P(),T(h.current),i&&(d==null||d()),r&&r())};return g.jsx(z1,{isPresent:L,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:o,mode:s,root:u,onExitComplete:L?void 0:$,anchorX:a,anchorY:c,children:A},M)})})},ju=x.createContext({strict:!1}),Xa={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"]};let Ja=!1;function H1(){if(Ja)return;const e={};for(const t in Xa)e[t]={isEnabled:n=>Xa[t].some(r=>!!n[r])};lu(e),Ja=!0}function Lu(){return H1(),kv()}function G1(e){const t=Lu();for(const n in e)t[n]={...t[n],...e[n]};lu(t)}const K1=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 Pr(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||K1.has(e)}let Du=e=>!Pr(e);function Y1(e){typeof e=="function"&&(Du=t=>t.startsWith("on")?!Pr(t):e(t))}try{Y1(require("@emotion/is-prop-valid").default)}catch{}function q1(e,t,n){const r={};for(const o in e)o==="values"&&typeof e.values=="object"||(Du(o)||n===!0&&Pr(o)||!t&&!Pr(o)||e.draggable&&o.startsWith("onDrag"))&&(r[o]=e[o]);return r}const Yr=x.createContext({});function Z1(e,t){if(Kr(e)){const{initial:n,animate:r}=e;return{initial:n===!1||On(n)?n:void 0,animate:On(r)?r:void 0}}return e.inherit!==!1?t:{}}function X1(e){const{initial:t,animate:n}=Z1(e,x.useContext(Yr));return x.useMemo(()=>({initial:t,animate:n}),[Qa(t),Qa(n)])}function Qa(e){return Array.isArray(e)?e.join(" "):e}const ti=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function $u(e,t,n){for(const r in t)!Oe(t[r])&&!gu(r,n)&&(e[r]=t[r])}function J1({transformTemplate:e},t){return x.useMemo(()=>{const n=ti();return Js(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Q1(e,t){const n=e.style||{},r={};return $u(r,n,e),Object.assign(r,J1(e,t)),r}function eb(e,t){const n={},r=Q1(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const Vu=()=>({...ti(),attrs:{}});function tb(e,t,n,r){const o=x.useMemo(()=>{const s=Vu();return yu(s,t,bu(r),e.transformTemplate,e.style),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};$u(s,e.style,e),o.style={...s,...o.style}}return o}const nb=["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 ni(e){return typeof e!="string"||e.includes("-")?!1:!!(nb.indexOf(e)>-1||/[A-Z]/u.test(e))}function rb(e,t,n,{latestValues:r},o,s=!1,i){const c=(i??ni(e)?tb:eb)(t,r,o,e),u=q1(t,typeof e=="string",s),l=e!==x.Fragment?{...u,...c,ref:n}:{},{children:d}=t,f=x.useMemo(()=>Oe(d)?d.get():d,[d]);return x.createElement(e,{...l,children:f})}function ob({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,o){return{latestValues:sb(n,r,o,e),renderState:t()}}function sb(e,t,n,r){const o={},s=r(e,{});for(const f in s)o[f]=fr(s[f]);let{initial:i,animate:a}=e;const c=Kr(e),u=cu(e);t&&u&&!c&&e.inherit!==!1&&(i===void 0&&(i=t.initial),a===void 0&&(a=t.animate));let l=n?n.initial===!1:!1;l=l||i===!1;const d=l?a:i;if(d&&typeof d!="boolean"&&!Gr(d)){const f=Array.isArray(d)?d:[d];for(let p=0;p<f.length;p++){const m=Hs(e,f[p]);if(m){const{transitionEnd:h,transition:v,...b}=m;for(const S in b){let y=b[S];if(Array.isArray(y)){const C=l?y.length-1:0;y=y[C]}y!==null&&(o[S]=y)}for(const S in h)o[S]=h[S]}}}return o}const Nu=e=>(t,n)=>{const r=x.useContext(Yr),o=x.useContext(Hr),s=()=>ob(e,t,r,o);return n?s():Es(s)},ib=Nu({scrapeMotionValuesFromProps:Qs,createRenderState:ti}),ab=Nu({scrapeMotionValuesFromProps:xu,createRenderState:Vu}),cb=Symbol.for("motionComponentSymbol");function lb(e,t,n){const r=x.useRef(n);x.useInsertionEffect(()=>{r.current=n});const o=x.useRef(null);return x.useCallback(s=>{var a;s&&((a=e.onMount)==null||a.call(e,s)),t&&(s?t.mount(s):t.unmount());const i=r.current;if(typeof i=="function")if(s){const c=i(s);typeof c=="function"&&(o.current=c)}else o.current?(o.current(),o.current=null):i(s);else i&&(i.current=s)},[t])}const Bu=x.createContext({});function yn(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function ub(e,t,n,r,o,s){var b,S;const{visualElement:i}=x.useContext(Yr),a=x.useContext(ju),c=x.useContext(Hr),u=x.useContext(ei).reducedMotion,l=x.useRef(null),d=x.useRef(!1);r=r||a.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:i,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,isSVG:s}),d.current&&l.current&&(l.current.manuallyAnimateOnMount=!0));const f=l.current,p=x.useContext(Bu);f&&!f.projection&&o&&(f.type==="html"||f.type==="svg")&&db(l.current,n,o,p);const m=x.useRef(!1);x.useInsertionEffect(()=>{f&&m.current&&f.update(n,c)});const h=n[Yl],v=x.useRef(!!h&&!((b=window.MotionHandoffIsComplete)!=null&&b.call(window,h))&&((S=window.MotionHasOptimisedAnimation)==null?void 0:S.call(window,h)));return dl(()=>{d.current=!0,f&&(m.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),f.scheduleRenderMicrotask(),v.current&&f.animationState&&f.animationState.animateChanges())}),x.useEffect(()=>{f&&(!v.current&&f.animationState&&f.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)==null||y.call(window,h)}),v.current=!1),f.enteringChildren=void 0)}),f}function db(e,t,n,r){const{layoutId:o,layout:s,drag:i,dragConstraints:a,layoutScroll:c,layoutRoot:u,layoutCrossfade:l}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Fu(e.parent)),e.projection.setOptions({layoutId:o,layout:s,alwaysMeasureLayout:!!i||a&&yn(a),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:r,crossfade:l,layoutScroll:c,layoutRoot:u})}function Fu(e){if(e)return e.options.allowProjection!==!1?e.projection:Fu(e.parent)}function xo(e,{forwardMotionProps:t=!1,type:n}={},r,o){r&&G1(r);const s=n?n==="svg":ni(e),i=s?ab:ib;function a(u,l){let d;const f={...x.useContext(ei),...u,layoutId:fb(u)},{isStatic:p}=f,m=X1(u),h=i(u,p);if(!p&&ul){hb(f,r);const v=pb(f);d=v.MeasureLayout,m.visualElement=ub(e,h,f,o,v.ProjectionNode,s)}return g.jsxs(Yr.Provider,{value:m,children:[d&&m.visualElement?g.jsx(d,{visualElement:m.visualElement,...f}):null,rb(e,u,lb(h,m.visualElement,l),h,p,t,s)]})}a.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const c=x.forwardRef(a);return c[cb]=e,c}function fb({layoutId:e}){const t=x.useContext(_s).id;return t&&e!==void 0?t+"-"+e:e}function hb(e,t){const n=x.useContext(ju).strict;if(process.env.NODE_ENV!=="production"&&t&&n){const r="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?Qt(!1,r,"lazy-strict-mode"):lt(!1,r,"lazy-strict-mode")}}function pb(e){const t=Lu(),{drag:n,layout:r}=t;if(!n&&!r)return{};const o={...n,...r};return{MeasureLayout:n!=null&&n.isEnabled(e)||r!=null&&r.isEnabled(e)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}function mb(e,t){if(typeof Proxy>"u")return xo;const n=new Map,r=(s,i)=>xo(s,i,e,t),o=(s,i)=>(process.env.NODE_ENV!=="production"&&Rs(!1,"motion() is deprecated. Use motion.create() instead."),r(s,i));return new Proxy(o,{get:(s,i)=>i==="create"?r:(n.has(i)||n.set(i,xo(i,void 0,e,t)),n.get(i))})}const gb=(e,t)=>t.isSVG??ni(e)?new Kv(t):new Fv(t,{allowProjection:e!==x.Fragment});class yb extends wt{constructor(t){super(t),t.animationState||(t.animationState=Jv(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Gr(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let vb=0;class bb extends wt{constructor(){super(...arguments),this.id=vb++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const o=this.node.animationState.setActive("exit",!t);n&&!t&&o.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const xb={animation:{Feature:yb},exit:{Feature:bb}};function Wn(e){return{point:{x:e.pageX,y:e.pageY}}}const Sb=e=>t=>qs(t)&&e(t,Wn(t));function Cn(e,t,n,r){return In(e,t,Sb(n),r)}const zu=({current:e})=>e?e.ownerDocument.defaultView:null,ec=(e,t)=>Math.abs(e-t);function Tb(e,t){const n=ec(e.x,t.x),r=ec(e.y,t.y);return Math.sqrt(n**2+r**2)}const tc=new Set(["auto","scroll"]);class Wu{constructor(t,n,{transformPagePoint:r,contextWindow:o=window,dragSnapToOrigin:s=!1,distanceThreshold:i=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=p=>{this.handleScroll(p.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=To(this.lastMoveEventInfo,this.history),m=this.startEvent!==null,h=Tb(p.offset,{x:0,y:0})>=this.distanceThreshold;if(!m&&!h)return;const{point:v}=p,{timestamp:b}=Me;this.history.push({...v,timestamp:b});const{onStart:S,onMove:y}=this.handlers;m||(S&&S(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,p)},this.handlePointerMove=(p,m)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=So(m,this.transformPagePoint),le.update(this.updatePoint,!0)},this.handlePointerUp=(p,m)=>{this.end();const{onEnd:h,onSessionEnd:v,resumeAnimation:b}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const S=To(p.type==="pointercancel"?this.lastMoveEventInfo:So(m,this.transformPagePoint),this.history);this.startEvent&&h&&h(p,S),v&&v(p,S)},!qs(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=i,this.contextWindow=o||window;const c=Wn(t),u=So(c,this.transformPagePoint),{point:l}=u,{timestamp:d}=Me;this.history=[{...l,timestamp:d}];const{onSessionStart:f}=n;f&&f(t,To(u,this.history)),this.removeListeners=Bn(Cn(this.contextWindow,"pointermove",this.handlePointerMove),Cn(this.contextWindow,"pointerup",this.handlePointerUp),Cn(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(tc.has(r.overflowX)||tc.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,o=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},s={x:o.x-n.x,y:o.y-n.y};s.x===0&&s.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(t,o),le.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),vt(this.updatePoint)}}function So(e,t){return t?{point:t(e.point)}:e}function nc(e,t){return{x:e.x-t.x,y:e.y-t.y}}function To({point:e},t){return{point:e,delta:nc(e,Uu(t)),offset:nc(e,wb(t)),velocity:Cb(t,.1)}}function wb(e){return e[0]}function Uu(e){return e[e.length-1]}function Cb(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=Uu(e);for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>rt(t)));)n--;if(!r)return{x:0,y:0};const s=He(o.timestamp-r.timestamp);if(s===0)return{x:0,y:0};const i={x:(o.x-r.x)/s,y:(o.y-r.y)/s};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function _b(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?fe(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?fe(n,e,r.max):Math.min(e,n)),e}function rc(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function Eb(e,{top:t,left:n,bottom:r,right:o}){return{x:rc(e.x,n,o),y:rc(e.y,t,r)}}function oc(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function Pb(e,t){return{x:oc(e.x,t.x),y:oc(e.y,t.y)}}function Ab(e,t){let n=.5;const r=De(e),o=De(t);return o>r?n=Mn(t.min,t.max-r,e.min):r>o&&(n=Mn(e.min,e.max-o,t.min)),st(0,1,n)}function Mb(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const is=.35;function kb(e=is){return e===!1?e=0:e===!0&&(e=is),{x:sc(e,"left","right"),y:sc(e,"top","bottom")}}function sc(e,t,n){return{min:ic(e,t),max:ic(e,n)}}function ic(e,t){return typeof e=="number"?e:e[t]||0}const Rb=new WeakMap;class Ob{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ce(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const s=d=>{n?(this.stopAnimation(),this.snapToCursor(Wn(d).point)):this.pauseAnimation()},i=(d,f)=>{this.stopAnimation();const{drag:p,dragPropagation:m,onDragStart:h}=this.getProps();if(p&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=vv(p),!this.openDragLock))return;this.latestPointerEvent=d,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ze(b=>{let S=this.getAxisMotionValue(b).get()||0;if(ot.test(S)){const{projection:y}=this.visualElement;if(y&&y.layout){const C=y.layout.layoutBox[b];C&&(S=De(C)*(parseFloat(S)/100))}}this.originPoint[b]=S}),h&&le.postRender(()=>h(d,f)),Jo(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},a=(d,f)=>{this.latestPointerEvent=d,this.latestPanInfo=f;const{dragPropagation:p,dragDirectionLock:m,onDirectionLock:h,onDrag:v}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:b}=f;if(m&&this.currentDirection===null){this.currentDirection=Ib(b),this.currentDirection!==null&&h&&h(this.currentDirection);return}this.updateAxis("x",f.point,b),this.updateAxis("y",f.point,b),this.visualElement.render(),v&&v(d,f)},c=(d,f)=>{this.latestPointerEvent=d,this.latestPanInfo=f,this.stop(d,f),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>ze(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)==null?void 0:f.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new Wu(t,{onSessionStart:s,onStart:i,onMove:a,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:r,contextWindow:zu(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,o=n||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!o||!r)return;const{velocity:i}=o;this.startAnimation(i);const{onDragEnd:a}=this.getProps();a&&le.postRender(()=>a(r,o))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:o}=this.getProps();if(!r||!nr(t,o,this.currentDirection))return;const s=this.getAxisMotionValue(t);let i=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(i=_b(i,this.constraints[t],this.elastic[t])),s.set(i)}resolveConstraints(){var s;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)==null?void 0:s.layout,o=this.constraints;t&&yn(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=Eb(r.layoutBox,t):this.constraints=!1,this.elastic=kb(n),o!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&ze(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=Mb(r.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!yn(t))return!1;const r=t.current;lt(r!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const s=Lv(r,o.root,this.visualElement.getTransformPagePoint());let i=Pb(o.layout.layoutBox,s);if(n){const a=n(Ov(i));this.hasMutatedConstraints=!!a,a&&(i=du(a))}return i}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:o,dragTransition:s,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},u=ze(l=>{if(!nr(l,n,this.currentDirection))return;let d=c&&c[l]||{};i&&(d={min:0,max:0});const f=o?200:1e6,p=o?40:1e7,m={type:"inertia",velocity:r?t[l]:0,bounceStiffness:f,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...s,...d};return this.startAxisValueAnimation(l,m)});return Promise.all(u).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Jo(this.visualElement,t),r.start(Us(t,r,0,n,this.visualElement,!1))}stopAnimation(){ze(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){ze(t=>{var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),o=r[n];return o||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){ze(n=>{const{drag:r}=this.getProps();if(!nr(n,r,this.currentDirection))return;const{projection:o}=this.visualElement,s=this.getAxisMotionValue(n);if(o&&o.layout){const{min:i,max:a}=o.layout.layoutBox[n],c=s.get()||0;s.set(t[n]-fe(i,a,.5)+c)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!yn(n)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};ze(i=>{const a=this.getAxisMotionValue(i);if(a&&this.constraints!==!1){const c=a.get();o[i]=Ab({min:c,max:c},this.constraints[i])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),ze(i=>{if(!nr(i,t,null))return;const a=this.getAxisMotionValue(i),{min:c,max:u}=this.constraints[i];a.set(fe(c,u,o[i]))})}addListeners(){if(!this.visualElement.current)return;Rb.set(this.visualElement,this);const t=this.visualElement.current,n=Cn(t,"pointerdown",c=>{const{drag:u,dragListener:l=!0}=this.getProps(),d=c.target,f=d!==t&&su(d);u&&l&&!f&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();yn(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,s=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),le.read(r);const i=In(window,"resize",()=>this.scalePositionWithinConstraints()),a=o.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(ze(l=>{const d=this.getAxisMotionValue(l);d&&(this.originPoint[l]+=c[l].translate,d.set(d.get()+c[l].translate))}),this.visualElement.render())});return()=>{i(),n(),s(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:s=!1,dragElastic:i=is,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:o,dragConstraints:s,dragElastic:i,dragMomentum:a}}}function nr(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Ib(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class jb extends wt{constructor(t){super(t),this.removeGroupControls=Ge,this.removeListeners=Ge,this.controls=new Ob(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ge}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const ac=e=>(t,n)=>{e&&le.postRender(()=>e(t,n))};class Lb extends wt{constructor(){super(...arguments),this.removePointerDownListener=Ge}onPointerDown(t){this.session=new Wu(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:zu(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:ac(t),onStart:ac(n),onMove:r,onEnd:(s,i)=>{delete this.session,o&&le.postRender(()=>o(s,i))}}}mount(){this.removePointerDownListener=Cn(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let wo=!1;class Db extends x.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:o}=this.props,{projection:s}=t;s&&(n.group&&n.group.add(s),r&&r.register&&o&&r.register(s),wo&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),hr.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:o,isPresent:s}=this.props,{projection:i}=r;return i&&(i.isPresent=s,t.layoutDependency!==n&&i.setOptions({...i.options,layoutDependency:n}),wo=!0,o||t.layoutDependency!==n||n===void 0||t.isPresent!==s?i.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?i.promote():i.relegate()||le.postRender(()=>{const a=i.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Ys.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:o}=t;wo=!0,o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Hu(e){const[t,n]=Iu(),r=x.useContext(_s);return g.jsx(Db,{...e,layoutGroup:r,switchLayoutGroup:x.useContext(Bu),isPresent:t,safeToRemove:n})}const $b={pan:{Feature:Lb},drag:{Feature:jb,ProjectionNode:Ou,MeasureLayout:Hu}};function cc(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,s=r[o];s&&le.postRender(()=>s(t,Wn(t)))}class Vb extends wt{mount(){const{current:t}=this.node;t&&(this.unmount=bv(t,(n,r)=>(cc(this.node,r,"Start"),o=>cc(this.node,o,"End"))))}unmount(){}}class Nb extends wt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!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=Bn(In(this.node.current,"focus",()=>this.onFocus()),In(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function lc(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),s=r[o];s&&le.postRender(()=>s(t,Wn(t)))}class Bb extends wt{mount(){const{current:t}=this.node;t&&(this.unmount=Tv(t,(n,r)=>(lc(this.node,r,"Start"),(o,{success:s})=>lc(this.node,o,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const as=new WeakMap,Co=new WeakMap,Fb=e=>{const t=as.get(e.target);t&&t(e)},zb=e=>{e.forEach(Fb)};function Wb({root:e,...t}){const n=e||document;Co.has(n)||Co.set(n,{});const r=Co.get(n),o=JSON.stringify(t);return r[o]||(r[o]=new IntersectionObserver(zb,{root:e,...t})),r[o]}function Ub(e,t,n){const r=Wb(t);return as.set(e,n),r.observe(e),()=>{as.delete(e),r.unobserve(e)}}const Hb={some:0,all:1};class Gb extends wt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:o="some",once:s}=t,i={root:n?n.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:Hb[o]},a=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,s&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:l,onViewportLeave:d}=this.node.getProps(),f=u?l:d;f&&f(c)};return Ub(this.node.current,i,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(Kb(t,n))&&this.startObserver()}unmount(){}}function Kb({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Yb={inView:{Feature:Gb},tap:{Feature:Bb},focus:{Feature:Nb},hover:{Feature:Vb}},qb={layout:{ProjectionNode:Ou,MeasureLayout:Hu}},Zb={...xb,...Yb,...$b,...qb},vn=mb(Zb,gb),Gu="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0.75%203.1875C0.75%201.84104%201.84104%200.75%203.1875%200.75L5.625%200.75V2.25H3.1875C2.66946%202.25%202.25%202.66946%202.25%203.1875V5.625H0.75L0.75%203.1875Z'%20fill='%23FDFCFC'/%3e%3cpath%20d='M0.75%2014.8125L0.75%2012.375H2.25V14.8125C2.25%2015.3305%202.66946%2015.75%203.1875%2015.75H5.625V17.25H3.1875C1.84104%2017.25%200.75%2016.159%200.75%2014.8125Z'%20fill='%23FDFCFC'/%3e%3cpath%20d='M15.75%2014.8125V12.375H17.25V14.8125C17.25%2016.159%2016.159%2017.25%2014.8125%2017.25H12.375V15.75H14.8125C15.3305%2015.75%2015.75%2015.3305%2015.75%2014.8125Z'%20fill='%23FDFCFC'/%3e%3cpath%20d='M15.75%203.1875C15.75%202.66946%2015.3305%202.25%2014.8125%202.25H12.375V0.75L14.8125%200.75C16.159%200.75%2017.25%201.84104%2017.25%203.1875V5.625H15.75V3.1875Z'%20fill='%23FDFCFC'/%3e%3cpath%20d='M10.8889%2010.5C11.6372%2010.5%2012.3895%2010.6845%2012.991%2011.053L12.9902%2011.0537C13.3468%2011.2719%2013.6565%2011.5584%2013.8684%2011.9092L14.5298%2013.0049L13.2451%2013.7798L12.5845%2012.6841C12.5191%2012.576%2012.3992%2012.4499%2012.2073%2012.3325C11.8787%2012.1312%2011.4076%2012%2010.8889%2012H7.11108C6.59216%2012%206.1214%2012.1305%205.79199%2012.3318L5.79272%2012.3325C5.64854%2012.4207%205.54509%2012.5138%205.47485%2012.6006L5.41553%2012.6841L4.75488%2013.7798L3.47021%2013.0049L4.13086%2011.9092C4.34281%2011.5583%204.6531%2011.2712%205.00977%2011.053C5.6104%2010.6859%206.36112%2010.5%207.11108%2010.5H10.8889Z'%20fill='%23FDFCFC'/%3e%3cpath%20d='M10.5%206.75C10.5%205.92157%209.82843%205.25%209%205.25C8.17157%205.25%207.5%205.92157%207.5%206.75C7.5%207.57843%208.17157%208.25%209%208.25C9.82843%208.25%2010.5%207.57843%2010.5%206.75ZM12%206.75C12%208.40685%2010.6569%209.75%209%209.75C7.34315%209.75%206%208.40685%206%206.75C6%205.09315%207.34315%203.75%209%203.75C10.6569%203.75%2012%205.09315%2012%206.75Z'%20fill='%23FDFCFC'/%3e%3c/svg%3e",Ku="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.25%2014.8125C2.25%2015.3305%202.66946%2015.75%203.1875%2015.75H5.625V17.25H3.1875C1.84104%2017.25%200.75%2016.159%200.75%2014.8125L0.75%2012.375H2.25V14.8125ZM17.25%2014.8125C17.25%2016.159%2016.159%2017.25%2014.8125%2017.25H12.375L12.375%2015.75H14.8125C15.3305%2015.75%2015.75%2015.3305%2015.75%2014.8125V12.375L17.25%2012.375V14.8125ZM14.135%206.35229C14.2958%206.19142%2014.5379%206.14314%2014.748%206.22998C14.9583%206.31702%2015.0959%206.52245%2015.0959%206.75V10.5015C15.0959%2010.812%2014.8439%2011.0638%2014.5334%2011.064C14.2228%2011.0639%2013.9709%2010.8121%2013.9709%2010.5015V8.10571C13.7502%208.30415%2013.4107%208.29824%2013.1982%208.08594C12.9785%207.86637%2012.9787%207.51027%2013.1982%207.29053L14.135%206.35229ZM11.3298%206.19336C11.5137%206.21969%2011.6748%206.33566%2011.7568%206.5061C11.8505%206.70099%2011.8245%206.93272%2011.6895%207.10156L9.42041%209.9375H11.25C11.5607%209.9375%2011.8125%2010.1893%2011.8125%2010.5C11.8125%2010.8107%2011.5607%2011.0625%2011.25%2011.0625H8.25C8.03386%2011.0625%207.83688%2010.9386%207.74316%2010.7439C7.6495%2010.549%207.67547%2010.3173%207.81055%2010.1484L10.0796%207.3125L8.25%207.3125C7.93934%207.3125%207.6875%207.06066%207.6875%206.75C7.6875%206.43934%207.93934%206.1875%208.25%206.1875L11.25%206.1875L11.3298%206.19336ZM5.25%206.19482C5.45567%206.22809%205.62952%206.37352%205.69531%206.57642L6.9104%2010.3264C7.00614%2010.6219%206.84405%2010.9396%206.54858%2011.0354C6.25308%2011.1311%205.93539%2010.9691%205.8396%2010.6736L5.72241%2010.3125H3.65259L3.5354%2010.6736C3.43961%2010.9691%203.12192%2011.1311%202.82642%2011.0354C2.53095%2010.9396%202.36886%2010.6219%202.4646%2010.3264L2.68579%209.6416C2.69424%209.59828%202.7083%209.55696%202.72607%209.51782L3.67969%206.57642L3.71411%206.49365C3.80908%206.30792%204.00155%206.1875%204.21509%206.1875H5.15991L5.25%206.19482ZM4.0166%209.1875H5.3584L4.75122%207.3125H4.62378L4.0166%209.1875ZM5.625%202.25H3.1875C2.66946%202.25%202.25%202.66946%202.25%203.1875V5.625H0.75L0.75%203.1875C0.75%201.84104%201.84104%200.75%203.1875%200.75L5.625%200.75V2.25ZM14.8125%200.75C16.159%200.75%2017.25%201.84104%2017.25%203.1875V5.625H15.75V3.1875C15.75%202.66946%2015.3305%202.25%2014.8125%202.25H12.375V0.75L14.8125%200.75Z'%20fill='%23FDFCFC'/%3e%3c/svg%3e";function Xb(e){return e==="Facial"?g.jsx("img",{src:Gu,alt:"Facial",width:16,height:16,style:{display:"block"}}):e==="LPR"?g.jsx("img",{src:Ku,alt:"LPR",width:16,height:16,style:{display:"block"}}):g.jsx(Ve.VideocamOutlined,{sx:{fontSize:16}})}function Jb(e){return e==="Facial"?g.jsx("img",{src:Gu,alt:"Facial",width:18,height:18,style:{display:"block"}}):e==="LPR"?g.jsx("img",{src:Ku,alt:"LPR",width:18,height:18,style:{display:"block"}}):g.jsx(Ve.VideocamOutlined,{sx:{fontSize:18,color:"#fff"}})}function Qb(e){if(!e||!Array.isArray(e)||e.length===0)return;const t={};return e.forEach(n=>{const r=n.algorithm||"Outros";t[r]=(t[r]||0)+1}),Object.entries(t).map(([n,r])=>({count:r,icon:Xb(n)}))}const ex="_spotWrapper_dvp29_1",tx="_mapSpot_dvp29_8",nx="_selected_dvp29_27",rx="_count_dvp29_31",ox="_countSelected_dvp29_39",sx="_cameraTypesContainer_dvp29_43",ix="_cameraTypeItem_dvp29_50",ax="_cameraTypeCount_dvp29_57",cx="_cameraTypeIcon_dvp29_64",lx="_selectionEffect_dvp29_72",ux="_arrowSvg_dvp29_81",dx="_cameraButtonWrapper_dvp29_86",fx="_cone_dvp29_91",hx="_cameraButton_dvp29_86",je={spotWrapper:ex,mapSpot:tx,selected:nx,count:rx,countSelected:ox,cameraTypesContainer:sx,cameraTypeItem:ix,cameraTypeCount:ax,cameraTypeIcon:cx,selectionEffect:lx,arrowSvg:ux,cameraButtonWrapper:dx,cone:fx,cameraButton:hx},px=vn(_.Box),uc=60,mx=34,ri=({count:e,addressText:t,cameras:n,isSelected:r,animateOnClick:o=!0,disableClick:s=!1,className:i,onClick:a,sx:c})=>{const[u,l]=x.useState(!1),d=x.useMemo(()=>Qb(n),[n]),f=d&&d.length>0,p=(v,b)=>{const S=(v-90)*(Math.PI/180);return{x:Math.cos(S)*b,y:Math.sin(S)*b}},m=(v,b)=>{const S=v.orientation??b*90,y=p(S,uc);return g.jsxs("svg",{className:je.arrowSvg,style:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",overflow:"visible",pointerEvents:"none"},width:"1",height:"1",children:[g.jsx("defs",{children:g.jsx("marker",{id:`arrowhead-${v.id}`,markerWidth:"6",markerHeight:"6",refX:"3",refY:"3",orient:"auto",children:g.jsx("polygon",{points:"0 0, 6 3, 0 6",fill:"var(--Tertiary-On-Tertiary, #ffffff)"})})}),g.jsx("line",{x1:"0",y1:"0",x2:y.x,y2:y.y,stroke:"var(--Tertiary-On-Tertiary, #ffffff)",strokeWidth:"2",markerEnd:`url(#arrowhead-${v.id})`})]},`arrow-${v.id}`)},h=(v,b)=>{const S=v.orientation??b*90,y=p(S,uc+mx/2+10),C=Jb(v.algorithm);return g.jsxs("div",{className:je.cameraButtonWrapper,style:{position:"absolute",left:"50%",top:"50%",transform:`translate(calc(-50% + ${y.x}px), calc(-50% + ${y.y}px))`},children:[g.jsx("div",{className:je.cone,style:{transform:`rotate(${S+180}deg)`}}),g.jsx("div",{className:je.cameraButton,children:C})]},`camera-${v.id}`)};return g.jsxs("div",{className:je.spotWrapper,children:[r&&n&&n.length>0&&(o?g.jsxs(vn.div,{className:je.selectionEffect,initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.5},transition:{duration:.3,ease:"easeOut"},children:[n.map((v,b)=>m(v,b)),n.map((v,b)=>h(v,b))]}):g.jsxs("div",{className:je.selectionEffect,children:[n.map((v,b)=>m(v,b)),n.map((v,b)=>h(v,b))]})),g.jsx(px,{className:`${je.mapSpot} ${r?je.selected:""} ${i||""}`,onClick:s?void 0:a,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),sx:{...s&&{pointerEvents:"none",cursor:"default"},...c},animate:{width:u&&f&&!r?"auto":30,height:u&&f&&!r?"auto":30,borderRadius:"100px",backgroundColor:r?"var(--Tertiary-Tertiary, #7FCFCF)":u&&f?"var(--Surface-Surface-Tint, #5E5E5E)":"var(--Surface-Inverse-Surface, #3B3B3C)",padding:u&&f&&!r?"4px 8px":0,borderWidth:r?1:0,borderStyle:"solid",borderColor:r?"var(--Tertiary-On-Tertiary, #ffffff)":"transparent"},transition:{duration:.2,ease:"easeInOut"},children:g.jsx(U1,{mode:"wait",children:u&&f&&!r?g.jsx(vn.div,{className:je.cameraTypesContainer,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2,ease:"easeInOut"},children:d.map((v,b)=>g.jsxs(vn.div,{className:je.cameraTypeItem,initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{duration:.2,delay:b*.05},children:[g.jsx(_.Typography,{className:je.cameraTypeCount,children:v.count}),v.icon&&g.jsx(_.Box,{className:je.cameraTypeIcon,children:v.icon})]},b))},"expanded"):g.jsx(vn.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2,ease:"easeInOut"},children:g.jsx(_.Typography,{className:`${je.count} ${r?je.countSelected:""}`,children:e})},"collapsed")})})]})};ri.displayName="MapSpot";const gx=16,Yu=({spots:e,onSpotClick:t,zoomLevel:n=gx,selectedSpotId:r,animateOnClick:o,disableClick:s})=>{const{isLoaded:i,zoomToPosition:a}=cl(),c=u=>{s||(a({lat:u.lat,lng:u.lng},n),t==null||t(u))};return i?g.jsx(g.Fragment,{children:e.map((u,l)=>g.jsx(il,{position:{lat:u.lat,lng:u.lng},onClick:s?void 0:()=>c(u),children:g.jsx(ri,{count:u.count,addressText:u.addressText,cameras:u.cameras,isSelected:r===u.id,animateOnClick:o,disableClick:s})},u.id??l))}):null};Yu.displayName="MapMarkers";const yx="_searchBar_15mix_1",vx="_startIconContainer_15mix_106",bx="_endIconContainer_15mix_117",xx="_endIconContainerClickable_15mix_153",Sx="_defaultIcon_15mix_157",bn={searchBar:yx,startIconContainer:vx,endIconContainer:bx,endIconContainerClickable:xx,defaultIcon:Sx},Tx=e=>()=>{e&&e()},wx=e=>t=>{e&&e(t)},Cx=()=>g.jsx(Ve.Search,{className:bn.defaultIcon}),_x=e=>e||Cx(),qu=x.forwardRef(({startIcon:e,endIcon:t,onEndIconClick:n,placeholder:r,value:o,onChange:s,className:i,...a},c)=>{const l=_.useTheme().palette.mode==="dark",d=_x(t),f=Tx(n),p=wx(s);return g.jsx(_.TextField,{ref:c,value:o,onChange:p,placeholder:r,variant:"outlined",autoComplete:"off",className:`${bn.searchBar} ${i||""}`,"data-theme":l?"dark":"light",InputProps:{startAdornment:e?g.jsx(_.InputAdornment,{position:"start",className:bn.startIconContainer,children:e}):null,endAdornment:g.jsx(_.InputAdornment,{position:"end",className:`${bn.endIconContainer} ${n?bn.endIconContainerClickable:""}`,onClick:f,disablePointerEvents:!n,children:d})},inputProps:{autoComplete:"off","data-form-type":"other"},...a})});qu.displayName="SearchBar";const Ex=dt(g.jsx("path",{d:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"}),"Home"),Px=dt([g.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3 6.08 3 3.28 5.64 3.03 9h2.02C5.3 6.75 7.18 5 9.5 5 11.99 5 14 7.01 14 9.5S11.99 14 9.5 14c-.17 0-.33-.03-.5-.05v2.02c.17.02.33.03.5.03 1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19z"},"0"),g.jsx("path",{d:"M6.47 10.82 4 13.29l-2.47-2.47-.71.71L3.29 14 .82 16.47l.71.71L4 14.71l2.47 2.47.71-.71L4.71 14l2.47-2.47z"},"1")],"SearchOff"),Ax="_container_1mb8b_1",Mx="_iconWrapper_1mb8b_11",kx="_icon_1mb8b_11",Rx="_title_1mb8b_21",Ox="_subtitle_1mb8b_30",Ix="_description_1mb8b_34",jx="_button_1mb8b_38",_t={container:Ax,iconWrapper:Mx,icon:kx,title:Rx,subtitle:Ox,description:Ix,button:jx},Zu=({onGoHome:e,buttonText:t="Voltar para o início",title:n="Página não encontrada",description:r="Desculpe, a página que você está procurando não existe ou foi movida para outro endereço.",errorCode:o="404",className:s})=>g.jsx(_.Container,{maxWidth:"sm",children:g.jsxs(_.Box,{className:`${_t.container} ${s||""}`,children:[g.jsx(_.Box,{className:_t.iconWrapper,children:g.jsx(Px,{className:_t.icon,color:"primary"})}),g.jsx(_.Typography,{variant:"h1",className:_t.title,sx:{fontSize:{xs:"6rem",md:"8rem"}},children:o}),g.jsx(_.Typography,{variant:"h4",component:"h2",className:_t.subtitle,color:"text.primary",children:n}),g.jsx(_.Typography,{variant:"body1",className:_t.description,color:"text.secondary",children:r}),e&&g.jsx(hs,{variant:"contained",size:"large",startIcon:g.jsx(Ex,{}),onClick:e,className:_t.button,children:t})]})});Zu.displayName="NotFoundContent";const Lx=e=>{const t=e.find(r=>r.active),n=e.flatMap(r=>{var o;return((o=r.submenu)==null?void 0:o.map(s=>({item:r,subItem:s})))??[]}).find(({subItem:r})=>r.active);return{itemId:(n==null?void 0:n.item.id)??(t==null?void 0:t.id)??null,subItemId:(n==null?void 0:n.subItem.id)??null,expandedItemId:(n==null?void 0:n.item.id)??null}},Dx=({items:e,isExpanded:t=!0,onClick:n})=>{const r=x.useMemo(()=>Lx(e),[e]),[o,s]=x.useState(r.itemId),[i,a]=x.useState(r.subItemId),[c,u]=x.useState(r.expandedItemId),[l,d]=x.useState(null),[f,p]=x.useState(null);x.useEffect(()=>{s(r.itemId),a(r.subItemId),u(r.expandedItemId)},[r.itemId,r.subItemId,r.expandedItemId]);const m=f?e.find(E=>E.id===f):void 0,h=(m==null?void 0:m.submenu)??[];return{selectedItemId:o,selectedSubItemId:i,expandedItemId:c,submenuAnchorEl:l,submenuItem:m,submenuItems:h,getIsItemActive:E=>{var A;const P=i?!!((A=E.submenu)!=null&&A.some(M=>M.id===i)):!1;return o?E.id===o:!!(E.active||P)},getIsSubItemActive:E=>i?E.id===i:!!E.active,shouldShowSubmenu:E=>{var P;return!!(t&&((P=E.submenu)!=null&&P.length)&&c===E.id)},handleItemClick:(E,P)=>{var A,M;s(E.id),a(null),(A=E.submenu)!=null&&A.length?t?u(L=>L===E.id?null:E.id):(d(P.currentTarget),p(E.id)):(u(null),d(null),p(null)),(M=E.onClick)==null||M.call(E,P),n==null||n({item:E})},handleSubItemClick:(E,P,A,M)=>{var L;s(E.id),a(P.id),M!=null&&M.closeMenu&&(d(null),p(null)),(L=P.onClick)==null||L.call(P,A),n==null||n({item:E,subItem:P})},closeSubmenu:()=>{d(null),p(null)}}},Xu=e=>typeof e=="number"?`${e*4}px`:e,$x=({item:e,onClick:t,isActive:n})=>{const r=Y.useTheme();return g.jsx(_.ButtonBase,{onClick:t,"aria-label":e.label,"aria-pressed":n||void 0,sx:{width:"100%",borderRadius:Xu(r.shape.borderRadius),px:2,py:1.25,justifyContent:"flex-start",textAlign:"left",color:r.palette.text.primary,backgroundColor:n?r.palette.action.selected:"transparent","&:hover":{backgroundColor:r.palette.action.hover}},children:g.jsx(_.Typography,{variant:"body2",sx:{fontWeight:500},children:e.label})})},Ju=({items:e,isExpanded:t=!0,className:n,onClick:r})=>{const o=Y.useTheme(),s=Xu(o.shape.borderRadius),{submenuAnchorEl:i,submenuItem:a,submenuItems:c,getIsItemActive:u,getIsSubItemActive:l,shouldShowSubmenu:d,handleItemClick:f,handleSubItemClick:p,closeSubmenu:m}=Dx({items:e,isExpanded:t,onClick:r});return g.jsxs(_.Stack,{className:n,direction:"column",spacing:2,sx:{width:"100%"},children:[e.map(h=>{var E,P;const v=u(h),b=d(h),S=t?o.spacing(2):o.spacing(4),y=t?v?o.palette.primary.main:o.palette.action.hover:"transparent",C=t?"transparent":v?o.palette.primary.main:o.palette.action.hover,T=!t&&v?o.palette.primary.contrastText:o.palette.text.primary;return g.jsxs(_.Stack,{direction:"column",spacing:1,sx:{width:"100%"},children:[g.jsx(_.ButtonBase,{onClick:A=>f(h,A),"aria-label":h.label,"aria-pressed":v||void 0,"aria-haspopup":(E=h.submenu)!=null&&E.length?"menu":void 0,sx:{width:"100%",borderRadius:s,px:t?2:1,py:t?1.5:1,justifyContent:t?"flex-start":"center",textAlign:"left",color:o.palette.text.primary,backgroundColor:y,boxShadow:t&&v?o.shadows[1]:"none","&:hover":{backgroundColor:t?o.palette.action.hover:"transparent"}},children:g.jsxs(_.Stack,{direction:t?"row":"column",alignItems:"center",spacing:t?1.5:1,sx:{width:"100%"},children:[g.jsx(_.Box,{sx:{width:64,height:S,borderRadius:s,display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:C,color:T,transition:o.transitions.create(["background-color","box-shadow"],{duration:o.transitions.duration.shortest}),...t?{}:{boxShadow:v?o.shadows[1]:"none","&:hover":{backgroundColor:v?Y.alpha(o.palette.primary.main,.9):o.palette.action.selected}}},children:h.icon}),g.jsx(_.Typography,{variant:"body2",sx:{width:"100%",textAlign:t?"left":"center",fontWeight:v?600:500},children:h.label}),t&&h.trailingIcon?g.jsx(_.Box,{sx:{ml:"auto",display:"inline-flex",alignItems:"center"},children:h.trailingIcon}):null]})}),b?g.jsx(_.Collapse,{in:b,timeout:"auto",unmountOnExit:!0,children:g.jsx(_.Stack,{direction:"column",spacing:1,sx:{pl:4},children:(P=h.submenu)==null?void 0:P.map(A=>{const M=l(A);return g.jsx($x,{item:A,isActive:M,onClick:L=>p(h,A,L)},A.id)})})}):null]},h.id)}),g.jsx(_.Menu,{anchorEl:i,open:!!(i&&c.length),onClose:m,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},MenuListProps:{dense:!0,"aria-label":(a==null?void 0:a.label)??"submenu"},PaperProps:{sx:{borderRadius:s,minWidth:o.spacing(22),px:1,py:.5,boxShadow:o.shadows[3]}},children:c.map(h=>{const v=l(h);return g.jsx(_.MenuItem,{selected:v,onClick:b=>{a&&p(a,h,b,{closeMenu:!0})},sx:{borderRadius:s,fontWeight:v?600:500},children:h.label},h.id)})})]})};Ju.displayName="SidebarMenu";const Vx=e=>{const t=e.find(n=>n.active);return(t==null?void 0:t.id)??null},Nx=({items:e,onSelect:t,isExpanded:n=!0})=>{const r=x.useMemo(()=>Vx(e),[e]),[o,s]=x.useState(r),[i,a]=x.useState(null);x.useEffect(()=>{s(r)},[r]);const c=o?e.find(p=>p.id===o):void 0;return{selectedItemId:o,selectedItem:c,menuAnchorEl:i,getIsItemActive:p=>o?p.id===o:!!p.active,openMenu:p=>{n||a(p.currentTarget)},closeMenu:()=>{n||a(null)},handleItemClick:(p,m)=>{var h;s(p.id),(h=p.onClick)==null||h.call(p,m),t==null||t(p),a(null)}}},Bx=e=>typeof e=="number"?`${e*4}px`:e,Qu=({items:e,currentLabel:t,headerLabel:n,headerIcon:r,headerTrailingIcon:o,listTitle:s,action:i,isExpanded:a=!0,className:c,onSelect:u})=>{var Q,U;const l=Y.useTheme(),d=x.useRef(null),f=Bx(l.shape.borderRadius),[p,m]=x.useState(!1),h=x.useMemo(()=>Number.parseFloat(l.spacing(2).toString()),[l]),{selectedItem:v,menuAnchorEl:b,getIsItemActive:S,openMenu:y,closeMenu:C,handleItemClick:T}=Nx({items:e,onSelect:u,isExpanded:a}),E=t??(v==null?void 0:v.label)??((Q=e[0])==null?void 0:Q.label)??"",P=r??(v==null?void 0:v.icon)??((U=e[0])==null?void 0:U.icon)??null,A=a||!P,M=I=>{if(a){m(X=>!X);return}y(I)},L=(I,X)=>{T(I,X),m(!1)},$=g.jsx(_.Stack,{direction:"column",spacing:.5,children:e.map(I=>{const X=S(I);return g.jsxs(_.MenuItem,{selected:X,onClick:R=>L(I,R),sx:{borderRadius:f,gap:1.5,px:2,py:1.25,color:l.palette.text.primary,"&:hover":{backgroundColor:l.palette.action.hover}},children:[I.icon?g.jsx(_.Box,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:I.icon}):null,g.jsx(_.Typography,{variant:"body1",sx:{fontWeight:X?600:500},children:I.label})]},I.id)})}),W=g.jsxs(_.Box,{sx:{borderRadius:f,backgroundColor:l.palette.background.paper,boxShadow:l.shadows[3],display:"flex",flexDirection:"column",maxHeight:l.spacing(50)},children:[s?g.jsx(_.Box,{sx:{px:2,pt:2,pb:1},children:g.jsx(_.Typography,{variant:"subtitle2",sx:{color:l.palette.text.primary},children:s})}):null,g.jsx(_.Box,{sx:{px:2,pb:2,overflowY:"auto",flex:1,minHeight:0},children:$})]}),H=i?g.jsxs(_.MenuItem,{onClick:i.onClick,sx:{borderRadius:f,gap:1.5,px:2,py:1.25,color:l.palette.text.primary,"&:hover":{backgroundColor:l.palette.action.hover}},children:[i.icon?g.jsx(_.Box,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:i.icon}):null,g.jsx(_.Typography,{variant:"body1",sx:{fontWeight:600},children:i.label})]}):null,q=H?g.jsx(_.Box,{sx:{borderRadius:f,backgroundColor:l.palette.background.paper,boxShadow:l.shadows[3]},children:H}):null,oe=g.jsxs(_.Stack,{direction:"column",spacing:1,sx:{minWidth:l.spacing(32)},children:[W,q]});return g.jsxs(_.Stack,{className:c,direction:a?"row":"column",spacing:a?2:1,sx:{width:"100%",alignItems:a?"flex-start":"stretch"},children:[g.jsx(_.ButtonBase,{onClick:M,"aria-label":E,ref:d,sx:{width:a?l.spacing(28):"64px",height:a?"auto":"64px",borderRadius:f,px:a?2:0,py:a?1.25:0,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"left",backgroundColor:l.palette.action.hover,"&:hover":{backgroundColor:l.palette.action.selected}},children:g.jsxs(_.Stack,{direction:"row",alignItems:"center",spacing:a?1:0,sx:{width:a?"100%":"auto",justifyContent:a?"space-between":"center",px:0},children:[P?g.jsx(_.Box,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:P}):null,A?g.jsxs(_.Box,{sx:{minWidth:0,flex:1},children:[n?g.jsx(_.Typography,{variant:"caption",sx:{color:l.palette.text.secondary},children:n}):null,g.jsx(_.Typography,{variant:"body2",sx:{fontWeight:600},noWrap:!0,children:E})]}):null,a&&o?g.jsx(_.Box,{sx:{ml:"auto",display:"inline-flex",alignItems:"center"},children:o}):null]})}),a?p?g.jsx(_.ClickAwayListener,{onClickAway:()=>m(!1),children:g.jsx(_.Popper,{open:p,anchorEl:d.current,placement:"right-start",modifiers:[{name:"offset",options:{offset:[0,h]}}],sx:{zIndex:l.zIndex.modal},children:oe})}):null:g.jsx(_.Menu,{anchorEl:b,open:!!b,onClose:C,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},disableAutoFocusItem:!0,slotProps:{paper:{sx:{borderRadius:f,p:0,ml:2,backgroundColor:"transparent",boxShadow:"none",overflow:"visible"}}},MenuListProps:{"aria-label":E?`menu-${E}`:"menu",sx:{p:0}},children:oe})]})};Qu.displayName="ModuleMenu";const oi=e=>e.seekable&&e.seekable.length>0?e.seekable.end(e.seekable.length-1):Number.isFinite(e.duration)&&e.duration>0?e.duration:e.currentTime,Fx=(e,t,n)=>({...e&&{"--player-width":typeof e=="number"?`${e}px`:e},...t&&{"--player-height":typeof t=="number"?`${t}px`:t},...n&&{"--player-aspect-ratio":n}}),zx=({stream:e,availableQualities:t,initialQuality:n,autoPlay:r,liveThresholdSeconds:o,allowPlaybackRateForStream:s})=>{const i=x.useRef(null),a=x.useRef(null),c=x.useMemo(()=>{if(!t||!t.length)return null;if(n){const I=t.find(X=>X.value===n);if(I)return I}return t[0]},[t,n]),[u,l]=x.useState(c),[d,f]=x.useState(!1),[p,m]=x.useState(!0),[h,v]=x.useState(!1),[b,S]=x.useState(0),[y,C]=x.useState(0),[T,E]=x.useState(1),[P,A]=x.useState(1),[M,L]=x.useState(!1),[$,W]=x.useState(!0),H=(u==null?void 0:u.stream)??e??null,q=(u==null?void 0:u.src)??null,Q=!!!H||s;x.useEffect(()=>{l(c)},[c]);const U=x.useCallback(()=>{const I=a.current;if(!I)return;if(!I.seekable||I.seekable.length===0){m(!0),v(!1);return}const X=oi(I),R=Math.max(0,X-I.currentTime);C(X),S(I.currentTime),v(X>0),m(R<=(o??2))},[o]);return x.useEffect(()=>{const I=a.current;if(!I)return;const X=()=>f(!0),R=()=>f(!1),w=()=>W(!0),j=()=>W(!0),k=()=>W(!1),O=()=>W(!1);return I.addEventListener("play",X),I.addEventListener("pause",R),I.addEventListener("waiting",w),I.addEventListener("loadstart",j),I.addEventListener("canplay",k),I.addEventListener("playing",O),I.addEventListener("timeupdate",U),I.addEventListener("durationchange",U),I.addEventListener("loadedmetadata",U),I.addEventListener("progress",U),()=>{I.removeEventListener("play",X),I.removeEventListener("pause",R),I.removeEventListener("waiting",w),I.removeEventListener("loadstart",j),I.removeEventListener("canplay",k),I.removeEventListener("playing",O),I.removeEventListener("timeupdate",U),I.removeEventListener("durationchange",U),I.removeEventListener("loadedmetadata",U),I.removeEventListener("progress",U)}},[U]),x.useEffect(()=>{const I=a.current;I&&(W(!0),H?(I.srcObject!==H&&(I.srcObject=H),I.getAttribute("src")&&I.removeAttribute("src")):q?(I.srcObject&&(I.srcObject=null),I.src!==q&&(I.src=q,I.load())):(I.srcObject&&(I.srcObject=null),I.getAttribute("src")&&I.removeAttribute("src")),r&&I.play().then(()=>{}).catch(()=>{}))},[H,q,r]),x.useEffect(()=>{const I=a.current;I&&(Q?I.playbackRate=T:(I.playbackRate=1,E(1)))},[T,Q]),x.useEffect(()=>{const I=()=>{L(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",I),()=>{document.removeEventListener("fullscreenchange",I)}},[]),{containerRef:i,videoRef:a,selectedQuality:u,setSelectedQuality:l,isPlaying:d,isLive:p,canSeek:h,currentTime:b,setCurrentTime:S,seekableEnd:y,playbackRate:T,setPlaybackRate:E,zoom:P,setZoom:A,isFullscreen:M,isLoading:$,canAdjustPlaybackRate:Q,updateLiveStatus:U}},Wx="_container_zv1tx_1",Ux="_loader_zv1tx_19",Hx="_video_zv1tx_29",Gx="_controlsOverlay_zv1tx_37",Kx="_timeline_zv1tx_58",Yx="_controlsRow_zv1tx_65",qx="_controlGroup_zv1tx_83",Zx="_iconButton_zv1tx_100",Xx="_seekButton_zv1tx_113",Jx="_menuButton_zv1tx_133",Qx="_liveBadge_zv1tx_149",Ae={container:Wx,loader:Ux,video:Hx,controlsOverlay:Gx,timeline:Kx,controlsRow:Yx,controlGroup:qx,iconButton:Zx,seekButton:Xx,menuButton:Jx,liveBadge:Qx},_o=({label:e,valueLabel:t,selectedValue:n,options:r,onChange:o,disabled:s,ariaLabel:i})=>{const[a,c]=x.useState(null),u=!!a;return g.jsxs(g.Fragment,{children:[g.jsx(_.ButtonBase,{disabled:s,className:Ae.menuButton,"aria-label":i,onClick:l=>c(l.currentTarget),children:e?`${e}: ${t}`:t}),g.jsx(_.Menu,{anchorEl:a,open:u,onClose:()=>c(null),children:r.map(l=>g.jsx(_.MenuItem,{selected:l.value===n,disabled:l.disabled,onClick:()=>{o(l.value),c(null)},children:l.label},`${e}-${String(l.value)}`))})]})},eS=e=>()=>{const t=e.current;t&&(t.paused?t.play().catch(()=>{}):t.pause())},tS=(e,t,n)=>r=>{const o=e.current;if(!o||!t)return;const s=oi(o),i=Math.min(Math.max(o.currentTime+r,0),s);o.currentTime=i,n()},nS=e=>()=>{e.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):e.current.requestFullscreen().catch(()=>{}))},rS=(e,t,n)=>r=>{const o=e.find(s=>s.value===r)??null;t(o),n==null||n(o)},oS=(e,t)=>(n,r)=>{if(!e)return;const o=Array.isArray(r)?r[0]:r;t(o)},sS=(e,t,n)=>(r,o)=>{const s=e.current;if(!s||!t)return;const i=Array.isArray(o)?o[0]:o,a=oi(s);s.currentTime=Math.min(Math.max(i,0),a),n()},ed=({stream:e=null,availableQualities:t=[],initialQuality:n,onQualityChange:r,autoPlay:o=!0,playsInline:s=!0,muted:i=!0,poster:a,className:c,sx:u,liveThresholdSeconds:l=2,allowPlaybackRateForStream:d=!1,playbackRates:f=[.5,1,1.5,2],zoomLevels:p=[1,1.2,1.5],width:m,height:h,aspectRatio:v="16 / 9",showTimestamp:b=!0,showTimeline:S=!0})=>{const y=Y.useTheme(),[C,T]=x.useState(""),[E,P]=x.useState(!0),A=x.useRef(null);x.useEffect(()=>{if(!b)return;const we=()=>{const Je=new Date,Hn=String(Je.getDate()).padStart(2,"0"),yd=String(Je.getMonth()+1).padStart(2,"0"),vd=Je.getFullYear(),bd=["Dom","Seg","Ter","Qua","Qui","Sex","Sab"][Je.getDay()],xd=String(Je.getHours()).padStart(2,"0"),Sd=String(Je.getMinutes()).padStart(2,"0"),Td=String(Je.getSeconds()).padStart(2,"0");T(`${Hn}-${yd}-${vd}, ${bd} ${xd}:${Sd}:${Td}`)};we();const Un=setInterval(we,1e3);return()=>clearInterval(Un)},[b]),x.useEffect(()=>{const we=M.current;if(!we)return;const Un=()=>{A.current&&(clearTimeout(A.current),A.current=null),P(!0)},Je=()=>{A.current=setTimeout(()=>{P(!1)},1e4)},Hn=()=>{E||P(!0),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{P(!1)},1e4)};return we.addEventListener("mouseenter",Un),we.addEventListener("mouseleave",Je),we.addEventListener("mousemove",Hn),()=>{we.removeEventListener("mouseenter",Un),we.removeEventListener("mouseleave",Je),we.removeEventListener("mousemove",Hn),A.current&&clearTimeout(A.current)}},[E]);const{containerRef:M,videoRef:L,selectedQuality:$,setSelectedQuality:W,isPlaying:H,isLive:q,canSeek:oe,currentTime:Q,setCurrentTime:U,seekableEnd:I,playbackRate:X,setPlaybackRate:R,zoom:w,setZoom:j,isFullscreen:k,isLoading:O,canAdjustPlaybackRate:F,updateLiveStatus:N}=zx({stream:e,availableQualities:t,initialQuality:n,autoPlay:o,liveThresholdSeconds:l,allowPlaybackRateForStream:d}),V=eS(L),z=tS(L,oe,N),G=nS(M),K=rS(t,W,r),he=oS(oe,U),D=sS(L,oe,N),Ee=p.map(we=>({value:we,label:`${Math.round(we*100)}%`})),Xe=f.map(we=>({value:we,label:`${we}x`})),ft=t.map(we=>({value:we.value,label:we.label})),qr=($==null?void 0:$.label)??"Auto",on=`${Math.round(w*100)}%`,sn=`${X}x`,an=oe&&I>0,Zr=Fx(m,h,v);return g.jsxs(_.Box,{ref:M,className:`${Ae.container} ${c||""}`.trim(),style:Zr,sx:{borderRadius:0,backgroundColor:y.palette.common.black,...u},children:[O&&g.jsx(_.Box,{className:Ae.loader,sx:{backgroundColor:y.palette.common.black},children:g.jsx(_.CircularProgress,{size:60,sx:{color:y.palette.primary.contrastText,width:{xs:"48px",sm:"60px"},height:{xs:"48px",sm:"60px"}}})}),g.jsx("video",{ref:L,className:Ae.video,autoPlay:o,playsInline:s,muted:i,poster:a,style:{transform:`scale(${w})`}}),b&&C&&g.jsx(_.Box,{sx:{position:"absolute",top:0,left:0,right:0,padding:{xs:"10px 12px",sm:"12px 16px"}},children:g.jsx(_.Typography,{variant:"body2",sx:{color:y.palette.common.white,fontWeight:500,fontSize:{xs:"12px",sm:"14px"},textShadow:"0 2px 8px rgba(0,0,0,0.8)"},children:C})}),q&&!E&&g.jsx(_.Box,{sx:{position:"absolute",bottom:16,left:20,zIndex:10},children:g.jsx(_.Box,{className:Ae.liveBadge,sx:{backgroundColor:Y.alpha(y.palette.common.white,.9),color:y.palette.common.black},component:"span","aria-live":"polite",children:"ao vivo"})}),g.jsxs(_.Box,{className:Ae.controlsOverlay,sx:{opacity:E?1:0,visibility:E?"visible":"hidden",transition:"opacity 0.3s ease, visibility 0.3s ease"},children:[S&&g.jsx(_.Box,{className:Ae.timeline,children:g.jsx(_.Slider,{size:"small",min:0,max:an?I:1,step:1,value:an?Q:0,disabled:!an,onChange:he,onChangeCommitted:D,"aria-label":"Linha do tempo do video",sx:{color:y.palette.common.white,"& .MuiSlider-thumb":{width:12,height:12,backgroundColor:y.palette.common.white},"& .MuiSlider-track":{border:"none",backgroundColor:y.palette.common.white},"& .MuiSlider-rail":{backgroundColor:Y.alpha(y.palette.common.white,.3),opacity:1}}})}),g.jsxs(_.Box,{className:Ae.controlsRow,children:[g.jsxs(_.Box,{className:Ae.controlGroup,children:[g.jsx(_.Box,{className:Ae.liveBadge,sx:{backgroundColor:q?Y.alpha(y.palette.common.white,.9):Y.alpha(y.palette.common.white,.15),color:q?y.palette.common.black:Y.alpha(y.palette.common.white,.7)},component:"span","aria-live":"polite",children:"ao vivo"}),g.jsx(_.Box,{className:Ae.seekButton,component:"button",onClick:()=>z(-15),"aria-label":"Voltar 15 segundos",sx:{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,border:"none",cursor:"pointer","&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}},children:"15s"}),g.jsx(_.IconButton,{className:Ae.iconButton,onClick:()=>z(-15),"aria-label":"Recuar 15 segundos",sx:{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,"&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}},children:g.jsx(Ve.FastRewind,{fontSize:"small"})}),g.jsx(_.IconButton,{className:Ae.iconButton,onClick:V,"aria-label":"Play/Pause",sx:{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,"&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}},children:H?g.jsx(Ve.Pause,{fontSize:"small"}):g.jsx(Ve.PlayArrow,{fontSize:"small"})}),g.jsx(_.IconButton,{className:Ae.iconButton,onClick:()=>z(15),"aria-label":"Avançar 15 segundos",sx:{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,"&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}},children:g.jsx(Ve.FastForward,{fontSize:"small"})}),g.jsx(_.Box,{className:Ae.seekButton,component:"button",onClick:()=>z(15),"aria-label":"Avançar 15 segundos",sx:{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,border:"none",cursor:"pointer","&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}},children:"15s"})]}),g.jsxs(_.Box,{className:Ae.controlGroup,children:[g.jsx(_.Box,{sx:{"& .MuiButtonBase-root":{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,"&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}}},children:g.jsx(_o,{label:"",valueLabel:sn,selectedValue:X,options:Xe,ariaLabel:"Selecionar velocidade de reprodução",onChange:R,disabled:!F})}),ft.length>0?g.jsx(_.Box,{sx:{"& .MuiButtonBase-root":{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,"&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}}},children:g.jsx(_o,{label:"",valueLabel:qr,selectedValue:($==null?void 0:$.value)??"auto",options:ft,ariaLabel:"Selecionar qualidade do vídeo",onChange:K})}):null,g.jsx(_.Box,{sx:{"& .MuiButtonBase-root":{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,"&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}}},children:g.jsx(_o,{label:"",valueLabel:on,selectedValue:w,options:Ee,ariaLabel:"Selecionar zoom do vídeo",onChange:j})}),g.jsx(_.IconButton,{className:Ae.iconButton,onClick:G,"aria-label":"Fullscreen",sx:{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,"&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}},children:k?g.jsx(Ve.FullscreenExit,{fontSize:"small"}):g.jsx(Ve.Fullscreen,{fontSize:"small"})})]})]})]})]})};ed.displayName="VideoPlayer";const iS=dt(g.jsx("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8"}),"UndoOutlined"),aS=dt(g.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),cS=dt(g.jsx("path",{d:"M19 13H5v-2h14z"}),"Remove"),lS="_root_1gj5n_1",uS="_container_1gj5n_6",dS="_header_1gj5n_13",fS="_headerText_1gj5n_21",hS="_controls_1gj5n_27",pS="_iconButton_1gj5n_34",mS="_zoomGroup_1gj5n_43",gS="_zoomTrack_1gj5n_52",yS="_zoomTrackFill_1gj5n_59",vS="_layers_1gj5n_67",bS="_timeScale_1gj5n_78",xS="_videoTrack_1gj5n_82",SS="_eventsTrack_1gj5n_86",TS="_trackBox_1gj5n_90",wS="_trackLabelRow_1gj5n_95",CS="_label_1gj5n_103",_S="_trackArea_1gj5n_112",ES="_tick_1gj5n_118",PS="_tickMajor_1gj5n_126",AS="_tickMinor_1gj5n_131",MS="_tickLabel_1gj5n_135",kS="_segment_1gj5n_146",RS="_event_1gj5n_86",OS="_eventDot_1gj5n_166",IS="_selectionOverlay_1gj5n_172",jS="_playhead_1gj5n_180",LS="_playheadLine_1gj5n_190",DS="_playheadHandle_1gj5n_199",J={root:lS,container:uS,header:dS,headerText:fS,controls:hS,iconButton:pS,zoomGroup:mS,zoomTrack:gS,zoomTrackFill:yS,layers:vS,timeScale:bS,videoTrack:xS,eventsTrack:SS,trackBox:TS,trackLabelRow:wS,label:CS,trackArea:_S,tick:ES,tickMajor:PS,tickMinor:AS,tickLabel:MS,segment:kS,event:RS,eventDot:OS,selectionOverlay:IS,playhead:jS,playheadLine:LS,playheadHandle:DS},at={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};function td(e){return"init"in e}function cs(e){return!!e.write}function dc(e){return"v"in e||"e"in e}function Ar(e){if("e"in e)throw e.e;if((at?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v}const Mr=new WeakMap;function nd(e){var t;return kr(e)&&!!((t=Mr.get(e))!=null&&t[0])}function $S(e){const t=Mr.get(e);t!=null&&t[0]&&(t[0]=!1,t[1].forEach(n=>n()))}function ls(e,t){let n=Mr.get(e);if(!n){n=[!0,new Set],Mr.set(e,n);const r=()=>{n[0]=!1};e.then(r,r)}n[1].add(t)}function kr(e){return typeof(e==null?void 0:e.then)=="function"}function rd(e,t,n){if(!n.p.has(e)){n.p.add(e);const r=()=>n.p.delete(e);t.then(r,r)}}function od(e,t,n){var r;const o=new Set;for(const s of((r=n.get(e))==null?void 0:r.t)||[])o.add(s);for(const s of t.p)o.add(s);return o}const VS=(e,t,...n)=>t.read(...n),NS=(e,t,...n)=>t.write(...n),BS=(e,t)=>{if(t.INTERNAL_onInit)return t.INTERNAL_onInit(e);if(t.unstable_onInit)return console.warn("[DEPRECATED] atom.unstable_onInit is renamed to atom.INTERNAL_onInit."),t.unstable_onInit(e)},FS=(e,t,n)=>{var r;return(r=t.onMount)==null?void 0:r.call(t,n)},zS=(e,t)=>{var n;const r=Ie(e),o=r[0],s=r[6],i=r[9];if((at?"production":void 0)!=="production"&&!t)throw new Error("Atom is undefined or null");let a=o.get(t);return a||(a={d:new Map,p:new Set,n:0},o.set(t,a),(n=s.i)==null||n.call(s,t),i==null||i(e,t)),a},WS=e=>{const t=Ie(e),n=t[1],r=t[3],o=t[4],s=t[5],i=t[6],a=t[13],c=[],u=l=>{try{l()}catch(d){c.push(d)}};do{i.f&&u(i.f);const l=new Set,d=l.add.bind(l);r.forEach(f=>{var p;return(p=n.get(f))==null?void 0:p.l.forEach(d)}),r.clear(),s.forEach(d),s.clear(),o.forEach(d),o.clear(),l.forEach(u),r.size&&a(e)}while(r.size||s.size||o.size);if(c.length)throw new AggregateError(c)},US=e=>{const t=Ie(e),n=t[1],r=t[2],o=t[3],s=t[11],i=t[14],a=t[17],c=[],u=new WeakSet,l=new WeakSet,d=Array.from(o);for(;d.length;){const f=d[d.length-1],p=s(e,f);if(l.has(f)){d.pop();continue}if(u.has(f)){if(r.get(f)===p.n)c.push([f,p]);else if((at?"production":void 0)!=="production"&&r.has(f))throw new Error("[Bug] invalidated atom exists");l.add(f),d.pop();continue}u.add(f);for(const m of od(f,p,n))u.has(m)||d.push(m)}for(let f=c.length-1;f>=0;--f){const[p,m]=c[f];let h=!1;for(const v of m.d.keys())if(v!==p&&o.has(v)){h=!0;break}h&&(i(e,p),a(e,p)),r.delete(p)}},us=new WeakSet,HS=(e,t)=>{var n,r;const o=Ie(e),s=o[1],i=o[2],a=o[3],c=o[6],u=o[7],l=o[11],d=o[12],f=o[13],p=o[14],m=o[16],h=o[17],v=o[20],b=l(e,t);if(dc(b)){if(s.has(t)&&i.get(t)!==b.n)return b;let M=!1;for(const[L,$]of b.d)if(p(e,L).n!==$){M=!0;break}if(!M)return b}b.d.clear();let S=!0;function y(){s.has(t)&&(h(e,t),f(e),d(e))}function C(M){var L;if(M===t){const W=l(e,M);if(!dc(W))if(td(M))v(e,M,M.init);else throw new Error("no atom init");return Ar(W)}const $=p(e,M);try{return Ar($)}finally{b.d.set(M,$.n),nd(b.v)&&rd(t,b.v,$),s.has(t)&&((L=s.get(M))==null||L.t.add(t)),S||y()}}let T,E;const P={get signal(){return T||(T=new AbortController),T.signal},get setSelf(){return(at?"production":void 0)!=="production"&&!cs(t)&&console.warn("setSelf function cannot be used with read-only atom"),!E&&cs(t)&&(E=(...M)=>{if((at?"production":void 0)!=="production"&&S&&console.warn("setSelf function cannot be called in sync"),!S)try{return m(e,t,...M)}finally{f(e),d(e)}}),E}},A=b.n;try{(at?"production":void 0)!=="production"&&us.delete(e);const M=u(e,t,C,P);return(at?"production":void 0)!=="production"&&us.has(e)&&console.warn("Detected store mutation during atom read. This is not supported."),v(e,t,M),kr(M)&&(ls(M,()=>T==null?void 0:T.abort()),M.then(y,y)),(n=c.r)==null||n.call(c,t),b}catch(M){return delete b.v,b.e=M,++b.n,b}finally{S=!1,A!==b.n&&i.get(t)===A&&(i.set(t,b.n),a.add(t),(r=c.c)==null||r.call(c,t))}},GS=(e,t)=>{const n=Ie(e),r=n[1],o=n[2],s=n[11],i=[t];for(;i.length;){const a=i.pop(),c=s(e,a);for(const u of od(a,c,r)){const l=s(e,u);o.set(u,l.n),i.push(u)}}},KS=(e,t,...n)=>{const r=Ie(e),o=r[3],s=r[6],i=r[8],a=r[11],c=r[12],u=r[13],l=r[14],d=r[15],f=r[16],p=r[17],m=r[20];let h=!0;const v=S=>Ar(l(e,S)),b=(S,...y)=>{var C;const T=a(e,S);try{if(S===t){if(!td(S))throw new Error("atom not writable");(at?"production":void 0)!=="production"&&us.add(e);const E=T.n,P=y[0];m(e,S,P),p(e,S),E!==T.n&&(o.add(S),d(e,S),(C=s.c)==null||C.call(s,S));return}else return f(e,S,...y)}finally{h||(u(e),c(e))}};try{return i(e,t,v,b,...n)}finally{h=!1}},YS=(e,t)=>{var n;const r=Ie(e),o=r[1],s=r[3],i=r[6],a=r[11],c=r[15],u=r[18],l=r[19],d=a(e,t),f=o.get(t);if(f&&!nd(d.v)){for(const[p,m]of d.d)if(!f.d.has(p)){const h=a(e,p);u(e,p).t.add(t),f.d.add(p),m!==h.n&&(s.add(p),c(e,p),(n=i.c)==null||n.call(i,p))}for(const p of f.d)if(!d.d.has(p)){f.d.delete(p);const m=l(e,p);m==null||m.t.delete(t)}}},qS=(e,t)=>{var n;const r=Ie(e),o=r[1],s=r[4],i=r[6],a=r[10],c=r[11],u=r[12],l=r[13],d=r[14],f=r[16],p=r[18],m=c(e,t);let h=o.get(t);if(!h){d(e,t);for(const v of m.d.keys())p(e,v).t.add(t);if(h={l:new Set,d:new Set(m.d.keys()),t:new Set},o.set(t,h),cs(t)){const v=()=>{let b=!0;const S=(...y)=>{try{return f(e,t,...y)}finally{b||(l(e),u(e))}};try{const y=a(e,t,S);y&&(h.u=()=>{b=!0;try{y()}finally{b=!1}})}finally{b=!1}};s.add(v)}(n=i.m)==null||n.call(i,t)}return h},ZS=(e,t)=>{var n,r;const o=Ie(e),s=o[1],i=o[5],a=o[6],c=o[11],u=o[19],l=c(e,t);let d=s.get(t);if(!d||d.l.size)return d;let f=!1;for(const p of d.t)if((n=s.get(p))!=null&&n.d.has(t)){f=!0;break}if(!f){d.u&&i.add(d.u),d=void 0,s.delete(t);for(const p of l.d.keys()){const m=u(e,p);m==null||m.t.delete(t)}(r=a.u)==null||r.call(a,t);return}return d},XS=(e,t,n)=>{const r=Ie(e)[11],o=r(e,t),s="v"in o,i=o.v;if(kr(n))for(const a of o.d.keys())rd(t,n,r(e,a));o.v=n,delete o.e,(!s||!Object.is(i,o.v))&&(++o.n,kr(i)&&$S(i))},JS=(e,t)=>{const n=Ie(e)[14];return Ar(n(e,t))},QS=(e,t,...n)=>{const r=Ie(e),o=r[12],s=r[13],i=r[16];try{return i(e,t,...n)}finally{s(e),o(e)}},e2=(e,t,n)=>{const r=Ie(e),o=r[12],s=r[18],i=r[19],c=s(e,t).l;return c.add(n),o(e),()=>{c.delete(n),i(e,t),o(e)}},sd=new WeakMap,Ie=e=>{const t=sd.get(e);if((at?"production":void 0)!=="production"&&!t)throw new Error("Store must be created by buildStore to read its building blocks");return t};function t2(...e){const t={get(r){const o=Ie(t)[21];return o(t,r)},set(r,...o){const s=Ie(t)[22];return s(t,r,...o)},sub(r,o){const s=Ie(t)[23];return s(t,r,o)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},VS,NS,BS,FS,zS,WS,US,HS,GS,KS,YS,qS,ZS,XS,JS,QS,e2,void 0].map((r,o)=>e[o]||r);return sd.set(t,Object.freeze(n)),t}const id={};let n2=0;function rn(e,t){const n=`atom${++n2}`,r={toString(){return(id?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof e=="function"?r.read=e:(r.init=e,r.read=r2,r.write=o2),r}function r2(e){return e(this)}function o2(e,t,n){return t(this,typeof n=="function"?n(e(this)):n)}function s2(){return t2()}let pn;function i2(){return pn||(pn=s2(),(id?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=pn),globalThis.__JOTAI_DEFAULT_STORE__!==pn&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),pn}const a2={},c2=x.createContext(void 0);function ad(e){return x.useContext(c2)||i2()}const ds=e=>typeof(e==null?void 0:e.then)=="function",fs=e=>{e.status||(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}))},l2=x.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(fs(e),e)}),Eo=new WeakMap,fc=(e,t)=>{let n=Eo.get(e);return n||(n=new Promise((r,o)=>{let s=e;const i=u=>l=>{s===u&&r(l)},a=u=>l=>{s===u&&o(l)},c=()=>{try{const u=t();ds(u)?(Eo.set(u,n),s=u,u.then(i(u),a(u)),ls(u,c)):r(u)}catch(u){o(u)}};e.then(i(e),a(e)),ls(e,c)}),Eo.set(e,n)),n};function Rr(e,t){const{delay:n,unstable_promiseStatus:r=!x.use}={},o=ad(),[[s,i,a],c]=x.useReducer(l=>{const d=o.get(e);return Object.is(l[0],d)&&l[1]===o&&l[2]===e?l:[d,o,e]},void 0,()=>[o.get(e),o,e]);let u=s;if((i!==o||a!==e)&&(c(),u=o.get(e)),x.useEffect(()=>{const l=o.sub(e,()=>{if(r)try{const d=o.get(e);ds(d)&&fs(fc(d,()=>o.get(e)))}catch{}if(typeof n=="number"){setTimeout(c,n);return}c()});return c(),l},[o,e,n,r]),x.useDebugValue(u),ds(u)){const l=fc(u,()=>o.get(e));return r&&fs(l),l2(l)}return u}function u2(e,t){const n=ad();return x.useCallback((...o)=>{if((a2?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return n.set(e,...o)},[n,e])}function Wt(e,t){return[Rr(e),u2(e)]}const si=rn(0),ii=rn(!0),ai=rn(null),cd=rn({windowSeconds:24*60*60,fps:30}),ld=rn([]),ud=rn([]);function ve(e,t,n){return Math.min(n,Math.max(t,e))}function yt(e){const{time:t,windowStart:n,windowSeconds:r,width:o}=e;return o<=0||r<=0?0:(t-n)/r*o}function mn(e){const{px:t,windowStart:n,windowSeconds:r,width:o}=e;return o<=0||r<=0?n:n+t/o*r}function _e(e){return String(Math.floor(e)).padStart(2,"0")}function d2(e=Date.now()){const t=new Date(e);return t.getHours()*3600+t.getMinutes()*60+t.getSeconds()+t.getMilliseconds()/1e3}function Po(e){const t=Math.max(0,e),n=Math.floor(t/3600)%24,r=Math.floor(t%3600/60),o=Math.floor(t%60);return`${_e(n)}:${_e(r)}:${_e(o)}`}function f2(e,t){const n=Math.max(0,e),r=Math.floor(n/3600)%24,o=Math.floor(n%3600/60),s=Math.floor(n%60),i=n-Math.floor(n),a=Math.floor(i*t);return`${_e(r)}:${_e(o)}:${_e(s)}:${_e(a)}`}function Ao(e){const t=Math.max(0,e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),o=Math.floor(t%60);return n>0?`${_e(n)}:${_e(r)}:${_e(o)}`:`${_e(r)}:${_e(o)}`}function h2(e,t){const n=Math.max(0,e),r=Math.floor(n/3600),o=Math.floor(n%3600/60),s=Math.floor(n%60),i=n-Math.floor(n),a=Math.floor(i*t);return r>0?`${_e(r)}:${_e(o)}:${_e(s)}:${_e(a)}`:`${_e(o)}:${_e(s)}:${_e(a)}`}function p2(e){const{width:t,windowSeconds:n,fps:r}=e,o=t>0?t/n:0,s=1/Math.max(1,r),i=[s,2*s,5*s,.25,.5,1,2,5,10,15,30,60,2*60,5*60,10*60,15*60,30*60,60*60,2*60*60,3*60*60,6*60*60],a=90,c=45;let u=i[i.length-1];for(const f of i)if(f*o>=a){u=f;break}const l=[u/2,u/5,u/10].filter(f=>f>0);let d=l[0]??u;for(const f of l)if(f*o>=c){d=f;break}return{majorStep:u,minorStep:d}}const m2=(e,t,n)=>t>=3600?Po(e).slice(0,2)+":00:00":t>=60?Po(e).slice(0,5):t>=1?Po(e):f2(e,n),g2=(e,t,n)=>t>=3600||t>=60||t>=1?Ao(e):h2(e,n);function y2(){const e=x.useRef(null),[t,n]=x.useState(0);return x.useLayoutEffect(()=>{const r=e.current;if(!r)return;const o=new ResizeObserver(()=>{n(r.getBoundingClientRect().width)});return o.observe(r),n(r.getBoundingClientRect().width),()=>o.disconnect()},[]),{ref:e,width:t}}function v2(e){const{totalSeconds:t,enableWheelZoom:n,autoZoomOnSelection:r,tickLabelFormatter:o,clearSelectionOnEventClick:s}=e,[i,a]=Wt(si),[c,u]=Wt(ii),[l,d]=Wt(ai),f=Rr(ld),p=Rr(ud),[m,h]=Wt(cd),{ref:v,width:b}=y2(),S=102,C=Math.max(0,b-S-10),[T,E]=x.useState(0),P=x.useMemo(()=>{const k=Math.max(1/Math.max(1,m.fps),.05);return ve(m.windowSeconds,k,t)},[m.windowSeconds,m.fps,t]);x.useEffect(()=>{if(!c||b<=0)return;const k=ve(i-P*.9,0,Math.max(0,t-P));E(k)},[i,c,b,P,t]);const A=x.useMemo(()=>{const k=ve(T,0,Math.max(0,t-P)),O=k+P;return{start:k,end:O,seconds:P}},[T,t,P]),M=x.useMemo(()=>{if(C<=0)return[];const{majorStep:k,minorStep:O}=p2({width:C,windowSeconds:A.seconds,fps:m.fps}),F=Math.floor(A.start/O)*O,N=A.end,V=[],z=O*1e-6;for(let G=F;G<=N+z;G+=O){const K=yt({time:G,windowStart:A.start,windowSeconds:A.seconds,width:C});if(K<-1||K>C+1)continue;const he=Math.abs(G/k-Math.round(G/k))<1e-6;V.push({time:G,px:K,kind:he?"major":"minor",label:he?o(G,k,m.fps):void 0})}return V},[C,o,A.end,A.seconds,A.start,m.fps]),L=x.useRef(null),$=x.useRef(null),W=k=>{$.current=k,L.current==null&&(L.current=requestAnimationFrame(()=>{L.current=null;const O=$.current;$.current=null,O==null||O()}))};x.useEffect(()=>()=>{L.current!=null&&cancelAnimationFrame(L.current)},[]);const H=x.useRef(null),q=k=>{const O=v.current;if(!O)return 0;const F=O.getBoundingClientRect();return ve(k-F.left-S,0,C)};return{viewportRef:v,width:b,axisLeft:S,axisWidth:C,totalSeconds:t,zoom:m,setZoom:h,isLive:c,setIsLive:u,currentTime:i,selectedRange:l,setSelectedRange:d,videoSegments:f,events:p,view:A,ticks:M,onWheel:k=>{if(!n||b<=0)return;k.preventDefault(),u(!1);const O=q(k.clientX),F=ve(mn({px:O,windowStart:A.start,windowSeconds:A.seconds,width:C}),0,t),V=k.deltaY<0?.8:1.25,z=ve(A.seconds*V,Math.max(1/Math.max(1,m.fps),.05),t),G=ve(F-O/Math.max(1,C)*z,0,Math.max(0,t-z));h(K=>({...K,windowSeconds:z})),E(G)},onPointerDownScrub:k=>{if(k.button!==0)return;const O=v.current;if(!O)return;O.setPointerCapture(k.pointerId);const F=q(k.clientX),N=ve(mn({px:F,windowStart:A.start,windowSeconds:A.seconds,width:C}),0,t);u(!1),H.current={mode:"playhead",pointerId:k.pointerId,startPx:F,startTime:N},a(N)},onPointerDownSelect:k=>{if(k.button!==0)return;const O=v.current;if(!O)return;O.setPointerCapture(k.pointerId);const F=q(k.clientX),N=ve(mn({px:F,windowStart:A.start,windowSeconds:A.seconds,width:C}),0,t);u(!1),H.current={mode:"select",pointerId:k.pointerId,startPx:F,startTime:N},d({start:N,end:N})},onPointerDownPlayhead:k=>{if(k.button!==0)return;const O=v.current;if(!O)return;O.setPointerCapture(k.pointerId);const F=q(k.clientX),N=ve(mn({px:F,windowStart:A.start,windowSeconds:A.seconds,width:C}),0,t);u(!1),H.current={mode:"playhead",pointerId:k.pointerId,startPx:F,startTime:N},a(N)},onPointerMove:k=>{const O=H.current;if(!O||O.pointerId!==k.pointerId)return;const F=q(k.clientX);W(()=>{const N=ve(mn({px:F,windowStart:A.start,windowSeconds:A.seconds,width:C}),0,t);if(O.mode==="playhead")a(N);else{const V=Math.min(O.startTime,N),z=Math.max(O.startTime,N);d({start:V,end:z})}})},onPointerUp:k=>{const O=H.current;if(!(!O||O.pointerId!==k.pointerId)&&(H.current=null,O.mode==="select"&&l)){const F=Math.abs(l.end-l.start);if(F<Math.max(1/Math.max(1,m.fps),.1))d(null);else if(r){const N=ve(F*1.05,Math.max(1/Math.max(1,m.fps),.05),t),V=ve(l.start,0,Math.max(0,t-N));h(z=>({...z,windowSeconds:N})),E(V)}}},onClickEvent:k=>{s&&d(null),u(!1),a(ve(k,0,t)),E(ve(k-A.seconds/2,0,Math.max(0,t-A.seconds)))},resetView:()=>{u(!1),h(k=>({...k,windowSeconds:t})),E(0)}}}const dd=({ticks:e,tickColor:t,labelColor:n})=>g.jsx("div",{className:J.trackArea,children:e.map(r=>g.jsxs("div",{children:[g.jsx("div",{className:`${J.tick} ${r.kind==="minor"?J.tickMinor:J.tickMajor}`.trim(),style:{left:`${r.px}px`,backgroundColor:t}}),r.kind==="major"&&r.label?g.jsx("div",{className:J.tickLabel,style:{left:`${r.px}px`,color:n},children:r.label}):null]},`${r.time}-${r.kind}`))});dd.displayName="TimeScale";const fd=({segments:e,viewStart:t,viewSeconds:n,width:r,totalSeconds:o,segmentColor:s,segmentColorHover:i})=>{const a=e.map(c=>({start:ve(c.start,0,o),end:ve(c.end,0,o)})).filter(c=>c.end>c.start).map(c=>{const u=Math.max(c.start,t),l=Math.min(c.end,t+n);return{start:u,end:l}}).filter(c=>c.end>c.start);return g.jsx("div",{className:J.trackArea,children:a.map((c,u)=>{const l=yt({time:c.start,windowStart:t,windowSeconds:n,width:r}),d=yt({time:c.end,windowStart:t,windowSeconds:n,width:r}),f=Math.max(0,d-l);return g.jsx("div",{className:J.segment,style:{left:`${l}px`,width:`${f}px`,background:s},onMouseEnter:p=>{p.currentTarget.style.background=i},onMouseLeave:p=>{p.currentTarget.style.background=s},"aria-hidden":!0},`${c.start}-${c.end}-${u}`)})})};fd.displayName="VideoTrack";const hd=({events:e,viewStart:t,viewSeconds:n,width:r,totalSeconds:o,onClickEvent:s,eventBg:i,eventBgHover:a,eventDot:c})=>{const u=e.map(l=>({...l,time:ve(l.time,0,o)})).filter(l=>l.time>=t&&l.time<=t+n);return g.jsx("div",{className:J.trackArea,children:u.map(l=>{const d=yt({time:l.time,windowStart:t,windowSeconds:n,width:r});return g.jsx("button",{type:"button",className:J.event,onPointerDown:f=>{f.stopPropagation()},onClick:()=>s(l.time),style:{left:`${d}px`,backgroundColor:i,border:"none",padding:0},onMouseEnter:f=>{f.currentTarget.style.backgroundColor=a},onMouseLeave:f=>{f.currentTarget.style.backgroundColor=i},"aria-label":`Evento em ${l.time.toFixed(2)}s`,children:l.icon?l.icon:g.jsx("span",{className:J.eventDot,style:{backgroundColor:c}})},l.id)})})};hd.displayName="EventsTrack";const pd=({className:e,title:t="Timeline",subtitle:n="Arraste para selecionar e aplicar zoom no período desejado",showHeader:r=!0,timeScaleMode:o="day24h",tickLabelFormatter:s,totalSeconds:i=24*60*60,enableWheelZoom:a=!0,height:c=190,autoZoomOnSelection:u=!0,showZoomControls:l=!0,enableScrubOnTracks:d=!1,clearSelectionOnEventClick:f=!0})=>{const p=Y.useTheme(),m=s??(o==="duration"?g2:m2),{viewportRef:h,axisLeft:v,axisWidth:b,zoom:S,currentTime:y,selectedRange:C,videoSegments:T,events:E,view:P,ticks:A,onWheel:M,onPointerDownScrub:L,onPointerDownSelect:$,onPointerDownPlayhead:W,onPointerMove:H,onPointerUp:q,onClickEvent:oe,resetView:Q,setZoom:U}=v2({totalSeconds:i,enableWheelZoom:a,autoZoomOnSelection:u,tickLabelFormatter:m,clearSelectionOnEventClick:f}),I=b?v+yt({time:y,windowStart:P.start,windowSeconds:P.seconds,width:b}):v,X=p.palette.common.white,R=Y.alpha(p.palette.common.black,.16),w="0px 4px 5.3px 0px rgba(0,0,0,0.16)",j=p.palette.mode==="dark"?Y.alpha(p.palette.common.white,.7):"#79747e",k=Y.alpha(p.palette.common.black,.16),O="#2c2c2c",F=Y.alpha(p.palette.primary.main,.15),N=Y.alpha(p.palette.primary.main,.22),V=Y.alpha(p.palette.common.white,1),z=Y.alpha(p.palette.common.white,1),G=Y.alpha(p.palette.common.black,.55),K=Y.alpha(p.palette.primary.main,.12),he=p.palette.primary.main,D=Math.max(1/Math.max(1,S.fps),.5),Ee=D/i,Xe=(()=>{const on=ve(P.seconds,D,i);if(Ee<=0||Ee>=1)return 0;const sn=Math.log(on/i)/Math.log(Ee)*100;return ve(sn,0,100)})(),ft=on=>{const sn=ve(on,0,100),an=i*Math.pow(Ee,sn/100);U(Zr=>({...Zr,windowSeconds:ve(an,D,i)}))},qr=`${Math.round(Xe)}%`;return g.jsxs(_.Box,{className:`${J.root} ${J.container} ${e??""}`.trim(),sx:{backgroundColor:X,border:`1px solid ${R}`,boxShadow:w,px:1,py:2},children:[r?g.jsxs("div",{className:J.header,children:[g.jsxs("div",{className:J.headerText,children:[g.jsx(_.Typography,{variant:"subtitle1",sx:{color:j,fontWeight:500},children:t}),g.jsx(_.Typography,{variant:"body2",sx:{color:j},children:n})]}),l?g.jsxs("div",{className:J.controls,children:[g.jsx(_.Box,{className:J.iconButton,sx:{border:`1px solid ${Y.alpha(p.palette.common.black,.22)}`},children:g.jsx(_.IconButton,{size:"small",onClick:Q,"aria-label":"Reset zoom",sx:{width:32,height:32},children:g.jsx(iS,{fontSize:"small"})})}),g.jsxs(_.Box,{className:J.zoomGroup,sx:{backgroundColor:p.palette.common.white,border:`1px solid ${Y.alpha(p.palette.common.black,.22)}`},"aria-label":"Zoom controls",children:[g.jsx(_.IconButton,{size:"small","aria-label":"Zoom out",onClick:()=>ft(Xe-10),children:g.jsx(cS,{fontSize:"small"})}),g.jsxs("div",{className:J.zoomTrack,"aria-hidden":!0,children:[g.jsx("div",{style:{position:"absolute",inset:0,backgroundColor:Y.alpha("#f5f5f5",.3),borderRadius:1,boxShadow:"1px 1px 1px rgba(10,10,10,0.04)"}}),g.jsx("div",{className:J.zoomTrackFill,style:{width:qr,backgroundColor:"#f5f5f5",boxShadow:"1px 1px 1px rgba(10,10,10,0.04)"}})]}),g.jsx(_.IconButton,{size:"small","aria-label":"Zoom in",onClick:()=>ft(Xe+10),children:g.jsx(aS,{fontSize:"small"})})]})]}):null]}):null,g.jsx(_.Box,{sx:{mt:r?2:0,height:c},children:g.jsxs("div",{ref:h,className:J.layers,onWheel:M,onPointerMove:H,onPointerUp:q,children:[g.jsxs("div",{className:J.playhead,style:{left:`${I}px`},onPointerDown:W,role:"slider","aria-label":"Playhead","aria-valuemin":0,"aria-valuemax":i,"aria-valuenow":y,tabIndex:0,children:[g.jsx("div",{className:J.playheadHandle,style:{borderBottomColor:he}}),g.jsx("div",{className:J.playheadLine,style:{backgroundColor:he}})]}),g.jsxs("div",{className:`${J.trackLabelRow} ${J.timeScale}`.trim(),children:[g.jsx("div",{}),g.jsx("div",{onPointerDown:L,style:{height:"100%",cursor:"ew-resize"},"aria-label":"Régua do tempo",children:g.jsx(dd,{ticks:A,tickColor:k,labelColor:O})})]}),g.jsxs(_.Box,{className:J.trackBox,sx:{mt:1,border:`1px solid ${Y.alpha(p.palette.common.black,.1)}`,borderRadius:"12px",height:106,position:"relative"},children:[C?g.jsx("div",{className:J.selectionOverlay,style:{left:`${v+yt({time:C.start,windowStart:P.start,windowSeconds:P.seconds,width:b})}px`,width:`${Math.max(0,yt({time:C.end,windowStart:P.start,windowSeconds:P.seconds,width:b})-yt({time:C.start,windowStart:P.start,windowSeconds:P.seconds,width:b}))}px`,backgroundColor:K}}):null,g.jsxs("div",{className:`${J.trackLabelRow} ${J.videoTrack}`.trim(),children:[g.jsx("div",{className:J.label,style:{color:j},children:"Video"}),g.jsx("div",{onPointerDown:d?L:void 0,style:{height:"100%"},children:g.jsx(fd,{segments:T,viewStart:P.start,viewSeconds:P.seconds,width:b,totalSeconds:i,segmentColor:F,segmentColorHover:N})})]}),g.jsxs("div",{className:`${J.trackLabelRow} ${J.eventsTrack}`.trim(),children:[g.jsx("div",{className:J.label,style:{color:j},children:"Eventos"}),g.jsx("div",{onPointerDown:d?L:void 0,style:{height:"100%"},children:g.jsx(hd,{events:E,viewStart:P.start,viewSeconds:P.seconds,width:b,totalSeconds:i,onClickEvent:oe,eventBg:V,eventBgHover:z,eventDot:G})})]}),g.jsx("div",{onPointerDown:$,style:{position:"absolute",left:v,right:10,top:0,bottom:0,cursor:"crosshair"},"aria-label":"Arraste para selecionar"})]})]})})]})};pd.displayName="VideoTimeline";const md=({stream:e=null,src:t,autoPlay:n=!0,muted:r=!0,playsInline:o=!0,className:s,liveEdgeThresholdSeconds:i=2,updateTimeForLiveStream:a=!0,constrainToSelectedRange:c=!0,loopSelection:u=!1})=>{const l=x.useRef(null),[d,f]=Wt(si),[p,m]=Wt(ii),h=Rr(ai),v=!!e;x.useEffect(()=>{const y=l.current;if(y){if(e){y.srcObject=e;return}y.srcObject=null,t&&(y.src=t)}},[e,t]),x.useEffect(()=>{const y=l.current;if(!y||v)return;const C=()=>{if(c&&h){const P=Math.max(0,h.start),A=Math.max(P,h.end);y.currentTime<P?y.currentTime=P:y.currentTime>A&&(u?y.currentTime=P:(y.pause(),y.currentTime=A))}if(f(y.currentTime),Number.isFinite(y.duration)&&y.duration>0){const P=y.duration-y.currentTime<=i;m(P)}},T=()=>{if(!c||!h)return;const P=Math.max(0,h.start),A=Math.max(P,h.end);(y.currentTime<P||y.currentTime>A)&&(y.currentTime=P)},E=()=>{p&&Number.isFinite(y.duration)&&y.duration>0&&(y.currentTime=y.duration)};return y.addEventListener("timeupdate",C),y.addEventListener("play",T),y.addEventListener("loadedmetadata",E),()=>{y.removeEventListener("timeupdate",C),y.removeEventListener("play",T),y.removeEventListener("loadedmetadata",E)}},[c,v,p,i,u,h,f,m]);const b=x.useRef(-1);x.useEffect(()=>{const y=l.current;if(!y||v||!t)return;if(p){if(Number.isFinite(y.duration)&&y.duration>0){const T=y.duration;Math.abs(y.currentTime-T)>.25&&(y.currentTime=T,b.current=T)}return}if(Math.abs(b.current-d)<.05)return;let C=d;if(c&&h){const T=Math.max(0,h.start),E=Math.max(T,h.end);C=Math.min(E,Math.max(T,C))}Math.abs(y.currentTime-C)>.25&&(y.currentTime=C,b.current=d)},[c,d,p,v,h,t]),x.useEffect(()=>{const y=l.current;if(!y||v||!t||!c||!h)return;const C=Math.max(0,h.start),T=!y.paused;y.currentTime=C,b.current=C,m(!1),f(C),T&&y.play().catch(()=>{})},[c,v,h,f,m,t]),x.useEffect(()=>{if(!v||(m(!0),!a))return;let y=null,C=!0;const T=()=>{C&&(f(d2()),y=requestAnimationFrame(T))};return y=requestAnimationFrame(T),()=>{C=!1,y!=null&&cancelAnimationFrame(y)}},[v,f,m,a]);const S=x.useMemo(()=>({width:"100%",maxWidth:920,background:"black",aspectRatio:"16 / 9",display:"block"}),[]);return g.jsx("video",{ref:l,className:s,style:S,autoPlay:n,muted:r,playsInline:o,controls:!0})};md.displayName="VideoPlayerWebRTC";const b2=dt(g.jsx("path",{d:"M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z"}),"Done"),x2="_container_1vjy6_1",S2="_segment_1vjy6_7",T2="_selected_1vjy6_20",w2="_label_1vjy6_28",C2="_icon_1vjy6_37",_2="_checkIcon_1vjy6_47",E2="_unselected_1vjy6_53",Et={container:x2,segment:S2,selected:T2,label:w2,icon:C2,checkIcon:_2,unselected:E2},gd=({items:e,className:t,sx:n,...r})=>{const s=_.useTheme().palette.mode==="dark",i=(a,c)=>{a.onClick?a.onClick(c):console.log(`Item "${a.label}" clicado`)};return g.jsx(_.Box,{className:`${Et.container} ${t||""}`,sx:n,"data-theme":s?"dark":"light",...r,children:e.map((a,c)=>g.jsxs(_.Box,{className:`${Et.segment} ${a.selected?Et.selected:Et.unselected}`,onClick:u=>i(a,u),children:[a.selected&&g.jsx(_.Box,{className:Et.icon,children:g.jsx(b2,{className:Et.checkIcon})}),g.jsx(_.Box,{className:Et.label,children:a.label})]},c))})};gd.displayName="DisplayTypes";exports.Button=hs;exports.CountCard=fg;exports.DisplayTypes=gd;exports.FilterButton=xc;exports.FilterChip=Sc;exports.FilterModal=Qc;exports.GoogleMap=ll;exports.MapContent=Cs;exports.MapMarkers=Yu;exports.MapSpot=ri;exports.ModuleMenu=Qu;exports.NotFoundContent=Zu;exports.SearchBar=qu;exports.SidebarMenu=Ju;exports.VideoPlayer=ed;exports.VideoPlayerWebRTC=md;exports.VideoTimeline=pd;exports.VisioThemeProvider=Md;exports.ZoomControls=bg;exports.currentTimeAtom=si;exports.darkColors=me;exports.darkTheme=yc;exports.eventsAtom=ud;exports.isLiveAtom=ii;exports.lightColors=pe;exports.lightTheme=gc;exports.radiiTokens=rr;exports.selectedRangeAtom=ai;exports.spacingScale=Ed;exports.spacingTokens=pc;exports.typographyTokens=Pe;exports.useGoogleMapContext=cl;exports.useVisioTheme=kd;exports.videoSegmentsAtom=ld;exports.zoomAtom=cd;
|
|
98
|
+
`),()=>{T.contains(C)&&T.removeChild(C)}},[t]),g.jsx(B1,{isPresent:t,childRef:i,sizeRef:a,children:Fe.cloneElement(e,{ref:l})})}const z1=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:o,presenceAffectsLayout:s,mode:i,anchorX:a,anchorY:c,root:u})=>{const l=Es(W1),d=x.useId();let f=!0,p=x.useMemo(()=>(f=!1,{id:d,initial:t,isPresent:n,custom:o,onExitComplete:m=>{l.set(m,!0);for(const h of l.values())if(!h)return;r&&r()},register:m=>(l.set(m,!1),()=>l.delete(m))}),[n,l,r]);return s&&f&&(p={...p}),x.useMemo(()=>{l.forEach((m,h)=>l.set(h,!1))},[n]),Fe.useEffect(()=>{!n&&!l.size&&r&&r()},[n]),i==="popLayout"&&(e=g.jsx(F1,{isPresent:n,anchorX:a,anchorY:c,root:u,children:e})),g.jsx(Hr.Provider,{value:p,children:e})};function W1(){return new Map}function Iu(e=!0){const t=x.useContext(Hr);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=t,s=x.useId();x.useEffect(()=>{if(e)return o(s)},[e]);const i=x.useCallback(()=>e&&r&&r(s),[s,r,e]);return!n&&r?[!1,i]:[!0]}const tr=e=>e.key||"";function Za(e){const t=[];return x.Children.forEach(e,n=>{x.isValidElement(n)&&t.push(n)}),t}const U1=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:o=!0,mode:s="sync",propagate:i=!1,anchorX:a="left",anchorY:c="top",root:u})=>{const[l,d]=Iu(i),f=x.useMemo(()=>Za(e),[e]),p=i&&!l?[]:f.map(tr),m=x.useRef(!0),h=x.useRef(f),v=Es(()=>new Map),b=x.useRef(new Set),[S,y]=x.useState(f),[C,T]=x.useState(f);dl(()=>{m.current=!1,h.current=f;for(let A=0;A<C.length;A++){const M=tr(C[A]);p.includes(M)?(v.delete(M),b.current.delete(M)):v.get(M)!==!0&&v.set(M,!1)}},[C,p.length,p.join("-")]);const E=[];if(f!==S){let A=[...f];for(let M=0;M<C.length;M++){const L=C[M],$=tr(L);p.includes($)||(A.splice(M,0,L),E.push(L))}return s==="wait"&&E.length&&(A=E),T(Za(A)),y(f),null}process.env.NODE_ENV!=="production"&&s==="wait"&&C.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:P}=x.useContext(_s);return g.jsx(g.Fragment,{children:C.map(A=>{const M=tr(A),L=i&&!l?!1:f===C||p.includes(M),$=()=>{if(b.current.has(M))return;if(b.current.add(M),v.has(M))v.set(M,!0);else return;let W=!0;v.forEach(H=>{H||(W=!1)}),W&&(P==null||P(),T(h.current),i&&(d==null||d()),r&&r())};return g.jsx(z1,{isPresent:L,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:o,mode:s,root:u,onExitComplete:L?void 0:$,anchorX:a,anchorY:c,children:A},M)})})},ju=x.createContext({strict:!1}),Xa={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"]};let Ja=!1;function H1(){if(Ja)return;const e={};for(const t in Xa)e[t]={isEnabled:n=>Xa[t].some(r=>!!n[r])};lu(e),Ja=!0}function Lu(){return H1(),kv()}function G1(e){const t=Lu();for(const n in e)t[n]={...t[n],...e[n]};lu(t)}const K1=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 Pr(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||K1.has(e)}let Du=e=>!Pr(e);function Y1(e){typeof e=="function"&&(Du=t=>t.startsWith("on")?!Pr(t):e(t))}try{Y1(require("@emotion/is-prop-valid").default)}catch{}function q1(e,t,n){const r={};for(const o in e)o==="values"&&typeof e.values=="object"||(Du(o)||n===!0&&Pr(o)||!t&&!Pr(o)||e.draggable&&o.startsWith("onDrag"))&&(r[o]=e[o]);return r}const Yr=x.createContext({});function Z1(e,t){if(Kr(e)){const{initial:n,animate:r}=e;return{initial:n===!1||On(n)?n:void 0,animate:On(r)?r:void 0}}return e.inherit!==!1?t:{}}function X1(e){const{initial:t,animate:n}=Z1(e,x.useContext(Yr));return x.useMemo(()=>({initial:t,animate:n}),[Qa(t),Qa(n)])}function Qa(e){return Array.isArray(e)?e.join(" "):e}const ti=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function $u(e,t,n){for(const r in t)!Oe(t[r])&&!gu(r,n)&&(e[r]=t[r])}function J1({transformTemplate:e},t){return x.useMemo(()=>{const n=ti();return Js(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Q1(e,t){const n=e.style||{},r={};return $u(r,n,e),Object.assign(r,J1(e,t)),r}function eb(e,t){const n={},r=Q1(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const Vu=()=>({...ti(),attrs:{}});function tb(e,t,n,r){const o=x.useMemo(()=>{const s=Vu();return yu(s,t,bu(r),e.transformTemplate,e.style),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};$u(s,e.style,e),o.style={...s,...o.style}}return o}const nb=["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 ni(e){return typeof e!="string"||e.includes("-")?!1:!!(nb.indexOf(e)>-1||/[A-Z]/u.test(e))}function rb(e,t,n,{latestValues:r},o,s=!1,i){const c=(i??ni(e)?tb:eb)(t,r,o,e),u=q1(t,typeof e=="string",s),l=e!==x.Fragment?{...u,...c,ref:n}:{},{children:d}=t,f=x.useMemo(()=>Oe(d)?d.get():d,[d]);return x.createElement(e,{...l,children:f})}function ob({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,o){return{latestValues:sb(n,r,o,e),renderState:t()}}function sb(e,t,n,r){const o={},s=r(e,{});for(const f in s)o[f]=fr(s[f]);let{initial:i,animate:a}=e;const c=Kr(e),u=cu(e);t&&u&&!c&&e.inherit!==!1&&(i===void 0&&(i=t.initial),a===void 0&&(a=t.animate));let l=n?n.initial===!1:!1;l=l||i===!1;const d=l?a:i;if(d&&typeof d!="boolean"&&!Gr(d)){const f=Array.isArray(d)?d:[d];for(let p=0;p<f.length;p++){const m=Hs(e,f[p]);if(m){const{transitionEnd:h,transition:v,...b}=m;for(const S in b){let y=b[S];if(Array.isArray(y)){const C=l?y.length-1:0;y=y[C]}y!==null&&(o[S]=y)}for(const S in h)o[S]=h[S]}}}return o}const Nu=e=>(t,n)=>{const r=x.useContext(Yr),o=x.useContext(Hr),s=()=>ob(e,t,r,o);return n?s():Es(s)},ib=Nu({scrapeMotionValuesFromProps:Qs,createRenderState:ti}),ab=Nu({scrapeMotionValuesFromProps:xu,createRenderState:Vu}),cb=Symbol.for("motionComponentSymbol");function lb(e,t,n){const r=x.useRef(n);x.useInsertionEffect(()=>{r.current=n});const o=x.useRef(null);return x.useCallback(s=>{var a;s&&((a=e.onMount)==null||a.call(e,s)),t&&(s?t.mount(s):t.unmount());const i=r.current;if(typeof i=="function")if(s){const c=i(s);typeof c=="function"&&(o.current=c)}else o.current?(o.current(),o.current=null):i(s);else i&&(i.current=s)},[t])}const Bu=x.createContext({});function yn(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function ub(e,t,n,r,o,s){var b,S;const{visualElement:i}=x.useContext(Yr),a=x.useContext(ju),c=x.useContext(Hr),u=x.useContext(ei).reducedMotion,l=x.useRef(null),d=x.useRef(!1);r=r||a.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:i,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,isSVG:s}),d.current&&l.current&&(l.current.manuallyAnimateOnMount=!0));const f=l.current,p=x.useContext(Bu);f&&!f.projection&&o&&(f.type==="html"||f.type==="svg")&&db(l.current,n,o,p);const m=x.useRef(!1);x.useInsertionEffect(()=>{f&&m.current&&f.update(n,c)});const h=n[Yl],v=x.useRef(!!h&&!((b=window.MotionHandoffIsComplete)!=null&&b.call(window,h))&&((S=window.MotionHasOptimisedAnimation)==null?void 0:S.call(window,h)));return dl(()=>{d.current=!0,f&&(m.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),f.scheduleRenderMicrotask(),v.current&&f.animationState&&f.animationState.animateChanges())}),x.useEffect(()=>{f&&(!v.current&&f.animationState&&f.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)==null||y.call(window,h)}),v.current=!1),f.enteringChildren=void 0)}),f}function db(e,t,n,r){const{layoutId:o,layout:s,drag:i,dragConstraints:a,layoutScroll:c,layoutRoot:u,layoutCrossfade:l}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Fu(e.parent)),e.projection.setOptions({layoutId:o,layout:s,alwaysMeasureLayout:!!i||a&&yn(a),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:r,crossfade:l,layoutScroll:c,layoutRoot:u})}function Fu(e){if(e)return e.options.allowProjection!==!1?e.projection:Fu(e.parent)}function xo(e,{forwardMotionProps:t=!1,type:n}={},r,o){r&&G1(r);const s=n?n==="svg":ni(e),i=s?ab:ib;function a(u,l){let d;const f={...x.useContext(ei),...u,layoutId:fb(u)},{isStatic:p}=f,m=X1(u),h=i(u,p);if(!p&&ul){hb(f,r);const v=pb(f);d=v.MeasureLayout,m.visualElement=ub(e,h,f,o,v.ProjectionNode,s)}return g.jsxs(Yr.Provider,{value:m,children:[d&&m.visualElement?g.jsx(d,{visualElement:m.visualElement,...f}):null,rb(e,u,lb(h,m.visualElement,l),h,p,t,s)]})}a.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const c=x.forwardRef(a);return c[cb]=e,c}function fb({layoutId:e}){const t=x.useContext(_s).id;return t&&e!==void 0?t+"-"+e:e}function hb(e,t){const n=x.useContext(ju).strict;if(process.env.NODE_ENV!=="production"&&t&&n){const r="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?Qt(!1,r,"lazy-strict-mode"):lt(!1,r,"lazy-strict-mode")}}function pb(e){const t=Lu(),{drag:n,layout:r}=t;if(!n&&!r)return{};const o={...n,...r};return{MeasureLayout:n!=null&&n.isEnabled(e)||r!=null&&r.isEnabled(e)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}function mb(e,t){if(typeof Proxy>"u")return xo;const n=new Map,r=(s,i)=>xo(s,i,e,t),o=(s,i)=>(process.env.NODE_ENV!=="production"&&Rs(!1,"motion() is deprecated. Use motion.create() instead."),r(s,i));return new Proxy(o,{get:(s,i)=>i==="create"?r:(n.has(i)||n.set(i,xo(i,void 0,e,t)),n.get(i))})}const gb=(e,t)=>t.isSVG??ni(e)?new Kv(t):new Fv(t,{allowProjection:e!==x.Fragment});class yb extends wt{constructor(t){super(t),t.animationState||(t.animationState=Jv(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Gr(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let vb=0;class bb extends wt{constructor(){super(...arguments),this.id=vb++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const o=this.node.animationState.setActive("exit",!t);n&&!t&&o.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const xb={animation:{Feature:yb},exit:{Feature:bb}};function Wn(e){return{point:{x:e.pageX,y:e.pageY}}}const Sb=e=>t=>qs(t)&&e(t,Wn(t));function Cn(e,t,n,r){return In(e,t,Sb(n),r)}const zu=({current:e})=>e?e.ownerDocument.defaultView:null,ec=(e,t)=>Math.abs(e-t);function Tb(e,t){const n=ec(e.x,t.x),r=ec(e.y,t.y);return Math.sqrt(n**2+r**2)}const tc=new Set(["auto","scroll"]);class Wu{constructor(t,n,{transformPagePoint:r,contextWindow:o=window,dragSnapToOrigin:s=!1,distanceThreshold:i=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=p=>{this.handleScroll(p.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=To(this.lastMoveEventInfo,this.history),m=this.startEvent!==null,h=Tb(p.offset,{x:0,y:0})>=this.distanceThreshold;if(!m&&!h)return;const{point:v}=p,{timestamp:b}=Me;this.history.push({...v,timestamp:b});const{onStart:S,onMove:y}=this.handlers;m||(S&&S(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,p)},this.handlePointerMove=(p,m)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=So(m,this.transformPagePoint),le.update(this.updatePoint,!0)},this.handlePointerUp=(p,m)=>{this.end();const{onEnd:h,onSessionEnd:v,resumeAnimation:b}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const S=To(p.type==="pointercancel"?this.lastMoveEventInfo:So(m,this.transformPagePoint),this.history);this.startEvent&&h&&h(p,S),v&&v(p,S)},!qs(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=i,this.contextWindow=o||window;const c=Wn(t),u=So(c,this.transformPagePoint),{point:l}=u,{timestamp:d}=Me;this.history=[{...l,timestamp:d}];const{onSessionStart:f}=n;f&&f(t,To(u,this.history)),this.removeListeners=Bn(Cn(this.contextWindow,"pointermove",this.handlePointerMove),Cn(this.contextWindow,"pointerup",this.handlePointerUp),Cn(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(tc.has(r.overflowX)||tc.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,o=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},s={x:o.x-n.x,y:o.y-n.y};s.x===0&&s.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(t,o),le.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),vt(this.updatePoint)}}function So(e,t){return t?{point:t(e.point)}:e}function nc(e,t){return{x:e.x-t.x,y:e.y-t.y}}function To({point:e},t){return{point:e,delta:nc(e,Uu(t)),offset:nc(e,wb(t)),velocity:Cb(t,.1)}}function wb(e){return e[0]}function Uu(e){return e[e.length-1]}function Cb(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=Uu(e);for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>rt(t)));)n--;if(!r)return{x:0,y:0};const s=He(o.timestamp-r.timestamp);if(s===0)return{x:0,y:0};const i={x:(o.x-r.x)/s,y:(o.y-r.y)/s};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function _b(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?fe(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?fe(n,e,r.max):Math.min(e,n)),e}function rc(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function Eb(e,{top:t,left:n,bottom:r,right:o}){return{x:rc(e.x,n,o),y:rc(e.y,t,r)}}function oc(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function Pb(e,t){return{x:oc(e.x,t.x),y:oc(e.y,t.y)}}function Ab(e,t){let n=.5;const r=De(e),o=De(t);return o>r?n=Mn(t.min,t.max-r,e.min):r>o&&(n=Mn(e.min,e.max-o,t.min)),st(0,1,n)}function Mb(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const is=.35;function kb(e=is){return e===!1?e=0:e===!0&&(e=is),{x:sc(e,"left","right"),y:sc(e,"top","bottom")}}function sc(e,t,n){return{min:ic(e,t),max:ic(e,n)}}function ic(e,t){return typeof e=="number"?e:e[t]||0}const Rb=new WeakMap;class Ob{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ce(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const s=d=>{n?(this.stopAnimation(),this.snapToCursor(Wn(d).point)):this.pauseAnimation()},i=(d,f)=>{this.stopAnimation();const{drag:p,dragPropagation:m,onDragStart:h}=this.getProps();if(p&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=vv(p),!this.openDragLock))return;this.latestPointerEvent=d,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ze(b=>{let S=this.getAxisMotionValue(b).get()||0;if(ot.test(S)){const{projection:y}=this.visualElement;if(y&&y.layout){const C=y.layout.layoutBox[b];C&&(S=De(C)*(parseFloat(S)/100))}}this.originPoint[b]=S}),h&&le.postRender(()=>h(d,f)),Jo(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},a=(d,f)=>{this.latestPointerEvent=d,this.latestPanInfo=f;const{dragPropagation:p,dragDirectionLock:m,onDirectionLock:h,onDrag:v}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:b}=f;if(m&&this.currentDirection===null){this.currentDirection=Ib(b),this.currentDirection!==null&&h&&h(this.currentDirection);return}this.updateAxis("x",f.point,b),this.updateAxis("y",f.point,b),this.visualElement.render(),v&&v(d,f)},c=(d,f)=>{this.latestPointerEvent=d,this.latestPanInfo=f,this.stop(d,f),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>ze(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)==null?void 0:f.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new Wu(t,{onSessionStart:s,onStart:i,onMove:a,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:r,contextWindow:zu(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,o=n||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!o||!r)return;const{velocity:i}=o;this.startAnimation(i);const{onDragEnd:a}=this.getProps();a&&le.postRender(()=>a(r,o))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:o}=this.getProps();if(!r||!nr(t,o,this.currentDirection))return;const s=this.getAxisMotionValue(t);let i=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(i=_b(i,this.constraints[t],this.elastic[t])),s.set(i)}resolveConstraints(){var s;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)==null?void 0:s.layout,o=this.constraints;t&&yn(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=Eb(r.layoutBox,t):this.constraints=!1,this.elastic=kb(n),o!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&ze(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=Mb(r.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!yn(t))return!1;const r=t.current;lt(r!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const s=Lv(r,o.root,this.visualElement.getTransformPagePoint());let i=Pb(o.layout.layoutBox,s);if(n){const a=n(Ov(i));this.hasMutatedConstraints=!!a,a&&(i=du(a))}return i}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:o,dragTransition:s,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},u=ze(l=>{if(!nr(l,n,this.currentDirection))return;let d=c&&c[l]||{};i&&(d={min:0,max:0});const f=o?200:1e6,p=o?40:1e7,m={type:"inertia",velocity:r?t[l]:0,bounceStiffness:f,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...s,...d};return this.startAxisValueAnimation(l,m)});return Promise.all(u).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Jo(this.visualElement,t),r.start(Us(t,r,0,n,this.visualElement,!1))}stopAnimation(){ze(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){ze(t=>{var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),o=r[n];return o||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){ze(n=>{const{drag:r}=this.getProps();if(!nr(n,r,this.currentDirection))return;const{projection:o}=this.visualElement,s=this.getAxisMotionValue(n);if(o&&o.layout){const{min:i,max:a}=o.layout.layoutBox[n],c=s.get()||0;s.set(t[n]-fe(i,a,.5)+c)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!yn(n)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};ze(i=>{const a=this.getAxisMotionValue(i);if(a&&this.constraints!==!1){const c=a.get();o[i]=Ab({min:c,max:c},this.constraints[i])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),ze(i=>{if(!nr(i,t,null))return;const a=this.getAxisMotionValue(i),{min:c,max:u}=this.constraints[i];a.set(fe(c,u,o[i]))})}addListeners(){if(!this.visualElement.current)return;Rb.set(this.visualElement,this);const t=this.visualElement.current,n=Cn(t,"pointerdown",c=>{const{drag:u,dragListener:l=!0}=this.getProps(),d=c.target,f=d!==t&&su(d);u&&l&&!f&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();yn(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,s=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),le.read(r);const i=In(window,"resize",()=>this.scalePositionWithinConstraints()),a=o.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(ze(l=>{const d=this.getAxisMotionValue(l);d&&(this.originPoint[l]+=c[l].translate,d.set(d.get()+c[l].translate))}),this.visualElement.render())});return()=>{i(),n(),s(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:s=!1,dragElastic:i=is,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:o,dragConstraints:s,dragElastic:i,dragMomentum:a}}}function nr(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Ib(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class jb extends wt{constructor(t){super(t),this.removeGroupControls=Ge,this.removeListeners=Ge,this.controls=new Ob(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ge}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const ac=e=>(t,n)=>{e&&le.postRender(()=>e(t,n))};class Lb extends wt{constructor(){super(...arguments),this.removePointerDownListener=Ge}onPointerDown(t){this.session=new Wu(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:zu(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:ac(t),onStart:ac(n),onMove:r,onEnd:(s,i)=>{delete this.session,o&&le.postRender(()=>o(s,i))}}}mount(){this.removePointerDownListener=Cn(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let wo=!1;class Db extends x.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:o}=this.props,{projection:s}=t;s&&(n.group&&n.group.add(s),r&&r.register&&o&&r.register(s),wo&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),hr.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:o,isPresent:s}=this.props,{projection:i}=r;return i&&(i.isPresent=s,t.layoutDependency!==n&&i.setOptions({...i.options,layoutDependency:n}),wo=!0,o||t.layoutDependency!==n||n===void 0||t.isPresent!==s?i.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?i.promote():i.relegate()||le.postRender(()=>{const a=i.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Ys.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:o}=t;wo=!0,o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Hu(e){const[t,n]=Iu(),r=x.useContext(_s);return g.jsx(Db,{...e,layoutGroup:r,switchLayoutGroup:x.useContext(Bu),isPresent:t,safeToRemove:n})}const $b={pan:{Feature:Lb},drag:{Feature:jb,ProjectionNode:Ou,MeasureLayout:Hu}};function cc(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,s=r[o];s&&le.postRender(()=>s(t,Wn(t)))}class Vb extends wt{mount(){const{current:t}=this.node;t&&(this.unmount=bv(t,(n,r)=>(cc(this.node,r,"Start"),o=>cc(this.node,o,"End"))))}unmount(){}}class Nb extends wt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!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=Bn(In(this.node.current,"focus",()=>this.onFocus()),In(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function lc(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),s=r[o];s&&le.postRender(()=>s(t,Wn(t)))}class Bb extends wt{mount(){const{current:t}=this.node;t&&(this.unmount=Tv(t,(n,r)=>(lc(this.node,r,"Start"),(o,{success:s})=>lc(this.node,o,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const as=new WeakMap,Co=new WeakMap,Fb=e=>{const t=as.get(e.target);t&&t(e)},zb=e=>{e.forEach(Fb)};function Wb({root:e,...t}){const n=e||document;Co.has(n)||Co.set(n,{});const r=Co.get(n),o=JSON.stringify(t);return r[o]||(r[o]=new IntersectionObserver(zb,{root:e,...t})),r[o]}function Ub(e,t,n){const r=Wb(t);return as.set(e,n),r.observe(e),()=>{as.delete(e),r.unobserve(e)}}const Hb={some:0,all:1};class Gb extends wt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:o="some",once:s}=t,i={root:n?n.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:Hb[o]},a=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,s&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:l,onViewportLeave:d}=this.node.getProps(),f=u?l:d;f&&f(c)};return Ub(this.node.current,i,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(Kb(t,n))&&this.startObserver()}unmount(){}}function Kb({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Yb={inView:{Feature:Gb},tap:{Feature:Bb},focus:{Feature:Nb},hover:{Feature:Vb}},qb={layout:{ProjectionNode:Ou,MeasureLayout:Hu}},Zb={...xb,...Yb,...$b,...qb},vn=mb(Zb,gb),Gu="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0.75%203.1875C0.75%201.84104%201.84104%200.75%203.1875%200.75L5.625%200.75V2.25H3.1875C2.66946%202.25%202.25%202.66946%202.25%203.1875V5.625H0.75L0.75%203.1875Z'%20fill='%23FDFCFC'/%3e%3cpath%20d='M0.75%2014.8125L0.75%2012.375H2.25V14.8125C2.25%2015.3305%202.66946%2015.75%203.1875%2015.75H5.625V17.25H3.1875C1.84104%2017.25%200.75%2016.159%200.75%2014.8125Z'%20fill='%23FDFCFC'/%3e%3cpath%20d='M15.75%2014.8125V12.375H17.25V14.8125C17.25%2016.159%2016.159%2017.25%2014.8125%2017.25H12.375V15.75H14.8125C15.3305%2015.75%2015.75%2015.3305%2015.75%2014.8125Z'%20fill='%23FDFCFC'/%3e%3cpath%20d='M15.75%203.1875C15.75%202.66946%2015.3305%202.25%2014.8125%202.25H12.375V0.75L14.8125%200.75C16.159%200.75%2017.25%201.84104%2017.25%203.1875V5.625H15.75V3.1875Z'%20fill='%23FDFCFC'/%3e%3cpath%20d='M10.8889%2010.5C11.6372%2010.5%2012.3895%2010.6845%2012.991%2011.053L12.9902%2011.0537C13.3468%2011.2719%2013.6565%2011.5584%2013.8684%2011.9092L14.5298%2013.0049L13.2451%2013.7798L12.5845%2012.6841C12.5191%2012.576%2012.3992%2012.4499%2012.2073%2012.3325C11.8787%2012.1312%2011.4076%2012%2010.8889%2012H7.11108C6.59216%2012%206.1214%2012.1305%205.79199%2012.3318L5.79272%2012.3325C5.64854%2012.4207%205.54509%2012.5138%205.47485%2012.6006L5.41553%2012.6841L4.75488%2013.7798L3.47021%2013.0049L4.13086%2011.9092C4.34281%2011.5583%204.6531%2011.2712%205.00977%2011.053C5.6104%2010.6859%206.36112%2010.5%207.11108%2010.5H10.8889Z'%20fill='%23FDFCFC'/%3e%3cpath%20d='M10.5%206.75C10.5%205.92157%209.82843%205.25%209%205.25C8.17157%205.25%207.5%205.92157%207.5%206.75C7.5%207.57843%208.17157%208.25%209%208.25C9.82843%208.25%2010.5%207.57843%2010.5%206.75ZM12%206.75C12%208.40685%2010.6569%209.75%209%209.75C7.34315%209.75%206%208.40685%206%206.75C6%205.09315%207.34315%203.75%209%203.75C10.6569%203.75%2012%205.09315%2012%206.75Z'%20fill='%23FDFCFC'/%3e%3c/svg%3e",Ku="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.25%2014.8125C2.25%2015.3305%202.66946%2015.75%203.1875%2015.75H5.625V17.25H3.1875C1.84104%2017.25%200.75%2016.159%200.75%2014.8125L0.75%2012.375H2.25V14.8125ZM17.25%2014.8125C17.25%2016.159%2016.159%2017.25%2014.8125%2017.25H12.375L12.375%2015.75H14.8125C15.3305%2015.75%2015.75%2015.3305%2015.75%2014.8125V12.375L17.25%2012.375V14.8125ZM14.135%206.35229C14.2958%206.19142%2014.5379%206.14314%2014.748%206.22998C14.9583%206.31702%2015.0959%206.52245%2015.0959%206.75V10.5015C15.0959%2010.812%2014.8439%2011.0638%2014.5334%2011.064C14.2228%2011.0639%2013.9709%2010.8121%2013.9709%2010.5015V8.10571C13.7502%208.30415%2013.4107%208.29824%2013.1982%208.08594C12.9785%207.86637%2012.9787%207.51027%2013.1982%207.29053L14.135%206.35229ZM11.3298%206.19336C11.5137%206.21969%2011.6748%206.33566%2011.7568%206.5061C11.8505%206.70099%2011.8245%206.93272%2011.6895%207.10156L9.42041%209.9375H11.25C11.5607%209.9375%2011.8125%2010.1893%2011.8125%2010.5C11.8125%2010.8107%2011.5607%2011.0625%2011.25%2011.0625H8.25C8.03386%2011.0625%207.83688%2010.9386%207.74316%2010.7439C7.6495%2010.549%207.67547%2010.3173%207.81055%2010.1484L10.0796%207.3125L8.25%207.3125C7.93934%207.3125%207.6875%207.06066%207.6875%206.75C7.6875%206.43934%207.93934%206.1875%208.25%206.1875L11.25%206.1875L11.3298%206.19336ZM5.25%206.19482C5.45567%206.22809%205.62952%206.37352%205.69531%206.57642L6.9104%2010.3264C7.00614%2010.6219%206.84405%2010.9396%206.54858%2011.0354C6.25308%2011.1311%205.93539%2010.9691%205.8396%2010.6736L5.72241%2010.3125H3.65259L3.5354%2010.6736C3.43961%2010.9691%203.12192%2011.1311%202.82642%2011.0354C2.53095%2010.9396%202.36886%2010.6219%202.4646%2010.3264L2.68579%209.6416C2.69424%209.59828%202.7083%209.55696%202.72607%209.51782L3.67969%206.57642L3.71411%206.49365C3.80908%206.30792%204.00155%206.1875%204.21509%206.1875H5.15991L5.25%206.19482ZM4.0166%209.1875H5.3584L4.75122%207.3125H4.62378L4.0166%209.1875ZM5.625%202.25H3.1875C2.66946%202.25%202.25%202.66946%202.25%203.1875V5.625H0.75L0.75%203.1875C0.75%201.84104%201.84104%200.75%203.1875%200.75L5.625%200.75V2.25ZM14.8125%200.75C16.159%200.75%2017.25%201.84104%2017.25%203.1875V5.625H15.75V3.1875C15.75%202.66946%2015.3305%202.25%2014.8125%202.25H12.375V0.75L14.8125%200.75Z'%20fill='%23FDFCFC'/%3e%3c/svg%3e";function Xb(e){return e==="Facial"?g.jsx("img",{src:Gu,alt:"Facial",width:16,height:16,style:{display:"block"}}):e==="LPR"?g.jsx("img",{src:Ku,alt:"LPR",width:16,height:16,style:{display:"block"}}):g.jsx(Ve.VideocamOutlined,{sx:{fontSize:16}})}function Jb(e){return e==="Facial"?g.jsx("img",{src:Gu,alt:"Facial",width:18,height:18,style:{display:"block"}}):e==="LPR"?g.jsx("img",{src:Ku,alt:"LPR",width:18,height:18,style:{display:"block"}}):g.jsx(Ve.VideocamOutlined,{sx:{fontSize:18,color:"#fff"}})}function Qb(e){if(!e||!Array.isArray(e)||e.length===0)return;const t={};return e.forEach(n=>{const r=n.algorithm||"Outros";t[r]=(t[r]||0)+1}),Object.entries(t).map(([n,r])=>({count:r,icon:Xb(n)}))}const ex="_spotWrapper_dvp29_1",tx="_mapSpot_dvp29_8",nx="_selected_dvp29_27",rx="_count_dvp29_31",ox="_countSelected_dvp29_39",sx="_cameraTypesContainer_dvp29_43",ix="_cameraTypeItem_dvp29_50",ax="_cameraTypeCount_dvp29_57",cx="_cameraTypeIcon_dvp29_64",lx="_selectionEffect_dvp29_72",ux="_arrowSvg_dvp29_81",dx="_cameraButtonWrapper_dvp29_86",fx="_cone_dvp29_91",hx="_cameraButton_dvp29_86",je={spotWrapper:ex,mapSpot:tx,selected:nx,count:rx,countSelected:ox,cameraTypesContainer:sx,cameraTypeItem:ix,cameraTypeCount:ax,cameraTypeIcon:cx,selectionEffect:lx,arrowSvg:ux,cameraButtonWrapper:dx,cone:fx,cameraButton:hx},px=vn(_.Box),uc=60,mx=34,ri=({count:e,addressText:t,cameras:n,isSelected:r,animateOnClick:o=!0,disableClick:s=!1,className:i,onClick:a,sx:c})=>{const[u,l]=x.useState(!1),d=x.useMemo(()=>Qb(n),[n]),f=d&&d.length>0,p=(v,b)=>{const S=(v-90)*(Math.PI/180);return{x:Math.cos(S)*b,y:Math.sin(S)*b}},m=(v,b)=>{const S=v.orientation??b*90,y=p(S,uc);return g.jsxs("svg",{className:je.arrowSvg,style:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",overflow:"visible",pointerEvents:"none"},width:"1",height:"1",children:[g.jsx("defs",{children:g.jsx("marker",{id:`arrowhead-${v.id}`,markerWidth:"6",markerHeight:"6",refX:"3",refY:"3",orient:"auto",children:g.jsx("polygon",{points:"0 0, 6 3, 0 6",fill:"var(--Tertiary-On-Tertiary, #ffffff)"})})}),g.jsx("line",{x1:"0",y1:"0",x2:y.x,y2:y.y,stroke:"var(--Tertiary-On-Tertiary, #ffffff)",strokeWidth:"2",markerEnd:`url(#arrowhead-${v.id})`})]},`arrow-${v.id}`)},h=(v,b)=>{const S=v.orientation??b*90,y=p(S,uc+mx/2+10),C=Jb(v.algorithm);return g.jsxs("div",{className:je.cameraButtonWrapper,style:{position:"absolute",left:"50%",top:"50%",transform:`translate(calc(-50% + ${y.x}px), calc(-50% + ${y.y}px))`},children:[g.jsx("div",{className:je.cone,style:{transform:`rotate(${S+180}deg)`}}),g.jsx("div",{className:je.cameraButton,children:C})]},`camera-${v.id}`)};return g.jsxs("div",{className:je.spotWrapper,children:[r&&n&&n.length>0&&(o?g.jsxs(vn.div,{className:je.selectionEffect,initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.5},transition:{duration:.3,ease:"easeOut"},children:[n.map((v,b)=>m(v,b)),n.map((v,b)=>h(v,b))]}):g.jsxs("div",{className:je.selectionEffect,children:[n.map((v,b)=>m(v,b)),n.map((v,b)=>h(v,b))]})),g.jsx(px,{className:`${je.mapSpot} ${r?je.selected:""} ${i||""}`,onClick:s?void 0:a,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),sx:{...c},animate:{width:u&&f&&!r?"auto":30,height:u&&f&&!r?"auto":30,borderRadius:"100px",backgroundColor:r?"var(--Tertiary-Tertiary, #7FCFCF)":u&&f?"var(--Surface-Surface-Tint, #5E5E5E)":"var(--Surface-Inverse-Surface, #3B3B3C)",padding:u&&f&&!r?"4px 8px":0,borderWidth:r?1:0,borderStyle:"solid",borderColor:r?"var(--Tertiary-On-Tertiary, #ffffff)":"transparent"},transition:{duration:.2,ease:"easeInOut"},children:g.jsx(U1,{mode:"wait",children:u&&f&&!r?g.jsx(vn.div,{className:je.cameraTypesContainer,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2,ease:"easeInOut"},children:d.map((v,b)=>g.jsxs(vn.div,{className:je.cameraTypeItem,initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{duration:.2,delay:b*.05},children:[g.jsx(_.Typography,{className:je.cameraTypeCount,children:v.count}),v.icon&&g.jsx(_.Box,{className:je.cameraTypeIcon,children:v.icon})]},b))},"expanded"):g.jsx(vn.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2,ease:"easeInOut"},children:g.jsx(_.Typography,{className:`${je.count} ${r?je.countSelected:""}`,children:e})},"collapsed")})})]})};ri.displayName="MapSpot";const gx=16,Yu=({spots:e,onSpotClick:t,zoomLevel:n=gx,selectedSpotId:r,animateOnClick:o,disableClick:s})=>{const{isLoaded:i,zoomToPosition:a}=cl(),c=u=>{a({lat:u.lat,lng:u.lng},n),s||t==null||t(u)};return i?g.jsx(g.Fragment,{children:e.map((u,l)=>g.jsx(il,{position:{lat:u.lat,lng:u.lng},onClick:()=>c(u),children:g.jsx(ri,{count:u.count,addressText:u.addressText,cameras:u.cameras,isSelected:!s&&r===u.id,animateOnClick:o,disableClick:s})},u.id??l))}):null};Yu.displayName="MapMarkers";const yx="_searchBar_15mix_1",vx="_startIconContainer_15mix_106",bx="_endIconContainer_15mix_117",xx="_endIconContainerClickable_15mix_153",Sx="_defaultIcon_15mix_157",bn={searchBar:yx,startIconContainer:vx,endIconContainer:bx,endIconContainerClickable:xx,defaultIcon:Sx},Tx=e=>()=>{e&&e()},wx=e=>t=>{e&&e(t)},Cx=()=>g.jsx(Ve.Search,{className:bn.defaultIcon}),_x=e=>e||Cx(),qu=x.forwardRef(({startIcon:e,endIcon:t,onEndIconClick:n,placeholder:r,value:o,onChange:s,className:i,...a},c)=>{const l=_.useTheme().palette.mode==="dark",d=_x(t),f=Tx(n),p=wx(s);return g.jsx(_.TextField,{ref:c,value:o,onChange:p,placeholder:r,variant:"outlined",autoComplete:"off",className:`${bn.searchBar} ${i||""}`,"data-theme":l?"dark":"light",InputProps:{startAdornment:e?g.jsx(_.InputAdornment,{position:"start",className:bn.startIconContainer,children:e}):null,endAdornment:g.jsx(_.InputAdornment,{position:"end",className:`${bn.endIconContainer} ${n?bn.endIconContainerClickable:""}`,onClick:f,disablePointerEvents:!n,children:d})},inputProps:{autoComplete:"off","data-form-type":"other"},...a})});qu.displayName="SearchBar";const Ex=dt(g.jsx("path",{d:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"}),"Home"),Px=dt([g.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3 6.08 3 3.28 5.64 3.03 9h2.02C5.3 6.75 7.18 5 9.5 5 11.99 5 14 7.01 14 9.5S11.99 14 9.5 14c-.17 0-.33-.03-.5-.05v2.02c.17.02.33.03.5.03 1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19z"},"0"),g.jsx("path",{d:"M6.47 10.82 4 13.29l-2.47-2.47-.71.71L3.29 14 .82 16.47l.71.71L4 14.71l2.47 2.47.71-.71L4.71 14l2.47-2.47z"},"1")],"SearchOff"),Ax="_container_1mb8b_1",Mx="_iconWrapper_1mb8b_11",kx="_icon_1mb8b_11",Rx="_title_1mb8b_21",Ox="_subtitle_1mb8b_30",Ix="_description_1mb8b_34",jx="_button_1mb8b_38",_t={container:Ax,iconWrapper:Mx,icon:kx,title:Rx,subtitle:Ox,description:Ix,button:jx},Zu=({onGoHome:e,buttonText:t="Voltar para o início",title:n="Página não encontrada",description:r="Desculpe, a página que você está procurando não existe ou foi movida para outro endereço.",errorCode:o="404",className:s})=>g.jsx(_.Container,{maxWidth:"sm",children:g.jsxs(_.Box,{className:`${_t.container} ${s||""}`,children:[g.jsx(_.Box,{className:_t.iconWrapper,children:g.jsx(Px,{className:_t.icon,color:"primary"})}),g.jsx(_.Typography,{variant:"h1",className:_t.title,sx:{fontSize:{xs:"6rem",md:"8rem"}},children:o}),g.jsx(_.Typography,{variant:"h4",component:"h2",className:_t.subtitle,color:"text.primary",children:n}),g.jsx(_.Typography,{variant:"body1",className:_t.description,color:"text.secondary",children:r}),e&&g.jsx(hs,{variant:"contained",size:"large",startIcon:g.jsx(Ex,{}),onClick:e,className:_t.button,children:t})]})});Zu.displayName="NotFoundContent";const Lx=e=>{const t=e.find(r=>r.active),n=e.flatMap(r=>{var o;return((o=r.submenu)==null?void 0:o.map(s=>({item:r,subItem:s})))??[]}).find(({subItem:r})=>r.active);return{itemId:(n==null?void 0:n.item.id)??(t==null?void 0:t.id)??null,subItemId:(n==null?void 0:n.subItem.id)??null,expandedItemId:(n==null?void 0:n.item.id)??null}},Dx=({items:e,isExpanded:t=!0,onClick:n})=>{const r=x.useMemo(()=>Lx(e),[e]),[o,s]=x.useState(r.itemId),[i,a]=x.useState(r.subItemId),[c,u]=x.useState(r.expandedItemId),[l,d]=x.useState(null),[f,p]=x.useState(null);x.useEffect(()=>{s(r.itemId),a(r.subItemId),u(r.expandedItemId)},[r.itemId,r.subItemId,r.expandedItemId]);const m=f?e.find(E=>E.id===f):void 0,h=(m==null?void 0:m.submenu)??[];return{selectedItemId:o,selectedSubItemId:i,expandedItemId:c,submenuAnchorEl:l,submenuItem:m,submenuItems:h,getIsItemActive:E=>{var A;const P=i?!!((A=E.submenu)!=null&&A.some(M=>M.id===i)):!1;return o?E.id===o:!!(E.active||P)},getIsSubItemActive:E=>i?E.id===i:!!E.active,shouldShowSubmenu:E=>{var P;return!!(t&&((P=E.submenu)!=null&&P.length)&&c===E.id)},handleItemClick:(E,P)=>{var A,M;s(E.id),a(null),(A=E.submenu)!=null&&A.length?t?u(L=>L===E.id?null:E.id):(d(P.currentTarget),p(E.id)):(u(null),d(null),p(null)),(M=E.onClick)==null||M.call(E,P),n==null||n({item:E})},handleSubItemClick:(E,P,A,M)=>{var L;s(E.id),a(P.id),M!=null&&M.closeMenu&&(d(null),p(null)),(L=P.onClick)==null||L.call(P,A),n==null||n({item:E,subItem:P})},closeSubmenu:()=>{d(null),p(null)}}},Xu=e=>typeof e=="number"?`${e*4}px`:e,$x=({item:e,onClick:t,isActive:n})=>{const r=Y.useTheme();return g.jsx(_.ButtonBase,{onClick:t,"aria-label":e.label,"aria-pressed":n||void 0,sx:{width:"100%",borderRadius:Xu(r.shape.borderRadius),px:2,py:1.25,justifyContent:"flex-start",textAlign:"left",color:r.palette.text.primary,backgroundColor:n?r.palette.action.selected:"transparent","&:hover":{backgroundColor:r.palette.action.hover}},children:g.jsx(_.Typography,{variant:"body2",sx:{fontWeight:500},children:e.label})})},Ju=({items:e,isExpanded:t=!0,className:n,onClick:r})=>{const o=Y.useTheme(),s=Xu(o.shape.borderRadius),{submenuAnchorEl:i,submenuItem:a,submenuItems:c,getIsItemActive:u,getIsSubItemActive:l,shouldShowSubmenu:d,handleItemClick:f,handleSubItemClick:p,closeSubmenu:m}=Dx({items:e,isExpanded:t,onClick:r});return g.jsxs(_.Stack,{className:n,direction:"column",spacing:2,sx:{width:"100%"},children:[e.map(h=>{var E,P;const v=u(h),b=d(h),S=t?o.spacing(2):o.spacing(4),y=t?v?o.palette.primary.main:o.palette.action.hover:"transparent",C=t?"transparent":v?o.palette.primary.main:o.palette.action.hover,T=!t&&v?o.palette.primary.contrastText:o.palette.text.primary;return g.jsxs(_.Stack,{direction:"column",spacing:1,sx:{width:"100%"},children:[g.jsx(_.ButtonBase,{onClick:A=>f(h,A),"aria-label":h.label,"aria-pressed":v||void 0,"aria-haspopup":(E=h.submenu)!=null&&E.length?"menu":void 0,sx:{width:"100%",borderRadius:s,px:t?2:1,py:t?1.5:1,justifyContent:t?"flex-start":"center",textAlign:"left",color:o.palette.text.primary,backgroundColor:y,boxShadow:t&&v?o.shadows[1]:"none","&:hover":{backgroundColor:t?o.palette.action.hover:"transparent"}},children:g.jsxs(_.Stack,{direction:t?"row":"column",alignItems:"center",spacing:t?1.5:1,sx:{width:"100%"},children:[g.jsx(_.Box,{sx:{width:64,height:S,borderRadius:s,display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:C,color:T,transition:o.transitions.create(["background-color","box-shadow"],{duration:o.transitions.duration.shortest}),...t?{}:{boxShadow:v?o.shadows[1]:"none","&:hover":{backgroundColor:v?Y.alpha(o.palette.primary.main,.9):o.palette.action.selected}}},children:h.icon}),g.jsx(_.Typography,{variant:"body2",sx:{width:"100%",textAlign:t?"left":"center",fontWeight:v?600:500},children:h.label}),t&&h.trailingIcon?g.jsx(_.Box,{sx:{ml:"auto",display:"inline-flex",alignItems:"center"},children:h.trailingIcon}):null]})}),b?g.jsx(_.Collapse,{in:b,timeout:"auto",unmountOnExit:!0,children:g.jsx(_.Stack,{direction:"column",spacing:1,sx:{pl:4},children:(P=h.submenu)==null?void 0:P.map(A=>{const M=l(A);return g.jsx($x,{item:A,isActive:M,onClick:L=>p(h,A,L)},A.id)})})}):null]},h.id)}),g.jsx(_.Menu,{anchorEl:i,open:!!(i&&c.length),onClose:m,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},MenuListProps:{dense:!0,"aria-label":(a==null?void 0:a.label)??"submenu"},PaperProps:{sx:{borderRadius:s,minWidth:o.spacing(22),px:1,py:.5,boxShadow:o.shadows[3]}},children:c.map(h=>{const v=l(h);return g.jsx(_.MenuItem,{selected:v,onClick:b=>{a&&p(a,h,b,{closeMenu:!0})},sx:{borderRadius:s,fontWeight:v?600:500},children:h.label},h.id)})})]})};Ju.displayName="SidebarMenu";const Vx=e=>{const t=e.find(n=>n.active);return(t==null?void 0:t.id)??null},Nx=({items:e,onSelect:t,isExpanded:n=!0})=>{const r=x.useMemo(()=>Vx(e),[e]),[o,s]=x.useState(r),[i,a]=x.useState(null);x.useEffect(()=>{s(r)},[r]);const c=o?e.find(p=>p.id===o):void 0;return{selectedItemId:o,selectedItem:c,menuAnchorEl:i,getIsItemActive:p=>o?p.id===o:!!p.active,openMenu:p=>{n||a(p.currentTarget)},closeMenu:()=>{n||a(null)},handleItemClick:(p,m)=>{var h;s(p.id),(h=p.onClick)==null||h.call(p,m),t==null||t(p),a(null)}}},Bx=e=>typeof e=="number"?`${e*4}px`:e,Qu=({items:e,currentLabel:t,headerLabel:n,headerIcon:r,headerTrailingIcon:o,listTitle:s,action:i,isExpanded:a=!0,className:c,onSelect:u})=>{var Q,U;const l=Y.useTheme(),d=x.useRef(null),f=Bx(l.shape.borderRadius),[p,m]=x.useState(!1),h=x.useMemo(()=>Number.parseFloat(l.spacing(2).toString()),[l]),{selectedItem:v,menuAnchorEl:b,getIsItemActive:S,openMenu:y,closeMenu:C,handleItemClick:T}=Nx({items:e,onSelect:u,isExpanded:a}),E=t??(v==null?void 0:v.label)??((Q=e[0])==null?void 0:Q.label)??"",P=r??(v==null?void 0:v.icon)??((U=e[0])==null?void 0:U.icon)??null,A=a||!P,M=I=>{if(a){m(X=>!X);return}y(I)},L=(I,X)=>{T(I,X),m(!1)},$=g.jsx(_.Stack,{direction:"column",spacing:.5,children:e.map(I=>{const X=S(I);return g.jsxs(_.MenuItem,{selected:X,onClick:R=>L(I,R),sx:{borderRadius:f,gap:1.5,px:2,py:1.25,color:l.palette.text.primary,"&:hover":{backgroundColor:l.palette.action.hover}},children:[I.icon?g.jsx(_.Box,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:I.icon}):null,g.jsx(_.Typography,{variant:"body1",sx:{fontWeight:X?600:500},children:I.label})]},I.id)})}),W=g.jsxs(_.Box,{sx:{borderRadius:f,backgroundColor:l.palette.background.paper,boxShadow:l.shadows[3],display:"flex",flexDirection:"column",maxHeight:l.spacing(50)},children:[s?g.jsx(_.Box,{sx:{px:2,pt:2,pb:1},children:g.jsx(_.Typography,{variant:"subtitle2",sx:{color:l.palette.text.primary},children:s})}):null,g.jsx(_.Box,{sx:{px:2,pb:2,overflowY:"auto",flex:1,minHeight:0},children:$})]}),H=i?g.jsxs(_.MenuItem,{onClick:i.onClick,sx:{borderRadius:f,gap:1.5,px:2,py:1.25,color:l.palette.text.primary,"&:hover":{backgroundColor:l.palette.action.hover}},children:[i.icon?g.jsx(_.Box,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:i.icon}):null,g.jsx(_.Typography,{variant:"body1",sx:{fontWeight:600},children:i.label})]}):null,q=H?g.jsx(_.Box,{sx:{borderRadius:f,backgroundColor:l.palette.background.paper,boxShadow:l.shadows[3]},children:H}):null,oe=g.jsxs(_.Stack,{direction:"column",spacing:1,sx:{minWidth:l.spacing(32)},children:[W,q]});return g.jsxs(_.Stack,{className:c,direction:a?"row":"column",spacing:a?2:1,sx:{width:"100%",alignItems:a?"flex-start":"stretch"},children:[g.jsx(_.ButtonBase,{onClick:M,"aria-label":E,ref:d,sx:{width:a?l.spacing(28):"64px",height:a?"auto":"64px",borderRadius:f,px:a?2:0,py:a?1.25:0,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"left",backgroundColor:l.palette.action.hover,"&:hover":{backgroundColor:l.palette.action.selected}},children:g.jsxs(_.Stack,{direction:"row",alignItems:"center",spacing:a?1:0,sx:{width:a?"100%":"auto",justifyContent:a?"space-between":"center",px:0},children:[P?g.jsx(_.Box,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:P}):null,A?g.jsxs(_.Box,{sx:{minWidth:0,flex:1},children:[n?g.jsx(_.Typography,{variant:"caption",sx:{color:l.palette.text.secondary},children:n}):null,g.jsx(_.Typography,{variant:"body2",sx:{fontWeight:600},noWrap:!0,children:E})]}):null,a&&o?g.jsx(_.Box,{sx:{ml:"auto",display:"inline-flex",alignItems:"center"},children:o}):null]})}),a?p?g.jsx(_.ClickAwayListener,{onClickAway:()=>m(!1),children:g.jsx(_.Popper,{open:p,anchorEl:d.current,placement:"right-start",modifiers:[{name:"offset",options:{offset:[0,h]}}],sx:{zIndex:l.zIndex.modal},children:oe})}):null:g.jsx(_.Menu,{anchorEl:b,open:!!b,onClose:C,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},disableAutoFocusItem:!0,slotProps:{paper:{sx:{borderRadius:f,p:0,ml:2,backgroundColor:"transparent",boxShadow:"none",overflow:"visible"}}},MenuListProps:{"aria-label":E?`menu-${E}`:"menu",sx:{p:0}},children:oe})]})};Qu.displayName="ModuleMenu";const oi=e=>e.seekable&&e.seekable.length>0?e.seekable.end(e.seekable.length-1):Number.isFinite(e.duration)&&e.duration>0?e.duration:e.currentTime,Fx=(e,t,n)=>({...e&&{"--player-width":typeof e=="number"?`${e}px`:e},...t&&{"--player-height":typeof t=="number"?`${t}px`:t},...n&&{"--player-aspect-ratio":n}}),zx=({stream:e,availableQualities:t,initialQuality:n,autoPlay:r,liveThresholdSeconds:o,allowPlaybackRateForStream:s})=>{const i=x.useRef(null),a=x.useRef(null),c=x.useMemo(()=>{if(!t||!t.length)return null;if(n){const I=t.find(X=>X.value===n);if(I)return I}return t[0]},[t,n]),[u,l]=x.useState(c),[d,f]=x.useState(!1),[p,m]=x.useState(!0),[h,v]=x.useState(!1),[b,S]=x.useState(0),[y,C]=x.useState(0),[T,E]=x.useState(1),[P,A]=x.useState(1),[M,L]=x.useState(!1),[$,W]=x.useState(!0),H=(u==null?void 0:u.stream)??e??null,q=(u==null?void 0:u.src)??null,Q=!!!H||s;x.useEffect(()=>{l(c)},[c]);const U=x.useCallback(()=>{const I=a.current;if(!I)return;if(!I.seekable||I.seekable.length===0){m(!0),v(!1);return}const X=oi(I),R=Math.max(0,X-I.currentTime);C(X),S(I.currentTime),v(X>0),m(R<=(o??2))},[o]);return x.useEffect(()=>{const I=a.current;if(!I)return;const X=()=>f(!0),R=()=>f(!1),w=()=>W(!0),j=()=>W(!0),k=()=>W(!1),O=()=>W(!1);return I.addEventListener("play",X),I.addEventListener("pause",R),I.addEventListener("waiting",w),I.addEventListener("loadstart",j),I.addEventListener("canplay",k),I.addEventListener("playing",O),I.addEventListener("timeupdate",U),I.addEventListener("durationchange",U),I.addEventListener("loadedmetadata",U),I.addEventListener("progress",U),()=>{I.removeEventListener("play",X),I.removeEventListener("pause",R),I.removeEventListener("waiting",w),I.removeEventListener("loadstart",j),I.removeEventListener("canplay",k),I.removeEventListener("playing",O),I.removeEventListener("timeupdate",U),I.removeEventListener("durationchange",U),I.removeEventListener("loadedmetadata",U),I.removeEventListener("progress",U)}},[U]),x.useEffect(()=>{const I=a.current;I&&(W(!0),H?(I.srcObject!==H&&(I.srcObject=H),I.getAttribute("src")&&I.removeAttribute("src")):q?(I.srcObject&&(I.srcObject=null),I.src!==q&&(I.src=q,I.load())):(I.srcObject&&(I.srcObject=null),I.getAttribute("src")&&I.removeAttribute("src")),r&&I.play().then(()=>{}).catch(()=>{}))},[H,q,r]),x.useEffect(()=>{const I=a.current;I&&(Q?I.playbackRate=T:(I.playbackRate=1,E(1)))},[T,Q]),x.useEffect(()=>{const I=()=>{L(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",I),()=>{document.removeEventListener("fullscreenchange",I)}},[]),{containerRef:i,videoRef:a,selectedQuality:u,setSelectedQuality:l,isPlaying:d,isLive:p,canSeek:h,currentTime:b,setCurrentTime:S,seekableEnd:y,playbackRate:T,setPlaybackRate:E,zoom:P,setZoom:A,isFullscreen:M,isLoading:$,canAdjustPlaybackRate:Q,updateLiveStatus:U}},Wx="_container_zv1tx_1",Ux="_loader_zv1tx_19",Hx="_video_zv1tx_29",Gx="_controlsOverlay_zv1tx_37",Kx="_timeline_zv1tx_58",Yx="_controlsRow_zv1tx_65",qx="_controlGroup_zv1tx_83",Zx="_iconButton_zv1tx_100",Xx="_seekButton_zv1tx_113",Jx="_menuButton_zv1tx_133",Qx="_liveBadge_zv1tx_149",Ae={container:Wx,loader:Ux,video:Hx,controlsOverlay:Gx,timeline:Kx,controlsRow:Yx,controlGroup:qx,iconButton:Zx,seekButton:Xx,menuButton:Jx,liveBadge:Qx},_o=({label:e,valueLabel:t,selectedValue:n,options:r,onChange:o,disabled:s,ariaLabel:i})=>{const[a,c]=x.useState(null),u=!!a;return g.jsxs(g.Fragment,{children:[g.jsx(_.ButtonBase,{disabled:s,className:Ae.menuButton,"aria-label":i,onClick:l=>c(l.currentTarget),children:e?`${e}: ${t}`:t}),g.jsx(_.Menu,{anchorEl:a,open:u,onClose:()=>c(null),children:r.map(l=>g.jsx(_.MenuItem,{selected:l.value===n,disabled:l.disabled,onClick:()=>{o(l.value),c(null)},children:l.label},`${e}-${String(l.value)}`))})]})},eS=e=>()=>{const t=e.current;t&&(t.paused?t.play().catch(()=>{}):t.pause())},tS=(e,t,n)=>r=>{const o=e.current;if(!o||!t)return;const s=oi(o),i=Math.min(Math.max(o.currentTime+r,0),s);o.currentTime=i,n()},nS=e=>()=>{e.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):e.current.requestFullscreen().catch(()=>{}))},rS=(e,t,n)=>r=>{const o=e.find(s=>s.value===r)??null;t(o),n==null||n(o)},oS=(e,t)=>(n,r)=>{if(!e)return;const o=Array.isArray(r)?r[0]:r;t(o)},sS=(e,t,n)=>(r,o)=>{const s=e.current;if(!s||!t)return;const i=Array.isArray(o)?o[0]:o,a=oi(s);s.currentTime=Math.min(Math.max(i,0),a),n()},ed=({stream:e=null,availableQualities:t=[],initialQuality:n,onQualityChange:r,autoPlay:o=!0,playsInline:s=!0,muted:i=!0,poster:a,className:c,sx:u,liveThresholdSeconds:l=2,allowPlaybackRateForStream:d=!1,playbackRates:f=[.5,1,1.5,2],zoomLevels:p=[1,1.2,1.5],width:m,height:h,aspectRatio:v="16 / 9",showTimestamp:b=!0,showTimeline:S=!0})=>{const y=Y.useTheme(),[C,T]=x.useState(""),[E,P]=x.useState(!0),A=x.useRef(null);x.useEffect(()=>{if(!b)return;const we=()=>{const Je=new Date,Hn=String(Je.getDate()).padStart(2,"0"),yd=String(Je.getMonth()+1).padStart(2,"0"),vd=Je.getFullYear(),bd=["Dom","Seg","Ter","Qua","Qui","Sex","Sab"][Je.getDay()],xd=String(Je.getHours()).padStart(2,"0"),Sd=String(Je.getMinutes()).padStart(2,"0"),Td=String(Je.getSeconds()).padStart(2,"0");T(`${Hn}-${yd}-${vd}, ${bd} ${xd}:${Sd}:${Td}`)};we();const Un=setInterval(we,1e3);return()=>clearInterval(Un)},[b]),x.useEffect(()=>{const we=M.current;if(!we)return;const Un=()=>{A.current&&(clearTimeout(A.current),A.current=null),P(!0)},Je=()=>{A.current=setTimeout(()=>{P(!1)},1e4)},Hn=()=>{E||P(!0),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{P(!1)},1e4)};return we.addEventListener("mouseenter",Un),we.addEventListener("mouseleave",Je),we.addEventListener("mousemove",Hn),()=>{we.removeEventListener("mouseenter",Un),we.removeEventListener("mouseleave",Je),we.removeEventListener("mousemove",Hn),A.current&&clearTimeout(A.current)}},[E]);const{containerRef:M,videoRef:L,selectedQuality:$,setSelectedQuality:W,isPlaying:H,isLive:q,canSeek:oe,currentTime:Q,setCurrentTime:U,seekableEnd:I,playbackRate:X,setPlaybackRate:R,zoom:w,setZoom:j,isFullscreen:k,isLoading:O,canAdjustPlaybackRate:F,updateLiveStatus:N}=zx({stream:e,availableQualities:t,initialQuality:n,autoPlay:o,liveThresholdSeconds:l,allowPlaybackRateForStream:d}),V=eS(L),z=tS(L,oe,N),G=nS(M),K=rS(t,W,r),he=oS(oe,U),D=sS(L,oe,N),Ee=p.map(we=>({value:we,label:`${Math.round(we*100)}%`})),Xe=f.map(we=>({value:we,label:`${we}x`})),ft=t.map(we=>({value:we.value,label:we.label})),qr=($==null?void 0:$.label)??"Auto",on=`${Math.round(w*100)}%`,sn=`${X}x`,an=oe&&I>0,Zr=Fx(m,h,v);return g.jsxs(_.Box,{ref:M,className:`${Ae.container} ${c||""}`.trim(),style:Zr,sx:{borderRadius:0,backgroundColor:y.palette.common.black,...u},children:[O&&g.jsx(_.Box,{className:Ae.loader,sx:{backgroundColor:y.palette.common.black},children:g.jsx(_.CircularProgress,{size:60,sx:{color:y.palette.primary.contrastText,width:{xs:"48px",sm:"60px"},height:{xs:"48px",sm:"60px"}}})}),g.jsx("video",{ref:L,className:Ae.video,autoPlay:o,playsInline:s,muted:i,poster:a,style:{transform:`scale(${w})`}}),b&&C&&g.jsx(_.Box,{sx:{position:"absolute",top:0,left:0,right:0,padding:{xs:"10px 12px",sm:"12px 16px"}},children:g.jsx(_.Typography,{variant:"body2",sx:{color:y.palette.common.white,fontWeight:500,fontSize:{xs:"12px",sm:"14px"},textShadow:"0 2px 8px rgba(0,0,0,0.8)"},children:C})}),q&&!E&&g.jsx(_.Box,{sx:{position:"absolute",bottom:16,left:20,zIndex:10},children:g.jsx(_.Box,{className:Ae.liveBadge,sx:{backgroundColor:Y.alpha(y.palette.common.white,.9),color:y.palette.common.black},component:"span","aria-live":"polite",children:"ao vivo"})}),g.jsxs(_.Box,{className:Ae.controlsOverlay,sx:{opacity:E?1:0,visibility:E?"visible":"hidden",transition:"opacity 0.3s ease, visibility 0.3s ease"},children:[S&&g.jsx(_.Box,{className:Ae.timeline,children:g.jsx(_.Slider,{size:"small",min:0,max:an?I:1,step:1,value:an?Q:0,disabled:!an,onChange:he,onChangeCommitted:D,"aria-label":"Linha do tempo do video",sx:{color:y.palette.common.white,"& .MuiSlider-thumb":{width:12,height:12,backgroundColor:y.palette.common.white},"& .MuiSlider-track":{border:"none",backgroundColor:y.palette.common.white},"& .MuiSlider-rail":{backgroundColor:Y.alpha(y.palette.common.white,.3),opacity:1}}})}),g.jsxs(_.Box,{className:Ae.controlsRow,children:[g.jsxs(_.Box,{className:Ae.controlGroup,children:[g.jsx(_.Box,{className:Ae.liveBadge,sx:{backgroundColor:q?Y.alpha(y.palette.common.white,.9):Y.alpha(y.palette.common.white,.15),color:q?y.palette.common.black:Y.alpha(y.palette.common.white,.7)},component:"span","aria-live":"polite",children:"ao vivo"}),g.jsx(_.Box,{className:Ae.seekButton,component:"button",onClick:()=>z(-15),"aria-label":"Voltar 15 segundos",sx:{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,border:"none",cursor:"pointer","&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}},children:"15s"}),g.jsx(_.IconButton,{className:Ae.iconButton,onClick:()=>z(-15),"aria-label":"Recuar 15 segundos",sx:{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,"&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}},children:g.jsx(Ve.FastRewind,{fontSize:"small"})}),g.jsx(_.IconButton,{className:Ae.iconButton,onClick:V,"aria-label":"Play/Pause",sx:{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,"&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}},children:H?g.jsx(Ve.Pause,{fontSize:"small"}):g.jsx(Ve.PlayArrow,{fontSize:"small"})}),g.jsx(_.IconButton,{className:Ae.iconButton,onClick:()=>z(15),"aria-label":"Avançar 15 segundos",sx:{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,"&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}},children:g.jsx(Ve.FastForward,{fontSize:"small"})}),g.jsx(_.Box,{className:Ae.seekButton,component:"button",onClick:()=>z(15),"aria-label":"Avançar 15 segundos",sx:{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,border:"none",cursor:"pointer","&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}},children:"15s"})]}),g.jsxs(_.Box,{className:Ae.controlGroup,children:[g.jsx(_.Box,{sx:{"& .MuiButtonBase-root":{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,"&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}}},children:g.jsx(_o,{label:"",valueLabel:sn,selectedValue:X,options:Xe,ariaLabel:"Selecionar velocidade de reprodução",onChange:R,disabled:!F})}),ft.length>0?g.jsx(_.Box,{sx:{"& .MuiButtonBase-root":{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,"&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}}},children:g.jsx(_o,{label:"",valueLabel:qr,selectedValue:($==null?void 0:$.value)??"auto",options:ft,ariaLabel:"Selecionar qualidade do vídeo",onChange:K})}):null,g.jsx(_.Box,{sx:{"& .MuiButtonBase-root":{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,"&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}}},children:g.jsx(_o,{label:"",valueLabel:on,selectedValue:w,options:Ee,ariaLabel:"Selecionar zoom do vídeo",onChange:j})}),g.jsx(_.IconButton,{className:Ae.iconButton,onClick:G,"aria-label":"Fullscreen",sx:{backgroundColor:Y.alpha(y.palette.common.white,.15),color:y.palette.common.white,"&:hover":{backgroundColor:Y.alpha(y.palette.common.white,.25)}},children:k?g.jsx(Ve.FullscreenExit,{fontSize:"small"}):g.jsx(Ve.Fullscreen,{fontSize:"small"})})]})]})]})]})};ed.displayName="VideoPlayer";const iS=dt(g.jsx("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8"}),"UndoOutlined"),aS=dt(g.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),cS=dt(g.jsx("path",{d:"M19 13H5v-2h14z"}),"Remove"),lS="_root_1gj5n_1",uS="_container_1gj5n_6",dS="_header_1gj5n_13",fS="_headerText_1gj5n_21",hS="_controls_1gj5n_27",pS="_iconButton_1gj5n_34",mS="_zoomGroup_1gj5n_43",gS="_zoomTrack_1gj5n_52",yS="_zoomTrackFill_1gj5n_59",vS="_layers_1gj5n_67",bS="_timeScale_1gj5n_78",xS="_videoTrack_1gj5n_82",SS="_eventsTrack_1gj5n_86",TS="_trackBox_1gj5n_90",wS="_trackLabelRow_1gj5n_95",CS="_label_1gj5n_103",_S="_trackArea_1gj5n_112",ES="_tick_1gj5n_118",PS="_tickMajor_1gj5n_126",AS="_tickMinor_1gj5n_131",MS="_tickLabel_1gj5n_135",kS="_segment_1gj5n_146",RS="_event_1gj5n_86",OS="_eventDot_1gj5n_166",IS="_selectionOverlay_1gj5n_172",jS="_playhead_1gj5n_180",LS="_playheadLine_1gj5n_190",DS="_playheadHandle_1gj5n_199",J={root:lS,container:uS,header:dS,headerText:fS,controls:hS,iconButton:pS,zoomGroup:mS,zoomTrack:gS,zoomTrackFill:yS,layers:vS,timeScale:bS,videoTrack:xS,eventsTrack:SS,trackBox:TS,trackLabelRow:wS,label:CS,trackArea:_S,tick:ES,tickMajor:PS,tickMinor:AS,tickLabel:MS,segment:kS,event:RS,eventDot:OS,selectionOverlay:IS,playhead:jS,playheadLine:LS,playheadHandle:DS},at={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};function td(e){return"init"in e}function cs(e){return!!e.write}function dc(e){return"v"in e||"e"in e}function Ar(e){if("e"in e)throw e.e;if((at?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v}const Mr=new WeakMap;function nd(e){var t;return kr(e)&&!!((t=Mr.get(e))!=null&&t[0])}function $S(e){const t=Mr.get(e);t!=null&&t[0]&&(t[0]=!1,t[1].forEach(n=>n()))}function ls(e,t){let n=Mr.get(e);if(!n){n=[!0,new Set],Mr.set(e,n);const r=()=>{n[0]=!1};e.then(r,r)}n[1].add(t)}function kr(e){return typeof(e==null?void 0:e.then)=="function"}function rd(e,t,n){if(!n.p.has(e)){n.p.add(e);const r=()=>n.p.delete(e);t.then(r,r)}}function od(e,t,n){var r;const o=new Set;for(const s of((r=n.get(e))==null?void 0:r.t)||[])o.add(s);for(const s of t.p)o.add(s);return o}const VS=(e,t,...n)=>t.read(...n),NS=(e,t,...n)=>t.write(...n),BS=(e,t)=>{if(t.INTERNAL_onInit)return t.INTERNAL_onInit(e);if(t.unstable_onInit)return console.warn("[DEPRECATED] atom.unstable_onInit is renamed to atom.INTERNAL_onInit."),t.unstable_onInit(e)},FS=(e,t,n)=>{var r;return(r=t.onMount)==null?void 0:r.call(t,n)},zS=(e,t)=>{var n;const r=Ie(e),o=r[0],s=r[6],i=r[9];if((at?"production":void 0)!=="production"&&!t)throw new Error("Atom is undefined or null");let a=o.get(t);return a||(a={d:new Map,p:new Set,n:0},o.set(t,a),(n=s.i)==null||n.call(s,t),i==null||i(e,t)),a},WS=e=>{const t=Ie(e),n=t[1],r=t[3],o=t[4],s=t[5],i=t[6],a=t[13],c=[],u=l=>{try{l()}catch(d){c.push(d)}};do{i.f&&u(i.f);const l=new Set,d=l.add.bind(l);r.forEach(f=>{var p;return(p=n.get(f))==null?void 0:p.l.forEach(d)}),r.clear(),s.forEach(d),s.clear(),o.forEach(d),o.clear(),l.forEach(u),r.size&&a(e)}while(r.size||s.size||o.size);if(c.length)throw new AggregateError(c)},US=e=>{const t=Ie(e),n=t[1],r=t[2],o=t[3],s=t[11],i=t[14],a=t[17],c=[],u=new WeakSet,l=new WeakSet,d=Array.from(o);for(;d.length;){const f=d[d.length-1],p=s(e,f);if(l.has(f)){d.pop();continue}if(u.has(f)){if(r.get(f)===p.n)c.push([f,p]);else if((at?"production":void 0)!=="production"&&r.has(f))throw new Error("[Bug] invalidated atom exists");l.add(f),d.pop();continue}u.add(f);for(const m of od(f,p,n))u.has(m)||d.push(m)}for(let f=c.length-1;f>=0;--f){const[p,m]=c[f];let h=!1;for(const v of m.d.keys())if(v!==p&&o.has(v)){h=!0;break}h&&(i(e,p),a(e,p)),r.delete(p)}},us=new WeakSet,HS=(e,t)=>{var n,r;const o=Ie(e),s=o[1],i=o[2],a=o[3],c=o[6],u=o[7],l=o[11],d=o[12],f=o[13],p=o[14],m=o[16],h=o[17],v=o[20],b=l(e,t);if(dc(b)){if(s.has(t)&&i.get(t)!==b.n)return b;let M=!1;for(const[L,$]of b.d)if(p(e,L).n!==$){M=!0;break}if(!M)return b}b.d.clear();let S=!0;function y(){s.has(t)&&(h(e,t),f(e),d(e))}function C(M){var L;if(M===t){const W=l(e,M);if(!dc(W))if(td(M))v(e,M,M.init);else throw new Error("no atom init");return Ar(W)}const $=p(e,M);try{return Ar($)}finally{b.d.set(M,$.n),nd(b.v)&&rd(t,b.v,$),s.has(t)&&((L=s.get(M))==null||L.t.add(t)),S||y()}}let T,E;const P={get signal(){return T||(T=new AbortController),T.signal},get setSelf(){return(at?"production":void 0)!=="production"&&!cs(t)&&console.warn("setSelf function cannot be used with read-only atom"),!E&&cs(t)&&(E=(...M)=>{if((at?"production":void 0)!=="production"&&S&&console.warn("setSelf function cannot be called in sync"),!S)try{return m(e,t,...M)}finally{f(e),d(e)}}),E}},A=b.n;try{(at?"production":void 0)!=="production"&&us.delete(e);const M=u(e,t,C,P);return(at?"production":void 0)!=="production"&&us.has(e)&&console.warn("Detected store mutation during atom read. This is not supported."),v(e,t,M),kr(M)&&(ls(M,()=>T==null?void 0:T.abort()),M.then(y,y)),(n=c.r)==null||n.call(c,t),b}catch(M){return delete b.v,b.e=M,++b.n,b}finally{S=!1,A!==b.n&&i.get(t)===A&&(i.set(t,b.n),a.add(t),(r=c.c)==null||r.call(c,t))}},GS=(e,t)=>{const n=Ie(e),r=n[1],o=n[2],s=n[11],i=[t];for(;i.length;){const a=i.pop(),c=s(e,a);for(const u of od(a,c,r)){const l=s(e,u);o.set(u,l.n),i.push(u)}}},KS=(e,t,...n)=>{const r=Ie(e),o=r[3],s=r[6],i=r[8],a=r[11],c=r[12],u=r[13],l=r[14],d=r[15],f=r[16],p=r[17],m=r[20];let h=!0;const v=S=>Ar(l(e,S)),b=(S,...y)=>{var C;const T=a(e,S);try{if(S===t){if(!td(S))throw new Error("atom not writable");(at?"production":void 0)!=="production"&&us.add(e);const E=T.n,P=y[0];m(e,S,P),p(e,S),E!==T.n&&(o.add(S),d(e,S),(C=s.c)==null||C.call(s,S));return}else return f(e,S,...y)}finally{h||(u(e),c(e))}};try{return i(e,t,v,b,...n)}finally{h=!1}},YS=(e,t)=>{var n;const r=Ie(e),o=r[1],s=r[3],i=r[6],a=r[11],c=r[15],u=r[18],l=r[19],d=a(e,t),f=o.get(t);if(f&&!nd(d.v)){for(const[p,m]of d.d)if(!f.d.has(p)){const h=a(e,p);u(e,p).t.add(t),f.d.add(p),m!==h.n&&(s.add(p),c(e,p),(n=i.c)==null||n.call(i,p))}for(const p of f.d)if(!d.d.has(p)){f.d.delete(p);const m=l(e,p);m==null||m.t.delete(t)}}},qS=(e,t)=>{var n;const r=Ie(e),o=r[1],s=r[4],i=r[6],a=r[10],c=r[11],u=r[12],l=r[13],d=r[14],f=r[16],p=r[18],m=c(e,t);let h=o.get(t);if(!h){d(e,t);for(const v of m.d.keys())p(e,v).t.add(t);if(h={l:new Set,d:new Set(m.d.keys()),t:new Set},o.set(t,h),cs(t)){const v=()=>{let b=!0;const S=(...y)=>{try{return f(e,t,...y)}finally{b||(l(e),u(e))}};try{const y=a(e,t,S);y&&(h.u=()=>{b=!0;try{y()}finally{b=!1}})}finally{b=!1}};s.add(v)}(n=i.m)==null||n.call(i,t)}return h},ZS=(e,t)=>{var n,r;const o=Ie(e),s=o[1],i=o[5],a=o[6],c=o[11],u=o[19],l=c(e,t);let d=s.get(t);if(!d||d.l.size)return d;let f=!1;for(const p of d.t)if((n=s.get(p))!=null&&n.d.has(t)){f=!0;break}if(!f){d.u&&i.add(d.u),d=void 0,s.delete(t);for(const p of l.d.keys()){const m=u(e,p);m==null||m.t.delete(t)}(r=a.u)==null||r.call(a,t);return}return d},XS=(e,t,n)=>{const r=Ie(e)[11],o=r(e,t),s="v"in o,i=o.v;if(kr(n))for(const a of o.d.keys())rd(t,n,r(e,a));o.v=n,delete o.e,(!s||!Object.is(i,o.v))&&(++o.n,kr(i)&&$S(i))},JS=(e,t)=>{const n=Ie(e)[14];return Ar(n(e,t))},QS=(e,t,...n)=>{const r=Ie(e),o=r[12],s=r[13],i=r[16];try{return i(e,t,...n)}finally{s(e),o(e)}},e2=(e,t,n)=>{const r=Ie(e),o=r[12],s=r[18],i=r[19],c=s(e,t).l;return c.add(n),o(e),()=>{c.delete(n),i(e,t),o(e)}},sd=new WeakMap,Ie=e=>{const t=sd.get(e);if((at?"production":void 0)!=="production"&&!t)throw new Error("Store must be created by buildStore to read its building blocks");return t};function t2(...e){const t={get(r){const o=Ie(t)[21];return o(t,r)},set(r,...o){const s=Ie(t)[22];return s(t,r,...o)},sub(r,o){const s=Ie(t)[23];return s(t,r,o)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},VS,NS,BS,FS,zS,WS,US,HS,GS,KS,YS,qS,ZS,XS,JS,QS,e2,void 0].map((r,o)=>e[o]||r);return sd.set(t,Object.freeze(n)),t}const id={};let n2=0;function rn(e,t){const n=`atom${++n2}`,r={toString(){return(id?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof e=="function"?r.read=e:(r.init=e,r.read=r2,r.write=o2),r}function r2(e){return e(this)}function o2(e,t,n){return t(this,typeof n=="function"?n(e(this)):n)}function s2(){return t2()}let pn;function i2(){return pn||(pn=s2(),(id?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=pn),globalThis.__JOTAI_DEFAULT_STORE__!==pn&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),pn}const a2={},c2=x.createContext(void 0);function ad(e){return x.useContext(c2)||i2()}const ds=e=>typeof(e==null?void 0:e.then)=="function",fs=e=>{e.status||(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}))},l2=x.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(fs(e),e)}),Eo=new WeakMap,fc=(e,t)=>{let n=Eo.get(e);return n||(n=new Promise((r,o)=>{let s=e;const i=u=>l=>{s===u&&r(l)},a=u=>l=>{s===u&&o(l)},c=()=>{try{const u=t();ds(u)?(Eo.set(u,n),s=u,u.then(i(u),a(u)),ls(u,c)):r(u)}catch(u){o(u)}};e.then(i(e),a(e)),ls(e,c)}),Eo.set(e,n)),n};function Rr(e,t){const{delay:n,unstable_promiseStatus:r=!x.use}={},o=ad(),[[s,i,a],c]=x.useReducer(l=>{const d=o.get(e);return Object.is(l[0],d)&&l[1]===o&&l[2]===e?l:[d,o,e]},void 0,()=>[o.get(e),o,e]);let u=s;if((i!==o||a!==e)&&(c(),u=o.get(e)),x.useEffect(()=>{const l=o.sub(e,()=>{if(r)try{const d=o.get(e);ds(d)&&fs(fc(d,()=>o.get(e)))}catch{}if(typeof n=="number"){setTimeout(c,n);return}c()});return c(),l},[o,e,n,r]),x.useDebugValue(u),ds(u)){const l=fc(u,()=>o.get(e));return r&&fs(l),l2(l)}return u}function u2(e,t){const n=ad();return x.useCallback((...o)=>{if((a2?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return n.set(e,...o)},[n,e])}function Wt(e,t){return[Rr(e),u2(e)]}const si=rn(0),ii=rn(!0),ai=rn(null),cd=rn({windowSeconds:24*60*60,fps:30}),ld=rn([]),ud=rn([]);function ve(e,t,n){return Math.min(n,Math.max(t,e))}function yt(e){const{time:t,windowStart:n,windowSeconds:r,width:o}=e;return o<=0||r<=0?0:(t-n)/r*o}function mn(e){const{px:t,windowStart:n,windowSeconds:r,width:o}=e;return o<=0||r<=0?n:n+t/o*r}function _e(e){return String(Math.floor(e)).padStart(2,"0")}function d2(e=Date.now()){const t=new Date(e);return t.getHours()*3600+t.getMinutes()*60+t.getSeconds()+t.getMilliseconds()/1e3}function Po(e){const t=Math.max(0,e),n=Math.floor(t/3600)%24,r=Math.floor(t%3600/60),o=Math.floor(t%60);return`${_e(n)}:${_e(r)}:${_e(o)}`}function f2(e,t){const n=Math.max(0,e),r=Math.floor(n/3600)%24,o=Math.floor(n%3600/60),s=Math.floor(n%60),i=n-Math.floor(n),a=Math.floor(i*t);return`${_e(r)}:${_e(o)}:${_e(s)}:${_e(a)}`}function Ao(e){const t=Math.max(0,e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),o=Math.floor(t%60);return n>0?`${_e(n)}:${_e(r)}:${_e(o)}`:`${_e(r)}:${_e(o)}`}function h2(e,t){const n=Math.max(0,e),r=Math.floor(n/3600),o=Math.floor(n%3600/60),s=Math.floor(n%60),i=n-Math.floor(n),a=Math.floor(i*t);return r>0?`${_e(r)}:${_e(o)}:${_e(s)}:${_e(a)}`:`${_e(o)}:${_e(s)}:${_e(a)}`}function p2(e){const{width:t,windowSeconds:n,fps:r}=e,o=t>0?t/n:0,s=1/Math.max(1,r),i=[s,2*s,5*s,.25,.5,1,2,5,10,15,30,60,2*60,5*60,10*60,15*60,30*60,60*60,2*60*60,3*60*60,6*60*60],a=90,c=45;let u=i[i.length-1];for(const f of i)if(f*o>=a){u=f;break}const l=[u/2,u/5,u/10].filter(f=>f>0);let d=l[0]??u;for(const f of l)if(f*o>=c){d=f;break}return{majorStep:u,minorStep:d}}const m2=(e,t,n)=>t>=3600?Po(e).slice(0,2)+":00:00":t>=60?Po(e).slice(0,5):t>=1?Po(e):f2(e,n),g2=(e,t,n)=>t>=3600||t>=60||t>=1?Ao(e):h2(e,n);function y2(){const e=x.useRef(null),[t,n]=x.useState(0);return x.useLayoutEffect(()=>{const r=e.current;if(!r)return;const o=new ResizeObserver(()=>{n(r.getBoundingClientRect().width)});return o.observe(r),n(r.getBoundingClientRect().width),()=>o.disconnect()},[]),{ref:e,width:t}}function v2(e){const{totalSeconds:t,enableWheelZoom:n,autoZoomOnSelection:r,tickLabelFormatter:o,clearSelectionOnEventClick:s}=e,[i,a]=Wt(si),[c,u]=Wt(ii),[l,d]=Wt(ai),f=Rr(ld),p=Rr(ud),[m,h]=Wt(cd),{ref:v,width:b}=y2(),S=102,C=Math.max(0,b-S-10),[T,E]=x.useState(0),P=x.useMemo(()=>{const k=Math.max(1/Math.max(1,m.fps),.05);return ve(m.windowSeconds,k,t)},[m.windowSeconds,m.fps,t]);x.useEffect(()=>{if(!c||b<=0)return;const k=ve(i-P*.9,0,Math.max(0,t-P));E(k)},[i,c,b,P,t]);const A=x.useMemo(()=>{const k=ve(T,0,Math.max(0,t-P)),O=k+P;return{start:k,end:O,seconds:P}},[T,t,P]),M=x.useMemo(()=>{if(C<=0)return[];const{majorStep:k,minorStep:O}=p2({width:C,windowSeconds:A.seconds,fps:m.fps}),F=Math.floor(A.start/O)*O,N=A.end,V=[],z=O*1e-6;for(let G=F;G<=N+z;G+=O){const K=yt({time:G,windowStart:A.start,windowSeconds:A.seconds,width:C});if(K<-1||K>C+1)continue;const he=Math.abs(G/k-Math.round(G/k))<1e-6;V.push({time:G,px:K,kind:he?"major":"minor",label:he?o(G,k,m.fps):void 0})}return V},[C,o,A.end,A.seconds,A.start,m.fps]),L=x.useRef(null),$=x.useRef(null),W=k=>{$.current=k,L.current==null&&(L.current=requestAnimationFrame(()=>{L.current=null;const O=$.current;$.current=null,O==null||O()}))};x.useEffect(()=>()=>{L.current!=null&&cancelAnimationFrame(L.current)},[]);const H=x.useRef(null),q=k=>{const O=v.current;if(!O)return 0;const F=O.getBoundingClientRect();return ve(k-F.left-S,0,C)};return{viewportRef:v,width:b,axisLeft:S,axisWidth:C,totalSeconds:t,zoom:m,setZoom:h,isLive:c,setIsLive:u,currentTime:i,selectedRange:l,setSelectedRange:d,videoSegments:f,events:p,view:A,ticks:M,onWheel:k=>{if(!n||b<=0)return;k.preventDefault(),u(!1);const O=q(k.clientX),F=ve(mn({px:O,windowStart:A.start,windowSeconds:A.seconds,width:C}),0,t),V=k.deltaY<0?.8:1.25,z=ve(A.seconds*V,Math.max(1/Math.max(1,m.fps),.05),t),G=ve(F-O/Math.max(1,C)*z,0,Math.max(0,t-z));h(K=>({...K,windowSeconds:z})),E(G)},onPointerDownScrub:k=>{if(k.button!==0)return;const O=v.current;if(!O)return;O.setPointerCapture(k.pointerId);const F=q(k.clientX),N=ve(mn({px:F,windowStart:A.start,windowSeconds:A.seconds,width:C}),0,t);u(!1),H.current={mode:"playhead",pointerId:k.pointerId,startPx:F,startTime:N},a(N)},onPointerDownSelect:k=>{if(k.button!==0)return;const O=v.current;if(!O)return;O.setPointerCapture(k.pointerId);const F=q(k.clientX),N=ve(mn({px:F,windowStart:A.start,windowSeconds:A.seconds,width:C}),0,t);u(!1),H.current={mode:"select",pointerId:k.pointerId,startPx:F,startTime:N},d({start:N,end:N})},onPointerDownPlayhead:k=>{if(k.button!==0)return;const O=v.current;if(!O)return;O.setPointerCapture(k.pointerId);const F=q(k.clientX),N=ve(mn({px:F,windowStart:A.start,windowSeconds:A.seconds,width:C}),0,t);u(!1),H.current={mode:"playhead",pointerId:k.pointerId,startPx:F,startTime:N},a(N)},onPointerMove:k=>{const O=H.current;if(!O||O.pointerId!==k.pointerId)return;const F=q(k.clientX);W(()=>{const N=ve(mn({px:F,windowStart:A.start,windowSeconds:A.seconds,width:C}),0,t);if(O.mode==="playhead")a(N);else{const V=Math.min(O.startTime,N),z=Math.max(O.startTime,N);d({start:V,end:z})}})},onPointerUp:k=>{const O=H.current;if(!(!O||O.pointerId!==k.pointerId)&&(H.current=null,O.mode==="select"&&l)){const F=Math.abs(l.end-l.start);if(F<Math.max(1/Math.max(1,m.fps),.1))d(null);else if(r){const N=ve(F*1.05,Math.max(1/Math.max(1,m.fps),.05),t),V=ve(l.start,0,Math.max(0,t-N));h(z=>({...z,windowSeconds:N})),E(V)}}},onClickEvent:k=>{s&&d(null),u(!1),a(ve(k,0,t)),E(ve(k-A.seconds/2,0,Math.max(0,t-A.seconds)))},resetView:()=>{u(!1),h(k=>({...k,windowSeconds:t})),E(0)}}}const dd=({ticks:e,tickColor:t,labelColor:n})=>g.jsx("div",{className:J.trackArea,children:e.map(r=>g.jsxs("div",{children:[g.jsx("div",{className:`${J.tick} ${r.kind==="minor"?J.tickMinor:J.tickMajor}`.trim(),style:{left:`${r.px}px`,backgroundColor:t}}),r.kind==="major"&&r.label?g.jsx("div",{className:J.tickLabel,style:{left:`${r.px}px`,color:n},children:r.label}):null]},`${r.time}-${r.kind}`))});dd.displayName="TimeScale";const fd=({segments:e,viewStart:t,viewSeconds:n,width:r,totalSeconds:o,segmentColor:s,segmentColorHover:i})=>{const a=e.map(c=>({start:ve(c.start,0,o),end:ve(c.end,0,o)})).filter(c=>c.end>c.start).map(c=>{const u=Math.max(c.start,t),l=Math.min(c.end,t+n);return{start:u,end:l}}).filter(c=>c.end>c.start);return g.jsx("div",{className:J.trackArea,children:a.map((c,u)=>{const l=yt({time:c.start,windowStart:t,windowSeconds:n,width:r}),d=yt({time:c.end,windowStart:t,windowSeconds:n,width:r}),f=Math.max(0,d-l);return g.jsx("div",{className:J.segment,style:{left:`${l}px`,width:`${f}px`,background:s},onMouseEnter:p=>{p.currentTarget.style.background=i},onMouseLeave:p=>{p.currentTarget.style.background=s},"aria-hidden":!0},`${c.start}-${c.end}-${u}`)})})};fd.displayName="VideoTrack";const hd=({events:e,viewStart:t,viewSeconds:n,width:r,totalSeconds:o,onClickEvent:s,eventBg:i,eventBgHover:a,eventDot:c})=>{const u=e.map(l=>({...l,time:ve(l.time,0,o)})).filter(l=>l.time>=t&&l.time<=t+n);return g.jsx("div",{className:J.trackArea,children:u.map(l=>{const d=yt({time:l.time,windowStart:t,windowSeconds:n,width:r});return g.jsx("button",{type:"button",className:J.event,onPointerDown:f=>{f.stopPropagation()},onClick:()=>s(l.time),style:{left:`${d}px`,backgroundColor:i,border:"none",padding:0},onMouseEnter:f=>{f.currentTarget.style.backgroundColor=a},onMouseLeave:f=>{f.currentTarget.style.backgroundColor=i},"aria-label":`Evento em ${l.time.toFixed(2)}s`,children:l.icon?l.icon:g.jsx("span",{className:J.eventDot,style:{backgroundColor:c}})},l.id)})})};hd.displayName="EventsTrack";const pd=({className:e,title:t="Timeline",subtitle:n="Arraste para selecionar e aplicar zoom no período desejado",showHeader:r=!0,timeScaleMode:o="day24h",tickLabelFormatter:s,totalSeconds:i=24*60*60,enableWheelZoom:a=!0,height:c=190,autoZoomOnSelection:u=!0,showZoomControls:l=!0,enableScrubOnTracks:d=!1,clearSelectionOnEventClick:f=!0})=>{const p=Y.useTheme(),m=s??(o==="duration"?g2:m2),{viewportRef:h,axisLeft:v,axisWidth:b,zoom:S,currentTime:y,selectedRange:C,videoSegments:T,events:E,view:P,ticks:A,onWheel:M,onPointerDownScrub:L,onPointerDownSelect:$,onPointerDownPlayhead:W,onPointerMove:H,onPointerUp:q,onClickEvent:oe,resetView:Q,setZoom:U}=v2({totalSeconds:i,enableWheelZoom:a,autoZoomOnSelection:u,tickLabelFormatter:m,clearSelectionOnEventClick:f}),I=b?v+yt({time:y,windowStart:P.start,windowSeconds:P.seconds,width:b}):v,X=p.palette.common.white,R=Y.alpha(p.palette.common.black,.16),w="0px 4px 5.3px 0px rgba(0,0,0,0.16)",j=p.palette.mode==="dark"?Y.alpha(p.palette.common.white,.7):"#79747e",k=Y.alpha(p.palette.common.black,.16),O="#2c2c2c",F=Y.alpha(p.palette.primary.main,.15),N=Y.alpha(p.palette.primary.main,.22),V=Y.alpha(p.palette.common.white,1),z=Y.alpha(p.palette.common.white,1),G=Y.alpha(p.palette.common.black,.55),K=Y.alpha(p.palette.primary.main,.12),he=p.palette.primary.main,D=Math.max(1/Math.max(1,S.fps),.5),Ee=D/i,Xe=(()=>{const on=ve(P.seconds,D,i);if(Ee<=0||Ee>=1)return 0;const sn=Math.log(on/i)/Math.log(Ee)*100;return ve(sn,0,100)})(),ft=on=>{const sn=ve(on,0,100),an=i*Math.pow(Ee,sn/100);U(Zr=>({...Zr,windowSeconds:ve(an,D,i)}))},qr=`${Math.round(Xe)}%`;return g.jsxs(_.Box,{className:`${J.root} ${J.container} ${e??""}`.trim(),sx:{backgroundColor:X,border:`1px solid ${R}`,boxShadow:w,px:1,py:2},children:[r?g.jsxs("div",{className:J.header,children:[g.jsxs("div",{className:J.headerText,children:[g.jsx(_.Typography,{variant:"subtitle1",sx:{color:j,fontWeight:500},children:t}),g.jsx(_.Typography,{variant:"body2",sx:{color:j},children:n})]}),l?g.jsxs("div",{className:J.controls,children:[g.jsx(_.Box,{className:J.iconButton,sx:{border:`1px solid ${Y.alpha(p.palette.common.black,.22)}`},children:g.jsx(_.IconButton,{size:"small",onClick:Q,"aria-label":"Reset zoom",sx:{width:32,height:32},children:g.jsx(iS,{fontSize:"small"})})}),g.jsxs(_.Box,{className:J.zoomGroup,sx:{backgroundColor:p.palette.common.white,border:`1px solid ${Y.alpha(p.palette.common.black,.22)}`},"aria-label":"Zoom controls",children:[g.jsx(_.IconButton,{size:"small","aria-label":"Zoom out",onClick:()=>ft(Xe-10),children:g.jsx(cS,{fontSize:"small"})}),g.jsxs("div",{className:J.zoomTrack,"aria-hidden":!0,children:[g.jsx("div",{style:{position:"absolute",inset:0,backgroundColor:Y.alpha("#f5f5f5",.3),borderRadius:1,boxShadow:"1px 1px 1px rgba(10,10,10,0.04)"}}),g.jsx("div",{className:J.zoomTrackFill,style:{width:qr,backgroundColor:"#f5f5f5",boxShadow:"1px 1px 1px rgba(10,10,10,0.04)"}})]}),g.jsx(_.IconButton,{size:"small","aria-label":"Zoom in",onClick:()=>ft(Xe+10),children:g.jsx(aS,{fontSize:"small"})})]})]}):null]}):null,g.jsx(_.Box,{sx:{mt:r?2:0,height:c},children:g.jsxs("div",{ref:h,className:J.layers,onWheel:M,onPointerMove:H,onPointerUp:q,children:[g.jsxs("div",{className:J.playhead,style:{left:`${I}px`},onPointerDown:W,role:"slider","aria-label":"Playhead","aria-valuemin":0,"aria-valuemax":i,"aria-valuenow":y,tabIndex:0,children:[g.jsx("div",{className:J.playheadHandle,style:{borderBottomColor:he}}),g.jsx("div",{className:J.playheadLine,style:{backgroundColor:he}})]}),g.jsxs("div",{className:`${J.trackLabelRow} ${J.timeScale}`.trim(),children:[g.jsx("div",{}),g.jsx("div",{onPointerDown:L,style:{height:"100%",cursor:"ew-resize"},"aria-label":"Régua do tempo",children:g.jsx(dd,{ticks:A,tickColor:k,labelColor:O})})]}),g.jsxs(_.Box,{className:J.trackBox,sx:{mt:1,border:`1px solid ${Y.alpha(p.palette.common.black,.1)}`,borderRadius:"12px",height:106,position:"relative"},children:[C?g.jsx("div",{className:J.selectionOverlay,style:{left:`${v+yt({time:C.start,windowStart:P.start,windowSeconds:P.seconds,width:b})}px`,width:`${Math.max(0,yt({time:C.end,windowStart:P.start,windowSeconds:P.seconds,width:b})-yt({time:C.start,windowStart:P.start,windowSeconds:P.seconds,width:b}))}px`,backgroundColor:K}}):null,g.jsxs("div",{className:`${J.trackLabelRow} ${J.videoTrack}`.trim(),children:[g.jsx("div",{className:J.label,style:{color:j},children:"Video"}),g.jsx("div",{onPointerDown:d?L:void 0,style:{height:"100%"},children:g.jsx(fd,{segments:T,viewStart:P.start,viewSeconds:P.seconds,width:b,totalSeconds:i,segmentColor:F,segmentColorHover:N})})]}),g.jsxs("div",{className:`${J.trackLabelRow} ${J.eventsTrack}`.trim(),children:[g.jsx("div",{className:J.label,style:{color:j},children:"Eventos"}),g.jsx("div",{onPointerDown:d?L:void 0,style:{height:"100%"},children:g.jsx(hd,{events:E,viewStart:P.start,viewSeconds:P.seconds,width:b,totalSeconds:i,onClickEvent:oe,eventBg:V,eventBgHover:z,eventDot:G})})]}),g.jsx("div",{onPointerDown:$,style:{position:"absolute",left:v,right:10,top:0,bottom:0,cursor:"crosshair"},"aria-label":"Arraste para selecionar"})]})]})})]})};pd.displayName="VideoTimeline";const md=({stream:e=null,src:t,autoPlay:n=!0,muted:r=!0,playsInline:o=!0,className:s,liveEdgeThresholdSeconds:i=2,updateTimeForLiveStream:a=!0,constrainToSelectedRange:c=!0,loopSelection:u=!1})=>{const l=x.useRef(null),[d,f]=Wt(si),[p,m]=Wt(ii),h=Rr(ai),v=!!e;x.useEffect(()=>{const y=l.current;if(y){if(e){y.srcObject=e;return}y.srcObject=null,t&&(y.src=t)}},[e,t]),x.useEffect(()=>{const y=l.current;if(!y||v)return;const C=()=>{if(c&&h){const P=Math.max(0,h.start),A=Math.max(P,h.end);y.currentTime<P?y.currentTime=P:y.currentTime>A&&(u?y.currentTime=P:(y.pause(),y.currentTime=A))}if(f(y.currentTime),Number.isFinite(y.duration)&&y.duration>0){const P=y.duration-y.currentTime<=i;m(P)}},T=()=>{if(!c||!h)return;const P=Math.max(0,h.start),A=Math.max(P,h.end);(y.currentTime<P||y.currentTime>A)&&(y.currentTime=P)},E=()=>{p&&Number.isFinite(y.duration)&&y.duration>0&&(y.currentTime=y.duration)};return y.addEventListener("timeupdate",C),y.addEventListener("play",T),y.addEventListener("loadedmetadata",E),()=>{y.removeEventListener("timeupdate",C),y.removeEventListener("play",T),y.removeEventListener("loadedmetadata",E)}},[c,v,p,i,u,h,f,m]);const b=x.useRef(-1);x.useEffect(()=>{const y=l.current;if(!y||v||!t)return;if(p){if(Number.isFinite(y.duration)&&y.duration>0){const T=y.duration;Math.abs(y.currentTime-T)>.25&&(y.currentTime=T,b.current=T)}return}if(Math.abs(b.current-d)<.05)return;let C=d;if(c&&h){const T=Math.max(0,h.start),E=Math.max(T,h.end);C=Math.min(E,Math.max(T,C))}Math.abs(y.currentTime-C)>.25&&(y.currentTime=C,b.current=d)},[c,d,p,v,h,t]),x.useEffect(()=>{const y=l.current;if(!y||v||!t||!c||!h)return;const C=Math.max(0,h.start),T=!y.paused;y.currentTime=C,b.current=C,m(!1),f(C),T&&y.play().catch(()=>{})},[c,v,h,f,m,t]),x.useEffect(()=>{if(!v||(m(!0),!a))return;let y=null,C=!0;const T=()=>{C&&(f(d2()),y=requestAnimationFrame(T))};return y=requestAnimationFrame(T),()=>{C=!1,y!=null&&cancelAnimationFrame(y)}},[v,f,m,a]);const S=x.useMemo(()=>({width:"100%",maxWidth:920,background:"black",aspectRatio:"16 / 9",display:"block"}),[]);return g.jsx("video",{ref:l,className:s,style:S,autoPlay:n,muted:r,playsInline:o,controls:!0})};md.displayName="VideoPlayerWebRTC";const b2=dt(g.jsx("path",{d:"M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z"}),"Done"),x2="_container_1vjy6_1",S2="_segment_1vjy6_7",T2="_selected_1vjy6_20",w2="_label_1vjy6_28",C2="_icon_1vjy6_37",_2="_checkIcon_1vjy6_47",E2="_unselected_1vjy6_53",Et={container:x2,segment:S2,selected:T2,label:w2,icon:C2,checkIcon:_2,unselected:E2},gd=({items:e,className:t,sx:n,...r})=>{const s=_.useTheme().palette.mode==="dark",i=(a,c)=>{a.onClick?a.onClick(c):console.log(`Item "${a.label}" clicado`)};return g.jsx(_.Box,{className:`${Et.container} ${t||""}`,sx:n,"data-theme":s?"dark":"light",...r,children:e.map((a,c)=>g.jsxs(_.Box,{className:`${Et.segment} ${a.selected?Et.selected:Et.unselected}`,onClick:u=>i(a,u),children:[a.selected&&g.jsx(_.Box,{className:Et.icon,children:g.jsx(b2,{className:Et.checkIcon})}),g.jsx(_.Box,{className:Et.label,children:a.label})]},c))})};gd.displayName="DisplayTypes";exports.Button=hs;exports.CountCard=fg;exports.DisplayTypes=gd;exports.FilterButton=xc;exports.FilterChip=Sc;exports.FilterModal=Qc;exports.GoogleMap=ll;exports.MapContent=Cs;exports.MapMarkers=Yu;exports.MapSpot=ri;exports.ModuleMenu=Qu;exports.NotFoundContent=Zu;exports.SearchBar=qu;exports.SidebarMenu=Ju;exports.VideoPlayer=ed;exports.VideoPlayerWebRTC=md;exports.VideoTimeline=pd;exports.VisioThemeProvider=Md;exports.ZoomControls=bg;exports.currentTimeAtom=si;exports.darkColors=me;exports.darkTheme=yc;exports.eventsAtom=ud;exports.isLiveAtom=ii;exports.lightColors=pe;exports.lightTheme=gc;exports.radiiTokens=rr;exports.selectedRangeAtom=ai;exports.spacingScale=Ed;exports.spacingTokens=pc;exports.typographyTokens=Pe;exports.useGoogleMapContext=cl;exports.useVisioTheme=kd;exports.videoSegmentsAtom=ld;exports.zoomAtom=cd;
|
|
99
99
|
//# sourceMappingURL=index.cjs.js.map
|