import{i as e}from"./chunk-aKtaBQYM.js";import{Ft as t,Mt as n,s as r,vt as i}from"./mui-BgU4WrXF.js";import{t as a}from"./EditAttributesAccordion-J3XCwwrK.js";import{i as o,n as s,r as c,t as l}from"./ExpandMore-D0ycvrdR.js";import{t as u}from"./Typography-7EcQ2i3p.js";import{t as d}from"./TextField-DctlzLY-.js";import{Ft as f,Vt as p,pt as m}from"./index-bel1r0Sr.js";import{t as h}from"./SelectField-Bcp-L6wk.js";import{n as g,t as _}from"./useSettingsStyles-Bugi6oTj.js";import{t as v}from"./EditItemView-BPUZddYO.js";var y=e(t(),1),b=e=>(0,y.useMemo)(()=>({color:{name:e(`attributeColor`),type:`string`},mapLineWidth:{name:e(`attributeMapLineWidth`),type:`number`},mapLineOpacity:{name:e(`attributeMapLineOpacity`),type:`number`},speedLimit:{name:e(`attributeSpeedLimit`),type:`number`,dataType:`speed`},polylineDistance:{name:e(`attributePolylineDistance`),type:`number`,dataType:`distance`},hide:{name:e(`sharedFilterMap`),type:`boolean`},floor:{name:e(`attributeGeofenceFloor`),type:`number`},ceiling:{name:e(`attributeGeofenceCeiling`),type:`number`}}),[e]),x=i(),S=()=>{let{classes:e}=_(),t=n(),i=m(),S=b(i),[C,w]=(0,y.useState)();return(0,x.jsx)(v,{endpoint:`geofences`,item:C,setItem:w,validate:()=>C&&C.name,onItemSaved:e=>{t(r.update([e]))},menu:(0,x.jsx)(g,{}),breadcrumbs:[`settingsTitle`,`sharedGeofence`],children:C&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(o,{defaultExpanded:!0,children:[(0,x.jsx)(s,{expandIcon:(0,x.jsx)(l,{}),children:(0,x.jsx)(u,{variant:`subtitle1`,children:i(`sharedRequired`)})}),(0,x.jsx)(c,{className:e.details,children:(0,x.jsx)(d,{value:C.name||``,onChange:e=>w({...C,name:e.target.value}),label:i(`sharedName`)})})]}),(0,x.jsxs)(o,{children:[(0,x.jsx)(s,{expandIcon:(0,x.jsx)(l,{}),children:(0,x.jsx)(u,{variant:`subtitle1`,children:i(`sharedExtra`)})}),(0,x.jsxs)(c,{className:e.details,children:[(0,x.jsx)(d,{value:C.description||``,onChange:e=>w({...C,description:e.target.value}),label:i(`sharedDescription`)}),(0,x.jsx)(h,{value:C.calendarId,onChange:e=>w({...C,calendarId:Number(e.target.value)}),endpoint:`/api/calendars`,label:i(`sharedCalendar`)}),(0,x.jsx)(f,{control:(0,x.jsx)(p,{checked:C.attributes.hide,onChange:e=>w({...C,attributes:{...C.attributes,hide:e.target.checked}})}),label:i(`sharedFilterMap`)})]})]}),(0,x.jsx)(a,{attributes:C.attributes,setAttributes:e=>w({...C,attributes:e}),definitions:S})]})})};export{S as default};